- 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() )
- && getConfiguration().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 = getConfiguration().getWebLink( source );
- url = weblink.getUrl().toString();
- }
- try {
- uri_str = url + URLEncoder.encode( seq.getAccession().getValue(), ForesterConstants.UTF8 );
- }
- catch ( final UnsupportedEncodingException e ) {
- AptxUtil.showErrorMessage( this, e.toString() );
- e.printStackTrace();
- }
- }
- else {
- String upkb = null;
- if ( node.getNodeData().isHasSequence() ) {
- Sequence seq = node.getNodeData().getSequence();
- if ( !ForesterUtil.isEmpty( seq.getSymbol() )
- && AptxUtil.UNIPROT_KB_PATTERN.matcher( seq.getSymbol() ).find() ) {
- upkb = AptxUtil.UNIPROT_KB_PATTERN.matcher( seq.getSymbol() ).group();
- }
- else if ( !ForesterUtil.isEmpty( seq.getName() )
- && AptxUtil.UNIPROT_KB_PATTERN.matcher( seq.getName() ).find() ) {
- upkb = AptxUtil.UNIPROT_KB_PATTERN.matcher( seq.getName() ).group();
- }
- else if ( ( node.getNodeData().getSequence().getAccession() != null )
- && !ForesterUtil.isEmpty( seq.getAccession().getValue() )
- && AptxUtil.UNIPROT_KB_PATTERN.matcher( seq.getAccession().getValue() ).find() ) {
- upkb = AptxUtil.UNIPROT_KB_PATTERN.matcher( seq.getAccession().getValue() ).group();
- }
- }
- if ( ForesterUtil.isEmpty( upkb ) && !ForesterUtil.isEmpty( node.getName() ) ) {
- final Matcher m = AptxUtil.UNIPROT_KB_PATTERN.matcher( node.getName() );
- if ( m.find() ) {
- upkb = m.group();
- }
- }
- try {
- uri_str = AptxUtil.UNIPROT_KB + URLEncoder.encode( upkb, ForesterConstants.UTF8 );
- }
- catch ( final UnsupportedEncodingException e ) {
- AptxUtil.showErrorMessage( this, e.toString() );
- e.printStackTrace();
- }
- }