From 920cb72ea431b22820ec7c2dc9c4ccd9eab67c15 Mon Sep 17 00:00:00 2001 From: Clare72 Date: Tue, 16 Dec 2025 14:39:24 +0000 Subject: [PATCH 1/3] fix lost query and return for get_expressed_genes_by_cell_and_gene_type --- src/vfb_connect/cross_server_tools.py | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/vfb_connect/cross_server_tools.py b/src/vfb_connect/cross_server_tools.py index 349d0a1e..7fc66fca 100644 --- a/src/vfb_connect/cross_server_tools.py +++ b/src/vfb_connect/cross_server_tools.py @@ -764,12 +764,13 @@ def get_transcriptomic_profile(self, cell_type, gene_type=False, no_subtypes=Fal else: return dc - def get_expressed_genes_by_cell_and_gene_type(self, cell_type, gene_type, no_subtypes=False, query_by_label=True, return_dataframe=True): + def get_expressed_genes_by_cell_and_gene_type(self, cell_type, gene_type, no_subtypes=False, query_by_label=True, + return_dataframe=True, verbose=False): """Get expressed genes (as a list) for scRNAseq clusters of a given cell type. Returns a DataFrame with one cluster per row, annotated as the specified cell type (or subtypes). Must restrict to a gene type (to prevent overly long gene lists), which can be retrieved using `get_gene_function_filters`. - If no data is found, returns Empty DataFrame. + If no data is found, returns False. :param cell_type: The ID, name, or symbol of a class in the Drosophila Anatomy Ontology (FBbt) or a list of these. NB lists must contain either no FBbt IDs or only FBbt IDs (with query_by_label=False). @@ -827,7 +828,20 @@ def get_expressed_genes_by_cell_and_gene_type(self, cell_type, gene_type, no_sub "ds.total_gene_count[0] AS dataset_total_gene_count, cluster_genes, " "apoc.coll.sort(apoc.coll.subtract(dataset_genes, cluster_genes)) AS genes_in_dataset_not_cluster" % (cell_type_short_form, gene_label, equal_condition, gene_label)) - print(query) + + if verbose: + print(query) + + r = self.nc.commit_list([query]) + if not r: + warnings.warn("No results returned") + return False + dc = dict_cursor(r) + if return_dataframe: + return pd.DataFrame.from_records(dc) + else: + return dc + def get_cell_types_by_genes(self, genes=None, gene_type=False, cell_type=None, query_by_label=True, return_dataframe=True, verbose=False): """Get cell types that express a given gene, list of genes and/or type of gene based on transcriptomics data. From 97e22d168d9243a5c95ee990bb52aca1dd5e3a73 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 16 Dec 2025 17:15:32 +0000 Subject: [PATCH 2/3] Initial plan From 8c6f519593722c2c6696baccb52ffe4d75feb087 Mon Sep 17 00:00:00 2001 From: Rob Court Date: Tue, 16 Dec 2025 17:15:49 +0000 Subject: [PATCH 3/3] Update src/vfb_connect/cross_server_tools.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- src/vfb_connect/cross_server_tools.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/vfb_connect/cross_server_tools.py b/src/vfb_connect/cross_server_tools.py index 7fc66fca..0951f1cb 100644 --- a/src/vfb_connect/cross_server_tools.py +++ b/src/vfb_connect/cross_server_tools.py @@ -834,7 +834,9 @@ def get_expressed_genes_by_cell_and_gene_type(self, cell_type, gene_type, no_sub r = self.nc.commit_list([query]) if not r: - warnings.warn("No results returned") + warnings.warn( + f"No results returned in get_expressed_genes_by_cell_and_gene_type for cell_type={cell_type} and gene_type={gene_type}" + ) return False dc = dict_cursor(r) if return_dataframe: