void readMoleculeFile(const char* fileName) { // // Input parser conversion functionality for Open babel // OpenBabel::OBConversion obConversion; obConversion.SetInFormat("SDF"); // // Open the file, split the current molecule into Molecule Data (prefix) // and Our Data (Suffix) // std::ifstream infile; infile.open(fileName); std::string name = "UNKNOWN"; std::string prefix = ""; std::string suffix = ""; while(splitMolecule(infile, name, prefix, suffix)) { // // If the name of molecule is not given, overwrite it with the name of the file. // if (name == "UNKNOWN") { name = "#### "; name += fileName; name += " ####"; } if (g_debug_output) std::cerr << "Name: " << std::endl << name << std::endl; if (g_debug_output) std::cerr << "Prefix: " << std::endl << prefix << std::endl; if (g_debug_output) std::cerr << "Suffix: " << std::endl << suffix << std::endl; // Create and parse using Open Babel OpenBabel::OBMol* mol = new OpenBabel::OBMol(); bool notAtEnd = obConversion.ReadString(mol, prefix); // Assign all needed data to the molecule (comment data) Molecule* local = createLocalMolecule(mol, fileName[0] == 'l' ? LINKER : RIGID, name, suffix); // calculate the molecular weight, H donors and acceptors and the plogp local->openBabelPredictLipinski(); // add to logfile if (local->islipinskiPredicted()) { std::ofstream logfile("synth_log_initial_fragments_logfile.txt", std::ofstream::out | std::ofstream::app); // append logfile << fileName << "\nMolWt = " << local->getMolWt() << "\n"; logfile << "HBD = " << local->getHBD() << "\n"; logfile << "HBA1 = " << local->getHBA1() << "\n"; logfile << "logP = " << local->getlogP() << "\n"; logfile << std::endl; logfile.close(); } else std::cerr << "Main: predictLipinski failed somehow!" << endl; if (g_debug_output) std::cout << "Local: " << *local << "|" << std::endl; // Add to the linker or rigid list as needed. addMolecule(fileName[0], local); } }