return Blast.isContainsQueryForBlast( node );
}
- final private boolean isCanOpenSeqWeb( final PhylogenyNode node ) {
- if ( node.getNodeData().isHasSequence()
- && ( node.getNodeData().getSequence().getAccession() != null )
- && !ForesterUtil.isEmpty( node.getNodeData().getSequence().getAccession().getSource() )
- && !ForesterUtil.isEmpty( node.getNodeData().getSequence().getAccession().getValue() )
- && getConfiguration().isHasWebLink( node.getNodeData().getSequence().getAccession().getSource()
- .toLowerCase() ) ) {
- return true;
- }
- return false;
- }
-
final private boolean isCanOpenTaxWeb( final PhylogenyNode node ) {
if ( node.getNodeData().isHasTaxonomy()
- && ( ( ( node.getNodeData().getTaxonomy().getIdentifier() != null )
- && !ForesterUtil.isEmpty( node.getNodeData().getTaxonomy().getIdentifier().getProvider() )
- && !ForesterUtil.isEmpty( node.getNodeData().getTaxonomy().getIdentifier().getValue() ) && getConfiguration()
- .isHasWebLink( node.getNodeData().getTaxonomy().getIdentifier().getProvider().toLowerCase() ) )
- || ( !ForesterUtil.isEmpty( node.getNodeData().getTaxonomy().getScientificName() ) )
+ && ( ( !ForesterUtil.isEmpty( node.getNodeData().getTaxonomy().getScientificName() ) )
|| ( !ForesterUtil.isEmpty( node.getNodeData().getTaxonomy().getTaxonomyCode() ) )
|| ( !ForesterUtil.isEmpty( node.getNodeData().getTaxonomy().getCommonName() ) ) || ( ( node
.getNodeData().getTaxonomy().getIdentifier() != null )
final String title = clickto_names.get( i );
_node_popup_menu_items[ i ] = new JMenuItem( title );
if ( title.equals( Configuration.clickto_options[ Configuration.open_seq_web ][ 0 ] ) ) {
- _node_popup_menu_items[ i ].setEnabled( isCanOpenSeqWeb( node ) );
+ final String id = isCanOpenSeqWeb( node );
+ if ( !ForesterUtil.isEmpty( id ) ) {
+ _node_popup_menu_items[ i ].setText( _node_popup_menu_items[ i ].getText() + " [" + id + "]" );
+ _node_popup_menu_items[ i ].setEnabled( true );
+ }
+ else {
+ _node_popup_menu_items[ i ].setEnabled( false );
+ }
}
else if ( title.equals( Configuration.clickto_options[ Configuration.open_tax_web ][ 0 ] ) ) {
_node_popup_menu_items[ i ].setEnabled( isCanOpenTaxWeb( node ) );
}
}
- final private void openSeqWeb( final PhylogenyNode node ) {
- if ( !isCanOpenSeqWeb( node ) ) {
- cannotOpenBrowserWarningMessage( "sequence" );
- return;
+ final private String isCanOpenSeqWeb( final PhylogenyNode node ) {
+ String v = ForesterUtil.extractUniProtKbProteinSeqIdentifier( node );
+ if ( ForesterUtil.isEmpty( v ) ) {
+ v = ForesterUtil.extractGenbankAccessor( node );
}
- String uri_str = null;
- 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;
+ if ( ForesterUtil.isEmpty( v ) ) {
+ v = ForesterUtil.extractRefSeqAccessorAccessor( node );
}
- else {
- final WebLink weblink = getConfiguration().getWebLink( source );
- url = weblink.getUrl().toString();
- }
- try {
- uri_str = url + URLEncoder.encode( seq.getAccession().getValue(), ForesterConstants.UTF8 );
+ if ( ForesterUtil.isEmpty( v ) ) {
+ v = ForesterUtil.extractGInumber( node );
}
- catch ( final UnsupportedEncodingException e ) {
- AptxUtil.showErrorMessage( this, e.toString() );
- e.printStackTrace();
+ return v;
+ }
+
+ final private void openSeqWeb( final PhylogenyNode node ) {
+ if ( ForesterUtil.isEmpty( isCanOpenSeqWeb( node ) ) ) {
+ cannotOpenBrowserWarningMessage( "sequence" );
+ return;
}
+ final String uri_str = AptxUtil.createUriForSeqWeb( node, getConfiguration(), this );
if ( !ForesterUtil.isEmpty( uri_str ) ) {
try {
- JApplet applet = null;
- if ( isApplet() ) {
- applet = obtainApplet();
- }
- AptxUtil.launchWebBrowser( new URI( uri_str ), isApplet(), applet, "_aptx_seq" );
+ AptxUtil.launchWebBrowser( new URI( uri_str ),
+ isApplet(),
+ isApplet() ? obtainApplet() : null,
+ "_aptx_seq" );
}
catch ( final IOException e ) {
AptxUtil.showErrorMessage( this, e.toString() );
}
String uri_str = null;
final Taxonomy tax = node.getNodeData().getTaxonomy();
- if ( ( tax.getIdentifier() != null ) && !ForesterUtil.isEmpty( tax.getIdentifier().getProvider() )
- && getConfiguration().isHasWebLink( tax.getIdentifier().getProvider().toLowerCase() ) ) {
- final String type = tax.getIdentifier().getProvider().toLowerCase();
- final WebLink weblink = getConfiguration().getWebLink( type );
- try {
- uri_str = weblink.getUrl() + URLEncoder.encode( tax.getIdentifier().getValue(), ForesterConstants.UTF8 );
- }
- catch ( final UnsupportedEncodingException e ) {
- AptxUtil.showErrorMessage( this, e.toString() );
- e.printStackTrace();
- }
- }
- else if ( ( tax.getIdentifier() != null ) && !ForesterUtil.isEmpty( tax.getIdentifier().getValue() )
+ if ( ( tax.getIdentifier() != null ) && !ForesterUtil.isEmpty( tax.getIdentifier().getValue() )
&& tax.getIdentifier().getValue().startsWith( "http://" ) ) {
try {
uri_str = new URI( tax.getIdentifier().getValue() ).toString();
}
else if ( !ForesterUtil.isEmpty( tax.getScientificName() ) ) {
try {
- uri_str = "http://www.eol.org/search?q="
+ uri_str = "http://www.uniprot.org/taxonomy/?query="
+ URLEncoder.encode( tax.getScientificName(), ForesterConstants.UTF8 );
}
catch ( final UnsupportedEncodingException e ) {
}
else if ( !ForesterUtil.isEmpty( tax.getCommonName() ) ) {
try {
- uri_str = "http://www.eol.org/search?q="
+ uri_str = "http://www.uniprot.org/taxonomy/?query="
+ URLEncoder.encode( tax.getCommonName(), ForesterConstants.UTF8 );
}
catch ( final UnsupportedEncodingException e ) {
}
if ( !ForesterUtil.isEmpty( uri_str ) ) {
try {
- JApplet applet = null;
- if ( isApplet() ) {
- applet = obtainApplet();
- }
- AptxUtil.launchWebBrowser( new URI( uri_str ), isApplet(), applet, "_aptx_tax" );
+ AptxUtil.launchWebBrowser( new URI( uri_str ),
+ isApplet(),
+ isApplet() ? obtainApplet() : null,
+ "_aptx_tax" );
}
catch ( final IOException e ) {
AptxUtil.showErrorMessage( this, e.toString() );
}
final private void paintOvRectangle( final Graphics2D g ) {
- final float w_ratio = ( float ) getWidth() / getVisibleRect().width;
- final float h_ratio = ( float ) getHeight() / getVisibleRect().height;
- final float x_ratio = ( float ) getWidth() / getVisibleRect().x;
- final float y_ratio = ( float ) getHeight() / getVisibleRect().y;
+ final float w_ratio = ( ( float ) getWidth() ) / getVisibleRect().width;
+ final float h_ratio = ( ( float ) getHeight() ) / getVisibleRect().height;
+ final float x_ratio = ( ( float ) getWidth() ) / getVisibleRect().x;
+ final float y_ratio = ( ( float ) getHeight() ) / getVisibleRect().y;
final float width = getOvMaxWidth() / w_ratio;
final float height = getOvMaxHeight() / h_ratio;
final float x = getVisibleRect().x + getOvXPosition() + ( getOvMaxWidth() / x_ratio );