From caebe5e946fc15f9042dc70cac985910c6205e3c Mon Sep 17 00:00:00 2001 From: "cmzmasek@gmail.com" Date: Wed, 12 Dec 2012 00:06:20 +0000 Subject: [PATCH] "rio" work --- .../java/src/org/forester/application/gsdi.java | 2 +- .../java/src/org/forester/application/rio.java | 179 ++---- .../archaeopteryx/MainFrameApplication.java | 2 +- .../org/forester/phylogeny/PhylogenyMethods.java | 4 +- forester/java/src/org/forester/rio/RIO.java | 632 ++------------------ forester/java/src/org/forester/sdi/GSDI.java | 47 +- forester/java/src/org/forester/sdi/GSDIR.java | 17 +- forester/java/src/org/forester/sdi/TestGSDI.java | 112 ++-- 8 files changed, 168 insertions(+), 827 deletions(-) diff --git a/forester/java/src/org/forester/application/gsdi.java b/forester/java/src/org/forester/application/gsdi.java index e062730..304d12d 100644 --- a/forester/java/src/org/forester/application/gsdi.java +++ b/forester/java/src/org/forester/application/gsdi.java @@ -305,7 +305,7 @@ public final class gsdi { true ); } else if ( base_algorithm == ALGORITHM.GSDIR ) { - sdi = new GSDIR( gene_tree, species_tree, allow_stripping_of_gene_tree, 1 ); + sdi = new GSDIR( gene_tree, species_tree, allow_stripping_of_gene_tree, true ); } } else { diff --git a/forester/java/src/org/forester/application/rio.java b/forester/java/src/org/forester/application/rio.java index 80a34ab..397329c 100644 --- a/forester/java/src/org/forester/application/rio.java +++ b/forester/java/src/org/forester/application/rio.java @@ -28,9 +28,7 @@ package org.forester.application; import java.io.File; -import java.io.FileWriter; import java.io.IOException; -import java.io.PrintWriter; import java.util.ArrayList; import java.util.List; @@ -41,7 +39,6 @@ import org.forester.phylogeny.factories.ParserBasedPhylogenyFactory; import org.forester.phylogeny.factories.PhylogenyFactory; import org.forester.rio.RIO; import org.forester.rio.RIOException; -import org.forester.sdi.SDI; import org.forester.sdi.SDI.ALGORITHM; import org.forester.sdi.SDIException; import org.forester.util.CommandLineArguments; @@ -50,20 +47,14 @@ import org.forester.util.ForesterUtil; public class rio { - final static private String PRG_NAME = "rio"; - final static private String PRG_VERSION = "3.00 beta 4"; - final static private String PRG_DATE = "2012.12.10"; - final static private String E_MAIL = "czmasek@burnham.org"; - final static private String WWW = "www.phylosoft.org/forester/"; - final static private String HELP_OPTION_1 = "help"; - final static private String HELP_OPTION_2 = "h"; - final static private String QUERY_OPTION = "q"; - final static private String SORT_OPTION = "s"; - final static private String ALLOW_NON_BIN_SPECIES_TREE_OPTION = "g"; - final static private String OUTPUT_ULTRA_P_OPTION = "u"; - final static private String CUTOFF_ULTRA_P_OPTION = "cu"; - final static private String CUTOFF_ORTHO_OPTION = "co"; - final static private String TABLE_OUTPUT_OPTION = "t"; + final static private String PRG_NAME = "rio"; + final static private String PRG_VERSION = "3.00 beta 4"; + final static private String PRG_DATE = "2012.12.10"; + final static private String E_MAIL = "czmasek@burnham.org"; + final static private String WWW = "www.phylosoft.org/forester/"; + final static private String HELP_OPTION_1 = "help"; + final static private String HELP_OPTION_2 = "h"; + final static private String USE_SDIR = "b"; public static void main( final String[] args ) { ForesterUtil.printProgramInformation( PRG_NAME, @@ -90,101 +81,40 @@ public class rio { printHelp(); } final List allowed_options = new ArrayList(); - allowed_options.add( QUERY_OPTION ); - allowed_options.add( SORT_OPTION ); - allowed_options.add( CUTOFF_ULTRA_P_OPTION ); - allowed_options.add( CUTOFF_ORTHO_OPTION ); - allowed_options.add( TABLE_OUTPUT_OPTION ); - allowed_options.add( OUTPUT_ULTRA_P_OPTION ); - allowed_options.add( ALLOW_NON_BIN_SPECIES_TREE_OPTION ); + allowed_options.add( USE_SDIR ); final String dissallowed_options = cla.validateAllowedOptionsAsString( allowed_options ); if ( dissallowed_options.length() > 0 ) { ForesterUtil.fatalError( PRG_NAME, "unknown option(s): " + dissallowed_options ); } final File gene_trees_file = cla.getFile( 0 ); final File species_tree_file = cla.getFile( 1 ); - File outfile = null; - if ( cla.getNumberOfNames() > 2 ) { - outfile = cla.getFile( 2 ); + final File othology_outtable = cla.getFile( 2 ); + final File logfile; + if ( cla.getNumberOfNames() > 3 ) { + logfile = cla.getFile( 3 ); + } + else { + logfile = null; } ForesterUtil.fatalErrorIfFileNotReadable( PRG_NAME, gene_trees_file ); ForesterUtil.fatalErrorIfFileNotReadable( PRG_NAME, species_tree_file ); - if ( ( outfile != null ) && outfile.exists() ) { - ForesterUtil.fatalError( PRG_NAME, "[" + outfile + "] already exists" ); - } - String query = null; - if ( cla.isOptionSet( QUERY_OPTION ) ) { - query = cla.getOptionValue( QUERY_OPTION ); - } - File table_outfile = null; - if ( cla.isOptionSet( TABLE_OUTPUT_OPTION ) ) { - table_outfile = new File( cla.getOptionValue( TABLE_OUTPUT_OPTION ) ); - if ( table_outfile.exists() ) { - ForesterUtil.fatalError( PRG_NAME, "[" + table_outfile + "] already exists" ); - } - } - boolean output_ultraparalogs = false; - if ( cla.isOptionSet( OUTPUT_ULTRA_P_OPTION ) ) { - output_ultraparalogs = true; - } - boolean gsdir = false; - if ( cla.isOptionSet( ALLOW_NON_BIN_SPECIES_TREE_OPTION ) ) { - gsdir = true; - } - double cutoff_for_orthologs = 50; - double cutoff_for_ultra_paralogs = 50; - int sort = 1; - try { - if ( cla.isOptionSet( CUTOFF_ORTHO_OPTION ) ) { - cutoff_for_orthologs = cla.getOptionValueAsDouble( CUTOFF_ORTHO_OPTION ); - if ( query == null ) { - ForesterUtil.fatalError( PRG_NAME, "missing query name, type \"rio -h\" for help" ); - } - if ( outfile == null ) { - ForesterUtil.fatalError( PRG_NAME, "missing outfile, type \"rio -h\" for help" ); - } - } - if ( cla.isOptionSet( CUTOFF_ULTRA_P_OPTION ) ) { - cutoff_for_ultra_paralogs = cla.getOptionValueAsDouble( CUTOFF_ULTRA_P_OPTION ); - output_ultraparalogs = true; - } - if ( cla.isOptionSet( SORT_OPTION ) ) { - sort = cla.getOptionValueAsInt( SORT_OPTION ); - } - } - catch ( final Exception e ) { - ForesterUtil.fatalError( PRG_NAME, "error in command line: " + e.getLocalizedMessage() ); + if ( othology_outtable.exists() ) { + ForesterUtil.fatalError( PRG_NAME, "\"" + othology_outtable + "\" already exists" ); } - if ( ( cutoff_for_orthologs < 0 ) || ( cutoff_for_ultra_paralogs < 0 ) || ( sort < 0 ) || ( sort > 2 ) ) { - ForesterUtil.fatalError( PRG_NAME, "numberical option out of range, type \"rio -h\" for help" ); - } - if ( ( ( query == null ) && ( ( outfile != null ) || output_ultraparalogs ) ) ) { - ForesterUtil.fatalError( PRG_NAME, "missing query name, type \"rio -h\" for help" ); - } - if ( ( output_ultraparalogs && ( outfile == null ) ) || ( ( query != null ) && ( outfile == null ) ) ) { - ForesterUtil.fatalError( PRG_NAME, "missing outfile, type \"rio -h\" for help" ); + boolean sdir = false; + if ( cla.isOptionSet( USE_SDIR ) ) { + sdir = true; } long time = 0; System.out.println( "Gene trees : " + gene_trees_file ); System.out.println( "Species tree : " + species_tree_file ); - if ( gsdir ) { + System.out.println( "All vs all orthology table: " + othology_outtable ); + if ( !sdir ) { System.out.println( "Non binary species tree : allowed (GSDIR algorithm)" ); } else { System.out.println( "Non binary species tree : disallowed (SDIR algorithm)" ); } - if ( query != null ) { - System.out.println( "Query : " + query ); - System.out.println( "Outfile : " + outfile ); - System.out.println( "Sort : " + sort ); - System.out.println( "Cutoff for orthologs : " + cutoff_for_orthologs ); - if ( output_ultraparalogs ) { - System.out.println( "Cutoff for ultra paralogs : " + cutoff_for_ultra_paralogs ); - } - } - if ( table_outfile != null ) { - System.out.println( "Table output : " + table_outfile ); - } System.out.println(); time = System.currentTimeMillis(); Phylogeny species_tree = null; @@ -199,38 +129,16 @@ public class rio { if ( !species_tree.isRooted() ) { ForesterUtil.fatalError( PRG_NAME, "species tree is not rooted" ); } - final SDI.ALGORITHM algorithm; - if ( gsdir ) { - algorithm = ALGORITHM.GSDIR; + final ALGORITHM algorithm; + if ( sdir ) { + algorithm = ALGORITHM.SDIR; } else { - algorithm = ALGORITHM.SDIR; + algorithm = ALGORITHM.GSDIR; } try { - final RIO rio; - if ( ForesterUtil.isEmpty( query ) ) { - rio = new RIO( gene_trees_file, species_tree, algorithm ); - } - else { - rio = new RIO( gene_trees_file, species_tree, query, algorithm ); - } - if ( outfile != null ) { - final StringBuilder output = new StringBuilder(); - output.append( rio.inferredOrthologsToString( query, sort, cutoff_for_orthologs ) ); - if ( output_ultraparalogs ) { - output.append( "\n\nUltra paralogs:\n" ); - output.append( rio.inferredUltraParalogsToString( query, cutoff_for_ultra_paralogs ) ); - } - output.append( "\n\nSort priority: " + RIO.getOrder( sort ) ); - output.append( "\nExt nodes : " + rio.getExtNodesOfAnalyzedGeneTrees() ); - output.append( "\nSamples : " + rio.getNumberOfSamples() + "\n" ); - final PrintWriter out = new PrintWriter( new FileWriter( outfile ), true ); - out.println( output ); - out.close(); - } - if ( table_outfile != null ) { - tableOutput( table_outfile, rio ); - } + final RIO rio = new RIO( gene_trees_file, species_tree, algorithm ); + tableOutput( othology_outtable, rio ); } catch ( final RIOException e ) { ForesterUtil.fatalError( PRG_NAME, e.getLocalizedMessage() ); @@ -244,8 +152,8 @@ public class rio { catch ( final Exception e ) { ForesterUtil.unexpectedFatalError( PRG_NAME, e ); } - if ( outfile != null ) { - ForesterUtil.programMessage( PRG_NAME, "wrote results to \"" + outfile + "\"" ); + if ( othology_outtable != null ) { + ForesterUtil.programMessage( PRG_NAME, "wrote results to \"" + othology_outtable + "\"" ); } time = System.currentTimeMillis() - time; ForesterUtil.programMessage( PRG_NAME, "time: " + time + "ms" ); @@ -290,26 +198,14 @@ public class rio { private final static void printHelp() { System.out.println( "Usage" ); System.out.println(); - System.out.println( PRG_NAME + " [options] [outfile]" ); + System.out + .println( PRG_NAME + + " [options] [logfile]" ); System.out.println(); System.out.println( " Options" ); - System.out.println( " -" + ALLOW_NON_BIN_SPECIES_TREE_OPTION + " : to allow non-binary species tree" ); - System.out.println( " -" + CUTOFF_ORTHO_OPTION + " : cutoff for ortholog output (default: 50)" ); - System.out.println( " -" + TABLE_OUTPUT_OPTION - + " : file-name for output table of all vs. all ortholgy support" ); - System.out.println( " -" + QUERY_OPTION - + " : name for query (sequence/node), if this is used, [outfile] is required as well" ); - System.out.println( " -" + SORT_OPTION + " : sort (default: 1)" ); - System.out.println( " -" + OUTPUT_ULTRA_P_OPTION - + " : to output ultra-paralogs (species specific expansions/paralogs)" ); - System.out.println( " -" + CUTOFF_ULTRA_P_OPTION + " : cutoff for ultra-paralog output (default: 50)" ); - System.out.println(); - System.out.println( " Note" ); - System.out.println( " Either output of all vs. all ortholgy support with -t= and/or output for" ); - System.out.println( " one query sequence with -q= and a [outfile] are required." ); + System.out.println( " -" + USE_SDIR + + " : to use SDIR instead of GSDIR (faster, but non-binary species trees are disallowed)" ); System.out.println(); - System.out.println( " Sort" ); - System.out.println( RIO.getOrderHelp().toString() ); System.out.println( " Formats" ); System.out.println( " The species tree is expected to be in phyloXML format." ); System.out @@ -318,8 +214,7 @@ public class rio { System.out.println( " (e.g. \"HUMAN\" from \"BCL2_HUMAN\")." ); System.out.println(); System.out.println( " Examples" ); - System.out.println( " \"rio gene_trees.nh species.xml outfile -q=BCL2_HUMAN -t=outtable -u -cu=60 -co=60\"" ); - System.out.println( " \"rio gene_trees.nh species.xml -t=outtable\"" ); + System.out.println( " \"rio gene_trees.nh species.xml outtable.tsv log.txt\"" ); System.out.println(); System.out.println( " More information: http://code.google.com/p/forester/wiki/RIO" ); System.out.println(); diff --git a/forester/java/src/org/forester/archaeopteryx/MainFrameApplication.java b/forester/java/src/org/forester/archaeopteryx/MainFrameApplication.java index 77f0364..aa78613 100644 --- a/forester/java/src/org/forester/archaeopteryx/MainFrameApplication.java +++ b/forester/java/src/org/forester/archaeopteryx/MainFrameApplication.java @@ -1271,7 +1271,7 @@ public final class MainFrameApplication extends MainFrame { gene_tree.recalculateNumberOfExternalDescendants( false ); GSDIR gsdir = null; try { - gsdir = new GSDIR( gene_tree, _species_tree.copy(), true, 1 ); + gsdir = new GSDIR( gene_tree, _species_tree.copy(), true, true ); } catch ( final Exception e ) { JOptionPane.showMessageDialog( this, e.toString(), "Error during GSDIR", JOptionPane.ERROR_MESSAGE ); diff --git a/forester/java/src/org/forester/phylogeny/PhylogenyMethods.java b/forester/java/src/org/forester/phylogeny/PhylogenyMethods.java index b89575e..75250eb 100644 --- a/forester/java/src/org/forester/phylogeny/PhylogenyMethods.java +++ b/forester/java/src/org/forester/phylogeny/PhylogenyMethods.java @@ -1642,8 +1642,8 @@ public class PhylogenyMethods { nodes_to_delete.add( n ); } } - for( final PhylogenyNode phylogenyNode : nodes_to_delete ) { - to_be_stripped.deleteSubtree( phylogenyNode, true ); + for( final PhylogenyNode n : nodes_to_delete ) { + to_be_stripped.deleteSubtree( n, true ); } to_be_stripped.clearHashIdToNodeMap(); to_be_stripped.externalNodesHaveChanged(); diff --git a/forester/java/src/org/forester/rio/RIO.java b/forester/java/src/org/forester/rio/RIO.java index dea0492..2bcd5e9 100644 --- a/forester/java/src/org/forester/rio/RIO.java +++ b/forester/java/src/org/forester/rio/RIO.java @@ -31,7 +31,6 @@ import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; @@ -47,47 +46,27 @@ import org.forester.phylogeny.PhylogenyMethods; import org.forester.phylogeny.PhylogenyNode; import org.forester.phylogeny.factories.ParserBasedPhylogenyFactory; import org.forester.phylogeny.factories.PhylogenyFactory; -import org.forester.phylogeny.iterators.PhylogenyNodeIterator; import org.forester.sdi.GSDIR; -import org.forester.sdi.SDI; +import org.forester.sdi.SDI.ALGORITHM; +import org.forester.sdi.SDI.TaxonomyComparisonBase; import org.forester.sdi.SDIException; import org.forester.sdi.SDIR; import org.forester.util.ForesterUtil; public final class RIO { - private final static boolean ROOT_BY_MINIMIZING_SUM_OF_DUPS = true; - private final static boolean ROOT_BY_MINIMIZING_TREE_HEIGHT = true; - private Phylogeny[] _analyzed_gene_trees; - private HashMap> _o_maps; - private HashMap> _so_maps; - private HashMap> _up_maps; - private List _seq_names; - private List _removed_gene_tree_nodes; - private int _samples; - private int _ext_nodes; + private final static boolean ROOT_BY_MINIMIZING_SUM_OF_DUPS = true; + private final static boolean ROOT_BY_MINIMIZING_TREE_HEIGHT = true; + private Phylogeny[] _analyzed_gene_trees; + private List _removed_gene_tree_nodes; + private int _samples; + private int _ext_nodes; + private TaxonomyComparisonBase _gsdir_tax_comp_base; - /** - * Default constructor. - * @throws SDIException - * @throws IOException - * @throws RIOException - */ - public RIO( final File gene_trees_file, - final Phylogeny species_tree, - final String query, - final SDI.ALGORITHM algorithm ) throws IOException, SDIException, RIOException { - if ( ForesterUtil.isEmpty( query ) ) { - throw new IllegalArgumentException( "query is empty" ); - } - init(); - inferOrthologs( gene_trees_file, species_tree, query, algorithm ); - } - - public RIO( final File gene_trees_file, final Phylogeny species_tree, final SDI.ALGORITHM algorithm ) + public RIO( final File gene_trees_file, final Phylogeny species_tree, final ALGORITHM algorithm ) throws IOException, SDIException, RIOException { init(); - inferOrthologs( gene_trees_file, species_tree, null, algorithm ); + inferOrthologs( gene_trees_file, species_tree, algorithm ); } public final Phylogeny[] getAnalyzedGeneTrees() { @@ -104,292 +83,17 @@ public final class RIO { return _ext_nodes; } - /** - * Returns a HashMap containing the inferred "ultra paralogs" of the - * external gene tree node with the sequence name seq_name. Sequence names - * are the keys (String), numbers of observations are the values (Int). - * "ultra paralogs" are to be inferred by method "inferOrthologs". Throws an - * exception if seq_name is not found. - * - * @param seq_name - * sequence name of a external node of the gene trees - * @return HashMap containing the inferred ultra paralogs - * (name(String)->value(Int)) - */ - public final HashMap getInferredUltraParalogs( final String seq_name ) { - if ( _up_maps == null ) { - return null; - } - return _up_maps.get( seq_name ); - } - public final int getNumberOfSamples() { return _samples; } - /** - * Returns a String containg the names of orthologs of the PhylogenyNode - * with seq name query_name. The String also contains how many times a - * particular ortholog has been observed. - *

- *

    - * The output order is (per line): Name, Ortholog, Subtree neighbor, Super - * ortholog, Distance - *
- *

- * The sort priority of this is determined by sort in the following manner: - *

    - *
  • 0 : Ortholog - *
  • 1 : Ortholog, Super ortholog - *
  • 2 : Super ortholog, Ortholog - *
- *

- * Returns "-" if no putative orthologs have been found (given - * threshold_orthologs). - *

- * Orthologs are to be inferred by method "inferOrthologs". - *

- * (Last modified: 05/08/01) - * - * @param query_name - * sequence name of a external node of the gene trees - * @param sort - * order and sort priority - * @param threshold_orthologs - * the minimal number of observations for a a sequence to be - * reported as orthologous, in percents (0.0-100.0%) - * @param threshold_subtreeneighborings - * the minimal number of observations for a a sequence to be - * reported as orthologous, in percents (0.0-100.0%) - * @return String containing the inferred orthologs, String containing "-" - * if no orthologs have been found null in case of error - */ - public final StringBuffer inferredOrthologsToString( final String query_name, int sort, double threshold_orthologs ) { - HashMap o_hashmap = null; - HashMap s_hashmap = null; - String name = ""; - double o = 0.0; // Orthologs. - double s = 0.0; // Super orthologs. - double value1 = 0.0; - double value2 = 0.0; - final ArrayList nv = new ArrayList(); - if ( ( _o_maps == null ) || ( _so_maps == null ) ) { - throw new RuntimeException( "orthologs have not been calculated (successfully)" ); - } - if ( ( sort < 0 ) || ( sort > 2 ) ) { - sort = 1; - } - if ( threshold_orthologs < 0.0 ) { - threshold_orthologs = 0.0; - } - else if ( threshold_orthologs > 100.0 ) { - threshold_orthologs = 100.0; - } - o_hashmap = getInferredOrthologs( query_name ); - s_hashmap = getInferredSuperOrthologs( query_name ); - if ( ( o_hashmap == null ) || ( s_hashmap == null ) ) { - throw new RuntimeException( "Orthologs for " + query_name + " were not established" ); - } - final StringBuffer orthologs = new StringBuffer(); - if ( _seq_names.size() > 0 ) { - I: for( int i = 0; i < _seq_names.size(); ++i ) { - name = _seq_names.get( i ); - if ( name.equals( query_name ) ) { - continue I; - } - o = getBootstrapValueFromHash( o_hashmap, name ); - if ( o < threshold_orthologs ) { - continue I; - } - s = getBootstrapValueFromHash( s_hashmap, name ); - switch ( sort ) { - case 0: - nv.add( new ResultLine( name, o, 5 ) ); - break; - case 1: - nv.add( new ResultLine( name, o, s, 5 ) ); - break; - case 2: - nv.add( new ResultLine( name, s, o, 5 ) ); - break; - default: - nv.add( new ResultLine( name, o, 5 ) ); - } - } // End of I for loop. - if ( ( nv != null ) && ( nv.size() > 0 ) ) { - orthologs.append( "seq name\t\tortho\ts-ortho" + ForesterUtil.LINE_SEPARATOR ); - final ResultLine[] nv_array = new ResultLine[ nv.size() ]; - for( int j = 0; j < nv.size(); ++j ) { - nv_array[ j ] = nv.get( j ); - } - Arrays.sort( nv_array ); - for( final ResultLine element : nv_array ) { - name = element.getKey(); - value1 = element.getValue1(); - value2 = element.getValue2(); - orthologs.append( addNameAndValues( name, value1, value2, sort ) ); - } - } - } - // No orthologs found. - if ( ( orthologs == null ) || ( orthologs.length() < 1 ) ) { - orthologs.append( "-" ); - } - return orthologs; - } - - /** - * Returns a String containg the names of orthologs of the PhylogenyNode - * with seq name query_name. The String also contains how many times a - * particular ortholog has been observed. Returns "-" if no putative - * orthologs have been found (given threshold_orthologs). - *

- * Orthologs are to be inferred by method "inferOrthologs". - * - * @param query_name - * sequence name of a external node of the gene trees - * @param return_dists - * @param threshold_ultra_paralogs - * between 1 and 100 - * @return String containing the inferred orthologs, String containing "-" - * if no orthologs have been found null in case of error - */ - public final String inferredUltraParalogsToString( final String query_name, double threshold_ultra_paralogs ) { - HashMap sp_hashmap = null; - String name = "", ultra_paralogs = ""; - int sort = 0; - double sp = 0.0; - double value1 = 0.0; - double value2 = 0.0; - final List nv = new ArrayList(); - if ( threshold_ultra_paralogs < 1.0 ) { - threshold_ultra_paralogs = 1.0; - } - else if ( threshold_ultra_paralogs > 100.0 ) { - threshold_ultra_paralogs = 100.0; - } - if ( _up_maps == null ) { - throw new RuntimeException( "Ultra paralogs have not been calculated (successfully)." ); - } - sp_hashmap = getInferredUltraParalogs( query_name ); - if ( sp_hashmap == null ) { - throw new RuntimeException( "Ultra paralogs for " + query_name + " were not established" ); - } - if ( _seq_names.size() > 0 ) { - I: for( int i = 0; i < _seq_names.size(); ++i ) { - name = _seq_names.get( i ); - if ( name.equals( query_name ) ) { - continue I; - } - sp = getBootstrapValueFromHash( sp_hashmap, name ); - if ( sp < threshold_ultra_paralogs ) { - continue I; - } - nv.add( new ResultLine( name, sp, 5 ) ); - } // End of I for loop. - if ( ( nv != null ) && ( nv.size() > 0 ) ) { - final ResultLine[] nv_array = new ResultLine[ nv.size() ]; - for( int j = 0; j < nv.size(); ++j ) { - nv_array[ j ] = nv.get( j ); - } - Arrays.sort( nv_array ); - sort = 90; - for( final ResultLine element : nv_array ) { - name = element.getKey(); - value1 = element.getValue1(); - value2 = element.getValue2(); - ultra_paralogs += addNameAndValues( name, value1, value2, sort ); - } - } - } - // No ultra paralogs found. - if ( ( ultra_paralogs == null ) || ( ultra_paralogs.length() < 1 ) ) { - ultra_paralogs = "-"; - } - return ultra_paralogs; - } - - // Helper method for inferredOrthologsToString. - // inferredOrthologsToArrayList, - // and inferredUltraParalogsToString. - private final double getBootstrapValueFromHash( final HashMap h, final String name ) { - if ( !h.containsKey( name ) ) { - return 0.0; - } - final int i = h.get( name ); - return ( ( i * 100.0 ) / getNumberOfSamples() ); - } - - /** - * Returns a HashMap containing the inferred orthologs of the external gene - * tree node with the sequence name seq_name. Sequence names are the keys - * (String), numbers of observations are the values (Int). Orthologs are to - * be inferred by method "inferOrthologs". Throws an exception if seq_name - * is not found. - * - * @param seq_name - * sequence name of a external node of the gene trees - * @return HashMap containing the inferred orthologs - * (name(String)->value(Int)) - */ - private final HashMap getInferredOrthologs( final String seq_name ) { - if ( _o_maps == null ) { - return null; - } - return _o_maps.get( seq_name ); - } - - /** - * Returns a HashMap containing the inferred "super orthologs" of the - * external gene tree node with the sequence name seq_name. Sequence names - * are the keys (String), numbers of observations are the values (Int). - * Super orthologs are to be inferred by method "inferOrthologs". Throws an - * exception if seq_name is not found. - * - * @param seq_name - * sequence name of a external node of the gene trees - * @return HashMap containing the inferred super orthologs - * (name(String)->value(Int)) - */ - private final HashMap getInferredSuperOrthologs( final String seq_name ) { - if ( _so_maps == null ) { - return null; - } - return _so_maps.get( seq_name ); + public final List getRemovedGeneTreeNodes() { + return _removed_gene_tree_nodes; } - /** - * Infers the orthologs (as well the "super orthologs", the "subtree - * neighbors", and the "ultra paralogs") for each external node of the gene - * Trees in multiple tree File gene_trees_file (=output of PHYLIP NEIGHBOR, - * for example). Tallies how many times each sequence is (super-) - * orthologous towards the query. Tallies how many times each sequence is - * ultra paralogous towards the query. Tallies how many times each sequence - * is a subtree neighbor of the query. Gene duplications are inferred using - * SDI. Modifies its argument species_tree. Is a little faster than - * "inferOrthologs(File,Phylogeny)" since orthologs are only inferred for - * query. - *

- * To obtain the results use the methods listed below. - * - * @param gene_trees_file - * a File containing gene Trees in NH format, which is the result - * of performing a bootstrap analysis in PHYLIP - * @param species_tree - * a species Phylogeny, which has species names in its species - * fields - * @param query - * the sequence name of the squence whose orthologs are to be - * inferred - * @throws SDIException - * @throws RIOException - * @throws IOException - * @throws FileNotFoundException - */ private final void inferOrthologs( final File gene_trees_file, final Phylogeny species_tree, - final String query, - final SDI.ALGORITHM algorithm ) throws SDIException, RIOException, + final ALGORITHM algorithm ) throws SDIException, RIOException, FileNotFoundException, IOException { // Read in first tree to get its sequence names // and strip species_tree. @@ -403,53 +107,45 @@ public final class RIO { } final Phylogeny[] gene_trees = factory.create( gene_trees_file, p ); // Removes from species_tree all species not found in gene_tree. - final List _removed_gene_tree_nodes = PhylogenyMethods + final List _removed_species_tree_ext_nodes = PhylogenyMethods .taxonomyBasedDeletionOfExternalNodes( gene_trees[ 0 ], species_tree ); if ( species_tree.isEmpty() ) { throw new RIOException( "failed to establish species based mapping between gene and species trees" ); } - if ( !ForesterUtil.isEmpty( query ) ) { - PhylogenyMethods.taxonomyBasedDeletionOfExternalNodes( species_tree, gene_trees[ 0 ] ); - if ( gene_trees[ 0 ].isEmpty() ) { - throw new RIOException( "failed to establish species based mapping between gene and species trees" ); - } - _seq_names = getAllExternalSequenceNames( gene_trees[ 0 ] ); - if ( ( _seq_names == null ) || ( _seq_names.size() < 1 ) ) { - throw new RIOException( "could not get sequence names" ); - } - _o_maps = new HashMap>(); - _so_maps = new HashMap>(); - _up_maps = new HashMap>(); - _o_maps.put( query, new HashMap( _seq_names.size() ) ); - _so_maps.put( query, new HashMap( _seq_names.size() ) ); - _up_maps.put( query, new HashMap( _seq_names.size() ) ); - } _analyzed_gene_trees = new Phylogeny[ gene_trees.length ]; - int c = 0; + int i = 0; int gene_tree_ext_nodes = 0; for( final Phylogeny gt : gene_trees ) { - // Removes from gene_tree all species not found in species_tree. - PhylogenyMethods.taxonomyBasedDeletionOfExternalNodes( species_tree, gt ); - if ( gt.isEmpty() ) { - throw new RIOException( "failed to establish species based mapping between gene and species trees" ); - } - if ( c == 0 ) { - gene_tree_ext_nodes = gt.getNumberOfExternalNodes(); - } - else if ( gene_tree_ext_nodes != gt.getNumberOfExternalNodes() ) { - throw new RIOException( "(cleaned up) gene tree #" + ( c + 1 ) - + " has a different number of external nodes (" + gt.getNumberOfExternalNodes() - + ") than those gene trees preceding it (" + gene_tree_ext_nodes + ")" ); + if ( algorithm == ALGORITHM.SDIR ) { + // Removes from gene_tree all species not found in species_tree. + PhylogenyMethods.taxonomyBasedDeletionOfExternalNodes( species_tree, gt ); + if ( gt.isEmpty() ) { + throw new RIOException( "failed to establish species based mapping between gene and species trees" ); + } + if ( i == 0 ) { + gene_tree_ext_nodes = gt.getNumberOfExternalNodes(); + } + else if ( gene_tree_ext_nodes != gt.getNumberOfExternalNodes() ) { + throw new RIOException( "(cleaned up) gene tree #" + ( i + 1 ) + + " has a different number of external nodes (" + gt.getNumberOfExternalNodes() + + ") than those gene trees preceding it (" + gene_tree_ext_nodes + ")" ); + } } - _analyzed_gene_trees[ c++ ] = performOrthologInference( gt, species_tree, query, algorithm ); + _analyzed_gene_trees[ i ] = performOrthologInference( gt, species_tree, algorithm, i ); + ++i; } setNumberOfSamples( gene_trees.length ); } + private final void init() { + _samples = 1; + _ext_nodes = 0; + } + private final Phylogeny performOrthologInference( final Phylogeny gene_tree, final Phylogeny species_tree, - final String query, - final SDI.ALGORITHM algorithm ) throws SDIException, RIOException { + final ALGORITHM algorithm, + final int i ) throws SDIException, RIOException { final Phylogeny assigned_tree; switch ( algorithm ) { case SDIR: { @@ -464,8 +160,9 @@ public final class RIO { break; } case GSDIR: { - final GSDIR gsdir = new GSDIR( gene_tree, species_tree, true, 1 ); - assigned_tree = gsdir.getMinDuplicationsSumGeneTrees().get( 1 ); + final GSDIR gsdir = new GSDIR( gene_tree, species_tree, true, i == 0 ); + assigned_tree = gsdir.getMinDuplicationsSumGeneTrees().get( 0 ); + _gsdir_tax_comp_base = gsdir.getTaxCompBase(); break; } default: { @@ -473,31 +170,9 @@ public final class RIO { } } setExtNodesOfAnalyzedGeneTrees( assigned_tree.getNumberOfExternalNodes() ); - if ( !ForesterUtil.isEmpty( query ) ) { - final List nodes = getNodesViaSequenceName( assigned_tree, query ); - if ( nodes.size() > 1 ) { - throw new RIOException( "node named [" + query + "] not unique" ); - } - else if ( nodes.isEmpty() ) { - throw new RIOException( "no node containing a sequence named [" + query + "] found" ); - } - final PhylogenyNode query_node = nodes.get( 0 ); - updateCounts( _o_maps, query, PhylogenyMethods.getOrthologousNodes( assigned_tree, query_node ) ); - updateCounts( _so_maps, query, PhylogenyMethods.getSuperOrthologousNodes( query_node ) ); - updateCounts( _up_maps, query, PhylogenyMethods.getUltraParalogousNodes( query_node ) ); - } return assigned_tree; } - private final void init() { - _o_maps = null; - _so_maps = null; - _up_maps = null; - _seq_names = null; - _samples = 1; - _ext_nodes = 0; - } - private final void setExtNodesOfAnalyzedGeneTrees( final int i ) { _ext_nodes = i; } @@ -509,33 +184,6 @@ public final class RIO { _samples = i; } - // Helper for doInferOrthologs( Phylogeny, Phylogeny, String ) - // and doInferOrthologs( Phylogeny, Phylogeny ). - private final void updateCounts( final HashMap> counter_map, - final String query_seq_name, - final List nodes ) { - final HashMap hash_map = counter_map.get( query_seq_name ); - if ( hash_map == null ) { - throw new RuntimeException( "unexpected error in updateCounts" ); - } - for( int j = 0; j < nodes.size(); ++j ) { - String seq_name; - if ( ( nodes.get( j ) ).getNodeData().isHasSequence() - && !ForesterUtil.isEmpty( ( nodes.get( j ) ).getNodeData().getSequence().getName() ) ) { - seq_name = ( nodes.get( j ) ).getNodeData().getSequence().getName(); - } - else { - seq_name = ( nodes.get( j ) ).getName(); - } - if ( hash_map.containsKey( seq_name ) ) { - hash_map.put( seq_name, hash_map.get( seq_name ) + 1 ); - } - else { - hash_map.put( seq_name, 1 ); - } - } - } - public final static IntMatrix calculateOrthologTable( final Phylogeny[] analyzed_gene_trees, final boolean sort ) throws RIOException { final List labels = new ArrayList(); @@ -592,200 +240,4 @@ public final class RIO { } return m; } - - /** - * Returns the order in which ortholog (o), "super ortholog" (s) and - * distance (d) are returned and sorted (priority of sort always goes from - * left to right), given sort. For the meaning of sort - * - * @see #inferredOrthologsToString(String,int,double,double) - * - * @param sort - * determines order and sort priority - * @return String indicating the order - */ - public final static String getOrder( final int sort ) { - String order = ""; - switch ( sort ) { - case 0: - order = "orthologies"; - break; - case 1: - order = "orthologies > super orthologies"; - break; - case 2: - order = "super orthologies > orthologies"; - break; - default: - order = "orthologies"; - break; - } - return order; - } - - public final static StringBuffer getOrderHelp() { - final StringBuffer sb = new StringBuffer(); - sb.append( " 0: orthologies" + ForesterUtil.LINE_SEPARATOR ); - sb.append( " 1: orthologies > super orthologies" + ForesterUtil.LINE_SEPARATOR ); - sb.append( " 2: super orthologies > orthologies" + ForesterUtil.LINE_SEPARATOR ); - return sb; - } - - // Helper method for inferredOrthologsToString - // and inferredUltraParalogsToString. - private final static String addNameAndValues( final String name, - final double value1, - final double value2, - final int sort ) { - final java.text.DecimalFormat df = new java.text.DecimalFormat( "0.#####" ); - df.setDecimalSeparatorAlwaysShown( false ); - String line = ""; - if ( name.length() < 8 ) { - line += ( name + "\t\t\t" ); - } - else if ( name.length() < 16 ) { - line += ( name + "\t\t" ); - } - else { - line += ( name + "\t" ); - } - switch ( sort ) { - case 0: - line += addToLine( value1, df ); - line += "-\t"; - break; - case 1: - line += addToLine( value1, df ); - line += addToLine( value2, df ); - break; - case 2: - line += addToLine( value2, df ); - line += addToLine( value1, df ); - break; - case 90: - line += addToLine( value1, df ); - line += "-\t"; - break; - case 91: - line += addToLine( value1, df ); - line += addToLine( value2, df ); - break; - } - line += ForesterUtil.LINE_SEPARATOR; - return line; - } - - // Helper for addNameAndValues. - private final static String addToLine( final double value, final java.text.DecimalFormat df ) { - String s = ""; - if ( value != ResultLine.DEFAULT ) { - s = df.format( value ) + "\t"; - } - else { - s = "-\t"; - } - return s; - } - - private final static List getAllExternalSequenceNames( final Phylogeny phy ) throws RIOException { - final List names = new ArrayList(); - for( final PhylogenyNodeIterator iter = phy.iteratorExternalForward(); iter.hasNext(); ) { - final PhylogenyNode n = iter.next(); - if ( n.getNodeData().isHasSequence() && !ForesterUtil.isEmpty( n.getNodeData().getSequence().getName() ) ) { - names.add( n.getNodeData().getSequence().getName() ); - } - else if ( !ForesterUtil.isEmpty( n.getName() ) ) { - names.add( n.getName() ); - } - else { - throw new RIOException( "node has no (sequence) name: " + n ); - } - } - return names; - } - - private final static List getNodesViaSequenceName( final Phylogeny phy, final String seq_name ) { - final List nodes = new ArrayList(); - for( final PhylogenyNodeIterator iter = phy.iteratorPreorder(); iter.hasNext(); ) { - final PhylogenyNode n = iter.next(); - if ( n.getNodeData().isHasSequence() && n.getNodeData().getSequence().getName().equals( seq_name ) ) { - nodes.add( n ); - } - if ( !n.getNodeData().isHasSequence() && n.getName().equals( seq_name ) ) { - nodes.add( n ); - } - } - return nodes; - } - - public final List getRemovedGeneTreeNodes() { - return _removed_gene_tree_nodes; - } - - private final class ResultLine implements Comparable { - - public static final int DEFAULT = -999; - private final String _key; - private final double _value1; - private final double _value2; - private int[] _p; - - ResultLine( final String name, final double value1, final double value2, final int c ) { - setSigns(); - _key = name; - _value1 = value1; - _value2 = value2; - if ( ( c >= 0 ) && ( c <= 2 ) ) { - _p[ c ] = -1; - } - } - - ResultLine( final String name, final double value1, final int c ) { - setSigns(); - _key = name; - _value1 = value1; - _value2 = ResultLine.DEFAULT; - if ( c == 0 ) { - _p[ 0 ] = -1; - } - } - - @Override - public int compareTo( final ResultLine n ) { - if ( ( getValue1() != ResultLine.DEFAULT ) && ( n.getValue1() != ResultLine.DEFAULT ) ) { - if ( getValue1() < n.getValue1() ) { - return _p[ 0 ]; - } - if ( getValue1() > n.getValue1() ) { - return ( -_p[ 0 ] ); - } - } - if ( ( getValue2() != ResultLine.DEFAULT ) && ( n.getValue2() != ResultLine.DEFAULT ) ) { - if ( getValue2() < n.getValue2() ) { - return _p[ 1 ]; - } - if ( getValue2() > n.getValue2() ) { - return ( -_p[ 1 ] ); - } - } - return ( getKey().compareTo( n.getKey() ) ); - } - - String getKey() { - return _key; - } - - double getValue1() { - return _value1; - } - - double getValue2() { - return _value2; - } - - private void setSigns() { - _p = new int[ 2 ]; - _p[ 0 ] = _p[ 1 ] = +1; - } - } // ResultLine } diff --git a/forester/java/src/org/forester/sdi/GSDI.java b/forester/java/src/org/forester/sdi/GSDI.java index bfdd14f..fa5265d 100644 --- a/forester/java/src/org/forester/sdi/GSDI.java +++ b/forester/java/src/org/forester/sdi/GSDI.java @@ -67,8 +67,6 @@ import org.forester.util.ForesterUtil; public class GSDI extends SDI { private final boolean _most_parsimonious_duplication_model; - private final boolean _strip_gene_tree; - private final boolean _strip_species_tree; protected int _speciation_or_duplication_events_sum; protected int _speciations_sum; private final List _stripped_gene_tree_nodes; @@ -87,35 +85,23 @@ public class GSDI extends SDI { _speciations_sum = 0; _most_parsimonious_duplication_model = most_parsimonious_duplication_model; _duplications_sum = 0; - _strip_gene_tree = strip_gene_tree; - _strip_species_tree = strip_species_tree; _stripped_gene_tree_nodes = new ArrayList(); _stripped_species_tree_nodes = new ArrayList(); _mapped_species_tree_nodes = new HashSet(); _scientific_names_mapped_to_reduced_specificity = new TreeSet(); - linkNodesOfG(); + linkNodesOfG( null, strip_gene_tree, strip_species_tree ); PhylogenyMethods.preOrderReId( getSpeciesTree() ); geneTreePostOrderTraversal(); } - GSDI( final Phylogeny gene_tree, final Phylogeny species_tree, final boolean most_parsimonious_duplication_model ) + // Used by GSDIR + protected GSDI( final Phylogeny gene_tree, final Phylogeny species_tree, final boolean strip_gene_tree ) throws SDIException { - this( gene_tree, species_tree, most_parsimonious_duplication_model, false, false ); - } - - public GSDI( final Phylogeny gene_tree, - final Phylogeny species_tree, - final boolean most_parsimonious_duplication_model, - final boolean strip_gene_tree, - final boolean strip_species_tree, - final int x ) throws SDIException { super( gene_tree, species_tree ); - _speciation_or_duplication_events_sum = 0; + _speciation_or_duplication_events_sum = -1; _speciations_sum = 0; - _most_parsimonious_duplication_model = most_parsimonious_duplication_model; + _most_parsimonious_duplication_model = true; _duplications_sum = 0; - _strip_gene_tree = strip_gene_tree; - _strip_species_tree = strip_species_tree; _stripped_gene_tree_nodes = new ArrayList(); _stripped_species_tree_nodes = new ArrayList(); _mapped_species_tree_nodes = new HashSet(); @@ -240,14 +226,21 @@ public class GSDI extends SDI { /** * This allows for linking of internal nodes of the species tree (as opposed * to just external nodes, as in the method it overrides. + * If TaxonomyComparisonBase is null, it will try to determine it. * @throws SDIException * */ - @Override - final void linkNodesOfG() throws SDIException { + final void linkNodesOfG( final TaxonomyComparisonBase tax_comp_base, + final boolean strip_gene_tree, + final boolean strip_species_tree ) throws SDIException { final Map species_to_node_map = new HashMap(); final List species_tree_ext_nodes = new ArrayList(); - _tax_comp_base = determineTaxonomyComparisonBase( _gene_tree ); + if ( tax_comp_base == null ) { + _tax_comp_base = determineTaxonomyComparisonBase( _gene_tree ); + } + else { + _tax_comp_base = tax_comp_base; + } // Stringyfied taxonomy is the key, node is the value. for( final PhylogenyNodeIterator iter = _species_tree.iteratorExternalForward(); iter.hasNext(); ) { final PhylogenyNode s = iter.next(); @@ -266,7 +259,7 @@ public class GSDI extends SDI { for( final PhylogenyNodeIterator iter = _gene_tree.iteratorExternalForward(); iter.hasNext(); ) { final PhylogenyNode g = iter.next(); if ( !g.getNodeData().isHasTaxonomy() ) { - if ( _strip_gene_tree ) { + if ( strip_gene_tree ) { _stripped_gene_tree_nodes.add( g ); } else { @@ -276,7 +269,7 @@ public class GSDI extends SDI { else { final String tax_str = taxonomyToString( g, _tax_comp_base ); if ( ForesterUtil.isEmpty( tax_str ) ) { - if ( _strip_gene_tree ) { + if ( strip_gene_tree ) { _stripped_gene_tree_nodes.add( g ); } else { @@ -290,7 +283,7 @@ public class GSDI extends SDI { s = tryMapByRemovingOverlySpecificData( species_to_node_map, tax_str ); } if ( s == null ) { - if ( _strip_gene_tree ) { + if ( strip_gene_tree ) { _stripped_gene_tree_nodes.add( g ); } else { @@ -305,13 +298,13 @@ public class GSDI extends SDI { } } } // for loop - if ( _strip_gene_tree ) { + if ( strip_gene_tree ) { stripGeneTree(); if ( getGeneTree().isEmpty() || ( getGeneTree().getNumberOfExternalNodes() < 2 ) ) { throw new SDIException( "species could not be mapped between gene tree and species tree" ); } } - if ( _strip_species_tree ) { + if ( strip_species_tree ) { stripSpeciesTree( species_tree_ext_nodes ); } } diff --git a/forester/java/src/org/forester/sdi/GSDIR.java b/forester/java/src/org/forester/sdi/GSDIR.java index 8179811..035a443 100644 --- a/forester/java/src/org/forester/sdi/GSDIR.java +++ b/forester/java/src/org/forester/sdi/GSDIR.java @@ -40,13 +40,12 @@ public class GSDIR extends GSDI { private final BasicDescriptiveStatistics _duplications_sum_stats; private final List _min_duplications_sum_gene_trees; - public GSDIR( final Phylogeny gene_tree, final Phylogeny species_tree, final boolean strip_gene_tree, final int x ) - throws SDIException { - super( gene_tree.copy(), species_tree, true, strip_gene_tree, true, 1 ); - _min_duplications_sum = Integer.MAX_VALUE; - _min_duplications_sum_gene_trees = new ArrayList(); - _duplications_sum_stats = new BasicDescriptiveStatistics(); - linkNodesOfG(); + public GSDIR( final Phylogeny gene_tree, + final Phylogeny species_tree, + final boolean strip_gene_tree, + final boolean strip_species_tree ) throws SDIException { + super( gene_tree.copy(), species_tree, strip_gene_tree ); + linkNodesOfG( null, strip_gene_tree, strip_species_tree ); final List gene_tree_branches_post_order = new ArrayList(); for( final PhylogenyNodeIterator it = _gene_tree.iteratorPostorder(); it.hasNext(); ) { final PhylogenyNode n = it.next(); @@ -54,9 +53,11 @@ public class GSDIR extends GSDI { gene_tree_branches_post_order.add( new PhylogenyBranch( n, n.getParent() ) ); } } + _min_duplications_sum = Integer.MAX_VALUE; + _min_duplications_sum_gene_trees = new ArrayList(); + _duplications_sum_stats = new BasicDescriptiveStatistics(); for( final PhylogenyBranch branch : gene_tree_branches_post_order ) { _duplications_sum = 0; - _speciation_or_duplication_events_sum = 0; _speciations_sum = 0; _gene_tree.reRoot( branch ); PhylogenyMethods.preOrderReId( getSpeciesTree() ); diff --git a/forester/java/src/org/forester/sdi/TestGSDI.java b/forester/java/src/org/forester/sdi/TestGSDI.java index 54d5255..62ab0f8 100644 --- a/forester/java/src/org/forester/sdi/TestGSDI.java +++ b/forester/java/src/org/forester/sdi/TestGSDI.java @@ -81,7 +81,7 @@ public final class TestGSDI { final Phylogeny gene_2_1 = factory.create( gene_2_1_str, new NHXParser() )[ 0 ]; multi_species_2.setRooted( true ); gene_2_1.setRooted( true ); - final GSDI sdi = new GSDI( gene_2_1, multi_species_2, false ); + final GSDI sdi = new GSDI( gene_2_1, multi_species_2, false, false, false ); if ( sdi.getSpeciationOrDuplicationEventsSum() != 0 ) { return false; } @@ -122,7 +122,7 @@ public final class TestGSDI { s1.setRooted( true ); final Phylogeny g1 = TestGSDI .createPhylogeny( "((((B[&&NHX:S=B],A1[&&NHX:S=A1]),C[&&NHX:S=C]),A2[&&NHX:S=A2]),D[&&NHX:S=D])" ); - final GSDI sdi1 = new GSDI( g1, s1, false ); + final GSDI sdi1 = new GSDI( g1, s1, false, false, false ); // Archaeopteryx.createApplication( g1 ); // Archaeopteryx.createApplication( s1 ); if ( sdi1.getDuplicationsSum() != 1 ) { @@ -146,7 +146,7 @@ public final class TestGSDI { } final Phylogeny g2 = TestGSDI .createPhylogeny( "((((A2[&&NHX:S=A2],A1[&&NHX:S=A1]),B[&&NHX:S=B]),C[&&NHX:S=C]),D[&&NHX:S=D])" ); - final GSDI sdi2 = new GSDI( g2, s1, false ); + final GSDI sdi2 = new GSDI( g2, s1, false, false, false ); if ( sdi2.getDuplicationsSum() != 0 ) { return false; } @@ -168,7 +168,7 @@ public final class TestGSDI { } final Phylogeny g3 = TestGSDI .createPhylogeny( "((((A2[&&NHX:S=A2],A1[&&NHX:S=A1]),C[&&NHX:S=C]),B[&&NHX:S=B]),D[&&NHX:S=D])" ); - final GSDI sdi3 = new GSDI( g3, s1, false ); + final GSDI sdi3 = new GSDI( g3, s1, false, false, false ); if ( sdi3.getDuplicationsSum() != 0 ) { return false; } @@ -190,7 +190,7 @@ public final class TestGSDI { } final Phylogeny g4 = TestGSDI .createPhylogeny( "(((B[&&NHX:S=B],C1[&&NHX:S=C]),C2[&&NHX:S=C]),D[&&NHX:S=D])" ); - final GSDI sdi4 = new GSDI( g4, s1, false ); + final GSDI sdi4 = new GSDI( g4, s1, false, false, false ); if ( sdi4.getDuplicationsSum() != 1 ) { return false; } @@ -208,7 +208,7 @@ public final class TestGSDI { } final Phylogeny g5 = TestGSDI .createPhylogeny( "(((D1[&&NHX:S=D],A1[&&NHX:S=A1]),B[&&NHX:S=B]),((D2[&&NHX:S=D],D3[&&NHX:S=D]),C[&&NHX:S=C]))" ); - final GSDI sdi5 = new GSDI( g5, s1, false ); + final GSDI sdi5 = new GSDI( g5, s1, false, false, false ); if ( sdi5.getDuplicationsSum() != 3 ) { return false; } @@ -240,7 +240,7 @@ public final class TestGSDI { final Phylogeny gene7_2 = TestGSDI .createPhylogeny( "(((((((((a1[&&NHX:S=a1],a2[&&NHX:S=a2]),b1[&&NHX:S=b1]),x[&&NHX:S=x]),m1[&&NHX:S=m1]),i1[&&NHX:S=i1]),j2[&&NHX:S=j2]),e1[&&NHX:S=e1]),y[&&NHX:S=y]),z[&&NHX:S=z])" ); gene7_2.setRooted( true ); - final GSDI sdi7_2 = new GSDI( gene7_2, species7, false ); + final GSDI sdi7_2 = new GSDI( gene7_2, species7, false, false, false ); if ( sdi7_2.getDuplicationsSum() != 1 ) { return false; } @@ -272,7 +272,7 @@ public final class TestGSDI { return false; } final Phylogeny g2_0 = TestGSDI.createPhylogeny( "(m1[&&NHX:S=m1],m3[&&NHX:S=m3])" ); - final GSDI sdi2_0 = new GSDI( g2_0, s2, false ); + final GSDI sdi2_0 = new GSDI( g2_0, s2, false, false, false ); if ( sdi2_0.getDuplicationsSum() != 0 ) { return false; } @@ -287,7 +287,7 @@ public final class TestGSDI { return false; } final Phylogeny g2_1 = TestGSDI.createPhylogeny( "(e2[&&NHX:S=e2],h2[&&NHX:S=h2])" ); - final GSDI sdi2_1 = new GSDI( g2_1, s2, false ); + final GSDI sdi2_1 = new GSDI( g2_1, s2, false, false, false ); if ( sdi2_1.getDuplicationsSum() != 0 ) { return false; } @@ -302,7 +302,7 @@ public final class TestGSDI { return false; } final Phylogeny g2_2 = TestGSDI.createPhylogeny( "(e2[&&NHX:S=e2],p4[&&NHX:S=p4])" ); - final GSDI sdi2_2 = new GSDI( g2_2, s2, false ); + final GSDI sdi2_2 = new GSDI( g2_2, s2, false, false, false ); if ( sdi2_2.getDuplicationsSum() != 0 ) { return false; } @@ -317,7 +317,7 @@ public final class TestGSDI { return false; } final Phylogeny g2_3 = TestGSDI.createPhylogeny( "(e2a[&&NHX:S=e2],e2b[&&NHX:S=e2])" ); - final GSDI sdi2_3 = new GSDI( g2_3, s2, false ); + final GSDI sdi2_3 = new GSDI( g2_3, s2, false, false, false ); if ( sdi2_3.getDuplicationsSum() != 1 ) { return false; } @@ -332,7 +332,7 @@ public final class TestGSDI { return false; } final Phylogeny g2_4 = TestGSDI.createPhylogeny( "((j1[&&NHX:S=j1],j4[&&NHX:S=j4]),i3[&&NHX:S=i3])" ); - final GSDI sdi2_4 = new GSDI( g2_4, s2, false ); + final GSDI sdi2_4 = new GSDI( g2_4, s2, false, false, false ); if ( sdi2_4.getDuplicationsSum() != 0 ) { return false; } @@ -351,7 +351,7 @@ public final class TestGSDI { return false; } final Phylogeny g2_5 = TestGSDI.createPhylogeny( "((j1[&&NHX:S=j1],j4[&&NHX:S=j4]),f3[&&NHX:S=f3])" ); - final GSDI sdi2_5 = new GSDI( g2_5, s2, false ); + final GSDI sdi2_5 = new GSDI( g2_5, s2, false, false, false ); if ( sdi2_5.getDuplicationsSum() != 0 ) { return false; } @@ -370,7 +370,7 @@ public final class TestGSDI { return false; } final Phylogeny g2_6 = TestGSDI.createPhylogeny( "((j3[&&NHX:S=j3],i4[&&NHX:S=i4]),f3[&&NHX:S=f3])" ); - final GSDI sdi2_6 = new GSDI( g2_6, s2, false ); + final GSDI sdi2_6 = new GSDI( g2_6, s2, false, false, false ); if ( sdi2_6.getDuplicationsSum() != 0 ) { return false; } @@ -389,7 +389,7 @@ public final class TestGSDI { return false; } final Phylogeny g2_7 = TestGSDI.createPhylogeny( "((j1[&&NHX:S=j1],k1[&&NHX:S=k1]),i1[&&NHX:S=i1])" ); - final GSDI sdi2_7 = new GSDI( g2_7, s2, false ); + final GSDI sdi2_7 = new GSDI( g2_7, s2, false, false, false ); if ( sdi2_7.getDuplicationsSum() != 0 ) { return false; } @@ -408,7 +408,7 @@ public final class TestGSDI { return false; } final Phylogeny g2_8 = TestGSDI.createPhylogeny( "(j1[&&NHX:S=j1],(k1[&&NHX:S=k1],i1[&&NHX:S=i1]))" ); - final GSDI sdi2_8 = new GSDI( g2_8, s2, false ); + final GSDI sdi2_8 = new GSDI( g2_8, s2, false, false, false ); if ( sdi2_8.getDuplicationsSum() != 0 ) { return false; } @@ -427,7 +427,7 @@ public final class TestGSDI { return false; } final Phylogeny g2_9 = TestGSDI.createPhylogeny( "((j1[&&NHX:S=j1],k4[&&NHX:S=k4]),f2[&&NHX:S=f2])" ); - final GSDI sdi2_9 = new GSDI( g2_9, s2, false ); + final GSDI sdi2_9 = new GSDI( g2_9, s2, false, false, false ); if ( sdi2_9.getDuplicationsSum() != 0 ) { return false; } @@ -444,7 +444,7 @@ public final class TestGSDI { return false; } final Phylogeny g2_10 = TestGSDI.createPhylogeny( "((m1[&&NHX:S=m1],k4[&&NHX:S=k4]),f2[&&NHX:S=f2])" ); - final GSDI sdi2_10 = new GSDI( g2_10, s2, false ); + final GSDI sdi2_10 = new GSDI( g2_10, s2, false, false, false ); if ( sdi2_10.getDuplicationsSum() != 0 ) { return false; } @@ -461,7 +461,7 @@ public final class TestGSDI { return false; } final Phylogeny g2_11 = TestGSDI.createPhylogeny( "((m1[&&NHX:S=m1],k4[&&NHX:S=k4]),x[&&NHX:S=x])" ); - final GSDI sdi2_11 = new GSDI( g2_11, s2, false ); + final GSDI sdi2_11 = new GSDI( g2_11, s2, false, false, false ); if ( sdi2_11.getDuplicationsSum() != 0 ) { return false; } @@ -478,7 +478,7 @@ public final class TestGSDI { return false; } final Phylogeny g2_12 = TestGSDI.createPhylogeny( "(m1[&&NHX:S=m1],(k4[&&NHX:S=k4],x[&&NHX:S=x]))" ); - final GSDI sdi2_12 = new GSDI( g2_12, s2, false ); + final GSDI sdi2_12 = new GSDI( g2_12, s2, false, false, false ); if ( sdi2_12.getDuplicationsSum() != 0 ) { return false; } @@ -495,7 +495,7 @@ public final class TestGSDI { return false; } final Phylogeny g2_13 = TestGSDI.createPhylogeny( "(x[&&NHX:S=x],(y[&&NHX:S=y],z[&&NHX:S=z]))" ); - final GSDI sdi2_13 = new GSDI( g2_13, s2, false ); + final GSDI sdi2_13 = new GSDI( g2_13, s2, false, false, false ); if ( sdi2_13.getDuplicationsSum() != 0 ) { return false; } @@ -512,7 +512,7 @@ public final class TestGSDI { return false; } final Phylogeny g2_14 = TestGSDI.createPhylogeny( "(a1_1[&&NHX:S=a1],(b1[&&NHX:S=b1],a1[&&NHX:S=a1]))" ); - final GSDI sdi2_14 = new GSDI( g2_14, s2, false ); + final GSDI sdi2_14 = new GSDI( g2_14, s2, false, false, false ); if ( sdi2_14.getDuplicationsSum() != 1 ) { return false; } @@ -529,7 +529,7 @@ public final class TestGSDI { return false; } final Phylogeny g2_15 = TestGSDI.createPhylogeny( "(a2[&&NHX:S=a2],(b1[&&NHX:S=b1],a1[&&NHX:S=a1]))" ); - final GSDI sdi2_15 = new GSDI( g2_15, s2, false ); + final GSDI sdi2_15 = new GSDI( g2_15, s2, false, false, false ); if ( sdi2_15.getDuplicationsSum() != 1 ) { return false; } @@ -546,7 +546,7 @@ public final class TestGSDI { return false; } final Phylogeny g2_16 = TestGSDI.createPhylogeny( "(n2[&&NHX:S=n2],(j3[&&NHX:S=j3],n1[&&NHX:S=n1]))" ); - final GSDI sdi2_16 = new GSDI( g2_16, s2, false ); + final GSDI sdi2_16 = new GSDI( g2_16, s2, false, false, false ); if ( sdi2_16.getDuplicationsSum() != 1 ) { return false; } @@ -563,7 +563,7 @@ public final class TestGSDI { return false; } final Phylogeny g2_17 = TestGSDI.createPhylogeny( "(p4[&&NHX:S=p4],(j3[&&NHX:S=j3],n1[&&NHX:S=n1]))" ); - final GSDI sdi2_17 = new GSDI( g2_17, s2, false ); + final GSDI sdi2_17 = new GSDI( g2_17, s2, false, false, false ); if ( sdi2_17.getDuplicationsSum() != 1 ) { return false; } @@ -581,7 +581,7 @@ public final class TestGSDI { } final Phylogeny g2_18 = TestGSDI .createPhylogeny( "((n11[&&NHX:S=n1],n12[&&NHX:S=n1]),(n13[&&NHX:S=n1],n14[&&NHX:S=n1]))" ); - final GSDI sdi2_18 = new GSDI( g2_18, s2, false ); + final GSDI sdi2_18 = new GSDI( g2_18, s2, false, false, false ); if ( sdi2_18.getDuplicationsSum() != 3 ) { return false; } @@ -602,7 +602,7 @@ public final class TestGSDI { } final Phylogeny g2_19 = TestGSDI .createPhylogeny( "((n11[&&NHX:S=n1],n21[&&NHX:S=n2]),(n12[&&NHX:S=n1],n22[&&NHX:S=n2]))" ); - final GSDI sdi2_19 = new GSDI( g2_19, s2, false ); + final GSDI sdi2_19 = new GSDI( g2_19, s2, false, false, false ); if ( sdi2_19.getDuplicationsSum() != 1 ) { return false; } @@ -623,7 +623,7 @@ public final class TestGSDI { } final Phylogeny g2_20 = TestGSDI .createPhylogeny( "((n11[&&NHX:S=n1],n2[&&NHX:S=n2]),(n12[&&NHX:S=n1],n3[&&NHX:S=n3]))" ); - final GSDI sdi2_20 = new GSDI( g2_20, s2, false ); + final GSDI sdi2_20 = new GSDI( g2_20, s2, false, false, false ); if ( sdi2_20.getDuplicationsSum() != 1 ) { return false; } @@ -644,7 +644,7 @@ public final class TestGSDI { } final Phylogeny g2_21 = TestGSDI .createPhylogeny( "((n1[&&NHX:S=n1],n2[&&NHX:S=n2]),(n3[&&NHX:S=n3],a1[&&NHX:S=a1]))" ); - final GSDI sdi2_21 = new GSDI( g2_21, s2, false ); + final GSDI sdi2_21 = new GSDI( g2_21, s2, false, false, false ); if ( sdi2_21.getDuplicationsSum() != 1 ) { return false; } @@ -665,7 +665,7 @@ public final class TestGSDI { } final Phylogeny g2_22 = TestGSDI .createPhylogeny( "((n1[&&NHX:S=n1],n2[&&NHX:S=n2]),(n3[&&NHX:S=n3],n4[&&NHX:S=n4]))" ); - final GSDI sdi2_22 = new GSDI( g2_22, s2, false ); + final GSDI sdi2_22 = new GSDI( g2_22, s2, false, false, false ); //Archaeopteryx.createApplication( g2_22 ); //Archaeopteryx.createApplication( s2 ); if ( sdi2_22.getDuplicationsSum() != 0 ) { @@ -688,7 +688,7 @@ public final class TestGSDI { } final Phylogeny g2_23 = TestGSDI .createPhylogeny( "((a1[&&NHX:S=a1],b1[&&NHX:S=b1]),(c1[&&NHX:S=c1],d1[&&NHX:S=d1]))" ); - final GSDI sdi2_23 = new GSDI( g2_23, s2, false ); + final GSDI sdi2_23 = new GSDI( g2_23, s2, false, false, false ); if ( sdi2_23.getDuplicationsSum() != 0 ) { return false; } @@ -709,7 +709,7 @@ public final class TestGSDI { } final Phylogeny g2_24 = TestGSDI .createPhylogeny( "((a1[&&NHX:S=a1],e1[&&NHX:S=e1]),(i1[&&NHX:S=i1],m1[&&NHX:S=m1]))" ); - final GSDI sdi2_24 = new GSDI( g2_24, s2, false ); + final GSDI sdi2_24 = new GSDI( g2_24, s2, false, false, false ); if ( sdi2_24.getDuplicationsSum() != 0 ) { return false; } @@ -730,7 +730,7 @@ public final class TestGSDI { } final Phylogeny g2_25 = TestGSDI .createPhylogeny( "((a1[&&NHX:S=a1],a4[&&NHX:S=a4]),(b1[&&NHX:S=b1],c1[&&NHX:S=c1]))" ); - final GSDI sdi2_25 = new GSDI( g2_25, s2, false ); + final GSDI sdi2_25 = new GSDI( g2_25, s2, false, false, false ); if ( sdi2_25.getDuplicationsSum() != 0 ) { return false; } @@ -751,7 +751,7 @@ public final class TestGSDI { } final Phylogeny g2_26 = TestGSDI .createPhylogeny( "(((a1[&&NHX:S=a1],a4[&&NHX:S=a4]),b1[&&NHX:S=b1]),e1[&&NHX:S=e1])" ); - final GSDI sdi2_26 = new GSDI( g2_26, s2, false ); + final GSDI sdi2_26 = new GSDI( g2_26, s2, false, false, false ); if ( sdi2_26.getDuplicationsSum() != 0 ) { return false; } @@ -772,7 +772,7 @@ public final class TestGSDI { } final Phylogeny g2_27 = TestGSDI .createPhylogeny( "(((a1[&&NHX:S=a1],a4[&&NHX:S=a4]),b1[&&NHX:S=b1]),c1[&&NHX:S=c1])" ); - final GSDI sdi2_27 = new GSDI( g2_27, s2, false ); + final GSDI sdi2_27 = new GSDI( g2_27, s2, false, false, false ); if ( sdi2_27.getDuplicationsSum() != 0 ) { return false; } @@ -793,7 +793,7 @@ public final class TestGSDI { } final Phylogeny g2_28 = TestGSDI .createPhylogeny( "(((a1[&&NHX:S=a1],b1[&&NHX:S=b1]),c1[&&NHX:S=c1]),e1[&&NHX:S=e1])" ); - final GSDI sdi2_28 = new GSDI( g2_28, s2, false ); + final GSDI sdi2_28 = new GSDI( g2_28, s2, false, false, false ); if ( sdi2_28.getDuplicationsSum() != 0 ) { return false; } @@ -814,7 +814,7 @@ public final class TestGSDI { } final Phylogeny g2_29 = TestGSDI .createPhylogeny( "(((a1[&&NHX:S=a1],b1[&&NHX:S=b1]),c1[&&NHX:S=c1]),d1[&&NHX:S=d1])" ); - final GSDI sdi2_29 = new GSDI( g2_29, s2, false ); + final GSDI sdi2_29 = new GSDI( g2_29, s2, false, false, false ); if ( sdi2_29.getDuplicationsSum() != 0 ) { return false; } @@ -835,7 +835,7 @@ public final class TestGSDI { } final Phylogeny g2_30 = TestGSDI .createPhylogeny( "(((a1[&&NHX:S=a1],b1[&&NHX:S=b1]),c1[&&NHX:S=c1]),a2[&&NHX:S=a2])" ); - final GSDI sdi2_30 = new GSDI( g2_30, s2, false ); + final GSDI sdi2_30 = new GSDI( g2_30, s2, false, false, false ); if ( sdi2_30.getDuplicationsSum() != 1 ) { return false; } @@ -856,7 +856,7 @@ public final class TestGSDI { } final Phylogeny g2_31 = TestGSDI .createPhylogeny( "(((a1[&&NHX:S=a1],b1[&&NHX:S=b1]),c1[&&NHX:S=c1]),c2[&&NHX:S=c2])" ); - final GSDI sdi2_31 = new GSDI( g2_31, s2, false ); + final GSDI sdi2_31 = new GSDI( g2_31, s2, false, false, false ); if ( sdi2_31.getDuplicationsSum() != 1 ) { return false; } @@ -877,7 +877,7 @@ public final class TestGSDI { } final Phylogeny g2_32 = TestGSDI .createPhylogeny( "((((((((((a1[&&NHX:S=a1],a2[&&NHX:S=a2]),b1[&&NHX:S=b1]),c1[&&NHX:S=c1]),d1[&&NHX:S=d1]),x[&&NHX:S=x]),p1[&&NHX:S=p1]),i1[&&NHX:S=i1]),e1[&&NHX:S=e1]),y[&&NHX:S=y]),z[&&NHX:S=z])" ); - final GSDI sdi2_32 = new GSDI( g2_32, s2, false ); + final GSDI sdi2_32 = new GSDI( g2_32, s2, false, false, false ); if ( sdi2_32.getDuplicationsSum() != 0 ) { return false; } @@ -919,7 +919,7 @@ public final class TestGSDI { } final Phylogeny g2_33 = TestGSDI .createPhylogeny( "(((((((((((a1[&&NHX:S=a1],a2[&&NHX:S=a2]),b1[&&NHX:S=b1]),c1[&&NHX:S=c1]),d1[&&NHX:S=d1]),x[&&NHX:S=x]),p1[&&NHX:S=p1]),i1[&&NHX:S=i1]),k2[&&NHX:S=k2]),e1[&&NHX:S=e1]),y[&&NHX:S=y]),z[&&NHX:S=z])" ); - final GSDI sdi2_33 = new GSDI( g2_33, s2, false ); + final GSDI sdi2_33 = new GSDI( g2_33, s2, false, false, false ); if ( sdi2_33.getDuplicationsSum() != 1 ) { return false; } @@ -964,7 +964,7 @@ public final class TestGSDI { } final Phylogeny g2_33_d = TestGSDI .createPhylogeny( "((((((((((((a1[&&NHX:S=a1],a2[&&NHX:S=a2])[&&NHX:D=N],b1[&&NHX:S=b1])[&&NHX:D=N],c1[&&NHX:S=c1])[&&NHX:D=?],d1[&&NHX:S=d1])[&&NHX:D=?],x[&&NHX:S=x])[&&NHX:D=N],p1[&&NHX:S=p1])[&&NHX:D=?],i1[&&NHX:S=i1])[&&NHX:D=?],k2[&&NHX:S=k2])[&&NHX:D=Y],e1[&&NHX:S=e1])[&&NHX:D=Y],y[&&NHX:S=y])[&&NHX:D=Y],z[&&NHX:S=z])[&&NHX:D=?],(((((((((((a1[&&NHX:S=a1],a2[&&NHX:S=a2])[&&NHX:D=N],b1[&&NHX:S=b1])[&&NHX:D=N],c1[&&NHX:S=c1])[&&NHX:D=?],d1[&&NHX:S=d1])[&&NHX:D=?],x[&&NHX:S=x])[&&NHX:D=N],p1[&&NHX:S=p1])[&&NHX:D=?],i1[&&NHX:S=i1])[&&NHX:D=?],k2[&&NHX:S=k2])[&&NHX:D=Y],e1[&&NHX:S=e1])[&&NHX:D=Y],y[&&NHX:S=y])[&&NHX:D=Y],z[&&NHX:S=z])[&&NHX:D=?])" ); - final GSDI sdi2_33_d = new GSDI( g2_33_d, s2, false ); + final GSDI sdi2_33_d = new GSDI( g2_33_d, s2, false, false, false ); if ( sdi2_33_d.getDuplicationsSum() != 3 ) { return false; } @@ -976,7 +976,7 @@ public final class TestGSDI { } final Phylogeny g2_34 = TestGSDI .createPhylogeny( "(((n1_0[&&NHX:S=n1],n2_0[&&NHX:S=n2]),(n1_1[&&NHX:S=n1],n3_0[&&NHX:S=n3])),n4_0[&&NHX:S=n4])" ); - final GSDI sdi2_34 = new GSDI( g2_34, s2, false ); + final GSDI sdi2_34 = new GSDI( g2_34, s2, false, false, false ); if ( sdi2_34.getDuplicationsSum() != 1 ) { return false; } @@ -1000,7 +1000,7 @@ public final class TestGSDI { } final Phylogeny g2_35 = TestGSDI .createPhylogeny( "((((n1_0[&&NHX:S=n1],n2_0[&&NHX:S=n2]),(n1_1[&&NHX:S=n1],n3_0[&&NHX:S=n3])),n4_0[&&NHX:S=n4]),a1_0[&&NHX:S=a1])" ); - final GSDI sdi2_35 = new GSDI( g2_35, s2, false ); + final GSDI sdi2_35 = new GSDI( g2_35, s2, false, false, false ); if ( sdi2_35.getDuplicationsSum() != 1 ) { return false; } @@ -1027,7 +1027,7 @@ public final class TestGSDI { } final Phylogeny g2_36 = TestGSDI .createPhylogeny( "(((a1_0[&&NHX:S=a1],b1_0[&&NHX:S=b1]),(a1_1[&&NHX:S=a1],c1_0[&&NHX:S=c1])),d1_0[&&NHX:S=d1])" ); - final GSDI sdi2_36 = new GSDI( g2_36, s2, false ); + final GSDI sdi2_36 = new GSDI( g2_36, s2, false, false, false ); if ( sdi2_36.getDuplicationsSum() != 1 ) { return false; } @@ -1051,7 +1051,7 @@ public final class TestGSDI { } final Phylogeny g2_37 = TestGSDI .createPhylogeny( "(((a1_0[&&NHX:S=a1],b1_0[&&NHX:S=b1]),(a2_0[&&NHX:S=a2],c1_0[&&NHX:S=c1])),d1_0[&&NHX:S=d1])" ); - final GSDI sdi2_37 = new GSDI( g2_37, s2, false ); + final GSDI sdi2_37 = new GSDI( g2_37, s2, false, false, false ); if ( sdi2_37.getDuplicationsSum() != 1 ) { return false; } @@ -1075,7 +1075,7 @@ public final class TestGSDI { } final Phylogeny g2_38 = TestGSDI .createPhylogeny( "(((([&&NHX:S=n1],[&&NHX:S=n1]),([&&NHX:S=n1],[&&NHX:S=n1])),[&&NHX:S=n1]),[&&NHX:S=n1])" ); - final GSDI sdi2_38 = new GSDI( g2_38, s2, false ); + final GSDI sdi2_38 = new GSDI( g2_38, s2, false, false, false ); if ( sdi2_38.getDuplicationsSum() != 5 ) { return false; } @@ -1087,7 +1087,7 @@ public final class TestGSDI { } final Phylogeny g2_100 = TestGSDI .createPhylogeny( "(((e1[&&NHX:S=e1],f2[&&NHX:S=f2]),(d3[&&NHX:S=d3],g4[&&NHX:S=g4])),(((a1[&&NHX:S=a1],h2[&&NHX:S=h2]),c3[&&NHX:S=c3]),(i4[&&NHX:S=i4],b1[&&NHX:S=b1])))" ); - final GSDI sdi2_100 = new GSDI( g2_100, s2, false ); + final GSDI sdi2_100 = new GSDI( g2_100, s2, false, false, false ); if ( sdi2_100.getDuplicationsSum() != 4 ) { return false; } @@ -1123,7 +1123,7 @@ public final class TestGSDI { } final Phylogeny g2_101 = TestGSDI .createPhylogeny( "(((e1[&&NHX:S=e1],f2[&&NHX:S=f2]),(d3[&&NHX:S=d3],g4[&&NHX:S=g4])),(((a1[&&NHX:S=a1],b2[&&NHX:S=b2]),c3[&&NHX:S=c3]),(i4[&&NHX:S=i4],j1[&&NHX:S=j1])))" ); - final GSDI sdi2_101 = new GSDI( g2_101, s2, false ); + final GSDI sdi2_101 = new GSDI( g2_101, s2, false, false, false ); if ( sdi2_101.getDuplicationsSum() != 2 ) { return false; } @@ -1172,7 +1172,7 @@ public final class TestGSDI { + "48[&&NHX:S=48]),49[&&NHX:S=49]),50[&&NHX:S=50]),51[&&NHX:S=51]),52[&&NHX:S=52]),53[&&NHX:S=53])," + "54[&&NHX:S=54]),55[&&NHX:S=55]),56[&&NHX:S=56]),57[&&NHX:S=57]),58[&&NHX:S=58]),59[&&NHX:S=59])," + "60[&&NHX:S=60]),61[&&NHX:S=61]),62[&&NHX:S=62]),63[&&NHX:S=63]),64[&&NHX:S=64]),65[&&NHX:S=65])" ); - final GSDI sdi7_4_1 = new GSDI( g_7_4_1, s_7_4, false ); + final GSDI sdi7_4_1 = new GSDI( g_7_4_1, s_7_4, false, false, false ); if ( sdi7_4_1.getDuplicationsSum() != 54 ) { return false; } @@ -1229,7 +1229,7 @@ public final class TestGSDI { + "54[&&NHX:S=54]),55[&&NHX:S=55]),56[&&NHX:S=56]),57[&&NHX:S=57]),58[&&NHX:S=58]),59[&&NHX:S=59])," + "60[&&NHX:S=60]),61[&&NHX:S=61]),62[&&NHX:S=62]),63[&&NHX:S=63]),64[&&NHX:S=64]),65[&&NHX:S=65])," + "66[&&NHX:S=66]),257[&&NHX:S=257]),258[&&NHX:S=258]),513[&&NHX:S=513]),514[&&NHX:S=514]),769[&&NHX:S=769]),770[&&NHX:S=770])" ); - final GSDI sdi7_4_2 = new GSDI( g_7_4_2, s_7_4, false ); + final GSDI sdi7_4_2 = new GSDI( g_7_4_2, s_7_4, false, false, false ); if ( sdi7_4_2.getDuplicationsSum() != 58 ) { return false; } @@ -1242,7 +1242,7 @@ public final class TestGSDI { final String g2_0_ = "(([&&NHX:S=a1],[&&NHX:S=a2]),([&&NHX:S=o2],[&&NHX:S=o4]))"; final Phylogeny g2_0p = TestGSDI.createPhylogeny( g2_0_ ); g2_0.setRooted( true ); - final GSDI sdi2_0p = new GSDI( g2_0p, s2, false ); + final GSDI sdi2_0p = new GSDI( g2_0p, s2, false, false, false ); if ( sdi2_0p.getDuplicationsSum() != 0 ) { return false; } @@ -1432,7 +1432,7 @@ public final class TestGSDI { // Archaeopteryx.createApplication( s1.copy() ); final Phylogeny g1 = TestGSDI .createPhylogeny( "(HUMAN[&&NHX:S=HUMAN],(RAT[&&NHX:S=RAT],(CAEEL[&&NHX:T=:S=CAEEL],YEAST[&&NHX:S=YEAST])))" ); - final GSDIR sdi1 = new GSDIR( g1.copy(), s1.copy(), false, 1 ); + final GSDIR sdi1 = new GSDIR( g1.copy(), s1.copy(), false, false ); if ( sdi1.getMinDuplicationsSum() != 0 ) { return false; } @@ -1441,7 +1441,7 @@ public final class TestGSDI { // final Phylogeny g2 = TestGSDI .createPhylogeny( "(((HUMAN[&&NHX:S=HUMAN],RAT[&&NHX:S=RAT]),CAEEL[&&NHX:T=:S=CAEEL]),YEAST[&&NHX:S=YEAST])" ); - final GSDIR sdi2 = new GSDIR( g2.copy(), s1.copy(), false, 1 ); + final GSDIR sdi2 = new GSDIR( g2.copy(), s1.copy(), false, false ); if ( sdi2.getMinDuplicationsSum() != 0 ) { return false; } @@ -1451,7 +1451,7 @@ public final class TestGSDI { final Phylogeny g3 = TestGSDI .createPhylogeny( "(RAT[&&NHX:S=RAT],HUMAN[&&NHX:S=HUMAN],(YEAST[&&NHX:S=YEAST],CAEEL[&&NHX:T=:S=CAEEL]))" ); // Archaeopteryx.createApplication( g3 ); - final GSDIR sdi3 = new GSDIR( g3.copy(), s1.copy(), false, 1 ); + final GSDIR sdi3 = new GSDIR( g3.copy(), s1.copy(), false, false ); if ( sdi3.getMinDuplicationsSum() != 0 ) { return false; } @@ -1461,7 +1461,7 @@ public final class TestGSDI { final Phylogeny g4 = TestGSDI .createPhylogeny( "(((((MOUSE[&&NHX:S=MOUSE],[&&NHX:S=RAT]),[&&NHX:S=HUMAN]),([&&NHX:S=ARATH],[&&NHX:S=YEAST])),[&&NHX:S=CAEEL]),[&&NHX:S=CAEBR])" ); Archaeopteryx.createApplication( g4 ); - final GSDIR sdi4 = new GSDIR( g4.copy(), s1.copy(), false, 1 ); + final GSDIR sdi4 = new GSDIR( g4.copy(), s1.copy(), false, false ); if ( sdi4.getMinDuplicationsSum() != 0 ) { return false; } -- 1.7.10.2