Skip to content

Commit

Permalink
Allow string of one neuronid in get_gene_expression()
Browse files Browse the repository at this point in the history
  • Loading branch information
pgleeson committed Feb 9, 2024
1 parent 30406bd commit 635793c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions scripts/gene_expression.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,8 @@
gexp = watlas.get_gene_expression(gene_names=["npr-1","egl-4"],neuron_ids=["ADAR","ADEL"],th=4)
print(gexp)

gexp = watlas.get_gene_expression(gene_names=["egl-4"],neuron_ids="ADAL",th=4)
print(gexp)

gexp = watlas.cengen.get_expression(gene_wbids=["WBGene00001173"],neuron_ids=["ADA","ADE","ADF","ADL","AFD"],th=2)
print(gexp)
3 changes: 3 additions & 0 deletions wormneuroatlas/NeuroAtlas.py
Original file line number Diff line number Diff line change
Expand Up @@ -1953,6 +1953,9 @@ def get_gene_expression(self, neuron_ais=None, neuron_ids=None,
if neuron_ais is not None:
neuron_cis = self.cengen_is[neuron_ais]
elif neuron_ids is not None:
if type(neuron_ids) == str:
# See https://github.com/francescorandi/wormneuroatlas/issues/4
neuron_ids = [neuron_ids]
try: neuron_ids[0]
except: neuron_ids = np.array([neuron_ids])
neuron_ais = self.ids_to_ais(neuron_ids)
Expand Down

0 comments on commit 635793c

Please sign in to comment.