Skip to content

Error displaying MMTF structures in Jmol #629

Open

Description

@lafita

When trying to display a structure in Jmol, for example from the MultipleAlignmentGUI, the following error gets thrown and the JmolPanel remains empty:

java.lang.ArithmeticException: / by zero
	at org.jmol.adapter.readers.cif.MessagePackReader.getInts(MessagePackReader.java:406)
	at org.jmol.adapter.readers.cif.MessagePackReader.decode(MessagePackReader.java:335)
	at org.jmol.adapter.readers.cif.MMTFReader.decode(MMTFReader.java:488)
	at org.jmol.adapter.readers.cif.MMTFReader.processBinaryDocument(MMTFReader.java:147)
	at org.jmol.adapter.smarter.AtomSetCollectionReader.readData(AtomSetCollectionReader.java:261)
	at org.jmol.adapter.smarter.SmarterJmolAdapter.staticGetAtomSetCollection(SmarterJmolAdapter.java:149)
	at org.jmol.adapter.smarter.SmarterJmolAdapter.getAtomSetCollection(SmarterJmolAdapter.java:142)
	at org.jmol.io.FileReader.run(FileReader.java:143)
	at org.jmol.viewer.FileManager.createAtomSetCollectionFromReader(FileManager.java:379)
	at org.jmol.viewer.Viewer.loadModelFromFile(Viewer.java:1697)
	at org.jmol.viewer.Viewer.loadModelFromFileRepaint(Viewer.java:1611)
	at org.jmol.viewer.Viewer.openReader(Viewer.java:1580)
	at org.jmol.api.JmolViewer.openReader(JmolViewer.java:319)
	at org.biojava.nbio.structure.align.gui.jmol.JmolPanel.setStructure(JmolPanel.java:146)
	at org.biojava.nbio.structure.align.gui.jmol.AbstractAlignmentJmol.setStructure(AbstractAlignmentJmol.java:159)
	at org.biojava.nbio.structure.align.gui.jmol.MultipleAlignmentJmol.initCoords(MultipleAlignmentJmol.java:358)
	at org.biojava.nbio.structure.align.gui.jmol.MultipleAlignmentJmol.(MultipleAlignmentJmol.java:342)
	at org.biojava.nbio.structure.align.gui.MultipleAlignmentJmolDisplay.display(MultipleAlignmentJmolDisplay.java:192)
	at org.biojava.nbio.structure.align.gui.MultipleAlignmentCalc.run(MultipleAlignmentCalc.java:90)
	at java.lang.Thread.run(Thread.java:745)

To reproduce the error, run the MultipleAlignmentGUI class with the provided example structures in the GUI.

Activity

  1. added
    bug
    on Jan 13, 2017
  2. added this to the BioJava 5.0.0 milestone on Jan 13, 2017
  3. josemduarte commented on Jan 13, 2017

    @josemduarte
    Contributor

    Could that be a bug in jmol's decoder? The mmtf file is an original one produced by RCSB, isn't it?

  4. lafita commented on Aug 8, 2017

    @lafita
    MemberAuthor

    Could that be a bug in jmol's decoder?

    Yes, it is a problem in Jmol decoder, because opening an MMTF file in a simple JmolPanel shows the same error.

    The mmtf file is an original one produced by RCSB, isn't it?

    Yes, it should be fine... I am wondering if it can be that some of the changes between MMTF versions might have broken the MMTF decoder of Jmol. Reviewing the history of changes I see this:

    1. We updated MMTF to version 1.0.0: Version 1.0.0 of MMTF changes #563
    2. We updated the Jmol version and used mmCif to transmit structures: Update Jmol #569 (worked fine)
    3. We switched to MMTF for structure transmission to Jmol: Switch Jmol interaction to use MMTF #570 (do you remember if it worked ok? @sbliven )
    4. We updated MMTF to version 1.0.5 Upgrading to mmtf 1.0.5 #646 (current - not working)

    The possible solutions are:

    1. Revert Switch Jmol interaction to use MMTF #570 and use mmCif for transmission.
    2. Update the Jmol version if the bug has been patched.
  5. pwrose commented on Aug 8, 2017

    @pwrose
    Member
  6. lafita commented on Aug 8, 2017

    @lafita
    MemberAuthor

    We are using version 14.6.2 in BioJava, but strangely when I download the desktop version (same as the one in BioJava) showing an MMTF structure works, but when I try the same structure (same file) in the BioJava JmolPanel it shows the error.

  7. modified the milestones: BioJava 5.0.0, on Mar 7, 2018
  8. lafita commented on Jul 26, 2018

    @lafita
    MemberAuthor

    I updated to Jmol 14.29.17 and the error is still there. I will submit a PR reverting to using mmCIF until we figure out what is the problem. For the purposes of visualizing structures the two formats are identical (except for little performance improvement).

    The current error looks like this on the Jmol viewer, in case this helps:

    screenshot

  9. lafita commented on Jul 26, 2018

    @lafita
    MemberAuthor

    I did a bit of research and the problem has to be when converting the MMTF object into an OutputStream.

    public void setStructure(final Structure s)
    {
    this.structure = s;
    try (
    PipedOutputStream out = new PipedOutputStream();
    // Viewer requires a BufferedInputStream for reflection
    InputStream in = new BufferedInputStream(new PipedInputStream(out));
    ) {
    new Thread((Runnable)() -> {
    try {
    MmtfActions.writeToOutputStream(s,out);
    } catch (Exception e) {
    logger.error("Error generating MMTF output for {}",
    s.getStructureIdentifier()==null ? s.getStructureIdentifier().getIdentifier() : s.getName(), e);
    }
    }).start();
    viewer.openReader(null, in);
    } catch (IOException e) {
    logger.error("Error transfering {} to Jmol",
    s.getStructureIdentifier()==null ? s.getStructureIdentifier().getIdentifier() : s.getName(), e);
    }
    evalString("save STATE state_1");
    }

    A possible test could be to save the OutputStream to a file and try opening it with a viewer.

  10. added a commit that references this issue on Jul 26, 2018
  11. removed this from the BioJava 5.3.1 milestone on Oct 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions