import java.util.Set;
import java.util.SortedSet;
import java.util.TreeSet;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
import javax.imageio.IIOImage;
import javax.imageio.ImageIO;
import org.forester.phylogeny.PhylogenyMethods;
import org.forester.phylogeny.PhylogenyMethods.DESCENDANT_SORT_PRIORITY;
import org.forester.phylogeny.PhylogenyNode;
-import org.forester.phylogeny.data.Accession;
import org.forester.phylogeny.data.Taxonomy;
import org.forester.phylogeny.factories.ParserBasedPhylogenyFactory;
import org.forester.phylogeny.factories.PhylogenyFactory;
private final static String[] AVAILABLE_FONT_FAMILIES_SORTED = GraphicsEnvironment.getLocalGraphicsEnvironment()
.getAvailableFontFamilyNames();
- private final static Pattern seq_identifier_pattern_1 = Pattern
- .compile( "^([A-Za-z]{2,5})[|=:]([0-9A-Za-z_\\.]{5,40})\\s*$" );
- private final static Pattern seq_identifier_pattern_2 = Pattern
- .compile( "^([A-Za-z]{2,5})[|=:]([0-9A-Za-z_\\.]{5,40})[|,; ].*$" );
static {
Arrays.sort( AVAILABLE_FONT_FAMILIES_SORTED );
}
return tax_set;
}
- public final static Accession obtainSequenceAccessionFromName( final String sequence_name ) {
- final String n = sequence_name.trim();
- final Matcher matcher1 = seq_identifier_pattern_1.matcher( n );
- String group1 = "";
- String group2 = "";
- if ( matcher1.matches() ) {
- group1 = matcher1.group( 1 );
- group2 = matcher1.group( 2 );
- }
- else {
- final Matcher matcher2 = seq_identifier_pattern_2.matcher( n );
- if ( matcher2.matches() ) {
- group1 = matcher2.group( 1 );
- group2 = matcher2.group( 2 );
- }
- }
- if ( ForesterUtil.isEmpty( group1 ) || ForesterUtil.isEmpty( group2 ) ) {
- return null;
- }
- return new Accession( group2, group1 );
- }
-
public final static void printWarningMessage( final String name, final String message ) {
System.out.println( "[" + name + "] > " + message );
}
return iter.hasNext();
}
- final static String createBasicInformation( final Phylogeny phy ) {
+ final static String createBasicInformation( final Phylogeny phy, final File treefile ) {
final StringBuilder desc = new StringBuilder();
if ( ( phy != null ) && !phy.isEmpty() ) {
+ String f = null;
+ if ( treefile != null ) {
+ try {
+ f = treefile.getCanonicalPath();
+ }
+ catch ( final IOException e ) {
+ //Not important, ignore.
+ }
+ if ( !ForesterUtil.isEmpty( f ) ) {
+ desc.append( "Path: " );
+ desc.append( f );
+ desc.append( "\n" );
+ }
+ }
if ( !ForesterUtil.isEmpty( phy.getName() ) ) {
desc.append( "Name: " );
desc.append( phy.getName() );
desc.append( "\n" );
desc.append( "Descendants per node statistics: " );
desc.append( "\n" );
- desc.append( " Median: " + ForesterUtil.round( ds.median(), 2 ) );
+ desc.append( " Median: " + ForesterUtil.round( ds.median(), 6 ) );
desc.append( "\n" );
- desc.append( " Mean: " + ForesterUtil.round( ds.arithmeticMean(), 2 ) + " (stdev: "
- + ForesterUtil.round( ds.sampleStandardDeviation(), 2 ) + ")" );
+ desc.append( " Mean: " + ForesterUtil.round( ds.arithmeticMean(), 6 ) + " (stdev: "
+ + ForesterUtil.round( ds.sampleStandardDeviation(), 6 ) + ")" );
desc.append( "\n" );
desc.append( " Minimum: " + ForesterUtil.roundToInt( ds.getMin() ) );
desc.append( "\n" );
desc.append( " (stdev: " + ForesterUtil.round( cs.sampleStandardDeviation(), 6 ) + ")" );
}
desc.append( "\n" );
- desc.append( " Minimum: " + ForesterUtil.roundToInt( cs.getMin() ) );
+ desc.append( " Minimum: " + ForesterUtil.round( cs.getMin(), 6 ) );
desc.append( "\n" );
- desc.append( " Maximum: " + ForesterUtil.roundToInt( cs.getMax() ) );
+ desc.append( " Maximum: " + ForesterUtil.round( cs.getMax(), 6 ) );
desc.append( "\n" );
}
}
nex.setIgnoreQuotes( false );
}
}
+ AptxUtil.printAppletMessage( "Archaeopteryx", "parser is " + parser.getName() );
final Phylogeny[] phys = factory.create( url.openStream(), parser );
- if ( nhx_or_nexus && internal_numbers_are_confidences ) {
- for( final Phylogeny phy : phys ) {
- PhylogenyMethods.transferInternalNodeNamesToConfidence( phy );
+ if ( phys != null ) {
+ if ( nhx_or_nexus && internal_numbers_are_confidences ) {
+ for( final Phylogeny phy : phys ) {
+ PhylogenyMethods.transferInternalNodeNamesToConfidence( phy, "" );
+ }
}
- }
- if ( midpoint_reroot ) {
- for( final Phylogeny phy : phys ) {
- PhylogenyMethods.midpointRoot( phy );
- PhylogenyMethods.orderAppearance( phy.getRoot(), true, true, DESCENDANT_SORT_PRIORITY.NODE_NAME );
+ if ( midpoint_reroot ) {
+ for( final Phylogeny phy : phys ) {
+ PhylogenyMethods.midpointRoot( phy );
+ PhylogenyMethods.orderAppearance( phy.getRoot(), true, true, DESCENDANT_SORT_PRIORITY.NODE_NAME );
+ }
}
}
return phys;