X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=forester%2Fjava%2Fsrc%2Forg%2Fforester%2Farchaeopteryx%2Ftools%2FBlast.java;h=839a328fb61a0daf20b78c04a51906d924fb219e;hb=ae9764d1d2d667c26a90543b553f2ada548f1bcf;hp=5bfc31e38a8c1953d7065ceb557140349b80f1ee;hpb=0f295917c869b17a9322af3e738e3527ba9b31d4;p=jalview.git diff --git a/forester/java/src/org/forester/archaeopteryx/tools/Blast.java b/forester/java/src/org/forester/archaeopteryx/tools/Blast.java index 5bfc31e..839a328 100644 --- a/forester/java/src/org/forester/archaeopteryx/tools/Blast.java +++ b/forester/java/src/org/forester/archaeopteryx/tools/Blast.java @@ -21,24 +21,99 @@ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA // // Contact: phylosoft @ gmail . com -// WWW: www.phylosoft.org/forester +// WWW: https://sites.google.com/site/cmzmasek/home/software/forester package org.forester.archaeopteryx.tools; import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; import java.util.Arrays; import java.util.Enumeration; import java.util.Hashtable; import java.util.Vector; +import javax.swing.JApplet; + +import org.forester.archaeopteryx.AptxUtil; +import org.forester.archaeopteryx.TreePanel; +import org.forester.phylogeny.PhylogenyNode; +import org.forester.phylogeny.data.Identifier; +import org.forester.util.ForesterUtil; +import org.forester.util.SequenceIdParser; import org.forester.ws.wabi.RestUtil; -public class Blast { +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; + } - public Blast() { + final public static boolean isContainsQueryForBlast( final PhylogenyNode node ) { + return !ForesterUtil.isEmpty( obtainQueryForBlast( node ) ); } - public void go( final String geneName ) { + final public void ddbjBlast( final String geneName ) { // Retrieve accession number list which has specified gene name from searchByXMLPath of ARSA. Please click here for details of ARSA. /*target: Sequence length is between 300bp and 1000bp. Feature key is CDS.