X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=forester%2Fjava%2Fsrc%2Forg%2Fforester%2Fapplication%2Fgsdi.java;h=7e2d51418d973c67c252ab7994980c42379c1d20;hb=90e29ddfe15f6c44f3e3ba419a67c3e267e279bd;hp=9e3f326b6f26f8e5a55208943f559b6725f4f9f0;hpb=656be28debec520e0e35a8b311114398a40ea366;p=jalview.git diff --git a/forester/java/src/org/forester/application/gsdi.java b/forester/java/src/org/forester/application/gsdi.java index 9e3f326..7e2d514 100644 --- a/forester/java/src/org/forester/application/gsdi.java +++ b/forester/java/src/org/forester/application/gsdi.java @@ -63,17 +63,18 @@ public final class gsdi { final static private String GSDIR_OPTION = "r"; final static private String MOST_PARSIMONIOUS_OPTION = "m"; final static private String GUESS_FORMAT_OF_SPECIES_TREE = "q"; + final static private String TRANSFER_TAXONOMY_OPTION = "t"; final static private String HELP_OPTION_1 = "help"; final static private String HELP_OPTION_2 = "h"; final static private String SUFFIX_FOR_SPECIES_TREE_USED = "_species_tree_used.xml"; final static private String LOGFILE_SUFFIX = "_gsdi_log.txt"; final static private String REMAPPED_SUFFIX = "_gsdi_remapped.txt"; final static private String PRG_NAME = "gsdi"; - final static private String PRG_VERSION = "1.000"; - final static private String PRG_DATE = "120629"; + final static private String PRG_VERSION = "1.001"; + final static private String PRG_DATE = "130325"; final static private String PRG_DESC = "general speciation duplication inference"; final static private String E_MAIL = "phylosoft@gmail.com"; - final static private String WWW = "www.phylosoft.org/forester"; + final static private String WWW = "https://sites.google.com/site/cmzmasek/home/software/forester"; public static void main( final String args[] ) { try { @@ -108,6 +109,7 @@ public final class gsdi { allowed_options.add( gsdi.GUESS_FORMAT_OF_SPECIES_TREE ); allowed_options.add( gsdi.MOST_PARSIMONIOUS_OPTION ); allowed_options.add( gsdi.ALLOW_STRIPPING_OF_GENE_TREE_OPTION ); + allowed_options.add( TRANSFER_TAXONOMY_OPTION ); final String dissallowed_options = cla.validateAllowedOptionsAsString( allowed_options ); if ( dissallowed_options.length() > 0 ) { ForesterUtil.fatalError( gsdi.PRG_NAME, "unknown option(s): " + dissallowed_options ); @@ -138,6 +140,10 @@ public final class gsdi { } allow_stripping_of_gene_tree = true; } + boolean transfer_taxonomy = false; + if ( cla.isOptionSet( TRANSFER_TAXONOMY_OPTION ) ) { + transfer_taxonomy = true; + } Phylogeny species_tree = null; Phylogeny gene_tree = null; File gene_tree_file = null; @@ -174,7 +180,7 @@ public final class gsdi { } try { final PhylogenyFactory factory = ParserBasedPhylogenyFactory.getInstance(); - gene_tree = factory.create( gene_tree_file, new PhyloXmlParser() )[ 0 ]; + gene_tree = factory.create( gene_tree_file, PhyloXmlParser.createPhyloXmlParserXsdValidating() )[ 0 ]; } catch ( final IOException e ) { fatalError( "error", @@ -234,16 +240,17 @@ public final class gsdi { + ( ForesterUtil.isEmpty( species_tree.getName() ) ? "" : gene_tree.getName() ) ); System.out.println( "Species tree name : " + ( ForesterUtil.isEmpty( species_tree.getName() ) ? "" : gene_tree.getName() ) ); + System.out.println( "Transfer taxonomy : " + transfer_taxonomy ); GSDII gsdii = null; final long start_time = new Date().getTime(); try { if ( base_algorithm == ALGORITHM.GSDI ) { - System.out.println( "Algorithm : GSDI" ); - log_writer.println( "Algorithm : GSDI" ); + System.out.println( "Algorithm : GSDI" ); + log_writer.println( "Algorithm : GSDI" ); } else if ( base_algorithm == ALGORITHM.GSDIR ) { - System.out.println( "Algorithm : GSDIR" ); - log_writer.println( "Algorithm : GSDIR" ); + System.out.println( "Algorithm : GSDIR" ); + log_writer.println( "Algorithm : GSDIR" ); } System.out.println( "Use most parsimonous duplication model : " + most_parsimonous_duplication_model ); System.out.println( "Allow stripping of gene tree nodes : " + allow_stripping_of_gene_tree ); @@ -255,10 +262,11 @@ public final class gsdi { species_tree, most_parsimonous_duplication_model, allow_stripping_of_gene_tree, - true ); + true, + transfer_taxonomy ); } else if ( base_algorithm == ALGORITHM.GSDIR ) { - gsdii = new GSDIR( gene_tree, species_tree, allow_stripping_of_gene_tree, true ); + gsdii = new GSDIR( gene_tree, species_tree, allow_stripping_of_gene_tree, true, transfer_taxonomy ); } } catch ( final SDIException e ) { @@ -280,18 +288,10 @@ public final class gsdi { + "ms" ); System.out.println( "Mapping based on : " + gsdii.getTaxCompBase() ); log_writer.println( "Mapping based on : " + gsdii.getTaxCompBase() ); - if ( ( base_algorithm == ALGORITHM.GSDIR ) ) { - final GSDIR gsdir = ( GSDIR ) gsdii; - System.out.println( "Duplications sum statistics : " + gsdir.getMinDuplicationsSum() ); - log_writer.println( "Duplications sum statistics : " + gsdir.getMinDuplicationsSum() ); - } try { final PhylogenyWriter writer = new PhylogenyWriter(); if ( base_algorithm == ALGORITHM.GSDIR ) { - writer.toPhyloXML( out_file, - ( ( GSDIR ) gsdii ).getMinDuplicationsSumGeneTrees(), - 0, - ForesterUtil.LINE_SEPARATOR ); + writer.toPhyloXML( out_file, ( ( GSDIR ) gsdii ).getMinDuplicationsSumGeneTree(), 0 ); } else { writer.toPhyloXML( out_file, gene_tree, 0 ); @@ -393,6 +393,8 @@ public final class gsdi { + ": to allow species tree in other formats than phyloXML (i.e. Newick, NHX, Nexus)" ); System.out.println( " -" + gsdi.GSDIR_OPTION + ": to use GSDIR algorithm instead of GSDI algorithm (re-rooting)" ); + System.out.println( " -" + TRANSFER_TAXONOMY_OPTION + + ": to transfer taxonomic data from species tree to gene tree\n" ); System.out.println(); System.out.println( "Gene tree:" ); System.out.println( " in phyloXM format, with taxonomy and sequence data in appropriate fields" );