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

SMILES parser fails #9

Open
OBrink opened this issue Nov 24, 2022 · 2 comments
Open

SMILES parser fails #9

OBrink opened this issue Nov 24, 2022 · 2 comments

Comments

@OBrink
Copy link
Contributor

OBrink commented Nov 24, 2022

Hey there!

When reading SMILES strings using PIKAChU, @Mar-Gol ran into the following problem:

Minimal example for reproduction:


>>> smiles = 'CCOC1=CC2=C(C=C1)S(=O)C(=C2C3=CC=CC=C3)C(=O)C4=CC=CC=C4'
>>> from pikachu.general import read_smiles
>>> mol = read_smiles(smiles)

Expected behavior:

  • The structure is converted into PIKAChU's molecular representation.

Observed behavior:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\Otto Brinkhaus\anaconda3\envs\RanDepict\lib\site-packages\pikachu\general.py", line 45, in read_smiles
    structure = smiles.smiles_to_structure()
  File "C:\Users\Otto Brinkhaus\anaconda3\envs\RanDepict\lib\site-packages\pikachu\smiles\smiles.py", line 496, in smiles_to_structure
    structure.refine_structure()
  File "C:\Users\Otto Brinkhaus\anaconda3\envs\RanDepict\lib\site-packages\pikachu\chem\structure.py", line 916, in refine_structure
    self.aromatic_cycles = self.find_aromatic_cycles()
  File "C:\Users\Otto Brinkhaus\anaconda3\envs\RanDepict\lib\site-packages\pikachu\chem\structure.py", line 781, in find_aromatic_cycles
    self.promote_lone_pairs_in_aromatic_cycles(aromatic_cycles)
  File "C:\Users\Otto Brinkhaus\anaconda3\envs\RanDepict\lib\site-packages\pikachu\chem\structure.py", line 731, in promote_lone_pairs_in_aromatic_cycles
    atom.promote_lone_pair_to_p_orbital()
  File "C:\Users\Otto Brinkhaus\anaconda3\envs\RanDepict\lib\site-packages\pikachu\chem\atom.py", line 512, in promote_lone_pair_to_p_orbital
    p_orbital = p_orbitals[-1]
IndexError: list index out of range
  • We used the latest version on pipy which we installed via pip install pikachu-chem.

I will build a work-around for our application for now, but I would appreciate your help a lot!
Thank you in advance!
Otto

@BTheDragonMaster
Copy link
Owner

Dear Otto,

Thank you very much for pointing this out! Unfortunately, PIKAChU has not been extensively tested with sulfur-containing aromatic rings; I will take a deep dive into the code sometime before the new year and see what is going on!

@OBrink
Copy link
Contributor Author

OBrink commented Nov 24, 2022

Thanks a lot!

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