- private final String obtainTitleForExtDescNodeData() {
- switch ( getOptions().getExtDescNodeDataToReturn() ) {
- case NODE_NAME:
- return "Node Names";
- case GENE_NAME:
- return "Gene Names";
- case SEQUENCE_NAME:
- return "Sequence Names";
- case SEQUENCE_SYMBOL:
- return "Sequence Symbols";
- case SEQUENCE_MOL_SEQ:
- return "Molecular Sequences";
- case SEQUENCE_MOL_SEQ_FASTA:
- return "Molecular Sequences (Fasta)";
- case SEQUENCE_ACC:
- return "Sequence Accessors";
- case TAXONOMY_SCIENTIFIC_NAME:
- return "Scientific Names";
- case TAXONOMY_CODE:
- return "Taxonomy Codes";
- case TAXONOMY_COMM0N_NAME:
- return "Taxonomy Common Names";
- case UNKNOWN:
- return "User Selected Data";
- default:
- throw new IllegalArgumentException( "unknown data element: "
- + getOptions().getExtDescNodeDataToReturn() );
- }
- }
-
- final private void openPdbWeb( final PhylogenyNode node ) {
- final List<Accession> pdb_ids = getPdbAccs( node );
- if ( ForesterUtil.isEmpty( pdb_ids ) ) {
- cannotOpenBrowserWarningMessage( "PDB" );
- return;
- }
- final List<String> uri_strs = TreePanelUtil.createUrisForPdbWeb( node, pdb_ids, getConfiguration(), this );
- if ( !ForesterUtil.isEmpty( uri_strs ) ) {
- for( final String uri_str : uri_strs ) {
+ private final void nodeDataAsSB( final PhylogenyNode node, final StringBuilder sb ) {
+ if ( node != null ) {
+ if ( getControlPanel().isShowNodeNames() && ( !ForesterUtil.isEmpty( node.getName() ) ) ) {
+ if ( sb.length() > 0 ) {
+ sb.append( " " );
+ }
+ sb.append( node.getName() );
+ }
+ if ( node.getNodeData().isHasSequence() ) {
+ 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().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().getName() );
+ }
+ if ( getControlPanel().isShowSequenceAcc()
+ && ( node.getNodeData().getSequence().getAccession() != null ) ) {
+ if ( sb.length() > 0 ) {
+ sb.append( " " );
+ }
+ if ( !ForesterUtil.isEmpty( node.getNodeData().getSequence().getAccession().getSource() ) ) {
+ sb.append( node.getNodeData().getSequence().getAccession().getSource() );
+ sb.append( ":" );
+ }
+ sb.append( node.getNodeData().getSequence().getAccession().getValue() );
+ }
+ }
+ if ( getControlPanel().isShowProperties() && node.getNodeData().isHasProperties() ) {
+ if ( sb.length() > 0 ) {
+ sb.append( " " );
+ }
+ sb.append( propertiesToString( node ) );
+ }
+ }
+ }
+
+ private final void nodeTaxonomyDataAsSB( final Taxonomy taxonomy, final StringBuilder sb ) {
+ if ( _control_panel.isShowTaxonomyCode() && !ForesterUtil.isEmpty( taxonomy.getTaxonomyCode() ) ) {
+ sb.append( taxonomy.getTaxonomyCode() );
+ sb.append( " " );
+ }
+ if ( _control_panel.isShowTaxonomyScientificNames() && _control_panel.isShowTaxonomyCommonNames() ) {
+ if ( !ForesterUtil.isEmpty( taxonomy.getScientificName() )
+ && !ForesterUtil.isEmpty( taxonomy.getCommonName() ) ) {
+ if ( getOptions().isAbbreviateScientificTaxonNames()
+ && ( taxonomy.getScientificName().indexOf( ' ' ) > 0 ) ) {
+ abbreviateScientificName( taxonomy.getScientificName(), sb );
+ }
+ else {
+ sb.append( taxonomy.getScientificName() );
+ }
+ sb.append( " (" );
+ sb.append( taxonomy.getCommonName() );
+ sb.append( ") " );
+ }
+ else if ( !ForesterUtil.isEmpty( taxonomy.getScientificName() ) ) {
+ if ( getOptions().isAbbreviateScientificTaxonNames()
+ && ( taxonomy.getScientificName().indexOf( ' ' ) > 0 ) ) {
+ abbreviateScientificName( taxonomy.getScientificName(), sb );
+ }
+ else {
+ sb.append( taxonomy.getScientificName() );
+ }
+ sb.append( " " );
+ }
+ else if ( !ForesterUtil.isEmpty( taxonomy.getCommonName() ) ) {
+ sb.append( taxonomy.getCommonName() );
+ sb.append( " " );
+ }
+ }
+ else if ( _control_panel.isShowTaxonomyScientificNames() ) {
+ if ( !ForesterUtil.isEmpty( taxonomy.getScientificName() ) ) {
+ if ( getOptions().isAbbreviateScientificTaxonNames()
+ && ( taxonomy.getScientificName().indexOf( ' ' ) > 0 ) ) {
+ abbreviateScientificName( taxonomy.getScientificName(), sb );
+ }
+ else {
+ sb.append( taxonomy.getScientificName() );
+ }
+ sb.append( " " );
+ }
+ }
+ else if ( _control_panel.isShowTaxonomyCommonNames() ) {
+ if ( !ForesterUtil.isEmpty( taxonomy.getCommonName() ) ) {
+ sb.append( taxonomy.getCommonName() );
+ sb.append( " " );
+ }
+ }
+ }
+
+ private final String obtainTitleForExtDescNodeData() {
+ switch ( getOptions().getExtDescNodeDataToReturn() ) {
+ case NODE_NAME:
+ return "Node Names";
+ case GENE_NAME:
+ return "Gene Names";
+ case SEQUENCE_NAME:
+ return "Sequence Names";
+ case SEQUENCE_SYMBOL:
+ return "Sequence Symbols";
+ case SEQUENCE_MOL_SEQ:
+ return "Molecular Sequences";
+ case SEQUENCE_MOL_SEQ_FASTA:
+ return "Molecular Sequences (Fasta)";
+ case SEQUENCE_ACC:
+ return "Sequence Accessors";
+ case TAXONOMY_SCIENTIFIC_NAME:
+ return "Scientific Names";
+ case TAXONOMY_CODE:
+ return "Taxonomy Codes";
+ case TAXONOMY_COMM0N_NAME:
+ return "Taxonomy Common Names";
+ case UNKNOWN:
+ return "User Selected Data";
+ default:
+ throw new IllegalArgumentException( "unknown data element: "
+ + getOptions().getExtDescNodeDataToReturn() );
+ }
+ }
+
+ final private void openPdbWeb( final PhylogenyNode node ) {
+ final List<Accession> pdb_ids = getPdbAccs( node );
+ if ( ForesterUtil.isEmpty( pdb_ids ) ) {
+ cannotOpenBrowserWarningMessage( "PDB" );
+ return;
+ }
+ final List<String> uri_strs = TreePanelUtil.createUrisForPdbWeb( node, pdb_ids, getConfiguration(), this );
+ if ( !ForesterUtil.isEmpty( uri_strs ) ) {
+ for( final String uri_str : uri_strs ) {