+public final class Blast {
+
+ final public static void openNcbiBlastWeb( final String query,
+ final boolean is_nucleic_acids,
+ final JApplet applet,
+ final TreePanel p ) {
+ //http://www.ncbi.nlm.nih.gov/blast/Blast.cgi?CMD=Web&PAGE=Proteins&DATABASE=swissprot&QUERY=gi|163848401
+ final StringBuilder uri_str = new StringBuilder();
+ uri_str.append( "http://www.ncbi.nlm.nih.gov/blast/Blast.cgi?CMD=Web&DATABASE=nr&PAGE=" );
+ if ( is_nucleic_acids ) {
+ uri_str.append( "Nucleotide" );
+ }
+ else {
+ uri_str.append( "Proteins" );
+ }
+ uri_str.append( "&QUERY=" );
+ uri_str.append( query );
+ try {
+ AptxUtil.launchWebBrowser( new URI( uri_str.toString() ), applet != null, applet, "_aptx_blast" );
+ }
+ catch ( final IOException e ) {
+ AptxUtil.showErrorMessage( p, e.toString() );
+ e.printStackTrace();
+ }
+ catch ( final URISyntaxException e ) {
+ AptxUtil.showErrorMessage( p, e.toString() );
+ e.printStackTrace();
+ }
+ }
+
+ final public static String obtainQueryForBlast( final PhylogenyNode node ) {
+ String query = "";
+ if ( node.getNodeData().isHasSequence() ) {
+ if ( !ForesterUtil.isEmpty( node.getNodeData().getSequence().getMolecularSequence() ) ) {
+ query = node.getNodeData().getSequence().getMolecularSequence();
+ }
+ if ( ForesterUtil.isEmpty( query ) && ( node.getNodeData().getSequence().getAccession() != null )
+ && !ForesterUtil.isEmpty( node.getNodeData().getSequence().getAccession().getValue() ) ) {
+ final Identifier id = SequenceIdParser.parse( node.getNodeData().getSequence().getAccession()
+ .getValue() );
+ if ( id != null ) {
+ query = id.getValue();
+ }
+ }
+ if ( ForesterUtil.isEmpty( query ) && !ForesterUtil.isEmpty( node.getNodeData().getSequence().getName() ) ) {
+ final Identifier id = SequenceIdParser.parse( node.getNodeData().getSequence().getName() );
+ if ( id != null ) {
+ query = id.getValue();
+ }
+ }
+ if ( ForesterUtil.isEmpty( query ) && !ForesterUtil.isEmpty( node.getNodeData().getSequence().getSymbol() ) ) {
+ final Identifier id = SequenceIdParser.parse( node.getNodeData().getSequence().getSymbol() );
+ if ( id != null ) {
+ query = id.getValue();
+ }
+ }
+ }
+ if ( ForesterUtil.isEmpty( query ) && !ForesterUtil.isEmpty( node.getName() ) ) {
+ final Identifier id = SequenceIdParser.parse( node.getName() );
+ if ( id != null ) {
+ query = id.getValue();
+ }
+ }
+ return query;
+ }