bionetgen.atomizer.utils package

Submodules

bionetgen.atomizer.utils.annotationComparison module

bionetgen.atomizer.utils.annotationDeletion module

bionetgen.atomizer.utils.annotationExtender module

bionetgen.atomizer.utils.annotationExtractor module

bionetgen.atomizer.utils.annotationResolver module

bionetgen.atomizer.utils.consoleCommands module

Created on Mon Sep 2 18:11:35 2013

@author: proto

bionetgen.atomizer.utils.consoleCommands.bngl2sbml(bnglFile, timeout=60)[source]
bionetgen.atomizer.utils.consoleCommands.bngl2xml(bnglFile, timeout=60)[source]
bionetgen.atomizer.utils.consoleCommands.correctness(bnglFile)[source]
bionetgen.atomizer.utils.consoleCommands.generateGraph(bnglFile, graphType, options=[])[source]
bionetgen.atomizer.utils.consoleCommands.getBngExecutable()[source]
bionetgen.atomizer.utils.consoleCommands.setBngExecutable(executable)[source]
bionetgen.atomizer.utils.consoleCommands.writeNetwork(bnglFile)[source]

bionetgen.atomizer.utils.extractAtomic module

Created on Wed Aug 7 20:54:17 2013

@author: proto

bionetgen.atomizer.utils.extractAtomic.extractMolecules(action, site1, site2, chemicalArray, differentiateDimers=False)[source]

this method goes through the chemicals in a given array ‘chemicalArray’ and extracts its atomic patterns into two arrays:

those elements that are contained in [site1,site2] will be put in the reactionCenter set. The rest will be placed in the context set. The entire system will be put into the atomicPatterns dictionary

Keyword arguments: site1,site2 – where the action takes place chemicalArray – the list of species we will be extracting atomic patters from

bionetgen.atomizer.utils.extractAtomic.extractTransformations(rules, differentiateDimers=False)[source]

goes through the list of rules and extracts its reactioncenter,context and product atomic patterns per transformation action

bionetgen.atomizer.utils.extractAtomic.getMapping(mapp, site)[source]
bionetgen.atomizer.utils.extractAtomic.solveWildcards(atomicArray)[source]

When you have a wildcard ‘+’ as a bond configuration, this method allows you to go through the list of atomic elements and find which patterns the ‘+’ can potentially resolve to

bionetgen.atomizer.utils.modelComparison module

bionetgen.atomizer.utils.nameNormalizer module

bionetgen.atomizer.utils.pathwaycommons module

bionetgen.atomizer.utils.pathwaycommons.getReactomeBondByName(name1, name2, sbmlURI, sbmlURI2, organism=None)[source]

resolves the uniprot id of parameters name1 and name2 and obtains whether they can be bound in the same complex or not based on reactome information

bionetgen.atomizer.utils.pathwaycommons.getReactomeBondByUniprot(uniprot1, uniprot2)[source]

Queries reactome to see if two proteins references by their uniprot id are bound in the same complex

bionetgen.atomizer.utils.pathwaycommons.isInComplexWith(name1, name2, sbmlURI=[], sbmlURI2=[], organism=None)[source]
bionetgen.atomizer.utils.pathwaycommons.memoize(obj)[source]
bionetgen.atomizer.utils.pathwaycommons.name2uniprot(nameStr, organism)[source]
bionetgen.atomizer.utils.pathwaycommons.queryActiveSite(nameStr, organism)[source]
bionetgen.atomizer.utils.pathwaycommons.queryBioGridByName(name1, name2, organism, truename1, truename2)[source]

bionetgen.atomizer.utils.readBNGXML module

Created on Mon Nov 19 14:28:16 2012

@author: proto

bionetgen.atomizer.utils.readBNGXML.createBNGLFromDescription(namespace)[source]

creates a bngl file from a dictionary description containing molecules, species, etc.

bionetgen.atomizer.utils.readBNGXML.createMolecule(molecule, bonds)[source]
bionetgen.atomizer.utils.readBNGXML.createSpecies(pattern)[source]
bionetgen.atomizer.utils.readBNGXML.findBond(bondDefinitions, component)[source]

Returns an appropiate bond number when veryfying how to molecules connect in a species

bionetgen.atomizer.utils.readBNGXML.getNumObservablesXML(xmlFile)[source]
bionetgen.atomizer.utils.readBNGXML.parseComponent(component)[source]

parses a bngxml molecule types section

bionetgen.atomizer.utils.readBNGXML.parseFullXML(xmlFile)[source]
bionetgen.atomizer.utils.readBNGXML.parseFullXMLFromString(xmlString)[source]
bionetgen.atomizer.utils.readBNGXML.parseFunction(function)[source]
bionetgen.atomizer.utils.readBNGXML.parseFunctions(functions)[source]
bionetgen.atomizer.utils.readBNGXML.parseMolecules(molecules)[source]

Parses an XML molecule section Returns: a molecule structure

bionetgen.atomizer.utils.readBNGXML.parseObservable(observable)[source]
bionetgen.atomizer.utils.readBNGXML.parseObservables(observables)[source]
bionetgen.atomizer.utils.readBNGXML.parseRule(rule, parameterDict)[source]

