X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=forester%2Fjava%2Fsrc%2Forg%2Fforester%2Fsurfacing%2FSurfacingUtil.java;h=05a910121eb8af9ba7b5d88aaa426820ed296ce6;hb=d605114bdf420c6cb680b02bb10ea25f09db769c;hp=660cbfd0489fbdb81bfe50a3bc45d8a58c126db8;hpb=1a473590cdf1a3913674e374a6d169954c38a6f4;p=jalview.git diff --git a/forester/java/src/org/forester/surfacing/SurfacingUtil.java b/forester/java/src/org/forester/surfacing/SurfacingUtil.java index 660cbfd..05a9101 100644 --- a/forester/java/src/org/forester/surfacing/SurfacingUtil.java +++ b/forester/java/src/org/forester/surfacing/SurfacingUtil.java @@ -60,7 +60,6 @@ import org.forester.evoinference.matrix.character.CharacterStateMatrix; import org.forester.evoinference.matrix.character.CharacterStateMatrix.BinaryStates; import org.forester.evoinference.matrix.character.CharacterStateMatrix.Format; import org.forester.evoinference.matrix.character.CharacterStateMatrix.GainLossStates; -import org.forester.evoinference.matrix.distance.BasicSymmetricalDistanceMatrix; import org.forester.evoinference.matrix.distance.DistanceMatrix; import org.forester.go.GoId; import org.forester.go.GoNameSpace; @@ -246,7 +245,7 @@ public final class SurfacingUtil { final DistanceMatrix distance ) { checkForOutputFileWriteability( nj_tree_outfile ); final NeighborJoining nj = NeighborJoining.createInstance(); - final Phylogeny phylogeny = nj.execute( ( BasicSymmetricalDistanceMatrix ) distance ); + final Phylogeny phylogeny = nj.execute( ( DistanceMatrix ) distance ); phylogeny.setName( nj_tree_outfile.getName() ); writePhylogenyToFile( phylogeny, nj_tree_outfile.toString() ); return phylogeny; @@ -1354,13 +1353,6 @@ public final class SurfacingUtil { if ( !intree.isRooted() ) { ForesterUtil.fatalError( surfacing.PRG_NAME, "input tree [" + intree_file + "] is not rooted" ); } - if ( intree.getNumberOfExternalNodes() < number_of_genomes ) { - ForesterUtil.fatalError( surfacing.PRG_NAME, - "number of external nodes [" + intree.getNumberOfExternalNodes() - + "] of input tree [" + intree_file - + "] is smaller than the number of genomes the be analyzed [" - + number_of_genomes + "]" ); - } final StringBuilder parent_names = new StringBuilder(); final int nodes_lacking_name = getNumberOfNodesLackingName( intree, parent_names ); if ( nodes_lacking_name > 0 ) { @@ -1600,7 +1592,6 @@ public final class SurfacingUtil { } } } - // final List igns = PhylogenyMethods.deleteExternalNodesPositiveSelection( genomes, intree ); if ( igns.size() > 0 ) { System.out.println( "Not using the following " + igns.size() + " nodes:" ); @@ -1609,16 +1600,29 @@ public final class SurfacingUtil { } System.out.println( "--" ); } + //Test for node names: + final SortedSet not_found = new TreeSet(); + final SortedSet not_unique = new TreeSet(); for( final String[] input_file_propertie : input_file_properties ) { - try { - intree.getNode( input_file_propertie[ 1 ] ); + final String name = input_file_propertie[ 1 ]; + final List nodes = intree.getNodes( name ); + if ( ( nodes == null ) || ( nodes.size() < 1 ) ) { + not_found.add( name ); } - catch ( final IllegalArgumentException e ) { - ForesterUtil.fatalError( surfacing.PRG_NAME, - "node named [" + input_file_propertie[ 1 ] - + "] not present/not unique in input tree" ); + if ( nodes.size() > 1 ) { + not_unique.add( name ); } } + if ( not_found.size() > 0 ) { + ForesterUtil.fatalError( surfacing.PRG_NAME, + "the following " + not_found.size() + + " node(s) are not present in the input tree: " + not_found ); + } + if ( not_unique.size() > 0 ) { + ForesterUtil.fatalError( surfacing.PRG_NAME, + "the following " + not_unique.size() + + " node(s) are not unique in the input tree: " + not_unique ); + } } public static void printOutPercentageOfMultidomainProteins( final SortedMap all_genomes_domains_per_potein_histo,