Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_chebi():
ch = ChEBI()
ch.getCompleteEntity("CHEBI:10102")
res = ch.conv("CHEBI:10102", "KEGG COMPOUND accession")
assert res == ['C07484']
try:
res = ch.conv("CHEBI:10102", "wrong db")
assert False
except:
assert True
ch.getOntologyChildren("CHEBI:27732")
ch.getOntologyParents("CHEBI:27732")
ch.getUpdatedPolymer("CHEBI:27732")
def test_chebi_mass():
ch = ChEBI()
mass1 = ch.getCompleteEntity("CHEBI:27732").mass
assert float(mass1) == 194.19076
def resolveAnnotation(annotation):
if not hasattr(resolveAnnotation, 'db'):
resolveAnnotation.db = {}
resolveAnnotation.ch = bioservices.ChEBI(verbose=False)
resolveAnnotation.bio = bioservices.BioModels(verbose=False)
resolveAnnotation.uni = bioservices.UniProt(verbose=False)
resolveAnnotation.k = bioservices.kegg.KeggParser(verbose=False)
resolveAnnotation.s = bioservices.Service('name')
resolveAnnotation.qg = bioservices.QuickGO(verbose=False)
resolveAnnotation.db['http://identifiers.org/uniprot/P62988'] = 'http://identifiers.org/uniprot/P62988'
resolveAnnotation.db['http://identifiers.org/uniprot/P06842'] = 'http://identifiers.org/uniprot/P06842'
resolveAnnotation.db['http://identifiers.org/uniprot/P07006'] = 'http://identifiers.org/uniprot/P06842'
if annotation in resolveAnnotation.db:
return resolveAnnotation.db[annotation]
tAnnotation = annotation.replace('%3A',':')
tAnnotation = annotation.split('/')[-1]
#tAnnotation = re.search(':([^:]+:[^:]+$)',tAnnotation).group(1)
def resolveAnnotationHelper(annotation):
if not hasattr(resolveAnnotation, 'db'):
resolveAnnotation.db = {}
resolveAnnotation.ch = bioservices.ChEBI(verbose=False)
resolveAnnotation.uni = bioservices.UniProt(verbose=False)
resolveAnnotation.k = bioservices.kegg.KEGG(verbose=False)
resolveAnnotation.qg = bioservices.QuickGO(verbose=False)
resolveAnnotation.t = bioservices.Taxon()
resolveAnnotation.db['http://identifiers.org/uniprot/P62988'] = 'http://identifiers.org/uniprot/P62988'
resolveAnnotation.db['http://identifiers.org/uniprot/P06842'] = 'http://identifiers.org/uniprot/P06842'
resolveAnnotation.db['http://identifiers.org/uniprot/P07006'] = 'http://identifiers.org/uniprot/P06842'
if annotation in resolveAnnotation.db:
return annotation,resolveAnnotation.db[annotation]
tAnnotation = annotation.replace('%3A',':')
tAnnotation = annotation.split('/')[-1]
#tAnnotation = re.search(':([^:]+:[^:]+$)',tAnnotation).group(1)
try:
def __init__(self, debug=False):
""" Creates and displays the search form. """
self.debug = debug
self.s = bioservices.BioModels()
self.ch = bioservices.ChEBI()
# Define widgets
#
self.wSearchTerm = w.Text(description='Search biomodels by species:', value="CHEBI:17925")
self.wSearchTerm.on_submit(self.searchChebi)
self.wSearchButton = w.Button(description='Search')
self.wSearchButton.on_click(self.searchChebi)
self.wSearchChebi = w.HBox(children=[
self.wSearchTerm, self.wSearchButton
])
self.wSelectChebis = w.Select(description='Matching ChEBI:', width='600px', height='250px')
# FIXME: update the deprecated functions
self.wSelectChebis.on_trait_change(self.selectChebi)
self.wSelectModels = w.Select(description='Matching BioModels:', width='200px')
self.wSelectModels.on_trait_change(self.selectedModel)
def resolveAnnotation(annotation):
if not hasattr(resolveAnnotation, 'db'):
resolveAnnotation.db = {}
resolveAnnotation.ch = bioservices.ChEBI(verbose=False)
resolveAnnotation.uni = bioservices.UniProt(verbose=False)
resolveAnnotation.k = bioservices.kegg.KeggParser(verbose=False)
resolveAnnotation.qg = bioservices.QuickGO(verbose=False)
resolveAnnotation.db['http://identifiers.org/uniprot/P62988'] = 'http://identifiers.org/uniprot/P62988'
resolveAnnotation.db['http://identifiers.org/uniprot/P06842'] = 'http://identifiers.org/uniprot/P06842'
resolveAnnotation.db['http://identifiers.org/uniprot/P07006'] = 'http://identifiers.org/uniprot/P06842'
if annotation in resolveAnnotation.db:
return resolveAnnotation.db[annotation]
tAnnotation = annotation.replace('%3A',':')
tAnnotation = annotation.split('/')[-1]
#tAnnotation = re.search(':([^:]+:[^:]+$)',tAnnotation).group(1)
try:
if 'obo.go' in annotation:
def __init__(self):
self.ch = bioservices.ChEBI()
self.kegg = bioservices.KEGG()
self.wOntologySelect = w.Dropdown(description='Ontology:', options=['ChEBI', 'KEGG.Reaction'])
self.wSearchTerm = w.Text(description='Search Term:', value="glucose")
self.wSearchTerm.on_submit(self.search)
self.wSearchButton = w.Button(description='Search')
self.wSearchButton.on_click(self.search)
self.wResultsSelect = w.Select(description='Results:', width='100%')
self.wResultsSelect.on_trait_change(self.selectedTerm)
self.wResultsURL = w.Textarea(description='URL:', width='100%')
self.wResults = w.VBox(children=[
self.wResultsSelect,
self.wResultsURL
], width='100%')
for ch in self.wResults.children:
def resolveAnnotation(annotation):
if not hasattr(resolveAnnotation, 'db'):
resolveAnnotation.db = {}
resolveAnnotation.ch = bioservices.ChEBI(verbose=False)
resolveAnnotation.bio = bioservices.BioModels(verbose=False)
resolveAnnotation.uni = bioservices.UniProt(verbose=False)
resolveAnnotation.k = bioservices.kegg.KeggParser(verbose=False)
resolveAnnotation.s = bioservices.Service('name')
resolveAnnotation.qg = bioservices.QuickGO(verbose=False)
resolveAnnotation.db['http://identifiers.org/uniprot/P62988'] = 'http://identifiers.org/uniprot/P62988'
resolveAnnotation.db['http://identifiers.org/uniprot/P06842'] = 'http://identifiers.org/uniprot/P06842'
resolveAnnotation.db['http://identifiers.org/uniprot/P07006'] = 'http://identifiers.org/uniprot/P06842'
if annotation in resolveAnnotation.db:
return resolveAnnotation.db[annotation]
tAnnotation = annotation.replace('%3A',':')
tAnnotation = annotation.split('/')[-1]
#tAnnotation = re.search(':([^:]+:[^:]+$)',tAnnotation).group(1)