Skip to content

MultipleAlignmentJmol modifies state, causing NullPointerException #817

@sbliven

Description

@sbliven

I get a NullPointerException when running the following code:

String pdb = "4i4q";
Structure s = StructureTools.getStructure(pdb);
assertNotNull(s);

Atom[] atoms = StructureTools.getRepresentativeAtomArray(s);
assertNotNull(atoms);
assertEquals(146, atoms.length);

CeSymmResult result = CeSymm.analyze(atoms);

MultipleAlignment msa = result.getMultipleAlignment();
List<Atom[]> msaAtoms = msa.getAtomArrays();

// Commenting our this line fixes the error below
new MultipleAlignmentJmol(msa, msaAtoms);

// Throws NPE
SymmetryTools.divideStructure(result);

Stack trace:

Exception in thread "main" java.lang.NullPointerException
	at org.biojava.nbio.structure.StructureTools.addGroupToStructure(StructureTools.java:547)
	at org.biojava.nbio.structure.symmetry.utils.SymmetryTools.divideStructure(SymmetryTools.java:538)
	at main.TestSymmetryDisplay.main(TestSymmetryDisplay.java:53)

The weird thing is that the error goes away if I don't create the MultipleAlignmentJmol instance. We must be modifying the CESymmResult state in a way that breaks divideStructure.

Note that this blocks moving CE-Symm to BioJava 5

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugBugs and bugfixes

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions