def test_filter(self): s = Sherlok('neuroner') annotations = s.annotate('layer 2/3 nest basket cell').annotations self.assertEqual(len(annotations), 8) selected = s.annotate('layer 2/3 nest basket cell', 'Layer').annotations self.assertEqual(len(selected), 1)
def get_neuroner_annotations(neuron_long_name): sherlok_instance = Sherlok('neuroner') r = sherlok_instance.annotate(neuron_long_name) annot_dict = clean_annotations(r.annotations, neuron_long_name, return_dict = False) return annot_dict
def test_opennlp_ners(self): s = Sherlok('opennlp.ners.en') text = '''Jack Burton (born April 29, 1954 in El Paso), also known as Jake Burton, is an American snowboarder and founder of Burton Snowboards.''' annotations = s.annotate(text).annotations self.assertEqual(len(annotations), 3) for a in annotations: print a
def test_cleanup(self): s = Sherlok('neuroner') an = s.annotate('layer 4 pyramidal long large neuron').annotations clean = clean_annotations(an) self.assertEqual(clean, [ 'HBP_LAYER:0000004', u'HBP_MORPHOLOGY:0000001', 'Missing:long', 'Size:large', 'NeuronTrigger:neuron' ])
#print('{} ({})'.format(hbp_cell_names[hbp_id][0], hbp_id)) already_printed = [] for nlex_id, score, explain in hits_sorted[:5]: # only if more than Neocortex explain_str = ' '.join(flatten(explain)) if nlex_id not in already_printed and explain_str != 'ABA_REGION:315 exact same brain region': already_printed.append(nlex_id) #print explain_str #print '* {} ({}, {})'.format(nlex_cell_names[nlex_id][0], round(score, 2), nlex_id) outf.write('{}\t{}\t{}\t{}\t{}\t{}\n'.format(hbp_cell_names[hbp_id][0], hbp_id, nlex_cell_names[nlex_id][0], round(score, 2), nlex_id, explain_str)) # In[45]: cell_= 'Nest Basket Cell' #'nest basket cell' clean_annotations(neuroner.annotate(cell_).annotations) # In[47]: sorted(hbp_hits['HBP_CELL:0000061'], key=get_key, reverse=True)[:5] # In[ ]:
#print('{} ({})'.format(hbp_cell_names[hbp_id][0], hbp_id)) already_printed = [] for nlex_id, score, explain in hits_sorted[:5]: # only if more than Neocortex explain_str = ' '.join(flatten(explain)) if nlex_id not in already_printed and explain_str != 'ABA_REGION:315 exact same brain region': already_printed.append(nlex_id) #print explain_str #print '* {} ({}, {})'.format(nlex_cell_names[nlex_id][0], round(score, 2), nlex_id) outf.write('{}\t{}\t{}\t{}\t{}\t{}\n'.format(hbp_cell_names[hbp_id][0], hbp_id, nlex_cell_names[nlex_id][0], round(score, 2), nlex_id, explain_str)) # In[45]: cell_= 'Nest Basket Cell' #'nest basket cell' _cleanup(neuroner.annotate(cell_).annotations) # In[47]: sorted(hbp_hits['HBP_CELL:0000061'], key=get_key, reverse=True)[:5] # In[ ]:
def test_cleanup(self): s = Sherlok('neuroner') an = s.annotate('layer 4 pyramidal long large neuron').annotations clean = clean_annotations(an) self.assertEqual(clean, ['HBP_LAYER:0000004', u'HBP_MORPHOLOGY:0000001', 'Missing:long', 'Size:large', 'NeuronTrigger:neuron'])
from sherlok import Sherlok # pip install sherlok pipeline = 'bluima.regions_rules' host = '128.178.97.193' s = Sherlok(pipeline, host=host) text = 'neocortex projects to the nucleus accumbens' res = s.annotate(text) print res.annotations res.refs # in
def test_cleanup(self): s = Sherlok("neuroner") an = s.annotate("layer 4 pyramidal long large neuron").annotations clean = _cleanup(an) self.assertEqual(clean, ["HBP_LAYER:0000004", u"HBP_MORPHOLOGY:0000001", "Missing:long", "Size:large"])