lonelyjoeparker / qmul-genome-convergence-pipeline

API and binaries for phylogenomic analyses, particularly comparison of input trees/alignments (CONTEXT) and detecting genomic convergence
4 stars 2 forks source link

NEXUS files authored by mesquite are not parsing correctly #38

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
NEXUS files authored by mesquite are not parsing correctly

Extra information present in the sequence matrix (e.g. two mentions of the word 
'matrix') is fooling the parser into thinking it is in the sequence block when 
in fact it is not (inMatrix==true at line 

uk.ac.qmul.sbcs.evolution.convergence.AlignedSequenceRepresentation.readNexusFil
e()
uk.ac.qmul.sbcs.evolution.convergence.AlignedSequenceRepresentation.java:576

As a result inptu is not parsed correctlty - among other things taoxn count is 
wrong (greater than size of taxa list array), and  invariant sites hash is not 
initialized correctly (length==0), see below. It may also be that the invariant 
sites behaviour is not implemented correctly, as this was possibly implemented 
after the nexus parser was written.

CapitalisedFileReader read 239 lines in input file.
determining input sequence format
Assuming filetype is NEXUS.
Processing a nexus file
java.lang.ArrayIndexOutOfBoundsException: 62
    at uk.ac.qmul.sbcs.evolution.convergence.AlignedSequenceRepresentation.readNexusFile(AlignedSequenceRepresentation.java:583)
    at uk.ac.qmul.sbcs.evolution.convergence.AlignedSequenceRepresentation.loadSequences(AlignedSequenceRepresentation.java:185)
    at uk.ac.qmul.sbcs.evolution.convergence.gui.controllers.AlignmentsController$AddSingleAlignmentsButtonListener.actionPerformed(AlignmentsController.java:125)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2028)
    at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2351)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
    at java.awt.Component.processMouseEvent(Component.java:6414)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3275)
    at java.awt.Component.processEvent(Component.java:6179)
    at java.awt.Container.processEvent(Container.java:2084)
    at java.awt.Component.dispatchEventImpl(Component.java:4776)
    at java.awt.Container.dispatchEventImpl(Container.java:2142)
    at java.awt.Component.dispatchEvent(Component.java:4604)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4618)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4279)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4209)
    at java.awt.Container.dispatchEventImpl(Container.java:2128)
    at java.awt.Window.dispatchEventImpl(Window.java:2492)
    at java.awt.Component.dispatchEvent(Component.java:4604)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:717)
    at java.awt.EventQueue.access$400(EventQueue.java:82)
    at java.awt.EventQueue$2.run(EventQueue.java:676)
    at java.awt.EventQueue$2.run(EventQueue.java:674)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:86)
    at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:97)
    at java.awt.EventQueue$3.run(EventQueue.java:690)
    at java.awt.EventQueue$3.run(EventQueue.java:688)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:86)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:687)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Exception in thread "AWT-EventQueue-0" 
java.lang.ArrayIndexOutOfBoundsException: 0
    at uk.ac.qmul.sbcs.evolution.convergence.AlignedSequenceRepresentation.determineInvariantSites(AlignedSequenceRepresentation.java:1223)
    at uk.ac.qmul.sbcs.evolution.convergence.AlignedSequenceRepresentation.loadSequences(AlignedSequenceRepresentation.java:226)
    at uk.ac.qmul.sbcs.evolution.convergence.gui.controllers.AlignmentsController$AddSingleAlignmentsButtonListener.actionPerformed(AlignmentsController.java:125)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2028)
    at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2351)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
    at java.awt.Component.processMouseEvent(Component.java:6414)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3275)
    at java.awt.Component.processEvent(Component.java:6179)
    at java.awt.Container.processEvent(Container.java:2084)
    at java.awt.Component.dispatchEventImpl(Component.java:4776)
    at java.awt.Container.dispatchEventImpl(Container.java:2142)
    at java.awt.Component.dispatchEvent(Component.java:4604)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4618)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4279)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4209)
    at java.awt.Container.dispatchEventImpl(Container.java:2128)
    at java.awt.Window.dispatchEventImpl(Window.java:2492)
    at java.awt.Component.dispatchEvent(Component.java:4604)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:717)
    at java.awt.EventQueue.access$400(EventQueue.java:82)
    at java.awt.EventQueue$2.run(EventQueue.java:676)
    at java.awt.EventQueue$2.run(EventQueue.java:674)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:86)
    at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:97)
    at java.awt.EventQueue$3.run(EventQueue.java:690)
    at java.awt.EventQueue$3.run(EventQueue.java:688)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:86)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:687)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

Original issue reported on code.google.com by joeparke...@gmail.com on 10 Feb 2015 at 4:19

Attachments:

GoogleCodeExporter commented 9 years ago
Have verified that ordinary nexus files do parse correctly. 
However this is clearly a compatibility issue and does need fixing.

Have refactored the parsing of AlignedSequenceRepresentation objects (see 
r372). Now concrete subclasses of AlignmentParser are used to parse the 
ArrayList<String> rawInput data read by file reader. Which concrete subclass is 
used is decided at runtime based on state of inputSequenceFileFormat enum.

Fasta, phylip and nexus file formats all tested and seem to be fine.

Original comment by joeparke...@gmail.com on 11 Feb 2015 at 1:49