Skip to content

Commit

Permalink
edit return for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
Clare72 committed Sep 14, 2023
1 parent a4a9571 commit 1a3df3f
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/vfb_connect/cross_server_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ def get_gene_function_filters(self):
labels = sorted(list(set(labels)))
return labels

def get_transcriptomic_profile(self, cell_type, gene_type=False):
def get_transcriptomic_profile(self, cell_type, gene_type=False, return_dataframe=True):
"""Get gene expression data for a given cell_type.
Returns a DataFrame of gene expression data for clusters of cells annotated as cell_type (or subtypes).
Expand Down Expand Up @@ -414,14 +414,12 @@ def get_transcriptomic_profile(self, cell_type, gene_type=False):
"sex.label AS sample_sex, COLLECT(tis.label) AS sample_tissue, "
"p.miniref[0] as ref, g.label AS gene, g.short_form AS gene_id, "
"apoc.coll.subtract(labels(g), ['Class', 'Entity', 'hasScRNAseq', 'Feature', 'Gene']) AS function, "
"e.expression_extent[0] as extent, e.expression_level[0] as level order by cell_type, g.label"
"e.expression_extent[0] as extent, toFloat(e.expression_level[0]) as level order by cell_type, g.label"
% (gene_label, cell_type_short_form))
result = self.neo_query_wrapper._query(query)
if result:
result_df = pd.DataFrame.from_dict(data=result, orient='columns')
result_df['level'] = result_df['level'].astype(float)
return result_df
r = self.nc.commit_list([query])
dc = dict_cursor(r)
if return_dataframe:
return pd.DataFrame.from_records(dc)
else:
print('No transcriptomics data for %s' % cell_type)
return False
return dc

0 comments on commit 1a3df3f

Please sign in to comment.