Git Product home page Git Product logo

go-notebooks's Introduction

Jupyter Notebooks for GO

This will eventually contain a rich set of Jupyter (ipython) notebooks that demonstrate how to programmatically obtain information and do useful analyses using GO ontologies and associations.

Viewing the notebooks

For optimal viewing, browse this folder using nbviewer .

Currently we only have one notebook, but more are coming! See pull requests for detail:

The notebooks can also be see in GitHub on the geneontology/go-notebooks

Running or editing a notebook

First check out this repo

pyvenv venv
source venv/bin/activate
export PYTHONPATH=.:$PYTHONPATH
pip install -r requirements.txt
jupyter notebook

Python libraries

This makes use of the OntoBio python library

See notebooks section on ReadTheDocs

go-notebooks's People

Contributors

cmungall avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

tronegacy

go-notebooks's Issues

Ontology object using remote services is not initializing

In past 2 weeks, I tried to use Ontology Factory several time but in first cell ontology object is not initializing.
from ontobio.ontol_factory import OntologyFactory
ofa = OntologyFactory()
ont = ofa.create('go')

It takes a-lot of time even hours but it does not initialize. I think there is something wrong on server side. On interrupting kernel of Notebook I found the following error. Last passage of error kept repeating again and again.
Please check server side if it is ok please guide me why it is not working now even it was working few days ago. Thanks in advance for your time and help.


KeyboardInterrupt Traceback (most recent call last)
in ()
3 from ontobio.ontol_factory import OntologyFactory
4 ofa = OntologyFactory()
----> 5 ont = ofa.create('go')

C:\Users\Badar Khan\Anaconda3\lib\site-packages\ontobio\ontol_factory.py in create(self, handle, **args)
74 logging.info("Using default_ontology")
75 return default_ontology
---> 76 return create_ontology(handle, **args)
77
78 #@cachier(stale_after=SHELF_LIFE)

C:\Users\Badar Khan\Anaconda3\lib\site-packages\ontobio\ontol_factory.py in create_ontology(handle, **args)
126 else:
127 logging.info("Fetching from SPARQL")
--> 128 ont = EagerRemoteSparqlOntology(handle=handle)
129 #g = get_digraph(handle, None, True)
130 return ont

C:\Users\Badar Khan\Anaconda3\lib\site-packages\ontobio\sparql\sparql_ontology.py in init(self, handle)
171 self.graph = g
172 self.graph_name = get_named_graph(handle)
--> 173 self.xref_graph = get_xref_graph(handle)
174 self.all_logical_definitions = []
175 logging.info("Graph: {} LDs: {}".format(self.graph, self.all_logical_definitions))

