- final static private String PRG_NAME = "RIO";
- final static private String PRG_VERSION = "2.03 ALPHA";
- final static private String PRG_DATE = "2010.01.15";
- final static private String E_MAIL = "czmasek@burnham.org";
- final static private String WWW = "www.phylosoft.org/forester/";
- final static private boolean TIME = true;
- final static private boolean VERBOSE = true;
- // For method getDistances -- calculation of distances.
- final static private boolean MINIMIZE_COST = false;
- // For method getDistances -- calculation of distances.
- final static private boolean MINIMIZE_DUPS = true;
- // For method getDistances -- calculation of distances.
- final static private boolean MINIMIZE_HEIGHT = true;
- final static private int WARN_NO_ORTHOS_DEFAULT = 2;
- final static private int
- // How many sd away from mean to root.
- WARN_MORE_THAN_ONE_ORTHO_DEFAULT = 2;
- // How many sd away from mean to LCA of orthos.
- final static private double THRESHOLD_ULTRA_PARALOGS_DEFAULT = 50;
- // How many sd away from mean to LCA of orthos.
- final static private double WARN_ONE_ORTHO_DEFAULT = 2;
-
- // Factor between the two distances to their LCA
- // (larger/smaller).
- // Factor between the two distances to their LCA
- // (larger/smaller).
- /**
- * Calculates the mean and standard deviation of all nodes of Phylogeny t
- * which have a bootstrap values zero or more. Returns null in case of
- * failure (e.g t has no bootstrap values, or just one).
- * <p>
- *
- * @param t
- * reference to a tree with bootstrap values
- * @return Array of doubles, [0] is the mean, [1] the standard deviation
- */
- private static double[] calculateMeanBoostrapValue( final Phylogeny t ) {
- double b = 0;
- int n = 0;
- long sum = 0;
- double x = 0.0, mean = 0.0;
- final double[] da = new double[ 2 ];
- final Vector<Double> bv = new Vector<Double>();
- PhylogenyNode node = null;
- PreorderTreeIterator i = null;
- i = new PreorderTreeIterator( t );
- // Calculates the mean.
- while ( i.hasNext() ) {
- node = i.next();
- if ( !( ( node.getParent() != null ) && node.getParent().isRoot()
- && ( PhylogenyMethods.getConfidenceValue( node.getParent().getChildNode1() ) > 0 )
- && ( PhylogenyMethods.getConfidenceValue( node.getParent().getChildNode2() ) > 0 ) && ( node
- .getParent().getChildNode2() == node ) ) ) {
- b = PhylogenyMethods.getConfidenceValue( node );
- if ( b > 0 ) {
- sum += b;
- bv.addElement( new Double( b ) );
- n++;
- }
- }
- // i.next();
- }
- if ( n < 2 ) {
- return null;
- }
- mean = ( double ) sum / n;
- // Calculates the standard deviation.
- sum = 0;
- for( int j = 0; j < n; ++j ) {
- b = ( bv.elementAt( j ) ).intValue();
- x = b - mean;
- sum += ( x * x );
- }
- 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 );
- }