Parses a rule XML section Returns: a list of the reactants and products used, followed by the mapping between the two and the list of operations that were performed

bionetgen.atomizer.utils.readBNGXML.parseXML(xmlFile)[source]
bionetgen.atomizer.utils.readBNGXML.parseXMLFromString(xmlString)[source]
bionetgen.atomizer.utils.readBNGXML.parseXMLStruct(doc)[source]

bionetgen.atomizer.utils.smallStructures module

Created on Wed May 30 11:44:17 2012

@author: proto

class bionetgen.atomizer.utils.smallStructures.Action[source]

Bases: object

setAction(action, site1, site2='')[source]
class bionetgen.atomizer.utils.smallStructures.Component(name, idx, bonds=[], states=[])[source]

Bases: object

addBond(bondName)[source]
addState(state, update=True)[source]
addStates(states, update=True)[source]
copy()[source]
createGraph(identifier)[source]
getName()[source]
getRuleStr()[source]
getTotalStr()[source]
graphVizGraph(graph, identifier)[source]
hasWilcardBonds()[source]
reset()[source]
setActiveState(state)[source]
str2()[source]
class bionetgen.atomizer.utils.smallStructures.Databases[source]

Bases: object

add2LabelDictionary(key, value)[source]
add2RawDatabase(rawDatabase)[source]
getLabelDictionary()[source]
getRawDatabase()[source]
getTranslator()[source]
class bionetgen.atomizer.utils.smallStructures.Molecule(name, idx)[source]

Bases: object

addBond(componentName, bondName)[source]
addChunk(chunk)[source]
addComponent(component, overlap=0)[source]
compare(cMolecule)[source]
contains(componentName)[source]
copy()[source]
distance(cMolecule)[source]
extend(molecule)[source]
getBondNumbers()[source]
getComponent(componentName)[source]
getComponentById(idx)[source]
getComponentWithBonds()[source]
graphVizGraph(graph, identifier, components=None, flag=False, options={})[source]
hasWildcardBonds()[source]
removeComponent(componentName)[source]
removeComponents(components)[source]
reset()[source]
setCompartment(compartment)[source]
str2()[source]
str3()[source]
toString()[source]
update(molecule)[source]
class bionetgen.atomizer.utils.smallStructures.Rule(label='')[source]

Bases: object

addActionList(actionList)[source]
addMapping(mapping)[source]
addMappingList(mappingList)[source]
addProduct(product)[source]
addProductList(products)[source]
addRate(rate)[source]
addReactant(reactant)[source]
addReactantList(reactants)[source]
class bionetgen.atomizer.utils.smallStructures.Species[source]

Bases: object

addChunk(tags, moleculesComponents, precursors)[source]

temporary transitional method

addCompartment(tags)[source]
addMolecule(molecule, concatenate=False, iteration=1)[source]
append(species)[source]
contains(moleculeName)[source]
containsComponentIdx(idx, dictionary)[source]
copy()[source]
deleteMolecule(moleculeName)[source]
extend(species, update=True)[source]
extractAtomicPatterns(action, site1, site2, differentiateDimers=False)[source]
getBondNumbers()[source]
getMolecule(moleculeName)[source]
getMoleculeById(idx)[source]
getMoleculeNames()[source]
getSize()[source]
graphVizGraph(graph, identifier, layout='LR', options={})[source]
hasWildCardBonds()[source]
listOfBonds(nameDict)[source]
notContainsComponentIdx(idx)[source]
reset()[source]
sort()[source]

Sort molecules by number of components, then number of bonded components, then the negative sum of the bond index, then number of active states, then string length

str2()[source]
toString()[source]
updateBonds(bondNumbers)[source]
class bionetgen.atomizer.utils.smallStructures.States(name='', idx='')[source]

Bases: object

bionetgen.atomizer.utils.smallStructures.parseReactions(reaction)[source]
bionetgen.atomizer.utils.smallStructures.readFromString(string)[source]

bionetgen.atomizer.utils.structures module

Created on Wed May 30 11:44:17 2012

@author: proto

class bionetgen.atomizer.utils.structures.Component(name, bonds=[], states=[])[source]

Bases: object

addBond(bondName)[source]

Adds bond information to this component while checking that the bond doesn’t already exist — Args:

bondName: Bond identifier to be associated to this component. Its partner is handled at the species level >>> c = Component(‘comp’) >>> result = c.addBond(‘1’) >>> [result, str(c)] [True, ‘comp!1’] >>> result = c.addBond(‘1’) >>> [result, str(c)] [False, ‘comp!1’]

addState(state, update=True)[source]

Adds an state to this component, optionally become the active state. The method adds base state 0 if the state doesnt exist — Args:

state (str): A string representing the new state variable update (bool): A flag indicating whether it should become the new active state (default True)

>>> c =Component('comp')
>>> c.addState('first')
>>> [str(c)]
['comp~first']
>>> c.addState('second', False)
>>> c.states.sort()
>>> [str(c), c.str2()]
['comp~first', 'comp~0~first~second']
addStates(states, update=True)[source]
Args:

