Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SMARTS Parse Error #65

Open
BioGavin opened this issue Jun 23, 2022 · 1 comment
Open

SMARTS Parse Error #65

BioGavin opened this issue Jun 23, 2022 · 1 comment

Comments

@BioGavin
Copy link

When running to the sdftinkerxyzpy.py script, a SMARTS parsing error occurs.

SMARTS Parse Error: syntax error while parsing: HN#[C,N]
SMARTS Parse Error: Failed parsing SMARTS 'HN#[C,N]' for input: 'HN#[C,N]'
...
Traceback (most recent call last):
  File "tett.py", line 130, in <module>
    for substructure_match in m.GetSubstructMatches(substructure):
Boost.Python.ArgumentError: Python argument types in
    Mol.GetSubstructMatches(Mol, NoneType)
did not match C++ signature:
    GetSubstructMatches(RDKit::ROMol self, RDKit::MolBundle query, RDKit::SubstructMatchParameters params)
    GetSubstructMatches(RDKit::ROMol self, RDKit::ROMol query, RDKit::SubstructMatchParameters params)
    GetSubstructMatches(RDKit::ROMol self, RDKit::MolBundle query, bool uniquify=True, bool useChirality=False, bool useQueryQueryMatches=False, unsigned int maxMatches=1000)
    GetSubstructMatches(RDKit::ROMol self, RDKit::ROMol query, bool uniquify=True, bool useChirality=False, bool useQueryQueryMatches=False, unsigned int maxMatches=1000)

After some exploration, I found the cause of the problem. 'H' is unknown and an invalid symbol in SMARTS.
When I check the code, I find that

 m = Chem.MolFromMolFile(sdf_file + ".sdf", removeHs=False)  # sdftinkerxyzpy.py line-360

If set removeHs=True, problem will be solved.

@amyjystad
Copy link

Having the same issue a year later, looks like theres a typo in line 258 of the sdftinkerxyzpy.py script, changing HN#[C,N] to [H]N#[C,N]. Has thus far fixed the parsing issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants