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.Annotation;
import org.forester.phylogeny.data.BranchColor;
import org.forester.phylogeny.data.Confidence;
import org.forester.util.DescriptiveStatistics;
import org.forester.util.ForesterConstants;
import org.forester.util.ForesterUtil;
-import org.forester.util.SequenceIdParser;
+import org.forester.util.SequenceAccessionTools;
public final class TreePanel extends JPanel implements ActionListener, MouseWheelListener, Printable {
.getValue()
+ " " );
}
- if ( getControlPanel().isShowGeneNames() && ( node.getNodeData().getSequence().getName().length() > 0 ) ) {
+ if ( getControlPanel().isShowSeqNames() && ( node.getNodeData().getSequence().getName().length() > 0 ) ) {
sum += getTreeFontSet()._fm_large.stringWidth( node.getNodeData().getSequence().getName() + " " );
}
- if ( getControlPanel().isShowGeneSymbols()
+ if ( getControlPanel().isShowSeqSymbols()
&& ( node.getNodeData().getSequence().getSymbol().length() > 0 ) ) {
sum += getTreeFontSet()._fm_large.stringWidth( node.getNodeData().getSequence().getSymbol() + " " );
}
+ if ( getControlPanel().isShowGeneNames()
+ && ( node.getNodeData().getSequence().getGeneName().length() > 0 ) ) {
+ sum += getTreeFontSet()._fm_large
+ .stringWidth( node.getNodeData().getSequence().getGeneName() + " " );
+ }
if ( getControlPanel().isShowAnnotation()
&& ( node.getNodeData().getSequence().getAnnotations() != null )
&& !node.getNodeData().getSequence().getAnnotations().isEmpty() ) {
DESCENDANT_SORT_PRIORITY pri = DESCENDANT_SORT_PRIORITY.TAXONOMY;
if ( ( !getControlPanel().isShowTaxonomyScientificNames() && !getControlPanel().isShowTaxonomyCode() && !getControlPanel()
.isShowTaxonomyCommonNames() ) ) {
- if ( ( getControlPanel().isShowSequenceAcc() || getControlPanel().isShowGeneNames() || getControlPanel()
- .isShowGeneSymbols() ) ) {
+ if ( ( getControlPanel().isShowSequenceAcc() || getControlPanel().isShowSeqNames() || getControlPanel()
+ .isShowSeqSymbols() ) ) {
pri = DESCENDANT_SORT_PRIORITY.SEQUENCE;
}
else if ( getControlPanel().isShowNodeNames() ) {
}
}
if ( type == '?' ) {
- if ( SequenceIdParser.isProtein( query ) ) {
+ if ( SequenceAccessionTools.isProteinDbQuery( query ) ) {
type = 'p';
}
else {
}
final private String isCanOpenSeqWeb( final PhylogenyNode node ) {
- String v = ForesterUtil.extractUniProtKbProteinSeqIdentifier( node );
- if ( ForesterUtil.isEmpty( v ) ) {
- v = ForesterUtil.extractGenbankAccessor( node );
- }
- if ( ForesterUtil.isEmpty( v ) ) {
- v = ForesterUtil.extractRefSeqAccessorAccessor( node );
+ final Accession a = SequenceAccessionTools.obtainAccessorFromDataFields( node );
+ if ( a != null ) {
+ return a.getValue();
}
- if ( ForesterUtil.isEmpty( v ) ) {
- v = ForesterUtil.extractGInumber( node );
- }
- return v;
+ return null;
}
final private boolean isCanOpenTaxWeb( final PhylogenyNode node ) {
switch ( getOptions().getExtDescNodeDataToReturn() ) {
case NODE_NAME:
return "Node Names";
+ case GENE_NAME:
+ return "Gene Names";
case SEQUENCE_NAME:
return "Sequence Names";
case SEQUENCE_SYMBOL:
_sb.append( node.getName() );
}
if ( node.getNodeData().isHasSequence() ) {
- if ( getControlPanel().isShowGeneSymbols() && ( node.getNodeData().getSequence().getSymbol().length() > 0 ) ) {
+ if ( getControlPanel().isShowSeqSymbols() && ( node.getNodeData().getSequence().getSymbol().length() > 0 ) ) {
if ( _sb.length() > 0 ) {
_sb.append( " " );
}
_sb.append( node.getNodeData().getSequence().getSymbol() );
}
- if ( getControlPanel().isShowGeneNames() && ( node.getNodeData().getSequence().getName().length() > 0 ) ) {
+ if ( getControlPanel().isShowGeneNames() && ( node.getNodeData().getSequence().getGeneName().length() > 0 ) ) {
+ if ( _sb.length() > 0 ) {
+ _sb.append( " " );
+ }
+ _sb.append( node.getNodeData().getSequence().getGeneName() );
+ }
+ if ( getControlPanel().isShowSeqNames() && ( node.getNodeData().getSequence().getName().length() > 0 ) ) {
if ( _sb.length() > 0 ) {
_sb.append( " " );
}
}
_sb.append( node.getNodeData().getSequence().getAccession().getValue() );
}
- if ( getControlPanel().isShowGeneNames() && ( node.getNodeData().getSequence().getName().length() > 0 ) ) {
+ if ( getControlPanel().isShowSeqNames() && ( node.getNodeData().getSequence().getName().length() > 0 ) ) {
if ( _sb.length() > 0 ) {
_sb.append( " " );
}
}
}
if ( node.getNodeData().isHasSequence() ) {
- if ( getControlPanel().isShowGeneNames()
+ if ( getControlPanel().isShowSeqNames()
&& ( !ForesterUtil.isEmpty( node.getNodeData().getSequence().getName() ) ) ) {
x += getTreeFontSet()._fm_large.stringWidth( node.getNodeData().getSequence().getName()
+ " " );
}
- if ( getControlPanel().isShowGeneSymbols()
+ if ( getControlPanel().isShowSeqSymbols()
&& ( !ForesterUtil.isEmpty( node.getNodeData().getSequence().getSymbol() ) ) ) {
x += getTreeFontSet()._fm_large.stringWidth( node.getNodeData().getSequence().getSymbol()
+ " " );
}
+ if ( getControlPanel().isShowGeneNames()
+ && ( !ForesterUtil.isEmpty( node.getNodeData().getSequence().getGeneName() ) ) ) {
+ x += getTreeFontSet()._fm_large.stringWidth( node.getNodeData().getSequence().getGeneName()
+ + " " );
+ }
if ( getControlPanel().isShowSequenceAcc()
&& ( node.getNodeData().getSequence().getAccession() != null ) ) {
x += getTreeFontSet()._fm_large.stringWidth( node.getNodeData().getSequence()
data.add( n.getNodeData().getSequence().getName() );
}
break;
+ case GENE_NAME:
+ if ( n.getNodeData().isHasSequence()
+ && !ForesterUtil.isEmpty( n.getNodeData().getSequence().getGeneName() ) ) {
+ data.add( n.getNodeData().getSequence().getGeneName() );
+ }
+ break;
case SEQUENCE_SYMBOL:
if ( n.getNodeData().isHasSequence()
&& !ForesterUtil.isEmpty( n.getNodeData().getSequence().getSymbol() ) ) {
ann.append( n.getNodeData().getSequence().getName() );
ann.append( "|" );
}
+ if ( !ForesterUtil.isEmpty( n.getNodeData().getSequence().getGeneName() ) ) {
+ ann.append( "GN=" );
+ ann.append( n.getNodeData().getSequence().getGeneName() );
+ ann.append( "|" );
+ }
if ( n.getNodeData().getSequence().getAccession() != null ) {
ann.append( "ACC=" );
ann.append( n.getNodeData().getSequence().getAccession().asText() );
_popup_buffer.append( "]" );
enc_data = true;
}
+ if ( !ForesterUtil.isEmpty( seq.getGeneName() ) ) {
+ if ( enc_data ) {
+ _popup_buffer.append( " [" );
+ }
+ else {
+ _popup_buffer.append( "[" );
+ }
+ _popup_buffer.append( seq.getGeneName() );
+ _popup_buffer.append( "]" );
+ enc_data = true;
+ }
if ( !ForesterUtil.isEmpty( seq.getName() ) ) {
if ( enc_data ) {
_popup_buffer.append( " " );