mirror of
https://github.com/rdkit/rdkit.git
synced 2026-06-03 21:44:30 +08:00
Handle DOS files in SynthonSpaceSearch (#8075)
* Handle DOS files. * Smaller test file. Add DOS file to .gitattributes. * Update Code/GraphMol/SynthonSpaceSearch/substructure_search_catch_tests.cpp --------- Co-authored-by: David Cosgrove <david@cozchemix.co.uk> Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
This commit is contained in:
2
.gitattributes
vendored
2
.gitattributes
vendored
@@ -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
|
||||
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <GraphMol/SynthonSpaceSearch/SynthonSpaceSubstructureSearcher.h>
|
||||
#include <GraphMol/SynthonSpaceSearch/SynthonSet.h>
|
||||
#include <GraphMol/SmilesParse/SmilesParse.h>
|
||||
#include <RDGeneral/StreamOps.h>
|
||||
|
||||
namespace RDKit::SynthonSpaceSearch {
|
||||
|
||||
@@ -123,7 +124,8 @@ void SynthonSpace::readTextFile(const std::string &inFilename) {
|
||||
std::string nextLine;
|
||||
int lineNum = 1;
|
||||
std::vector<std::string> nextSynthon;
|
||||
while (getline(ifs, nextLine)) {
|
||||
while (!ifs.eof()) {
|
||||
nextLine = getLine(ifs);
|
||||
++lineNum;
|
||||
if (nextLine.empty() || nextLine[0] == '#') {
|
||||
continue;
|
||||
|
||||
@@ -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
|
||||
@@ -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);
|
||||
}
|
||||
Reference in New Issue
Block a user