From: <lol...@us...> - 2011-09-12 07:10:28
|
Revision: 952 http://treebase.svn.sourceforge.net/treebase/?rev=952&view=rev Author: loloyohe Date: 2011-09-12 07:10:22 +0000 (Mon, 12 Sep 2011) Log Message: ----------- Added code starting at line 388 that fixes bug #3303002, in which some studies were not printing the matrix in NeXML. I have commented out the original code with the bug in case the new code does not work for some reason. Modified Paths: -------------- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlMatrixConverter.java Modified: trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlMatrixConverter.java =================================================================== --- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlMatrixConverter.java 2011-09-01 18:31:45 UTC (rev 951) +++ trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlMatrixConverter.java 2011-09-12 07:10:22 UTC (rev 952) @@ -384,6 +384,17 @@ OTU xmlOTU = getOTUById(xmlOTUs, tbRow.getTaxonLabel().getId()); int charIndex = 0; if ( characterList.size() <= MAX_GRANULAR_NCHAR && xmlOTUs.getAllOTUs().size() <= MAX_GRANULAR_NTAX ) { + for ( MatrixColumn tbColumn : ((CharacterMatrix)tbMatrix).getColumns() ) { + String seq = tbRow.buildElementAsString(); + xmlMatrix.setSeq(seq, xmlOTU); + org.nexml.model.Character xmlCharacter = characterList.get(charIndex); + MatrixCell<CharacterState> xmlCell = xmlMatrix.getCell(xmlOTU, xmlCharacter); + + attachTreeBaseID ((Annotatable) xmlCell, tbColumn , DiscreteMatrixElement.class); + + //The following is commented out as tbRow.getElements() does not work directly and crashes the loop. + //The above for loop fixes this issue. + /* for ( MatrixElement tbCell : tbRow.getElements() ) { org.nexml.model.Character xmlCharacter = characterList.get(charIndex); MatrixCell<CharacterState> xmlCell = xmlMatrix.getCell(xmlOTU, xmlCharacter); @@ -392,6 +403,8 @@ CharacterState xmlState = xmlCharacter.getCharacterStateSet().lookupCharacterStateBySymbol(tbSymbolString); xmlCell.setValue(xmlState); attachTreeBaseID((Annotatable)xmlCell,tbCell,DiscreteMatrixElement.class); + */ + for ( RowSegment tbSegment : tbSegments ) { if ( tbSegment.getStartIndex() <= charIndex && charIndex <= tbSegment.getEndIndex() ) { //declare variables for row-segment annotations This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |