From 681810fc5bc5d35d5bff53dab460bf5df8dd06de Mon Sep 17 00:00:00 2001 From: Joseph Tumulty <141662454+JTumulty@users.noreply.github.com> Date: Thu, 15 Jan 2026 14:45:15 -0500 Subject: [PATCH] Update build_consensus_reference.py to fix Issue #20 Removed column name designation from pd.DataFrame.from_dict() call in lines 300-301 --- src/starcat/build_consensus_reference.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/starcat/build_consensus_reference.py b/src/starcat/build_consensus_reference.py index cf90e4d..36b5fce 100644 --- a/src/starcat/build_consensus_reference.py +++ b/src/starcat/build_consensus_reference.py @@ -297,8 +297,8 @@ def cluster_geps(self): clus_dict_all[gep_num] = [gep] # Relabel GEPs and order by cNMF result source - clus_df = pd.DataFrame.from_dict(clus_dict_all, orient='index', - columns = ['GEP%d' % x for x in range(1, self.num_results+1)]) + clus_df = pd.DataFrame.from_dict(clus_dict_all, orient='index') + result_names = sorted(clus_df.unstack().dropna().apply(lambda x: x.split(':')[0]).unique()) clus_df_clean = pd.DataFrame(index=clus_df.index, columns=result_names) @@ -415,4 +415,4 @@ def get_top_genes(self, clus_df, cgep_spectra, n_top_genes=30): top_genes['cGEP'] = cgep_spectra.loc[cgep, :].sort_values(ascending=False).index[:n_top_genes] top_genes_percgep_dict[cgep] = top_genes - return(top_genes_percgep_dict) \ No newline at end of file + return(top_genes_percgep_dict)