Back to index

python-biopython  1.60
Public Member Functions | Private Attributes
Bio.Pathway.System Class Reference

List of all members.

Public Member Functions

def __init__
def __repr__
def __str__
def add_reaction
def remove_reaction
def reactions
def species
def stochiometry

Private Attributes

 __reactions

Detailed Description

Abstraction for a collection of reactions.

This class is used in the Bio.Pathway framework to represent an arbitrary
collection of reactions without explicitly defined links.

Attributes:

None    

Definition at line 148 of file __init__.py.


Constructor & Destructor Documentation

def Bio.Pathway.System.__init__ (   self,
  reactions = [] 
)
Initializes a new System object.

Definition at line 159 of file __init__.py.

00159 
00160     def __init__(self, reactions = []):
00161         """Initializes a new System object."""
00162         self.__reactions = set(reactions)


Member Function Documentation

Returns a debugging string representation of self.

Definition at line 163 of file __init__.py.

00163 
00164     def __repr__(self):
00165         """Returns a debugging string representation of self."""
00166         return "System(" + ",".join(map(repr,self.__reactions)) + ")"
    
Returns a string representation of self.

Definition at line 167 of file __init__.py.

00167 
00168     def __str__(self):
00169         """Returns a string representation of self."""
00170         return "System of " + str(len(self.__reactions)) + \
00171                " reactions involving " + str(len(self.species())) + \
00172                " species"

Here is the call graph for this function:

def Bio.Pathway.System.add_reaction (   self,
  reaction 
)
Adds reaction to self.

Definition at line 173 of file __init__.py.

00173 
00174     def add_reaction(self, reaction):
00175         """Adds reaction to self."""
00176         self.__reactions.add(reaction)

Returns a list of the reactions in this system.

Note the order is arbitrary!

Definition at line 181 of file __init__.py.

00181 
00182     def reactions(self):
00183         """Returns a list of the reactions in this system.
00184         
00185         Note the order is arbitrary!
00186         """
00187         #TODO - Define __lt__ so that Reactions can be sorted on Python?
00188         return list(self.__reactions)

Here is the caller graph for this function:

def Bio.Pathway.System.remove_reaction (   self,
  reaction 
)
Removes reaction from self.

Definition at line 177 of file __init__.py.

00177 
00178     def remove_reaction(self, reaction):
00179         """Removes reaction from self."""
00180         self.__reactions.remove(reaction)

Returns a list of the species in this system.

Definition at line 189 of file __init__.py.

00189 
00190     def species(self):
00191         """Returns a list of the species in this system."""
00192         return sorted(set(reduce(lambda s,x: s + x,
00193                           [x.species() for x in self.reactions()], [])))

Here is the call graph for this function:

Here is the caller graph for this function:

Computes the stoichiometry matrix for self.

Returns (species, reactions, stoch) where

    species    = ordered list of species in this system
    reactions  = ordered list of reactions in this system
    stoch      = 2D array where stoch[i][j] is coef of the
         jth species in the ith reaction, as defined
         by species and reactions above

Definition at line 194 of file __init__.py.

00194 
00195     def stochiometry(self):
00196         """Computes the stoichiometry matrix for self.
00197 
00198         Returns (species, reactions, stoch) where
00199 
00200             species    = ordered list of species in this system
00201             reactions  = ordered list of reactions in this system
00202             stoch      = 2D array where stoch[i][j] is coef of the
00203                          jth species in the ith reaction, as defined
00204                          by species and reactions above
00205         """
00206         # Note: This an inefficient and ugly temporary implementation.
00207         #       To be practical, stochiometric matrices should probably
00208         #       be implemented by sparse matrices, which would require
00209         #       NumPy dependencies.
00210         #
00211         # PS: We should implement automatic checking for NumPy here.
00212         species = self.species()
00213         reactions = self.reactions()
00214         stoch = [] * len(reactions)
00215         for i in range(len(reactions)):
00216             stoch[i] = 0 * len(species)
00217             for s in reactions[i].species():
00218                 stoch[species.index(s)] = reactions[i].reactants[s]
00219         return (species, reactions, stoch)
00220 

Here is the call graph for this function:


Member Data Documentation

Definition at line 161 of file __init__.py.


The documentation for this class was generated from the following file: