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

obabel error on reading "Cl" as "l" #2685

Open
zubairhussain123 opened this issue Mar 28, 2024 · 3 comments
Open

obabel error on reading "Cl" as "l" #2685

zubairhussain123 opened this issue Mar 28, 2024 · 3 comments

Comments

@zubairhussain123
Copy link

zubairhussain123 commented Mar 28, 2024

while converting the **smi** files to other formats like **pdb** or **mol** sometimes the obabel can't read **Cl** atoms in the smiles becuase they are not in the proper format or the **Cl** is sometimes written as **l**. To fix this error use python code as given below:

with open("list.txt", "r") as input_file: # replace list.txt according to your file name
    smiles_data = input_file.read()

# Replace 'l' with 'Cl' in the SMILES data
modified_smiles_data = smiles_data.replace("l", "Cl")

# Save the modified SMILES data to a new file
with open("modified_smiles.txt", "w") as output_file:
    output_file.write(modified_smiles_data)

This code will generate a new fixed file named as 'modified_smiles.txt'.

Copy link

welcome bot commented Mar 28, 2024

Thanks for opening your first issue here! Be sure to follow the issue template!

@nbehrnd
Copy link
Contributor

nbehrnd commented Mar 28, 2024

@zubairhussain123 As suggested by the issue template, to ease a replication and potential improvement of obabel, share

  • a typical input file which leads to these observations
  • a report of version of OpenBabel you used and the hosting operating system

@fredrikw
Copy link
Contributor

fredrikw commented Apr 8, 2024

I'm sorry but I fail to see why it's an issue with OpenBabel that you have broken SMILES strings. And running this code will produce garbage if you have a proper SMILES since every instance of "Cl" will be "CCl"...

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

3 participants