def preprocess(cell_names, prefix=''): cell_names_processed = {} for id, entity in cell_names.items(): name, synonyms = entity print('name::', name, "id:", id, "prefix:", prefix) variants = [] variants.append(_cleanup(neuroner.annotate(prefix + name).annotations)) # name for s in synonyms: print(' syn::', s) variants.append(_cleanup(neuroner.annotate(prefix + s).annotations)) # synonyms cell_names_processed[id] = variants return cell_names_processed
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'])
#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 = _cleanup(an) self.assertEqual(clean, ["HBP_LAYER:0000004", u"HBP_MORPHOLOGY:0000001", "Missing:long", "Size:large"])