Skip to content

Commit dddfc01

Browse files
committed
handle ids with : and no connectivity results, don't exclude any dbs
1 parent ecbdd5e commit dddfc01

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

src/vfb_connect/cross_server_tools.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -835,7 +835,7 @@ def get_expressed_genes_by_cell_and_gene_type(self, cell_type, gene_type, no_sub
835835
% (cell_type_short_form, gene_label, equal_condition, gene_label))
836836
if verbose:
837837
print(query)
838-
838+
839839
r = self.nc.commit_list([query])
840840
dc = dict_cursor(r)
841841
if return_dataframe:
@@ -1460,11 +1460,14 @@ def get_nt_receptors_in_downstream_neurons(self, upstream_type, downstream_type=
14601460
:return: A DataFrame with neurotransmitter receptors in downstream neurons of the specified neuron type.
14611461
:rtype: pandas.DataFrame or list of dicts
14621462
"""
1463-
upstream_type = self.lookup_id(upstream_type)
1464-
downstream_type = self.lookup_id(downstream_type)
1463+
upstream_type = self.lookup_id(upstream_type.replace('FBbt:','FBbt_'))
1464+
downstream_type = self.lookup_id(downstream_type.replace('FBbt:','FBbt_'))
14651465

14661466
# get all types of all connected neurons that are instances of downstream_type
1467-
downstream = self.get_connected_neurons_by_type(upstream_type=upstream_type, downstream_type=downstream_type, weight=weight)
1467+
downstream = self.get_connected_neurons_by_type(upstream_type=upstream_type, downstream_type=downstream_type, weight=weight, group_by_class=False, verbose=verbose, exclude_dbs=[])
1468+
if downstream.empty:
1469+
print("No connections found between %s and %s neurons." % (upstream_type, downstream_type))
1470+
return pd.DataFrame() if return_dataframe else []
14681471
downstream['downstream_class'] = downstream['downstream_class'].apply(
14691472
lambda x: x.split('|') if isinstance(x, str) else x)
14701473
downstream_classes = downstream.explode('downstream_class')['downstream_class'].drop_duplicates().to_list()

src/vfb_connect/test/cross_server_tools_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,10 @@ def test_cypher_query(self):
135135
self.assertEqual(fu[0]['n']['label'], 'fan-shaped body')
136136

137137
def test_nt_receptors_in_downstream_neurons(self):
138-
fu = self.vc.get_nt_receptors_in_downstream_neurons(upstream_type='Dm8', downstream_type='Dm9', weight=10)
138+
fu = self.vc.get_nt_receptors_in_downstream_neurons(upstream_type='FBbt:00013774', downstream_type='Dm9', weight=10)
139139
print(fu)
140140
self.assertTrue(len(fu) > 9)
141-
bar = self.vc.get_nt_receptors_in_downstream_neurons(upstream_type='Dm8', downstream_type='Dm9', weight=10, return_dataframe=False)
141+
bar = self.vc.get_nt_receptors_in_downstream_neurons(upstream_type='Dm8a', downstream_type='Dm9', weight=10, return_dataframe=False)
142142
print(bar)
143143
self.assertTrue(len(bar) > 9)
144144

0 commit comments

Comments
 (0)