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