Skip to content

NPE when parsing certain PDB structures with "params.setCreateAtomBonds(true)" #943

@cleberecht

Description

@cleberecht

Hi,
thank you a lot providing and updating BioJava continuously.

I encountered a problem with the legacy pdb file parsing in the latest 6.0.0-alpha4 version of BioJava. When creating creating bonds an NPE is thrown.

Minimal (not)working example:

PDBFileReader reader = new PDBFileReader();
FileParsingParameters params = new FileParsingParameters();
params.setCreateAtomBonds(true);
reader.setFileParsingParameters(params);
reader.getStructureById("1v9i");

throws

java.lang.NullPointerException: Cannot invoke "org.biojava.nbio.structure.Chain.getGroupByPDB(org.biojava.nbio.structure.ResidueNumber)" because "chain" is null

	at org.biojava.nbio.structure.io.BondMaker.getAtomFromRecord(BondMaker.java:475)
	at org.biojava.nbio.structure.io.BondMaker.formLinkRecordBond(BondMaker.java:336)
	at org.biojava.nbio.structure.io.PDBFileParser.formBonds(PDBFileParser.java:2775)
	at org.biojava.nbio.structure.io.PDBFileParser.parsePDBFile(PDBFileParser.java:2700)
	at org.biojava.nbio.structure.io.PDBFileParser.parsePDBFile(PDBFileParser.java:2557)
	at org.biojava.nbio.structure.io.PDBFileReader.getStructure(PDBFileReader.java:140)
	at org.biojava.nbio.structure.io.LocalPDBDirectory.getStructureById(LocalPDBDirectory.java:334)
	at ...

I think there is a problem with the legacy chain id format where authId:C is requested but only asymId:A and asymId:B are present.

All the Best
Christoph

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions