final ResultMulti res = new ResultMulti();
for( int i = 0; i < qnodes.size(); ++i ) {
final PhylogenyNode qnode = qnodes.get( i );
- System.out.println( ">>" + qnode.getName() );
+ //System.out.println( ">>" + qnode.getName() );
if ( qnode.isRoot() ) {
throw new IllegalArgumentException( "Query " + query + " is root." );
}
}
//final String greatest_common_prefix_up[] = analyzeSiblings( qnode_p, qnode_pp, separator, query, res );
final String greatest_common_prefix_up = analyzeSiblings( qnode_p, qnode_pp, separator, query );
- System.out.println( "greatest_common_prefix_up=" + greatest_common_prefix_up + " " + conf );
+ //System.out.println( "greatest_common_prefix_up=" + greatest_common_prefix_up + " " + conf );
if ( !ForesterUtil.isEmpty( greatest_common_prefix_up ) ) {
res.addGreatestCommonPrefixUp( greatest_common_prefix_up, conf );
}
res.addGreatestCommonPrefixUp( UNKNOWN, conf );
}
final String greatest_common_prefix_down = analyzeSiblings( qnode, qnode_p, separator, query );
- System.out.println( "greatest_common_prefix_down=" + greatest_common_prefix_down + " " + conf );
+ // System.out.println( "greatest_common_prefix_down=" + greatest_common_prefix_down + " " + conf );
if ( !ForesterUtil.isEmpty( greatest_common_prefix_down ) ) {
res.addGreatestCommonPrefixDown( greatest_common_prefix_down, conf );
}
package org.forester.clade_analysis;
import java.math.BigDecimal;
+import java.text.DecimalFormat;
final class Prefix {
- private final String _prefix;
- private final BigDecimal _confidence;
- private final String _separator;
- private final String _first;
+ private final static DecimalFormat df = new DecimalFormat( "0.0#####" );
+ private final String _prefix;
+ private final BigDecimal _confidence;
+ private final String _separator;
+ private final String _first;
Prefix( final String prefix, final String confidence, final String separator ) {
_prefix = prefix;
- _confidence = new BigDecimal( confidence);
- _separator = separator ;
- if ( _prefix.indexOf( _separator ) < 0) {
+ _confidence = new BigDecimal( confidence );
+ _separator = separator;
+ if ( _prefix.indexOf( _separator ) < 0 ) {
_first = _prefix;
}
else {
- _first = _prefix.substring( 0, _prefix.indexOf(_separator ) );
+ _first = _prefix.substring( 0, _prefix.indexOf( _separator ) );
}
}
-
- Prefix( final String prefix, final double confidence , final String separator) {
+
+ Prefix( final String prefix, final double confidence, final String separator ) {
_prefix = prefix;
- _confidence = new BigDecimal( confidence);
- _separator = separator ;
- if ( _prefix.indexOf( _separator ) < 0) {
+ _confidence = new BigDecimal( confidence );
+ _separator = separator;
+ if ( _prefix.indexOf( _separator ) < 0 ) {
_first = _prefix;
}
else {
- _first = _prefix.substring( 0, _prefix.indexOf(_separator ) );
- }
+ _first = _prefix.substring( 0, _prefix.indexOf( _separator ) );
+ }
}
String getPrefix() {
return _prefix;
}
-
+
String getPrefixFirstElement() {
- return _first;
+ return _first;
}
+
double getConfidence() {
return _confidence.doubleValue();
}
@Override
public String toString() {
- return getPrefix() + ": " + getConfidence();
+ return getPrefix() + ": " + df.format( getConfidence() );
}
}
@Override
public final String toString() {
final StringBuilder sb = new StringBuilder();
- sb.append( "Cleaned:" );
- sb.append( ForesterUtil.LINE_SEPARATOR );
- for( final Prefix prefix : _all ) {
- sb.append( prefix );
- sb.append( ForesterUtil.LINE_SEPARATOR );
- }
- sb.append( ForesterUtil.LINE_SEPARATOR );
+ // sb.append( "Cleaned:" );
+ // sb.append( ForesterUtil.LINE_SEPARATOR );
+ // for( final Prefix prefix : _all ) {
+ // sb.append( prefix );
+ // sb.append( ForesterUtil.LINE_SEPARATOR );
+ // }
+ // sb.append( ForesterUtil.LINE_SEPARATOR );
sb.append( "Collapsed:" );
sb.append( ForesterUtil.LINE_SEPARATOR );
for( final Prefix prefix : _collapsed ) {
}
if ( !ForesterUtil.isEmpty( _all_down ) ) {
sb.append( ForesterUtil.LINE_SEPARATOR );
- sb.append( "Cleaned Down:" );
- sb.append( ForesterUtil.LINE_SEPARATOR );
- for( final Prefix prefix : _all_down ) {
- sb.append( prefix );
- sb.append( ForesterUtil.LINE_SEPARATOR );
- }
- sb.append( ForesterUtil.LINE_SEPARATOR );
+ // sb.append( "Cleaned Down:" );
+ // sb.append( ForesterUtil.LINE_SEPARATOR );
+ // for( final Prefix prefix : _all_down ) {
+ // sb.append( prefix );
+ // sb.append( ForesterUtil.LINE_SEPARATOR );
+ // }
+ // sb.append( ForesterUtil.LINE_SEPARATOR );
sb.append( "Collapsed Down:" );
sb.append( ForesterUtil.LINE_SEPARATOR );
for( final Prefix prefix : _collapsed_down ) {
sb.append( prefix );
sb.append( ForesterUtil.LINE_SEPARATOR );
}
- if ( _has_specifics_down ) {
+ /* if ( _has_specifics_down ) {
sb.append( ForesterUtil.LINE_SEPARATOR );
sb.append( "Specifics Down:" );
sb.append( ForesterUtil.LINE_SEPARATOR );
}
}
}
- }
+ }*/
}
if ( !ForesterUtil.isEmpty( _all_up ) ) {
sb.append( ForesterUtil.LINE_SEPARATOR );
- sb.append( "Cleaned Up:" );
- sb.append( ForesterUtil.LINE_SEPARATOR );
- for( final Prefix prefix : _all_up ) {
- sb.append( prefix );
- sb.append( ForesterUtil.LINE_SEPARATOR );
- }
- sb.append( ForesterUtil.LINE_SEPARATOR );
+ // sb.append( "Cleaned Up:" );
+ // sb.append( ForesterUtil.LINE_SEPARATOR );
+ // for( final Prefix prefix : _all_up ) {
+ // sb.append( prefix );
+ // sb.append( ForesterUtil.LINE_SEPARATOR );
+ // }
+ // sb.append( ForesterUtil.LINE_SEPARATOR );
sb.append( "Collapsed Up:" );
sb.append( ForesterUtil.LINE_SEPARATOR );
for( final Prefix prefix : _collapsed_up ) {
sb.append( prefix );
sb.append( ForesterUtil.LINE_SEPARATOR );
}
- if ( _has_specifics ) {
+ /* if ( _has_specifics ) {
sb.append( ForesterUtil.LINE_SEPARATOR );
sb.append( "Specifics Up:" );
sb.append( ForesterUtil.LINE_SEPARATOR );
}
}
}
- }
+ }*/
}
return sb.toString();
}