diff --git a/.gitattributes b/.gitattributes index ec7598870..0f1249eff 100644 --- a/.gitattributes +++ b/.gitattributes @@ -16,6 +16,7 @@ CMakeLists.txt text # Declare files that will always have CRLF line endings on checkout. #*.sln text eol=crlf +Code/GraphMol/SynthonSpaceSearch/data/amide_space_dos.txt eol=crlf # Declare files that will always have LF line endings on checkout. #*.svg text eol=lf @@ -26,4 +27,3 @@ CMakeLists.txt text *.pkl binary *.fpb binary - diff --git a/Code/GraphMol/SynthonSpaceSearch/SynthonSpace.cpp b/Code/GraphMol/SynthonSpaceSearch/SynthonSpace.cpp index dfc97fe2d..37889ef0e 100644 --- a/Code/GraphMol/SynthonSpaceSearch/SynthonSpace.cpp +++ b/Code/GraphMol/SynthonSpaceSearch/SynthonSpace.cpp @@ -26,6 +26,7 @@ #include #include #include +#include namespace RDKit::SynthonSpaceSearch { @@ -123,7 +124,8 @@ void SynthonSpace::readTextFile(const std::string &inFilename) { std::string nextLine; int lineNum = 1; std::vector nextSynthon; - while (getline(ifs, nextLine)) { + while (!ifs.eof()) { + nextLine = getLine(ifs); ++lineNum; if (nextLine.empty() || nextLine[0] == '#') { continue; diff --git a/Code/GraphMol/SynthonSpaceSearch/data/amide_space_dos.txt b/Code/GraphMol/SynthonSpaceSearch/data/amide_space_dos.txt new file mode 100644 index 000000000..d97c3d35d --- /dev/null +++ b/Code/GraphMol/SynthonSpaceSearch/data/amide_space_dos.txt @@ -0,0 +1,8 @@ +SMILES synton_id synton# reaction_id +c1ccccc1C(=O)[1*] 1-1 0 amide-1 +C1CCCCC1C(=O)[1*] 1-2 0 amide-1 +Clc1ccccc1C(=O)[1*] 1-3 0 amide-1 +CCCCC(=O)[1*] 1-4 0 amide-1 +[1*]N1CCCC1 2-1 1 amide-1 +[1*]NCCCCC 2-2 1 amide-1 +[1*]NCC1CC1 2-3 1 amide-1 diff --git a/Code/GraphMol/SynthonSpaceSearch/substructure_search_catch_tests.cpp b/Code/GraphMol/SynthonSpaceSearch/substructure_search_catch_tests.cpp index 4270063bb..06fd4ba5a 100644 --- a/Code/GraphMol/SynthonSpaceSearch/substructure_search_catch_tests.cpp +++ b/Code/GraphMol/SynthonSpaceSearch/substructure_search_catch_tests.cpp @@ -550,4 +550,13 @@ TEST_CASE("Greg Space Failure") { auto results = synthonspace.substructureSearch(*queryMol, params); CHECK(results.getHitMolecules().size() == 1); +} + +TEST_CASE("DOS File") { + REQUIRE(rdbase); + std::string fName(rdbase); + std::string libName = fName + "/Code/GraphMol/SynthonSpaceSearch/data/amide_space_dos.txt"; + SynthonSpace synthonspace; + synthonspace.readTextFile(libName); + CHECK(synthonspace.getNumProducts() == 12); } \ No newline at end of file