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

Problem with empty "COMPND" line in PDB file import #870

Closed
JonasSchaub opened this issue Jul 6, 2022 · 2 comments
Closed

Problem with empty "COMPND" line in PDB file import #870

JonasSchaub opened this issue Jul 6, 2022 · 2 comments

Comments

@JonasSchaub
Copy link
Contributor

Dear CDK developers,

I tried to import a PDB format file created with GaussView containing the structure of alanine (attached).
This raised an exception:

java.lang.StringIndexOutOfBoundsException: String index out of range: -4
at java.base/java.lang.String.substring(String.java:1841)
at org.openscience.cdk.io.PDBReader.readChemFile(PDBReader.java:397)
at org.openscience.cdk.io.PDBReader.read(PDBReader.java:198)

After looking into it, I think the problem is line 3 in the file that has the property key "COMPND". In the class PDBReader line 396 and following, the functionality tries to parse the rest of the line as a title for the imported compound. But it is not checked whether there is actually something more than just "COMPND" in the line. Maybe, you can add a check for the line length before it is parsed (as it is done above for "REMARK").

If I can be of any further help, please let me know!

Kind regards,
Jonas Schaub

Ala_PDB.txt

@johnmay
Copy link
Member

johnmay commented Jul 6, 2022

Yep seems like an easy fix, thanks

@johnmay
Copy link
Member

johnmay commented Jul 13, 2022

Fixed by #871

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