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

MultipleAlignmentJmol modifies state, causing NullPointerException #817

Open
sbliven opened this issue Dec 31, 2018 · 4 comments
Open

MultipleAlignmentJmol modifies state, causing NullPointerException #817

sbliven opened this issue Dec 31, 2018 · 4 comments
Labels
bug Bugs and bugfixes

Comments

@sbliven
Copy link
Member

sbliven commented Dec 31, 2018

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

@josemduarte
Copy link
Contributor

A bug in cloning perhaps?

@sbliven
Copy link
Member Author

sbliven commented Jan 1, 2019

I've fixed the NPE, but I'm still a bit concerned about MultipleAlignmentJmol modifying stuff. I'm not sure if I have time to track this bug down though.

@sbliven
Copy link
Member Author

sbliven commented Jan 7, 2019

Reopening for potential cloning bug

@sbliven sbliven reopened this Jan 7, 2019
sbliven added a commit to sbliven/biojava-sbliven that referenced this issue Jan 7, 2019
@sbliven
Copy link
Member Author

sbliven commented Jan 7, 2019

I have a test for this issue in my fix817 branch (83f2b38). Basically, creating MultipleAlignmentJmol results in all atoms having null EntityInfo.

@josemduarte josemduarte added the bug Bugs and bugfixes label Sep 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bugs and bugfixes
Projects
None yet
Development

No branches or pull requests

2 participants