本文整理汇总了C++中Data::AddSpecies方法的典型用法代码示例。如果您正苦于以下问题:C++ Data::AddSpecies方法的具体用法?C++ Data::AddSpecies怎么用?C++ Data::AddSpecies使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Data
的用法示例。
在下文中一共展示了Data::AddSpecies方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ProcessWebInterfaceModels
void ProcessWebInterfaceModels() {
string Filename(GetParameter("web interface model directory"));
Filename.append("ModelList.txt");
vector<string> Lines = ReadStringsFromFile(Filename,false);
//this database will hold a combination of all of the model compounds and reactions
Data* CompleteDatabase = new Data(0);
//the following structures will hold the data for the various models as they are read in
vector<Data*> Models;
vector< map<string, Identity*, std::less<string> > > ModelGenes;
map<string, vector<string>, std::less<string> > ReactionGenes;
map<string, vector<string>, std::less<string> > ReactionModels;
map<string, vector<string>, std::less<string> > CompoundModels;
//Reading in the models and storing the data in the above structures
for (int i=1; i < int(Lines.size()); i++) {
cout << i << endl;
//Parsing the model list line
vector<string>* Strings = StringToStrings(Lines[i], "\t");
if (Strings->size() >= 4) {
Filename.assign(GetParameter("web interface model directory"));
Filename.append((*Strings)[3]);
}
//Loading each model from the combined model file
if (FileExists(Filename)) {
map<string, Identity*, std::less<string> > CurrentGeneData;
ModelGenes.push_back(CurrentGeneData);
Data* NewData = new Data(0);
Models.push_back(NewData);
NewData->AddData("NAME",(*Strings)[0].data(),STRING);
NewData->AddData("AUTHORS",(*Strings)[1].data(),STRING);
NewData->AddData("ORGANISMS NAME",(*Strings)[2].data(),STRING);
NewData->AddData("FILENAME",(*Strings)[3].data(),STRING);
NewData->LoadSystem(Filename);
//Loading additional data on compounds and reactions from the centralized database
int TotalTransported = 0;
for (int j=0; j < NewData->FNumSpecies(); j++) {
if (NewData->GetSpecies(j)->FExtracellular()) {
TotalTransported++;
}
NewData->GetSpecies(j)->LoadSpecies(NewData->GetSpecies(j)->GetData("DATABASE",STRING));
CompoundModels[NewData->GetSpecies(j)->Query("CGI_ID")].push_back((*Strings)[0]);
if (CompleteDatabase->FindSpecies("DATABASE;CGI_ID",NewData->GetSpecies(j)->Query("CGI_ID").data()) == NULL && CompleteDatabase->FindSpecies("DATABASE;CGI_ID",NewData->GetSpecies(j)->GetData("DATABASE",STRING).data()) == NULL) {
CompleteDatabase->AddSpecies(NewData->GetSpecies(j));
}
}
//Note that the reaction equation that was read in was cleared in favor of the database equation... this could lead to problems
int TotalReactionsWithGenes = 0;
for (int j=0; j < NewData->FNumReactions(); j++) {
NewData->GetReaction(j)->LoadReaction(NewData->GetReaction(j)->GetData("DATABASE",STRING));
ReactionModels[NewData->GetReaction(j)->Query("CGI_ID")].push_back((*Strings)[0]);
//Capturing the gene data for entry into the gene hash
vector<string> GeneData = NewData->GetReaction(j)->GetAllData("ASSOCIATED PEG",DATABASE_LINK);
if (GeneData.size() > 0) {
TotalReactionsWithGenes++;
}
for (int k=0; k < int(GeneData.size()); k++) {
//Adding the gene to the reaction gene hash
string GeneName((*Strings)[2]);
GeneName.append(":");
GeneName.append(GeneData[k]);
ReactionGenes[NewData->GetReaction(j)->Query("CGI_ID")].push_back(GeneName);
//Finding the gene and creating a new gene if the gene does not currently exist
Identity* CurrentGene = ModelGenes[ModelGenes.size()-1][GeneData[k]];
if (CurrentGene == NULL) {
CurrentGene = new Identity;
ModelGenes[ModelGenes.size()-1][GeneData[k]] = CurrentGene;
}
//Adding the reaction data to the gene data
CurrentGene->AddData("REACTIONS",NewData->GetReaction(j)->Query("CGI_ID").data(),STRING);
vector<string> EnzymeData = NewData->GetReaction(j)->GetAllData("ENZYME",DATABASE_LINK);
for (int l=0; l < int(EnzymeData.size()); l++) {
CurrentGene->AddData("ENZYME",EnzymeData[l].data(),STRING);
}
EnzymeData = NewData->GetReaction(j)->GetAllData("PATHWAYS",STRING);
for (int l=0; l < int(EnzymeData.size()); l++) {
CurrentGene->AddData("PATHWAY",EnzymeData[l].data(),STRING);
}
}
//Adding all unique reactions to the complete database
if (CompleteDatabase->FindReaction("DATABASE;CGI_ID",NewData->GetReaction(j)->Query("CGI_ID").data()) == NULL && CompleteDatabase->FindReaction("DATABASE;CGI_ID",NewData->GetReaction(j)->GetData("DATABASE",STRING).data()) == NULL) {
CompleteDatabase->AddReaction(NewData->GetReaction(j));
}
}
//Searching the model for dead compounds and reactions
NewData->FindDeadEnds();
NewData->AddData("TRANSPORTED COMPOUNDS",double(TotalTransported));
NewData->AddData("REACTION WITH GENES",double(TotalReactionsWithGenes));
}
delete Strings;
}
//Printing the combined compounds table
Filename.assign(GetParameter("web interface model directory"));
Filename.append("AllCompoundsTable.txt");
ofstream CompleteOutput;
//.........这里部分代码省略.........