X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=forester%2Fjava%2Fsrc%2Forg%2Fforester%2Ftools%2FSupportCount.java;h=d68a5161a27d2c104ed8a5f7807d3d9b8a8152bc;hb=718bd74aff29f5883486fc0ab8b54e1519ab51d0;hp=5c8e924b4448ac12314856b912ddeae9f6f03467;hpb=f3578c8bca780191d23d36d3791d2ec2c0bf38ad;p=jalview.git diff --git a/forester/java/src/org/forester/tools/SupportCount.java b/forester/java/src/org/forester/tools/SupportCount.java index 5c8e924..d68a516 100644 --- a/forester/java/src/org/forester/tools/SupportCount.java +++ b/forester/java/src/org/forester/tools/SupportCount.java @@ -21,7 +21,7 @@ // 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.tools; @@ -40,8 +40,8 @@ import org.forester.phylogeny.iterators.PhylogenyNodeIterator; /* * 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 { @@ -64,7 +64,7 @@ public final class SupportCount { phylogeny.reRoot( phylogeny.getNode( child0_name ) ); evaluator_phylogeny.reRoot( evaluator_phylogeny.getNode( child0_name ) ); } - final Map> phylogeny_external_names_per_node = SupportCount + final Map> phylogeny_external_names_per_node = SupportCount .extractExternalNamesPerNode( phylogeny ); return ( SupportCount.compare( phylogeny, evaluator_phylogeny, @@ -74,18 +74,18 @@ public final class SupportCount { } /** - * + * * 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 @@ -97,7 +97,7 @@ public final class SupportCount { */ private static double compare( final Phylogeny phylogeny, final Phylogeny evaluator_phylogeny, - final Map> phylogeny_external_names_per_node, + final Map> phylogeny_external_names_per_node, final boolean update_support_in_phylogeny, final double similarity_threshold ) { int matching_branches = 0; @@ -114,7 +114,7 @@ public final class SupportCount { 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 c2 = phylogeny_external_names_per_node.get( id ); if ( ( c2.size() == c1.size() ) && c2.containsAll( c1 ) ) { if ( c2.size() > 1 ) { @@ -160,7 +160,7 @@ public final class SupportCount { * 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 @@ -181,7 +181,7 @@ public final class SupportCount { } final String child0_name = phylogeny.getFirstExternalNode().getName(); phylogeny.reRoot( phylogeny.getNode( child0_name ) ); - final Map> phylogeny_external_names_per_node = SupportCount + final Map> phylogeny_external_names_per_node = SupportCount .extractExternalNamesPerNode( phylogeny ); if ( verbose ) { System.out.println(); @@ -239,14 +239,14 @@ public final class SupportCount { return evaluator_phylogenies_above_threshold; } - private static Map> extractExternalNamesPerNode( final Phylogeny phylogeny ) + private static Map> extractExternalNamesPerNode( final Phylogeny phylogeny ) throws NoSuchElementException { - final HashMap> phylogeny_external_names_per_node = new HashMap>(); + final HashMap> phylogeny_external_names_per_node = new HashMap>(); for( final PhylogenyNodeIterator it = phylogeny.iteratorPostorder(); it.hasNext(); ) { final PhylogenyNode n = it.next(); final List l = n.getAllExternalDescendants(); final ArrayList c = new ArrayList(); - 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() ); }