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
Exemple #3
0
 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'
     ])
    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)
Exemple #5
0
get_ipython().magic(u'load_ext autoreload')
get_ipython().magic(u'autoreload 2')


# # Comparing NeuroLex and BBP ontologies
# 

# In[2]:

import sys
sys.path.append('../')
from neuroner.neuroner import clean_annotations, similarity2

from sherlok import Sherlok
neuroner = Sherlok('neuroner')


# In[3]:

# PARSE OBO
import oboparser, re

hbp_obo_file  = 'hbp_cell_ontology.obo'
nlex_obo_file = 'neurolex.obo'

# a simple function to pull out the cell names
SYNONOYM_NAME = re.compile(r'"(.*?)"').search
def get_cell_names(obo_onto_file):
    cell_names = {}    
    for stanza in oboparser.parse(obo_onto_file):
Exemple #6
0
get_ipython().magic(u'load_ext autoreload')
get_ipython().magic(u'autoreload 2')


# # Comparing NeuroLex and BBP ontologies
# 

# In[2]:

import sys
sys.path.append('../')
from similarity import _cleanup, _normalize, similarity2

from sherlok import Sherlok
neuroner = Sherlok('neuroner')


# In[3]:

# PARSE OBO
import oboparser, re

hbp_obo_file  = 'hbp_cell_ontology.obo'
nlex_obo_file = 'neurolex.obo'

# a simple function to pull out the cell names
SYNONOYM_NAME = re.compile(r'"(.*?)"').search
def get_cell_names(obo_onto_file):
    cell_names = {}    
    for stanza in oboparser.parse(obo_onto_file):
 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
Exemple #9
0
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
Exemple #10
0
'''
Computes the semantic similarity between two neuron mentions.
The main function is similarity()
Computation is delegated to similarity_inter and similarity_intra
'''

import similarity_inter, similarity_intra
from operator import itemgetter
from itertools import groupby
import re

from sherlok import Sherlok  # pip install --upgrade sherlok
s = Sherlok('neuroner')

WEIGHTS = {  #TODO: implement weights
    #TODO: merge with BASE_MULTIPLIER implemented in similarity_intra
    'Layer': 1.0,
    'ProteinProp': 1.0
}
'''
Computes the intra and inter semantic similarity between two neurons
in: n1@str, n2@str: the two neurons to measure similarity
out: (score:float, [([matching_properties], explanation@str)])
'''


def similarity(n1,
               n2,
               weights=WEIGHTS,
               symmetric=True,
               use_inter_similarity=True):
Exemple #11
0
 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"])