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.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.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.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.findBond(bondDefinitions, component)[source]
Returns an appropiate bond number when veryfying how to molecules connect in a species
- bionetgen.atomizer.utils.readBNGXML.parseComponent(component)[source]
parses a bngxml molecule types section
- bionetgen.atomizer.utils.readBNGXML.parseMolecules(molecules)[source]
Parses an XML molecule section Returns: a molecule structure
bionetgen.atomizer.utils.smallStructures module
Created on Wed May 30 11:44:17 2012
@author: proto
- class bionetgen.atomizer.utils.smallStructures.Component(name, idx, bonds=[], states=[])[source]
Bases:
object
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]
adds a state list to this component, the active state will be the last component in the lsit
- 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']
- 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']
- class bionetgen.atomizer.utils.structures.Molecule(name)[source]
Bases:
object
- 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)'
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
- 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