00001 // CatalyzedTranslationReaction.cpp: implementation of the CatalyzedTranslationReaction class. 00002 // 00004 00005 #include "CatalyzedTranslationReaction.h" 00006 00008 // Construction/Destruction 00010 00011 CatalyzedTranslationReaction::CatalyzedTranslationReaction(Chemical *mRNA, Chemical *catalyst, Chemical *protein, RateConstant *k_tr, std::string reactionName) 00012 :Reaction(reactionName) 00013 { 00014 // stoichiometry 00015 this->mRNA = chemicals.size(); 00016 chemicals.push_back(mRNA); 00017 numberOfEachChemicalChangedByReaction.push_back(0); 00018 00019 this->catalyst = chemicals.size(); 00020 chemicals.push_back(catalyst); 00021 numberOfEachChemicalChangedByReaction.push_back(0); 00022 00023 this->protein = chemicals.size(); 00024 chemicals.push_back(protein); 00025 numberOfEachChemicalChangedByReaction.push_back(+1); 00026 00027 // rates 00028 this->k_tr = rateConstants.size(); 00029 rateConstants.push_back(k_tr); 00030 00031 // put enough dummy chemicalJacobian elements on the vector 00032 // - they are recomputed every time you ask for the chemicalJacobian 00033 chemicalJacobian.push_back(new JElement(-1,-1)); 00034 this->SetTeXForm(); 00035 00036 } 00037 00038 CatalyzedTranslationReaction::~CatalyzedTranslationReaction() 00039 { 00040 00041 } 00042 00043 double CatalyzedTranslationReaction::GetRate() const 00044 { 00045 return ((rateConstants[k_tr]->GetValue())*(chemicals[mRNA]->GetAmount())*(chemicals[catalyst]->GetAmount())); 00046 } 00047 00048 void CatalyzedTranslationReaction::SetTeXForm() 00049 { 00050 // strstream stream; 00051 std::ostringstream stream; 00052 // TeX form of the reaction 00053 stream << rateConstants[k_tr]->GetTeXName().c_str(); 00054 stream << "\\left [" << chemicals[mRNA]->GetTeXName().c_str(); 00055 stream << "\\right ]"; 00056 stream << "\\left [" << chemicals[catalyst]->GetTeXName().c_str(); 00057 stream << "\\right ]"; 00058 // add a NULL 00059 stream << std::ends; 00060 // set the TeX string equal to what's in the stream 00061 m_sTeXForm = stream.str(); 00062 // allow memory to be freed 00063 // stream.rdbuf()->freeze(0); 00064 } 00065 00066 std::vector<Reaction::JElement *> *CatalyzedTranslationReaction::GetChemicalJacobian() 00067 { 00068 chemicalJacobian[0]->SetWithRespectTo(chemicals[mRNA]->GetChemicalNumber()); 00069 chemicalJacobian[0]->SetJValue((rateConstants[k_tr]->GetValue())*(chemicals[catalyst]->GetAmount())); 00070 00071 chemicalJacobian[1]->SetWithRespectTo(chemicals[catalyst]->GetChemicalNumber()); 00072 chemicalJacobian[1]->SetJValue((rateConstants[k_tr]->GetValue())*(chemicals[mRNA]->GetAmount())); 00073 00074 return &chemicalJacobian; 00075 }