/*
* A simple class containing a static method to evaluate the topology of a given
* phylogeny with a list of resampled phylogenies.
- *
- *
+ *
+ *
* @author Christian M Zmasek
*/
public final class SupportCount {
phylogeny.reRoot( phylogeny.getNode( child0_name ) );
evaluator_phylogeny.reRoot( evaluator_phylogeny.getNode( child0_name ) );
}
- final Map<Integer, ArrayList<String>> phylogeny_external_names_per_node = SupportCount
+ final Map<Long, ArrayList<String>> phylogeny_external_names_per_node = SupportCount
.extractExternalNamesPerNode( phylogeny );
return ( SupportCount.compare( phylogeny,
evaluator_phylogeny,
}
/**
- *
+ *
* Precondition: phylogeny and evaluator_phylogeny have to be rooted in the
* same manner.
- *
+ *
* Returns a measure of the similarity ("average bootstrap similarity")
* between the topologies of phylogeny and evaluator_phylogeny: (sum of
* branches which divide phylogeny in a manner consitent with
* evaluator_phylogeny)/sum of branches in phylogeny. Therefore, this
* measure is 1.0 for indentical topologies and 0.0 for completely
* incompatible topologies.
- *
- *
+ *
+ *
* @param phylogeny
* @param evaluator_phylogeny
* @param external_names_per_node
*/
private static double compare( final Phylogeny phylogeny,
final Phylogeny evaluator_phylogeny,
- final Map<Integer, ArrayList<String>> phylogeny_external_names_per_node,
+ final Map<Long, ArrayList<String>> phylogeny_external_names_per_node,
final boolean update_support_in_phylogeny,
final double similarity_threshold ) {
int matching_branches = 0;
for( final Object element : evaluator_phylogeny_it.next().getAllExternalDescendants() ) {
c1.add( ( ( PhylogenyNode ) element ).getName() );
}
- for( final Integer id : phylogeny_external_names_per_node.keySet() ) {
+ for( final Long id : phylogeny_external_names_per_node.keySet() ) {
final List<String> c2 = phylogeny_external_names_per_node.get( id );
if ( ( c2.size() == c1.size() ) && c2.containsAll( c1 ) ) {
if ( c2.size() > 1 ) {
* phylogenies. If phylogenies contains topogies with names not present in
* phylogeny, strip_phylogenies must be set to true. phylogeny must not
* contain names not found in all phylogenies.
- *
+ *
* @param phylogeny
* the topology to be evaluated
* @param evaluator_phylogenies
}
final String child0_name = phylogeny.getFirstExternalNode().getName();
phylogeny.reRoot( phylogeny.getNode( child0_name ) );
- final Map<Integer, ArrayList<String>> phylogeny_external_names_per_node = SupportCount
+ final Map<Long, ArrayList<String>> phylogeny_external_names_per_node = SupportCount
.extractExternalNamesPerNode( phylogeny );
if ( verbose ) {
System.out.println();
return evaluator_phylogenies_above_threshold;
}
- private static Map<Integer, ArrayList<String>> extractExternalNamesPerNode( final Phylogeny phylogeny )
+ private static Map<Long, ArrayList<String>> extractExternalNamesPerNode( final Phylogeny phylogeny )
throws NoSuchElementException {
- final HashMap<Integer, ArrayList<String>> phylogeny_external_names_per_node = new HashMap<Integer, ArrayList<String>>();
+ final HashMap<Long, ArrayList<String>> phylogeny_external_names_per_node = new HashMap<Long, ArrayList<String>>();
for( final PhylogenyNodeIterator it = phylogeny.iteratorPostorder(); it.hasNext(); ) {
final PhylogenyNode n = it.next();
final List<PhylogenyNode> l = n.getAllExternalDescendants();
final ArrayList<String> c = new ArrayList<String>();
- phylogeny_external_names_per_node.put( new Integer( n.getId() ), c );
+ phylogeny_external_names_per_node.put( new Long( n.getId() ), c );
for( final PhylogenyNode phylogenyNode : l ) {
c.add( phylogenyNode.getName() );
}