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):
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
00027
00028 Org = self.Org
00029
00030 for txid in self.keys():
00031 tx = self[txid]
00032 if Org.Protein.has_key(txid):
00033 enzrxns = Org.Protein[txid][Tags.Cats]
00034 eid = CheckMulti(txid, enzrxns)
00035 reacids = Org.Enzrxn[eid][Tags.Reac]
00036 reacid = CheckMulti(txid, reacids)
00037 reac = Org.Reaction[reacid]
00038
00039 for k in tx.keys():
00040 if k != Tags.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]
00046
00047
00048
00049
00050
00051
00052
00053