X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=forester%2Fjava%2Fsrc%2Forg%2Fforester%2Farchaeopteryx%2FMainFrameApplication.java;h=85e93363a49a8b8735e7ddc40b7b4165944d5069;hb=f642399d323502c48c4ccb25ad6a4268a4152e6a;hp=947ed2ace1f23fe877e8e7e18cf9a477554d87ba;hpb=6b3ec0cd978bd692dfae1de3e076963283fdf322;p=jalview.git diff --git a/forester/java/src/org/forester/archaeopteryx/MainFrameApplication.java b/forester/java/src/org/forester/archaeopteryx/MainFrameApplication.java index 947ed2a..85e9336 100644 --- a/forester/java/src/org/forester/archaeopteryx/MainFrameApplication.java +++ b/forester/java/src/org/forester/archaeopteryx/MainFrameApplication.java @@ -93,6 +93,7 @@ import org.forester.phylogeny.PhylogenyMethods; import org.forester.phylogeny.PhylogenyNode; import org.forester.phylogeny.PhylogenyNode.NH_CONVERSION_SUPPORT_VALUE_STYLE; import org.forester.phylogeny.data.Confidence; +import org.forester.phylogeny.data.Sequence; import org.forester.phylogeny.data.Taxonomy; import org.forester.phylogeny.factories.ParserBasedPhylogenyFactory; import org.forester.phylogeny.factories.PhylogenyFactory; @@ -123,6 +124,7 @@ public final class MainFrameApplication extends MainFrame { private final static SequencesFileFilter seqsfilter = new SequencesFileFilter(); private final static DefaultFilter defaultfilter = new DefaultFilter(); private static final long serialVersionUID = -799735726778865234L; + private static final boolean PREPROCESS_TREES = false; private final JFileChooser _values_filechooser; private final JFileChooser _sequences_filechooser; private final JFileChooser _open_filechooser; @@ -896,11 +898,11 @@ public final class MainFrameApplication extends MainFrame { .add( _show_default_node_shapes_internal_cbmi = new JCheckBoxMenuItem( DISPLAY_NODE_BOXES_LABEL_INT ) ); _options_jmenu .add( _show_default_node_shapes_external_cbmi = new JCheckBoxMenuItem( DISPLAY_NODE_BOXES_LABEL_EXT ) ); + _options_jmenu.add( _line_up_renderable_data_cbmi = new JCheckBoxMenuItem( MainFrame.LINE_UP_RENDERABLE_DATA ) ); if ( getConfiguration().doDisplayOption( Configuration.show_domain_architectures ) ) { - _options_jmenu.add( _show_domain_labels = new JCheckBoxMenuItem( SHOW_DOMAIN_LABELS_LABEL ) ); _options_jmenu.add( _right_line_up_domains_cbmi = new JCheckBoxMenuItem( MainFrame.RIGHT_LINE_UP_DOMAINS ) ); + _options_jmenu.add( _show_domain_labels = new JCheckBoxMenuItem( MainFrame.SHOW_DOMAIN_LABELS_LABEL ) ); } - _options_jmenu.add( _line_up_renderable_data_cbmi = new JCheckBoxMenuItem( MainFrame.LINE_UP_RENDERABLE_DATA ) ); _options_jmenu.add( _show_annotation_ref_source = new JCheckBoxMenuItem( SHOW_ANN_REF_SOURCE_LABEL ) ); _options_jmenu.add( _show_confidence_stddev_cbmi = new JCheckBoxMenuItem( SHOW_CONF_STDDEV_LABEL ) ); _options_jmenu.add( _color_by_taxonomic_group_cbmi = new JCheckBoxMenuItem( COLOR_BY_TAXONOMIC_GROUP ) ); @@ -2211,6 +2213,9 @@ public final class MainFrameApplication extends MainFrame { } } } + if ( PREPROCESS_TREES ) { + preProcessTreesUponReading( phys ); + } AptxUtil.addPhylogeniesToTabs( phys, file.getName(), file.getAbsolutePath(), @@ -2234,6 +2239,30 @@ public final class MainFrameApplication extends MainFrame { System.gc(); } + private void preProcessTreesUponReading( final Phylogeny[] phys ) { + for( final Phylogeny phy : phys ) { + if ( ( phy != null ) && !phy.isEmpty() ) { + for( final PhylogenyNodeIterator it = phy.iteratorPreorder(); it.hasNext(); ) { + final PhylogenyNode n = it.next(); + if ( n.isExternal() ) { + if ( n.getNodeData().isHasSequence() ) { + final Sequence s = n.getNodeData().getSequence(); + if ( ForesterUtil.isEmpty( s.getGeneName() ) ) { + if ( ( s.getAccession() != null ) + && !ForesterUtil.isEmpty( s.getAccession().getValue() ) ) { + s.setGeneName( s.getAccession().getValue() ); + } + else if ( !ForesterUtil.isEmpty( n.getName() ) ) { + s.setGeneName( n.getName() ); + } + } + } + } + } + } + } + } + private void readSpeciesTreeFromFile() { Phylogeny t = null; boolean exception = false;