• Main Page
  • Namespaces
  • Classes
  • Files
  • File List

/home/mark/model/software/ScrumPy/ScrumPy/Bioinf/PyoCyc/Transporter.py

00001 
00002 import Tags, Base, Reaction
00003 
00004 DefaultFile="transporters.dat"
00005 
00006 class Record(Reaction.Record):
00007     RecordClass="Transporter"
00008     
00009 
00010 def CheckMulti(k,ids):
00011     if len(ids) > 1:
00012         print "! Multi react for ", k, " ",
00013     return ids[0]
00014 
00015 class DB(Reaction.DB):   # transporters are a sub-class of reaction
00016     def __init__(self,path=Base.DefaultPath,**kwargs):
00017         Reaction.DB.__init__(self,path=path,file=DefaultFile,RecClass=Record, **kwargs)
00018 
00019         
00020         """
00021         Tranpsoprters are tricky, because they may well already be in the Prorein DB
00022         If that is the case we must look up the associated reaction, and replace the stoichiometries
00023         with our own. The Reaction DB does not hold the compartmentel information, we do
00024         """
00025         if self.Org == None:
00026             return # the above doesn't apply if we are acting as a stand alone db
00027 
00028         Org = self.Org
00029 
00030         for txid in self.keys():
00031             tx = self[txid]                                                    # get the reaction for the transporter UID
00032             if  Org.Protein.has_key(txid):                            # this UID already in the protein DB
00033                 enzrxns = Org.Protein[txid][Tags.Cats]        # get the enzyme UIDs for protein
00034                 eid = CheckMulti(txid, enzrxns)
00035                 reacids = Org.Enzrxn[eid][Tags.Reac]      # get the reaction UIDs for the enzyme
00036                 reacid = CheckMulti(txid, reacids)
00037                 reac = Org.Reaction[reacid]                       # get the reaction for the enzyme                      
00038                                                 
00039                 for k in tx.keys():                   # update the reaction with the transporter values
00040                     if k != Tags.UID:                # except the UID :-)
00041                         reac[k] = tx[k]
00042                 reac.lhs = tx.lhs[:]
00043                 reac.rhs = tx.rhs[:]
00044             else:
00045                 Org.Reaction.Records[txid] = self[txid] # if not already present add direct to the reaction DB
00046                 
00047                         
00048                 
00049                 
00050                     
00051                 
00052     
00053     

Generated on Tue Sep 4 2012 15:38:01 for ScrumPy by  doxygen 1.7.1