Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def biomodels():
return BioModels(verbose=False)
def analyzeSpaceDistribution(analyzedModels):
bio = bioservices.BioModels()
number,spaceCovered = zip(*analyzedModels)
hist,bin_edges = np.histogram(spaceCovered,bins=5)
binIndexArray = np.digitize(spaceCovered,bin_edges)
modelAnnotationBin = defaultdict(list)
for element,binIndex in zip(number,binIndexArray):
try:
info = bio.getSimpleModelsByIds('BIOMD%010i' % element)
parsedInfo = bioservices.Service('name').easyXML(info)
modelName = stats.removeTags(str(parsedInfo['modelname'][0]))
modelName = modelName.split(' - ')
if len(modelName) > 1:
modelName = modelName[1]
else:
modelName = modelName[0].split('_')
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')
def analyzeGroupingCDF():
bio = bioservices.BioModels()
with open('groupedProcessList.dump', 'rb') as f:
groupedDict = pickle.load(f)
elementList, groupedProcessList, redundantProcessList = zip(*groupedDict)
hist, bin_edges = np.histogram(redundantProcessList, bins=5)
binIndexArray = np.digitize(redundantProcessList, bin_edges)
modelAnnotationBin = defaultdict(list)
for element, binIndex in zip(elementList, binIndexArray):
try:
info = bio.getSimpleModelsByIds('BIOMD%010i' % element)
parsedInfo = bioservices.Service('name').easyXML(info)
modelName = stats.removeTags(str(parsedInfo['modelname'][0]))
modelName = modelName.split(' - ')
if len(modelName) > 1:
modelName = modelName[1]
ev2.append([x['index'],x['nreactions'],x['nspecies'],x['compression']])
except:
continue
number,rulesLength,speciesLength,evaluation2 = zip(*ev2)
trueRatio = []
#with open('ratomization.dump','rb') as f:
# ratomizationDict = pickle.load(f)
for x,z,w in zip(rulesLength,number,evaluation2):
if x>=0:
trueRatio.append([z,1-w])
bio = bioservices.BioModels()
modelAnnotationArray = []
for element,compression in trueRatio:
try:
info = bio.getSimpleModelsByIds('BIOMD%010i' % element)
parsedInfo = bioservices.Service('name').easyXML(info)
modelName = removeTags(str(parsedInfo['modelname'][0]))
modelName = modelName.split(' - ')
if len(modelName) > 1:
modelName = modelName[1]
else:
modelName = modelName[0].split('_')
if len(modelName) > 1:
modelName = ' '.join(modelName[1:])
else:
modelName = modelName[0]
ev2.append([x['index'],x['nreactions'],x['nspecies'],x['compression']])
except:
continue
number,rulesLength,speciesLength,evaluation2 = zip(*ev2)
trueRatio = []
#with open('ratomization.dump','rb') as f:
# ratomizationDict = pickle.load(f)
for x,z,w in zip(rulesLength,number,evaluation2):
if x>=0:
trueRatio.append([z,1-w])
bio = bioservices.BioModels()
modelAnnotationArray = []
for element,compression in trueRatio:
try:
info = bio.getSimpleModelsByIds('BIOMD%010i' % element)
parsedInfo = bioservices.Service('name').easyXML(info)
modelName = removeTags(str(parsedInfo['modelname'][0]))
modelName = modelName.split(' - ')
if len(modelName) > 1:
modelName = modelName[1]
else:
modelName = modelName[0].split('_')
if len(modelName) > 1:
modelName = ' '.join(modelName[1:])
else:
modelName = modelName[0]
def analyzeGroupingCDF():
bio = bioservices.BioModels()
with open('groupedProcessList.dump','rb') as f:
groupedDict = pickle.load(f)
elementList,groupedProcessList,redundantProcessList = zip(*groupedDict)
hist,bin_edges = np.histogram(redundantProcessList,bins=5)
binIndexArray = np.digitize(redundantProcessList,bin_edges)
modelAnnotationBin = defaultdict(list)
for element,binIndex in zip(elementList,binIndexArray):
try:
info = bio.getSimpleModelsByIds('BIOMD%010i' % element)
parsedInfo = bioservices.Service('name').easyXML(info)
modelName = stats.removeTags(str(parsedInfo['modelname'][0]))
modelName = modelName.split(' - ')
if len(modelName) > 1:
modelName = modelName[1]
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)
tmpArray = {}