void ProcessMolfiles() { string fullfile = FOutputFilepath()+"MolfileInput.txt"; ifstream Input; if (!OpenInput(Input,fullfile)) { return; } ofstream Output; string outfile = FOutputFilepath()+"MolfileOutput.txt"; if (OpenOutput(Output,outfile)) { Data* NewData = new Data(0); Output << "id\tmolfile\tgroups\tcharge\tformula\tstringcode\tmass\tdeltaG\tdeltaGerr" << endl; GetStringsFileline(Input,"\t",false); while(!Input.eof()) { vector<string>* strings = GetStringsFileline(Input,"\t",false); if (strings->size() >= 2) { Species* NewSpecies = new Species("", NewData, false); NewSpecies->ReadFromMol(FOutputFilepath()+"molfiles/"+(*strings)[1]); NewSpecies->PerformAllCalculations(true,true,true,true,true); string cues = NewSpecies->CreateStructuralCueList(); findandreplace(cues,"\t","|"); Output << (*strings)[0] << "\t" << (*strings)[1] << "\t" << cues << "\t" << NewSpecies->FCharge() << "\t" << NewSpecies->FFormula() << "\t"; Output << NewSpecies->FCode() << "\t" << NewSpecies->FMW() << "\t" << NewSpecies->FEstDeltaG() << "\t" << NewSpecies->FEstDeltaGUncertainty() << endl; delete NewSpecies; } delete strings; } Output.close(); } Input.close(); }
void CreateStringCode(string InputFilename, string OutputFilename) { Data* NewData = new Data(0); string TempFilename; Species* NewSpecies = new Species(TempFilename,NewData); if (InputFilename.length() > 3 && InputFilename.substr(InputFilename.length()-3,3).compare("mol") == 0) { NewSpecies->ReadFromMol(InputFilename); } else if (InputFilename.length() > 3 && InputFilename.substr(InputFilename.length()-3,3).compare("dat") == 0) { NewSpecies->ReadFromDat(InputFilename); } else { NewSpecies->ReadFromSmiles(InputFilename); } NewSpecies->MakeNeutral(); NewSpecies->PerformAllCalculations(false,true,true,false,false); ofstream Output; if (!OpenOutput(Output,OutputFilename)) { return; } Output << NewSpecies->FCode(); Output.close(); delete NewData; }