- da[ 0 ] = mean;
- da[ 1 ] = java.lang.Math.sqrt( sum / ( n - 1.0 ) );
- return da;
- }
-
- private final static void errorInCommandLine() {
- System.out.println( "\nrio: Error in command line.\n" );
- printHelp();
- System.exit( -1 );
- }
-
- // Uses DistanceCalculator to calculate distances.
- private final static StringBuffer getDistances( final File tree_file_for_dist_val,
- final File outfile,
- final Phylogeny species_tree,
- final String seq_name,
- final ArrayList<String> al_ortholog_names_for_dc,
- final HashMap<String, Integer> ortholog_hashmap,
- final HashMap<String, Integer> super_ortholog_hashmap,
- final int warn_more_than_one_ortho,
- final int warn_no_orthos,
- final double warn_one_ortho,
- final int bootstraps,
- final double t_orthologs_dc ) throws IOException, SDIException {
- Phylogeny consensus_tree = null;
- Phylogeny
- // to be a consensus tree.
- assigned_cons_tree = null;
- final SDIR sdiunrooted = new SDIR();
- final ArrayList<PhylogenyNode> al_ortholog_nodes = new ArrayList<PhylogenyNode>();
- double m = 0.0;
- double sd = 0.0;
- double d = 0.0;
- int n = 0;
- final PhylogenyFactory factory = ParserBasedPhylogenyFactory.getInstance();
- consensus_tree = factory.create( tree_file_for_dist_val, new PhyloXmlParser() )[ 0 ];
- PhylogenyMethods.taxonomyBasedDeletionOfExternalNodes( species_tree, consensus_tree );
- assigned_cons_tree = sdiunrooted.infer( consensus_tree,
- species_tree,
- rio.MINIMIZE_COST,
- rio.MINIMIZE_DUPS,
- rio.MINIMIZE_HEIGHT,
- true,
- 1 )[ 0 ];
- final DistanceCalculator dc = new DistanceCalculator();
- final StringBuffer sb = new StringBuffer();
- sb.append( "Given the threshold for distance calculations (" + ForesterUtil.roundToInt( t_orthologs_dc )
- + "): " );
- // No orthologs.
- if ( al_ortholog_names_for_dc.size() == 0 ) {
- dc.setTree( assigned_cons_tree );
- // Remark. Calculation of mean and sd _does_ include the node
- // with seq_name.
- m = dc.getMean();
- sd = dc.getStandardDeviation();
- d = dc.getDistanceToRoot( seq_name );
- n = dc.getN();
- sb.append( "No sequence is considered orthologous to query."
- + "\ndistance of query to root = " + ForesterUtil.FORMATTER_06.format( d )
- + "\nmean of distances (for all sequences) to root = " + ForesterUtil.FORMATTER_06.format( m )
- + "\nsd of distances (for all sequences) to root = " + ForesterUtil.FORMATTER_06.format( sd )
- + "\nn (sum of sequences in alignment plus query) = " + n );
- if ( !( ( ( m - ( warn_no_orthos * sd ) ) < d ) && ( ( m + ( warn_no_orthos * sd ) ) > d ) ) ) {
- sb.append( "\nWARNING: distance of query to root is outside of mean+/-" + warn_no_orthos + "*sd!" );
- }