Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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:
if 'obo.go' in annotation or '/go/GO' in annotation:
"""
KEGG module example
====================
Histogram of KEGG pathways relations
"""
#################################################
#
from pylab import *
# extract all relations from all pathways
from bioservices.kegg import KEGG
s = KEGG()
s.organism = "hsa"
# retrieve more than 260 pathways so it takes time
max_pathways = 10
results = [s.parse_kgml_pathway(x) for x in s.pathwayIds[0:max_pathways]]
relations = [x['relations'] for x in results]
# plot
hist([len(this) for this in relations], 20)
xlabel('number of relations')
ylabel('#')
title("number of relations per pathways")
grid(True)