states (list): list of states to add to this component

>>> c = Component('comp')
>>> c.addStates(['z1','z2'])
>>> c.states.sort()
>>> [str(c), c.str2()]
['comp~z2', 'comp~0~z1~z2']
copy()[source]

Returns an indepent copy of this component

>>> c = Component('first')
>>> c2 = c.copy()
>>> c2.name = 'second'
>>> [str(c), str(c2)]
['first', 'second']
getName()[source]
getRuleStr()[source]
getTotalStr()[source]
reset()[source]
setActiveState(state)[source]

Sets the active state of the component if the state already exists — Args:

state: Sets the new active state

>>> c = Component('comp')
>>> c.addState('z1')
>>> result = c.setActiveState('0')
>>> [result, str(c)]
[True, 'comp~0']
>>> result = c.setActiveState('nonexistant')
>>> [result, str(c)]
[False, 'comp~0']
signature()[source]
str2()[source]
class bionetgen.atomizer.utils.structures.Databases[source]

Bases: object

add2LabelDictionary(key, value)[source]
add2RawDatabase(rawDatabase)[source]
getLabelDictionary()[source]
getRawDatabase()[source]
getTranslator()[source]
class bionetgen.atomizer.utils.structures.Molecule(name)[source]

Bases: object

addBond(componentName, bondName)[source]
addChunk(chunk)[source]
addComponent(component, overlap=0)[source]

Adds a component, optionally refusing to add a component if it already exists and sorting components by name — Args:

component (Component): component structure overlap (bool): check for overlap before adding

>>> mol = Molecule('mol')
>>> mol.addComponent(Component('gamma'))
>>> mol.addComponent(Component('beta'))
>>> mol.addComponent(Component('alpha'))
>>> mol.addComponent(Component('alpha'), overlap=1)
>>> str(mol)
'mol(alpha,beta,gamma)'
>>> mol.addComponent(Component('alpha'), overlap=0)
>>> str(mol)
'mol(alpha,alpha,beta,gamma)'
contains(componentName)[source]
copy()[source]
evaluateBonds(bonds)[source]
evaluateMolecule()[source]
extend(molecule)[source]
getBondNumbers()[source]
getComponent(componentName)[source]
getComponentWithBonds()[source]
removeComponent(componentName)[source]
removeComponents(components)[source]
reset()[source]
setCompartment(compartment)[source]
signature(component)[source]
sort()[source]
str2()[source]
toString()[source]
update(molecule)[source]
class bionetgen.atomizer.utils.structures.Species[source]

Bases: object

addChunk(tags, moleculesComponents, precursors)[source]

temporary transitional method

addCompartment(tags)[source]
addMolecule(molecule, concatenate=False, iteration=1)[source]
append(species)[source]
contains(moleculeName)[source]
copy()[source]
deleteBond(moleculePair)[source]
deleteMolecule(moleculeName)[source]
extend(species, update=True)[source]
getBondNumbers()[source]
getMolecule(moleculeName)[source]
getMoleculeNames()[source]
getSize()[source]
reset()[source]
sort()[source]

Sort molecules by number of components, then number of bonded components, then lowest numbered bond, then the negative sum of the bond index, then number of active states, then string length

str2()[source]
toString()[source]
updateBonds(bondNumbers)[source]
bionetgen.atomizer.utils.structures.compareLists(list1, list2)[source]

bionetgen.atomizer.utils.util module

Created on Sun Mar 25 21:26:49 2012

@author: proto

class bionetgen.atomizer.utils.util.NumericStringParser[source]

Bases: object

Most of this code comes from the fourFn.py pyparsing example

eval(num_string, parseAll=True)[source]
evaluateStack(s)[source]
pushFirst(strg, loc, toks)[source]
pushUMinus(strg, loc, toks)[source]
exception bionetgen.atomizer.utils.util.TranslationException(value)[source]

Bases: Exception

bionetgen.atomizer.utils.util.defaultReactionDefinition()[source]
bionetgen.atomizer.utils.util.finishStreamLog(console)[source]
bionetgen.atomizer.utils.util.logMess(logType, logMessage)[source]
class bionetgen.atomizer.utils.util.memoize(func)[source]

Bases: object

cache the return value of a method

This class is meant to be used as a decorator of methods. The return value from a given method invocation will be cached on the instance whose method was invoked. All arguments passed to a method decorated with memoize must be hashable.

If a memoized method is invoked directly on its class the result will not be cached. Instead the method will be invoked like a static method: class Obj(object):

@memoize def add_to(self, arg):

return self + arg

Obj.add_to(1) # not enough arguments Obj.add_to(1, 2) # returns 3, result is not cached

class bionetgen.atomizer.utils.util.memoizeMapped(func)[source]

Bases: object

Optimized local cache for recursive resolveHelper method to limit memory usage

bionetgen.atomizer.utils.util.pmemoize(obj)[source]
bionetgen.atomizer.utils.util.setupLog(fileName, level, quietMode=False)[source]
bionetgen.atomizer.utils.util.setupStreamLog(console)[source]
bionetgen.atomizer.utils.util.testBNGFailure(fileName)[source]

Module contents