C:\Users\Badar Khan\Anaconda3\lib\site-packages\ontobio\sparql\sparql_ontol_utils.py in get_xref_graph(ont)
64 """
65 g = networkx.MultiGraph()
---> 66 for (c,x) in fetchall_xrefs(ont):
67 g.add_edge(c,x,source=c)
68 return g

C:\Users\Badar Khan\Anaconda3\lib\site-packages\cachier\core.py in func_wrapper(*args, **kwds)
157 return entry['value'] # return stale val
158 _print('Already calc. Waiting on change.')
--> 159 return core.wait_on_entry_calc(key)
160 if next_time:
161 _print('Async calc and return stale')

C:\Users\Badar Khan\Anaconda3\lib\site-packages\cachier\pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value

C:\Users\Badar Khan\Anaconda3\lib\site-packages\cachier\pickle_core.py in wait_on_entry_calc(self, key)
191 if observer.isAlive():
192 # print('Timedout waiting. Starting again...')
--> 193 return self.wait_on_entry_calc(key)
194 # print("Returned value: {}".format(event_handler.value))
195 return event_handler.value

Error in 2nd cell - AttributeError: 'Session' object has no attribute 'solr_assocs'

Hi,
I ran this code but found error in 2nd cell. Please guide me what is its cause.
For reference Code and its detail is attached. Ontobio package is added successfully.

Code of 2nd Cell

-Create an association factory to get pombase GO annotations
-(this uses an 'eager' method, where all annotations are fetched from services in advance)
from ontobio.assoc_factory import AssociationSetFactory
afactory = AssociationSetFactory()
aset = afactory.create(ontology=ont, subject_category='gene', object_category='function', taxon='NCBITaxon:4896')

Error of 2nd Cell


AttributeError Traceback (most recent call last)
in ()
3 from ontobio.assoc_factory import AssociationSetFactory
4 afactory = AssociationSetFactory()
----> 5 aset = afactory.create(ontology=ont, subject_category='gene', object_category='function', taxon='NCBITaxon:4896')

C:\Users\Badar Khan\Anaconda3\lib\site-packages\ontobio\assoc_factory.py in create(self, ontology, subject_category, object_category, evidence, taxon, relation, file, fmt)
60 object_category=object_category,
61 evidence=evidence,
---> 62 taxon=taxon)
63
64 logging.info("Creating map for {} subjects".format(len(assocs)))

C:\Users\Badar Khan\Anaconda3\lib\site-packages\cachier\core.py in func_wrapper(*args, **kwds)
176 return core.wait_on_entry_calc(key)
177 _print('No entry found. No current calc. Calling like a boss.')
--> 178 return _calc_entry(core, key, func, args, kwds)
179
180 def clear_cache():

C:\Users\Badar Khan\Anaconda3\lib\site-packages\cachier\core.py in _calc_entry(core, key, func, args, kwds)
76 core.mark_entry_being_calculated(key)
77 # _get_executor().submit(core.mark_entry_being_calculated, key)
---> 78 func_res = func(*args, **kwds)
79 core.set_entry(key, func_res)
80 # _get_executor().submit(core.set_entry, key, func_res)

C:\Users\Badar Khan\Anaconda3\lib\site-packages\ontobio\assoc_factory.py in bulk_fetch_cached(**args)
150 def bulk_fetch_cached(**args):
151 logging.info("Fetching assocs from store (will be cached)")
--> 152 return bulk_fetch(**args)
153

C:\Users\Badar Khan\Anaconda3\lib\site-packages\ontobio\golr\golr_associations.py in bulk_fetch(subject_category, object_category, taxon, rows, **kwargs)
144 rows=rows,
145 iterative=True,
--> 146 **kwargs)
147 logging.info("Rows retrieved: {}".format(len(assocs)))
148 if len(assocs) == 0:

C:\Users\Badar Khan\Anaconda3\lib\site-packages\ontobio\golr\golr_associations.py in search_associations_compact(**kwargs)
75 searchresult = search_associations(use_compact_associations=True,
76 facet_fields=[],
---> 77 **kwargs
78 )
79 return searchresult['compact_associations']

C:\Users\Badar Khan\Anaconda3\lib\site-packages\ontobio\golr\golr_associations.py in search_associations(**kwargs)
31 logging.info("CREATING_GOLR_QUERY {}".format(kwargs))
32 q = GolrAssociationQuery(**kwargs)
---> 33 return q.exec()
34
35 def get_objects_for_subject(subject=None,

C:\Users\Badar Khan\Anaconda3\lib\site-packages\ontobio\golr\golr_query.py in exec(self, **kwargs)
830 """
831
--> 832 params = self.solr_params()
833 logging.info("PARAMS="+str(params))
834 results = self.solr.search(**params)

C:\Users\Badar Khan\Anaconda3\lib\site-packages\ontobio\golr\golr_query.py in solr_params(self)
560 if self.solr is None:
561 if self.url is None:
--> 562 self._set_solr(self.get_config().solr_assocs)
563 #self.solr = monarch_solr
564 else:

AttributeError: 'Session' object has no attribute 'solr_assocs'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.