import org.forester.io.parsers.util.ParserUtils;
import org.forester.phylogeny.Phylogeny;
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.BranchColor;
-import org.forester.phylogeny.data.Sequence;
import org.forester.phylogeny.data.Taxonomy;
import org.forester.phylogeny.factories.ParserBasedPhylogenyFactory;
import org.forester.phylogeny.factories.PhylogenyFactory;
final Configuration conf,
final TreePanel tp ) {
String uri_str = null;
- if ( node.getNodeData().isHasSequence() && ( node.getNodeData().getSequence().getAccession() != null )
- && !ForesterUtil.isEmpty( node.getNodeData().getSequence().getAccession().getSource() )
- && !ForesterUtil.isEmpty( node.getNodeData().getSequence().getAccession().getValue() )
- && conf.isHasWebLink( node.getNodeData().getSequence().getAccession().getSource().toLowerCase() ) ) {
- final Sequence seq = node.getNodeData().getSequence();
- final String source = seq.getAccession().getSource().toLowerCase();
- String url;
- if ( source.toLowerCase().equals( "ncbi" ) ) {
- url = Constants.NCBI_ALL_DATABASE_SEARCH;
- }
- else {
- final WebLink weblink = conf.getWebLink( source );
- url = weblink.getUrl().toString();
- }
+ final String upkb = ForesterUtil.extractUniProtKbProteinSeqIdentifier( node );
+ if ( !ForesterUtil.isEmpty( upkb ) ) {
try {
- uri_str = url + URLEncoder.encode( seq.getAccession().getValue(), ForesterConstants.UTF8 );
+ uri_str = ForesterUtil.UNIPROT_KB + URLEncoder.encode( upkb, ForesterConstants.UTF8 );
}
catch ( final UnsupportedEncodingException e ) {
showErrorMessage( tp, e.toString() );
}
}
if ( ForesterUtil.isEmpty( uri_str ) ) {
- final String upkb = ForesterUtil.extractUniProtKbProteinSeqIdentifier( node );
- if ( !ForesterUtil.isEmpty( upkb ) ) {
+ final String v = ForesterUtil.extractGenbankAccessor( node );
+ if ( !ForesterUtil.isEmpty( v ) ) {
try {
- uri_str = ForesterUtil.UNIPROT_KB + URLEncoder.encode( upkb, ForesterConstants.UTF8 );
+ if ( SequenceIdParser.isProtein( v ) ) {
+ uri_str = ForesterUtil.NCBI_PROTEIN + URLEncoder.encode( v, ForesterConstants.UTF8 );
+ }
+ else {
+ uri_str = ForesterUtil.NCBI_NUCCORE + URLEncoder.encode( v, ForesterConstants.UTF8 );
+ }
}
catch ( final UnsupportedEncodingException e ) {
showErrorMessage( tp, e.toString() );
}
}
if ( ForesterUtil.isEmpty( uri_str ) ) {
- final String v = ForesterUtil.extractGenbankAccessor( node );
+ final String v = ForesterUtil.extractRefSeqAccessorAccessor( node );
if ( !ForesterUtil.isEmpty( v ) ) {
try {
if ( SequenceIdParser.isProtein( v ) ) {
}
}
if ( ForesterUtil.isEmpty( uri_str ) ) {
- final String v = ForesterUtil.extractRefSeqAccessorAccessor( node );
+ final String v = ForesterUtil.extractGInumber( node );
if ( !ForesterUtil.isEmpty( v ) ) {
try {
- if ( SequenceIdParser.isProtein( v ) ) {
- uri_str = ForesterUtil.NCBI_PROTEIN + URLEncoder.encode( v, ForesterConstants.UTF8 );
- }
- else {
- uri_str = ForesterUtil.NCBI_NUCCORE + URLEncoder.encode( v, ForesterConstants.UTF8 );
- }
+ uri_str = ForesterUtil.NCBI_GI + URLEncoder.encode( v, ForesterConstants.UTF8 );
}
catch ( final UnsupportedEncodingException e ) {
showErrorMessage( tp, e.toString() );
desc.append( "\n" );
desc.append( " Median: " + ForesterUtil.round( bs.median(), 6 ) );
desc.append( "\n" );
- desc.append( " Mean: " + ForesterUtil.round( bs.arithmeticMean(), 6 ) );
- desc.append( "\n" );
- desc.append( " SD: " + ForesterUtil.round( bs.sampleStandardDeviation(), 6 ) );
+ desc.append( " Mean: " + ForesterUtil.round( bs.arithmeticMean(), 6 ) + " (stdev: "
+ + ForesterUtil.round( bs.sampleStandardDeviation(), 6 ) + ")" );
desc.append( "\n" );
desc.append( " Minimum: " + ForesterUtil.round( bs.getMin(), 6 ) );
desc.append( "\n" );
desc.append( "\n" );
desc.append( " Median: " + ForesterUtil.round( ds.median(), 2 ) );
desc.append( "\n" );
- desc.append( " Mean: " + ForesterUtil.round( ds.arithmeticMean(), 2 ) );
- desc.append( "\n" );
- desc.append( " SD: " + ForesterUtil.round( ds.sampleStandardDeviation(), 2 ) );
+ desc.append( " Mean: " + ForesterUtil.round( ds.arithmeticMean(), 2 ) + " (stdev: "
+ + ForesterUtil.round( ds.sampleStandardDeviation(), 2 ) + ")" );
desc.append( "\n" );
desc.append( " Minimum: " + ForesterUtil.roundToInt( ds.getMin() ) );
desc.append( "\n" );
desc.append( " Median: " + ForesterUtil.round( cs.median(), 6 ) );
desc.append( "\n" );
desc.append( " Mean: " + ForesterUtil.round( cs.arithmeticMean(), 6 ) );
- desc.append( "\n" );
if ( cs.getN() > 2 ) {
- desc.append( " SD: " + ForesterUtil.round( cs.sampleStandardDeviation(), 6 ) );
- desc.append( "\n" );
+ desc.append( " (stdev: " + ForesterUtil.round( cs.sampleStandardDeviation(), 6 ) + ")" );
}
+ desc.append( "\n" );
desc.append( " Minimum: " + ForesterUtil.roundToInt( cs.getMin() ) );
desc.append( "\n" );
desc.append( " Maximum: " + ForesterUtil.roundToInt( cs.getMax() ) );
return true;
}
- final static boolean isMac() {
- try {
- final String s = ForesterUtil.OS_NAME.toLowerCase();
- return s.startsWith( "mac" );
- }
- catch ( final Exception e ) {
- ForesterUtil.printWarningMessage( Constants.PRG_NAME, "minor error: " + e );
- return false;
- }
- }
-
final static boolean isUsOrCanada() {
try {
if ( ( Locale.getDefault().equals( Locale.CANADA ) ) || ( Locale.getDefault().equals( Locale.US ) ) ) {
return false;
}
- final static boolean isWindows() {
- try {
- final String s = ForesterUtil.OS_NAME.toLowerCase();
- return s.indexOf( "win" ) > -1;
- }
- catch ( final Exception e ) {
- ForesterUtil.printWarningMessage( Constants.PRG_NAME, "minor error: " + e );
- return false;
- }
- }
-
final static void lookAtSomeTreePropertiesForAptxControlSettings( final Phylogeny t,
final ControlPanel atv_control,
final Configuration configuration ) {
final boolean phyloxml_validate_against_xsd,
final boolean replace_underscores,
final boolean internal_numbers_are_confidences,
- final TAXONOMY_EXTRACTION taxonomy_extraction )
- throws FileNotFoundException, IOException {
+ final TAXONOMY_EXTRACTION taxonomy_extraction,
+ final boolean midpoint_reroot ) throws FileNotFoundException,
+ IOException {
final PhylogenyFactory factory = ParserBasedPhylogenyFactory.getInstance();
final PhylogenyParser parser;
boolean nhx_or_nexus = false;
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 );
+ }
+ }
return phys;
}
if ( os.toLowerCase().startsWith( "win" ) ) {
Runtime.getRuntime().exec( "rundll32 url.dll,FileProtocolHandler " + url );
}
- else if ( isMac() ) {
+ else if ( ForesterUtil.isMac() ) {
final Class<?> file_mgr = Class.forName( "com.apple.eio.FileManager" );
final Method open_url = file_mgr.getDeclaredMethod( "openURL", new Class[] { String.class } );
open_url.invoke( null, new Object[] { url } );