import java.util.HashSet;
import java.util.Hashtable;
import java.util.List;
-import java.util.Map;
import java.util.Set;
-import java.util.SortedMap;
import java.util.SortedSet;
-import java.util.TreeMap;
import javax.swing.BorderFactory;
import javax.swing.JApplet;
import org.forester.phylogeny.data.Confidence;
import org.forester.phylogeny.data.DomainArchitecture;
import org.forester.phylogeny.data.Event;
-import org.forester.phylogeny.data.NodeData.NODE_DATA;
+import org.forester.phylogeny.data.NodeDataField;
import org.forester.phylogeny.data.NodeVisualData;
import org.forester.phylogeny.data.NodeVisualData.NodeFill;
import org.forester.phylogeny.data.NodeVisualData.NodeShape;
private static final BasicStroke STROKE_2 = new BasicStroke( 2f );
private static final double TWO_PI = 2 * Math.PI;
private final static int WIGGLE = 2;
- private static final String SHOW_ONLY_THIS_CONF_TYPE = "posterior probability"; //TODO remove me
+ private static final String SHOW_ONLY_THIS_CONF_TYPE = null; //TODO remove me
HashMap<Long, Short> _nodeid_dist_to_leaf = new HashMap<Long, Short>();
final private Arc2D _arc = new Arc2D.Double();
private AffineTransform _at;
else {
_node_popup_menu_items[ i ].setEnabled( false );
}
- //
+ }
+ else if ( title.startsWith( Configuration.clickto_options[ Configuration.get_ext_desc_data ][ 0 ] ) ) {
+ _node_popup_menu_items[ i ]
+ .setText( Configuration.clickto_options[ Configuration.get_ext_desc_data ][ 0 ] + ": "
+ + getOptions().getExtDescNodeDataToReturn().toString() );
}
else if ( title.equals( Configuration.clickto_options[ Configuration.open_tax_web ][ 0 ] ) ) {
_node_popup_menu_items[ i ].setEnabled( isCanOpenTaxWeb( node ) );
}
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 DOMAINS_ALL:
- return "Domains [E-value threshold: " + Math.pow( 10, getDomainStructureEvalueThresholdExp() ) + "]";
- case DOMAINS_COLLAPSED_PER_PROTEIN:
- return "Domains [collapsed per protein, E-value threshold: " + Math.pow( 10, getDomainStructureEvalueThresholdExp() ) + "]";
- case GO_ANNOTATIONS:
- return "Go Annotations";
- case GO_ANNOTATIONS_WITH_COUNTS:
- return "Go Annotations [with counts]";
- case UNKNOWN:
- return "User Selected Data";
- default:
- throw new IllegalArgumentException( "unknown data element: "
- + getOptions().getExtDescNodeDataToReturn() );
- }
+ return getOptions().getExtDescNodeDataToReturn().toString();
}
final private void openPdbWeb( final PhylogenyNode node ) {
}
paintNodeBox( node.getXcoord(), node.getYcoord(), node, g, to_pdf, to_graphics_file );
}
+ if ( getControlPanel().isShowMolSequences() && ( node.getNodeData().isHasSequence() )
+ && ( node.getNodeData().getSequence().isMolecularSequenceAligned() )
+ && ( !ForesterUtil.isEmpty( node.getNodeData().getSequence().getMolecularSequence() ) ) ) {
+ paintMolecularSequences( g, node, to_pdf );
+ }
if ( dynamically_hide
&& !is_in_found_nodes
&& ( ( node.isExternal() && ( ( _external_node_index % dynamic_hiding_factor ) != 1 ) ) || ( !node
}
}
}
- if ( getControlPanel().isShowMolSequences() && ( node.getNodeData().isHasSequence() )
- && ( node.getNodeData().getSequence().isMolecularSequenceAligned() )
- && ( !ForesterUtil.isEmpty( node.getNodeData().getSequence().getMolecularSequence() ) ) ) {
- final RenderableMsaSequence rs = RenderableMsaSequence.createInstance( node.getNodeData().getSequence()
- .getMolecularSequence(), node.getNodeData().getSequence().getType(), getConfiguration() );
- if ( rs != null ) {
- final int default_height = 7;
- float y = getYdistance();
- if ( getControlPanel().isDynamicallyHideData() ) {
- y = getTreeFontSet().getFontMetricsLarge().getHeight();
- }
- final int h = y < default_height ? ForesterUtil.roundToInt( y ) : default_height;
- rs.setRenderingHeight( h > 1 ? h : 2 );
- if ( getControlPanel().isDrawPhylogram() ) {
- rs.render( ( float ) ( ( getMaxDistanceToRoot() * getXcorrectionFactor() ) + _length_of_longest_text ),
- node.getYcoord() - ( h / 2.0f ),
- g,
- this,
- to_pdf );
- }
- else {
- rs.render( getPhylogeny().getFirstExternalNode().getXcoord() + _length_of_longest_text,
- node.getYcoord() - ( h / 2.0f ),
- g,
- this,
- to_pdf );
- }
+
+ //if ( getControlPanel().isShowMolSequences() && ( node.getNodeData().isHasSequence() )
+ // && ( node.getNodeData().getSequence().isMolecularSequenceAligned() )
+ // && ( !ForesterUtil.isEmpty( node.getNodeData().getSequence().getMolecularSequence() ) ) ) {
+ // paintMolecularSequences( g, node, to_pdf );
+ //}
+ }
+
+ private void paintMolecularSequences( final Graphics2D g, final PhylogenyNode node, final boolean to_pdf ) {
+ final RenderableMsaSequence rs = RenderableMsaSequence.createInstance( node.getNodeData().getSequence()
+ .getMolecularSequence(), node.getNodeData().getSequence().getType(), getConfiguration() );
+ if ( rs != null ) {
+ final int default_height = 8;
+ float y = getYdistance();
+
+ final int h = ( y / 2) < default_height ? ForesterUtil.roundToInt( y * 2 ) : default_height;
+ rs.setRenderingHeight( h > 1 ? h : 1 );
+
+ if ( getControlPanel().isDrawPhylogram() ) {
+ rs.render( ( float ) ( ( getMaxDistanceToRoot() * getXcorrectionFactor() ) + _length_of_longest_text ),
+ node.getYcoord() - ( h / 2.0f ),
+ g,
+ this,
+ to_pdf );
+ }
+ else {
+ rs.render( getPhylogeny().getFirstExternalNode().getXcoord() + _length_of_longest_text,
+ node.getYcoord() - ( h / 2.0f ),
+ g,
+ this,
+ to_pdf );
}
}
}
data.add( n.getNodeData().getSequence().getSymbol() );
}
break;
- case SEQUENCE_MOL_SEQ:
- if ( n.getNodeData().isHasSequence()
- && !ForesterUtil.isEmpty( n.getNodeData().getSequence().getMolecularSequence() ) ) {
- data.add( n.getNodeData().getSequence().getMolecularSequence() );
- }
- break;
case SEQUENCE_MOL_SEQ_FASTA:
final StringBuilder sb = new StringBuilder();
if ( n.getNodeData().isHasSequence()
data.add( n.getNodeData().getTaxonomy().getScientificName() );
}
break;
- case TAXONOMY_COMM0N_NAME:
- if ( n.getNodeData().isHasTaxonomy()
- && !ForesterUtil.isEmpty( n.getNodeData().getTaxonomy().getCommonName() ) ) {
- data.add( n.getNodeData().getTaxonomy().getCommonName() );
- }
- break;
case TAXONOMY_CODE:
if ( n.getNodeData().isHasTaxonomy()
&& !ForesterUtil.isEmpty( n.getNodeData().getTaxonomy().getTaxonomyCode() ) ) {
data.add( n.getNodeData().getTaxonomy().getTaxonomyCode() );
}
break;
- case DOMAINS_ALL:
+ case DOMAINS_ALL:
case DOMAINS_COLLAPSED_PER_PROTEIN:
if ( n.getNodeData().isHasSequence()
- && n.getNodeData().getSequence().getDomainArchitecture() != null ) {
+ && ( n.getNodeData().getSequence().getDomainArchitecture() != null ) ) {
final DomainArchitecture da = n.getNodeData().getSequence().getDomainArchitecture();
final Set<String> s = new HashSet<String>();
for( int i = 0; i < da.getDomains().size(); ++i ) {
final String name = d.getName();
if ( !( s.contains( name ) ) ) {
data.add( name );
- if ( getOptions().getExtDescNodeDataToReturn() == NODE_DATA.DOMAINS_COLLAPSED_PER_PROTEIN ) {
+ if ( getOptions().getExtDescNodeDataToReturn() == NodeDataField.DOMAINS_COLLAPSED_PER_PROTEIN ) {
s.add( name );
}
}
}
}
}
- break;
- case GO_ANNOTATIONS:
+ break;
+ case SEQ_ANNOTATIONS:
if ( n.getNodeData().isHasSequence() ) {
if ( n.getNodeData().isHasSequence()
- && n.getNodeData().getSequence().getAnnotations() != null ) {
+ && ( n.getNodeData().getSequence().getAnnotations() != null ) ) {
final SortedSet<Annotation> a = n.getNodeData().getSequence().getAnnotations();
for( int i = 0; i < a.size(); ++i ) {
- data.add( n.getNodeData().getSequence().getAnnotation( i ).toString() );
+ data.add( n.getNodeData().getSequence().getAnnotation( i ).toString() );
}
}
}
- break;
+ break;
+ case GO_TERM_IDS:
+ if ( n.getNodeData().isHasSequence() ) {
+ if ( n.getNodeData().isHasSequence()
+ && ( n.getNodeData().getSequence().getAnnotations() != null ) ) {
+ final SortedSet<Annotation> a = n.getNodeData().getSequence().getAnnotations();
+ for( int i = 0; i < a.size(); ++i ) {
+ final Annotation ann = n.getNodeData().getSequence().getAnnotation( i );
+ final String ref = ann.getRef();
+ if ( ref.toUpperCase().startsWith( "GO:" ) ) {
+ data.add( ref );
+ }
+ }
+ }
+ }
+ break;
case UNKNOWN:
TreePanelUtil.showExtDescNodeDataUserSelectedHelper( getControlPanel(), n, data );
break;
+ getOptions().getExtDescNodeDataToReturn() );
}
} // for loop
-
final StringBuilder sb = new StringBuilder();
-
-
- final int size = TreePanelUtil.makeSB( data, getOptions(), sb );
+ final int size = TreePanelUtil.nodeDataIntoStringBuffer( data, getOptions(), sb );
if ( ( getConfiguration().getExtNodeDataReturnOn() == EXT_NODE_DATA_RETURN_ON.CONSOLE )
|| ( getConfiguration().getExtNodeDataReturnOn() == EXT_NODE_DATA_RETURN_ON.BUFFER_ONLY ) ) {
if ( getConfiguration().getExtNodeDataReturnOn() == EXT_NODE_DATA_RETURN_ON.CONSOLE ) {
setCurrentExternalNodesDataBuffer( sb );
String title;
if ( ( getFoundNodes0() != null ) && !getFoundNodes0().isEmpty() ) {
- title = ( getOptions().getExtDescNodeDataToReturn() == NODE_DATA.UNKNOWN ? "Data"
+ title = ( getOptions().getExtDescNodeDataToReturn() == NodeDataField.UNKNOWN ? "Data"
: obtainTitleForExtDescNodeData() )
+ " for "
+ data.size()
+ size;
}
else {
- title = ( getOptions().getExtDescNodeDataToReturn() == NODE_DATA.UNKNOWN ? "Data"
+ title = ( getOptions().getExtDescNodeDataToReturn() == NodeDataField.UNKNOWN ? "Data"
: obtainTitleForExtDescNodeData() )
+ " for "
+ data.size()