shared_ptr <KeyfileList> TextUserInterface::AskKeyfiles (const wxString &message) const { wxString msg = _("Enter keyfile"); if (!message.empty()) msg = message; make_shared_auto (KeyfileList, keyfiles); wxString s; wxString m = msg + L" [" + _("none") + L"]: "; while (!(s = AskString (m)).empty()) { keyfiles->push_back (make_shared <Keyfile> (wstring (s))); m = msg + L" [" + _("finish") + L"]: "; } return keyfiles; }
FilePath TextUserInterface::AskFilePath (const wxString &message) const { return AskString (!message.empty() ? message : wxString (_("Enter filename: "))); }
void LoadDatabaseFile(const char* DatabaseFilename) { if (GetParameter("Network output location").compare("none") != 0 && GetParameter("Network output location").length() > 0) { if (GetParameter("os").compare("windows") == 0) { system(("move "+GetDatabaseDirectory(GetParameter("database"),"output directory")+GetParameter("output folder")+" "+GetParameter("Network output location")).data()); } else { system(("cp -r "+GetDatabaseDirectory(GetParameter("database"),"output directory")+GetParameter("output folder")+" "+GetParameter("Network output location")).data()); } } //Getting filename that all compound and reaction data will be saved into string Filename(DatabaseFilename); if (Filename.length() == 0) { Filename = AskString("Input filename for database: "); } //Creating datastructure for all program data Data* NewData = new Data(0); NewData->ClearData("NAME",STRING); NewData->AddData("NAME",RemoveExtension(RemovePath(Filename)).data(),STRING); //Loading data from file if (NewData->LoadSystem(Filename) == FAIL) { delete NewData; return; } //Performing a variety of tasks according to the parameters in the parameters files including KEGG lookup, reaction and compound printing etc. NewData->PerformAllRequestedTasks(); // Test for Adjustment of DeltaGs for PH for COMPOUNDS bool TestCpds = 0; if (TestCpds){ double IonicS = 0.25; FErrorFile() << "Std Transformed Gibbs Energy of Formation vs pH" << endl; for (int i=0; i < NewData->FNumSpecies(); i++){ string CompoundID = NewData->GetSpecies(i)->GetData("DATABASE",STRING); // gets the cpdID string Name = NewData->GetSpecies(i)->GetData("NAME",STRING); // gets the name of the cpd Species* Temp = NewData->FindSpecies("DATABASE",CompoundID.data()); //if (CompoundID.compare("cpd00003") == 0 || CompoundID.compare("cpd00004") == 0 || CompoundID.compare("cpd00002") == 0) { double AdjDeltaG5 = Temp->AdjustedDeltaG(IonicS,5,298.15); double AdjDeltaG5_kJ = 4.184*AdjDeltaG5; double AdjDeltaG6 = Temp->AdjustedDeltaG(IonicS,6,298.15); double AdjDeltaG6_kJ = 4.184*AdjDeltaG6; double AdjDeltaG7 = Temp->AdjustedDeltaG(IonicS,7,298.15); double AdjDeltaG7_kJ = 4.184*AdjDeltaG7; double AdjDeltaG8 = Temp->AdjustedDeltaG(IonicS,8,298.15); double AdjDeltaG8_kJ = 4.184*AdjDeltaG8; double AdjDeltaG9 = Temp->AdjustedDeltaG(IonicS,9,298.15); double AdjDeltaG9_kJ = 4.184*AdjDeltaG9; FErrorFile() << CompoundID << "\t" << AdjDeltaG5_kJ << "\t" << AdjDeltaG6_kJ << "\t" << AdjDeltaG7_kJ << "\t" << AdjDeltaG8_kJ << "\t" << AdjDeltaG9_kJ << endl; //} } FlushErrorFile(); } // Test for Adjustment of DeltaGs for IONIC STRENGTH for COMPOUNDS bool TestCpdsIS = 0; if (TestCpdsIS){ FErrorFile() << "Std Transformed Gibbs Energy of Formation vs Ionic Strength" << endl; for (int i=0; i < NewData->FNumSpecies(); i++){ string CompoundID = NewData->GetSpecies(i)->GetData("DATABASE",STRING); // gets the cpdID string Name = NewData->GetSpecies(i)->GetData("NAME",STRING); // gets the name of the cpd Species* Temp = NewData->FindSpecies("DATABASE",CompoundID.data()); double AdjDeltaG_IS0 = Temp->AdjustedDeltaG(0,7,298.15); double AdjDeltaG_IS0_kJ = 4.184*AdjDeltaG_IS0; double AdjDeltaG_IS10 = Temp->AdjustedDeltaG(0.1,7,298.15); double AdjDeltaG_IS10_kJ = 4.184*AdjDeltaG_IS10; double AdjDeltaG_IS25 = Temp->AdjustedDeltaG(0.25,7,298.15); double AdjDeltaG_IS25_kJ = 4.184*AdjDeltaG_IS25; FErrorFile() << CompoundID << "\t" << AdjDeltaG_IS0_kJ << "\t" << AdjDeltaG_IS10_kJ << "\t" << AdjDeltaG_IS25_kJ << endl; } FlushErrorFile(); } // Test for Adjustment of DeltaGs for pH for REACTIONS bool TestRxns = 0; if (TestRxns){ double IonicS = 0.25; //double pH = 7; FErrorFile() << "Std Transformed Gibbs Energy of Reaction (kJmol-1) vs pH" << endl; for (int i=0; i < NewData->FNumReactions(); i++){ Reaction* Rxn = NewData->GetReaction(i); string RxnID = Rxn->GetData("DATABASE",STRING); string Name = Rxn->GetData("NAME",STRING); double DG5 = Rxn->FEstDeltaG(5,IonicS)*4.184; double DG6 = Rxn->FEstDeltaG(6,IonicS)*4.184; double DG7 = Rxn->FEstDeltaG(7,IonicS)*4.184; double DG8 = Rxn->FEstDeltaG(8,IonicS)*4.184; double DG9 = Rxn->FEstDeltaG(9,IonicS)*4.184; FErrorFile() << RxnID << "\t" << DG5 << "\t" << DG6 << "\t" << DG7 << "\t" << DG8 << "\t" << DG9 << endl; } FlushErrorFile(); } // Test for Adjustment of DeltaGs for IONIC STRENGTH for REACTIONS bool TestRxnsIS = 0; if (TestRxnsIS){ FErrorFile() << "Std Transformed Gibbs Energy of Reaction (kJmol-1) vs Ionic Strength" << endl; for (int i=0; i < NewData->FNumReactions(); i++){ Reaction* Rxn = NewData->GetReaction(i); string RxnID = Rxn->GetData("DATABASE",STRING); string Name = Rxn->GetData("NAME",STRING); double DG_IS0 = Rxn->FEstDeltaG(7,0.25)*4.184; double DG_IS10 = Rxn->FEstDeltaG(7,0.15)*4.184; double DG_IS25 = Rxn->FEstDeltaG(7,0.25)*4.184; FErrorFile() << RxnID << "\t" << DG_IS0 << "\t" << DG_IS10 << "\t" << DG_IS25 << endl; } // FlushErrorFile(); } delete NewData; };