+ if ( use_dir ) {
+ System.out.println( "Gene trees in-dir :\t" + indir.getCanonicalPath() );
+ System.out.println( "Gene trees suffix :\t" + gene_trees_suffix );
+ }
+ else {
+ System.out.println( "Gene trees :\t" + gene_trees_file.getCanonicalPath() );
+ }
+ System.out.println( "Species tree :\t" + species_tree_file.getCanonicalPath() );
+ }
+ catch ( final IOException e ) {
+ ForesterUtil.fatalError( e.getLocalizedMessage() );
+ }
+ if ( perform_id_mapping ) {
+ try {
+ System.out.println( "Id mappings in-dir :\t" + id_mapping_dir.getCanonicalPath() );
+ }
+ catch ( IOException e ) {
+ ForesterUtil.fatalError( e.getLocalizedMessage() );
+ }
+ System.out.println( "Id mappings suffix :\t" + id_mapping_suffix );
+ }
+ if ( perform_gsdir_on_best_tree ) {
+ try {
+ System.out.println( "Consensus (\"best\") gene trees in-dir:\t" + best_trees_indir.getCanonicalPath() );
+ }
+ catch ( IOException e ) {
+ ForesterUtil.fatalError( e.getLocalizedMessage() );
+ }
+ System.out.println( "Consensus (\"best\") gene trees suffix:\t" + best_trees_suffix );
+ }
+ if ( use_dir ) {
+ System.out.println( "Out-dir :\t" + outdir );
+ }
+ else {
+ System.out.println( "All vs all orthology results table :\t" + orthology_outtable );
+ }
+ if ( logfile != null ) {
+ System.out.println( "Logfile :\t" + logfile );
+ }
+ System.out.println( "Ortholog groups cutoff :\t" + ortholog_group_cutoff );
+ if ( gt_first != RIO.DEFAULT_RANGE ) {
+ System.out.println( "First gene tree to analyze :\t" + gt_first );
+ }
+ if ( gt_last != RIO.DEFAULT_RANGE ) {
+ System.out.println( "Last gene tree to analyze :\t" + gt_last );
+ }
+ String rerooting_str = "";
+ switch ( rerooting ) {
+ case BY_ALGORITHM: {
+ rerooting_str = "by minimizing duplications";
+ break;
+ }
+ case MIDPOINT: {
+ rerooting_str = "by midpoint method";
+ break;
+ }
+ case OUTGROUP: {
+ rerooting_str = "by outgroup: " + outgroup;
+ break;
+ }
+ case NONE: {
+ rerooting_str = "none";
+ break;
+ }
+ }
+ System.out.println( "Re-rooting : \t" + rerooting_str );
+ if ( !sdir ) {
+ System.out.println( "Non binary species tree :\tallowed" );
+ }
+ else {
+ System.out.println( "Non binary species tree :\tdisallowed" );
+ }
+ time = System.currentTimeMillis();
+ final ALGORITHM algorithm;
+ if ( sdir ) {
+ algorithm = ALGORITHM.SDIR;
+ }
+ else {
+ algorithm = ALGORITHM.GSDIR;
+ }
+ EasyWriter log = null;
+ if ( use_dir ) {
+ if ( outdir.exists() ) {
+ if ( !outdir.isDirectory() ) {
+ ForesterUtil.fatalError( PRG_NAME,
+ "out-directory [" + outdir + "] already exists but is not a directory" );
+ }
+ }
+ else {
+ final boolean success = outdir.mkdirs();
+ if ( !success ) {
+ ForesterUtil.fatalError( PRG_NAME, "could not create out-directory [" + outdir + "]" );
+ }
+ }
+ final String species_tree_file_name = species_tree_file.getName();
+ final File gene_trees_files[] = indir.listFiles( new FilenameFilter() {
+
+ @Override
+ public boolean accept( final File dir, final String name ) {
+ return ( ( name.endsWith( gene_trees_suffix ) ) && !( name.equals( species_tree_file_name ) ) );
+ }
+ } );
+ if ( gene_trees_files.length < 1 ) {
+ ForesterUtil.fatalError( PRG_NAME,
+ "in-directory [" + indir
+ + "] does not contain any gene tree files with suffix "
+ + gene_trees_suffix );
+ }
+ try {
+ log = ForesterUtil.createEasyWriter( logfile );
+ }
+ catch ( final IOException e ) {
+ ForesterUtil.fatalError( PRG_NAME, "could not create [" + logfile + "]" );
+ }
+ Arrays.sort( gene_trees_files );
+ try {
+ log.print( "# program" );
+ log.print( "\t" );
+ log.print( PRG_NAME );
+ log.println();
+ log.print( "# version" );
+ log.print( "\t" );
+ log.print( PRG_VERSION );
+ log.println();
+ log.print( "# date" );
+ log.print( "\t" );
+ log.print( PRG_DATE );
+ log.println();
+ log.print( "# Algorithm " );
+ log.print( "\t" );
+ log.print( algorithm.toString() );
+ log.println();
+ log.print( "# Gene trees in-dir" );
+ log.print( "\t" );
+ log.print( indir.getCanonicalPath() );
+ log.println();
+ log.print( "# Gene trees suffix" );
+ log.print( "\t" );
+ log.print( gene_trees_suffix );
+ log.println();
+ log.print( "# Species tree" );
+ log.print( "\t" );
+ log.print( species_tree_file.getCanonicalPath() );
+ log.println();
+ if ( perform_id_mapping ) {
+ log.print( "# Id mappings in-dir" );
+ log.print( "\t" );
+ log.print( id_mapping_dir.getCanonicalPath() );
+ log.println();
+ log.print( "# Id mappings suffix" );
+ log.print( "\t" );
+ log.print( id_mapping_suffix );
+ log.println();
+ }
+ if ( perform_gsdir_on_best_tree ) {
+ log.print( "# Consensus (\"best\") gene tree dir" );
+ log.print( "\t" );
+ log.print( best_trees_indir.getCanonicalPath() );
+ log.println();
+ log.print( "# Consensus (\"best\") gene tree suffix" );
+ log.print( "\t" );
+ log.print( best_trees_suffix );
+ log.println();
+ }
+ log.print( "# Out-dir" );
+ log.print( "\t" );
+ log.print( outdir.getCanonicalPath() );
+ log.println();
+ log.print( "# Logfile" );
+ log.print( "\t" );
+ log.print( logfile.getCanonicalPath() );
+ log.println();
+ log.print( "# Ortholog groups cutoff" );
+ log.print( "\t" );
+ log.print( Double.toString( ortholog_group_cutoff ) );
+ log.println();
+ if ( gt_first != RIO.DEFAULT_RANGE ) {
+ log.print( "# First gene tree to analyze" );
+ log.print( "\t" );
+ log.print( Integer.toString( gt_first ) );
+ log.println();
+ }
+ if ( gt_last != RIO.DEFAULT_RANGE ) {
+ log.print( "# Last gene tree to analyze" );
+ log.print( "\t" );
+ log.print( Integer.toString( gt_last ) );
+ log.println();
+ }
+ log.print( "# Re-rooting" );
+ log.print( "\t" );
+ log.print( rerooting_str );
+ log.println();
+ log.print( "# Non binary species tree" );
+ log.print( "\t" );
+ if ( !sdir ) {
+ log.print( "allowed" );