Skip to content

Commit

Permalink
Merge pull request #63 from SynBioDex/feature-support_paml
Browse files Browse the repository at this point in the history
Support PAML
  • Loading branch information
bbartley authored Apr 25, 2022
2 parents 59b9880 + 83afcc0 commit 70d3f64
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
[submodule "tyto/ontologies/sbol-owl"]
path = tyto/ontologies/sbol-owl
url = https://github.com/dissys/sbol-owl.git
[submodule "tyto/ontologies/paml"]
path = tyto/ontologies/paml
url = [email protected]:bioprotocols/paml.git
6 changes: 4 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from setuptools import setup, find_packages

setup(name='tyto',
version='1.1',
version='1.2',
description='Automatically generates Python symbols for ontology terms',
python_requires='>=3.6',
url='https://github.com/SynBioDex/tyto',
Expand Down Expand Up @@ -33,7 +33,9 @@
'ontologies/*.rdf',
'ontologies/*.ttl',
'ontologies/sbol-owl3/sbolowl3.rdf',
'ontologies/sbol-owl/sbol.rdf']},
'ontologies/sbol-owl/sbol.rdf',
'ontologies/paml/paml/paml.ttl',
'ontologies/paml/uml/uml.ttl']},
include_package_data=True,
install_requires=[
'rdflib>=5.0',
Expand Down
4 changes: 4 additions & 0 deletions test/test_ontology.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,10 @@ def test_pubchem(self):
# Ambiguous term matches many SIDs
PubChem['water']

class TestPAML(unittest.TestCase):

def test_paml(self):
self.assertEqual(PAML.SampleArray, 'http://bioprotocols.org/paml#SampleArray')

if __name__ == '__main__':
unittest.main()
2 changes: 2 additions & 0 deletions tyto/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@
from .sbol3 import SBOL3
from .edam import EDAM
from .pubchem import PubChem
from .paml import PAML
from .uml import UML
5 changes: 4 additions & 1 deletion tyto/endpoint/endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,10 @@ def is_loaded(self):
return bool(self.graph)

def load(self):
self.graph.parse(self.path)
if self.path.split('.')[-1] == 'ttl':
self.graph.parse(self.path, format='ttl')
else:
self.graph.parse(self.path)

def query(self, ontology, sparql, err_msg):
sparql_final = sparql.format(from_clause='') # Because only one ontology per file, delete the from clause
Expand Down
1 change: 1 addition & 0 deletions tyto/ontologies/paml
Submodule paml added at 96fdd6
6 changes: 6 additions & 0 deletions tyto/paml.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from .tyto import Ontology, installation_path


PAML = Ontology(path=installation_path('ontologies/paml/paml/paml.ttl'),
uri='http://bioprotocols.org/paml#')

6 changes: 6 additions & 0 deletions tyto/uml.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from .tyto import Ontology, installation_path


UML = Ontology(path=installation_path('ontologies/paml/uml/uml.ttl'),
uri='http://bioprotocols.org/uml#')

0 comments on commit 70d3f64

Please sign in to comment.