X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=forester%2Fjava%2Fsrc%2Forg%2Fforester%2Fevoinference%2Fparsimony%2FDolloParsimony.java;h=094621873d7c39d464eaf8bdb61881129dfc5449;hb=88718609970e490e94727d12ebbca1270ba2c0a7;hp=a10e8656f30491f6f808668f52f5f36fbbf372c6;hpb=eccc2fdb674f76be1815fd7984295661bff8a2be;p=jalview.git diff --git a/forester/java/src/org/forester/evoinference/parsimony/DolloParsimony.java b/forester/java/src/org/forester/evoinference/parsimony/DolloParsimony.java index a10e865..0946218 100644 --- a/forester/java/src/org/forester/evoinference/parsimony/DolloParsimony.java +++ b/forester/java/src/org/forester/evoinference/parsimony/DolloParsimony.java @@ -6,7 +6,7 @@ // Copyright (C) 2008-2009 Christian M. Zmasek // Copyright (C) 2008-2009 Burnham Institute for Medical Research // All rights reserved -// +// // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either @@ -16,13 +16,13 @@ // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. -// +// // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA // // Contact: phylosoft @ gmail . com -// WWW: www.phylosoft.org/forester +// WWW: https://sites.google.com/site/cmzmasek/home/software/forester package org.forester.evoinference.parsimony; @@ -130,13 +130,12 @@ public class DolloParsimony { private Map getStatesForCharacter( final Phylogeny p, final CharacterStateMatrix matrix, final int character_index ) { - final Map states = new HashMap( matrix - .getNumberOfIdentifiers() ); + final Map states = new HashMap( matrix.getNumberOfIdentifiers() ); for( int indentifier_index = 0; indentifier_index < matrix.getNumberOfIdentifiers(); ++indentifier_index ) { final BinaryStates state = matrix.getState( indentifier_index, character_index ); if ( state == null ) { throw new IllegalArgumentException( "value at [" + indentifier_index + ", " + character_index - + "] is null" ); + + "] is null" ); } states.put( p.getNode( matrix.getIdentifier( indentifier_index ) ), state ); } @@ -177,8 +176,8 @@ public class DolloParsimony { nodes.add( postorder.next() ); } setGainLossMatrix( new BasicCharacterStateMatrix( nodes.size(), - external_node_states_matrix - .getNumberOfCharacters() ) ); + external_node_states_matrix + .getNumberOfCharacters() ) ); int identifier_index = 0; for( final PhylogenyNode node : nodes ) { getGainLossMatrix().setIdentifier( identifier_index++, @@ -201,8 +200,8 @@ public class DolloParsimony { } } setInternalStatesMatrix( new BasicCharacterStateMatrix( internal_nodes.size(), - external_node_states_matrix - .getNumberOfCharacters() ) ); + external_node_states_matrix + .getNumberOfCharacters() ) ); int identifier_index = 0; for( final PhylogenyNode node : internal_nodes ) { getInternalStatesMatrix().setIdentifier( identifier_index++, @@ -315,17 +314,17 @@ public class DolloParsimony { final PhylogenyNode node, final GainLossStates state ) { getGainLossMatrix().setState( ForesterUtil.isEmpty( node.getName() ) ? node.getId() + "" : node.getName(), - character_state_column, - state ); + character_state_column, + state ); } private void setInternalNodeState( final Map states, final int character_state_column, final PhylogenyNode node ) { getInternalStatesMatrix() - .setState( ForesterUtil.isEmpty( node.getName() ) ? node.getId() + "" : node.getName(), - character_state_column, - states.get( node ) ); + .setState( ForesterUtil.isEmpty( node.getName() ) ? node.getId() + "" : node.getName(), + character_state_column, + states.get( node ) ); } private void setInternalStatesMatrix( final CharacterStateMatrix internal_states_matrix ) { @@ -369,7 +368,7 @@ public class DolloParsimony { final PhylogenyNode node_child = node.getChildNode( i ); if ( !states.containsKey( node_child ) ) { throw new RuntimeException( "this should not have happened: node [" + node_child.getName() - + "] not found in node state map" ); + + "] not found in node state map" ); } if ( ( states.get( node_child ) == BinaryStates.PRESENT ) || ( states.get( node_child ) == BinaryStates.UNKNOWN ) ) {