// 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
// 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;
private Map<PhylogenyNode, BinaryStates> getStatesForCharacter( final Phylogeny p,
final CharacterStateMatrix<BinaryStates> matrix,
final int character_index ) {
- final Map<PhylogenyNode, BinaryStates> states = new HashMap<PhylogenyNode, BinaryStates>( matrix
- .getNumberOfIdentifiers() );
+ final Map<PhylogenyNode, BinaryStates> states = new HashMap<PhylogenyNode, BinaryStates>( 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 );
}
nodes.add( postorder.next() );
}
setGainLossMatrix( new BasicCharacterStateMatrix<CharacterStateMatrix.GainLossStates>( 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++,
}
}
setInternalStatesMatrix( new BasicCharacterStateMatrix<BinaryStates>( 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++,
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<PhylogenyNode, BinaryStates> 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<BinaryStates> internal_states_matrix ) {
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 ) ) {