+ final String error_intreefile = ForesterUtil.isReadableFile( intreefile );
+ if ( !ForesterUtil.isEmpty( error_intreefile ) ) {
+ ForesterUtil.fatalError( PRG_NAME, error_intreefile );
+ }
+ final File outtablefile;
+ if ( cla.getNumberOfNames() > 1 ) {
+ outtablefile = cla.getFile( 1 );
+ final String error_outtablefile = ForesterUtil.isWritableFile( outtablefile );
+ if ( !ForesterUtil.isEmpty( error_outtablefile ) ) {
+ ForesterUtil.fatalError( PRG_NAME, error_outtablefile );
+ }
+ }
+ else {
+ outtablefile = null;
+ }
+ final BasicTable<String> t;
+ final SortedMap<String, String> map;
+ if ( mapping_file != null ) {
+ t = BasicTableParser.parse( mapping_file, '\t' );
+ if ( t.getNumberOfColumns() != 2 ) {
+ ForesterUtil.fatalError( PRG_NAME,
+ "mapping file needs to have 2 tab-separated columns, not "
+ + t.getNumberOfColumns() );
+ }
+ map = t.getColumnsAsMap( 0, 1 );
+ }
+ else {
+ t = null;
+ map = null;
+ }
+ final boolean extra_processing1;
+ if ( cla.isOptionSet( EXTRA_PROCESSING_OPTION1 ) ) {
+ extra_processing1 = true;
+ }
+ else {
+ extra_processing1 = false;
+ }
+ String extra_processing1_sep = EXTRA_PROCESSING1_SEP_DEFAULT;
+ if ( cla.isOptionSet( EXTRA_PROCESSING1_SEP_OPTION ) ) {
+ if ( !extra_processing1 ) {
+ ForesterUtil.fatalError( PRG_NAME,
+ "extra processing is not enabled, cannot set -"
+ + EXTRA_PROCESSING1_SEP_OPTION + " option" );
+ }
+ if ( cla.isOptionValueSet( EXTRA_PROCESSING1_SEP_OPTION ) ) {
+ extra_processing1_sep = cla.getOptionValue( EXTRA_PROCESSING1_SEP_OPTION );
+ }
+ else {
+ ForesterUtil.fatalError( PRG_NAME, "no value for extra processing separator" );
+ }
+ }
+ if ( ( extra_processing1_sep != null ) && extra_processing1_sep.equals( separator ) ) {
+ ForesterUtil.fatalError( PRG_NAME,
+ "extra processing separator must not be the same the annotation-separator" );
+ }
+ boolean extra_processing1_keep = EXTRA_PROCESSING1_KEEP_EXTRA_DEFAULT;
+ if ( cla.isOptionSet( EXTRA_PROCESSING1_KEEP_EXTRA_OPTION ) ) {
+ if ( !extra_processing1 ) {
+ ForesterUtil.fatalError( PRG_NAME,
+ "extra processing is not enabled, cannot set -"
+ + EXTRA_PROCESSING1_KEEP_EXTRA_OPTION + " option" );
+ }
+ extra_processing1_keep = true;
+ }
+ Pattern special_pattern = null;
+ boolean special_processing = false;
+ if ( cla.isOptionSet( SPECIAL_PROCESSING_OPTION ) ) {
+ if ( extra_processing1 == true ) {
+ ForesterUtil
+ .fatalError( PRG_NAME,
+ "extra processing cannot be used together with special processing pattern" );
+ }
+ if ( cla.isOptionValueSet( SPECIAL_PROCESSING_OPTION ) ) {
+ final String str = cla.getOptionValue( SPECIAL_PROCESSING_OPTION );
+ try {
+ special_pattern = Pattern.compile( str );
+ }
+ catch ( final PatternSyntaxException e ) {
+ ForesterUtil
+ .fatalError( PRG_NAME,
+ "error in special processing pattern: " + str + ": " + e.getMessage() );
+ }
+ special_processing = true;
+ }
+ else {
+ ForesterUtil.fatalError( PRG_NAME, "no value for special processing pattern" );
+ }
+ }
+ final boolean verbose;
+ if ( cla.isOptionSet( VERBOSE_OPTION ) ) {
+ verbose = true;
+ }
+ else {
+ verbose = false;
+ }
+ final boolean quit;
+ if ( cla.isOptionSet( QUIET_OPTION ) ) {
+ quit = true;
+ }
+ else {
+ quit = false;
+ }
+ System.out.println( "Input tree : " + intreefile );
+ System.out.println( "Specific-hit support cutoff: " + cutoff_specifics );
+ if ( mapping_file != null ) {
+ System.out.println( "Mapping file : " + mapping_file + " (" + t.getNumberOfRows()
+ + " rows)" );
+ }
+ System.out.println( "Annotation-separator : " + separator );
+ System.out.println( "Query pattern : " + pattern );
+ if ( extra_processing1 ) {
+ System.out.println( "Extra processing : " + extra_processing1 );
+ System.out.println( "Extra processing separator : " + extra_processing1_sep );
+ System.out.println( "Keep extra annotations : " + extra_processing1_keep );
+ }
+ if ( special_processing ) {
+ System.out.println( "Special processing : " + special_processing );
+ System.out.println( "Special processing pattern : " + special_pattern );
+ }
+ if ( outtablefile != null ) {
+ System.out.println( "Output table : " + outtablefile );
+ }
+ Phylogeny phys[] = null;