From 2b4d8edabd858f232899cf045ec0124a079ed8ce Mon Sep 17 00:00:00 2001 From: "cmzmasek@gmail.com" Date: Sat, 17 Sep 2011 03:19:09 +0000 Subject: [PATCH] in progress --- .../analysis/AncestralTaxonomyInference.java | 10 +++++----- .../forester/application/simple_node_processor.java | 18 +++++++++--------- .../forester/archaeopteryx/MainFrameApplication.java | 2 +- .../org/forester/archaeopteryx/NodeEditPanel.java | 11 ++++------- .../src/org/forester/archaeopteryx/NodePanel.java | 7 ++----- .../src/org/forester/archaeopteryx/TreePanel.java | 2 +- .../archaeopteryx/tools/TaxonomyDataObtainer.java | 2 +- .../src/org/forester/phylogeny/PhylogenyNode.java | 9 +-------- .../src/org/forester/ws/uniprot/UniProtTaxonomy.java | 8 ++++---- 9 files changed, 28 insertions(+), 41 deletions(-) diff --git a/forester/java/src/org/forester/analysis/AncestralTaxonomyInference.java b/forester/java/src/org/forester/analysis/AncestralTaxonomyInference.java index fb34a14..e422508 100644 --- a/forester/java/src/org/forester/analysis/AncestralTaxonomyInference.java +++ b/forester/java/src/org/forester/analysis/AncestralTaxonomyInference.java @@ -203,11 +203,11 @@ public final class AncestralTaxonomyInference { node = "[" + desc.getId() + "]"; } msg = "Node " + node + " has no or inappropriate taxonomic information"; - List e = desc.getAllExternalDescendants(); + final List e = desc.getAllExternalDescendants(); //TODO remove me! System.out.println(); int x = 0; - for( PhylogenyNode object : e ) { + for( final PhylogenyNode object : e ) { System.out.println( x + ":" ); System.out.println( object.getName() + " " ); x++; @@ -232,10 +232,10 @@ public final class AncestralTaxonomyInference { if ( last_common_lineage == null ) { System.out.println( "No common lineage for:" ); int counter = 0; - for( String[] strings : lineages ) { + for( final String[] strings : lineages ) { System.out.print( counter + ": " ); ++counter; - for( String string : strings ) { + for( final String string : strings ) { System.out.print( string + " " ); } System.out.println(); @@ -328,7 +328,7 @@ public final class AncestralTaxonomyInference { } } if ( delete ) { - for( PhylogenyNode node : not_found_external_nodes ) { + for( final PhylogenyNode node : not_found_external_nodes ) { phy.deleteSubtree( node, false ); } phy.recalculateNumberOfExternalDescendants( true ); diff --git a/forester/java/src/org/forester/application/simple_node_processor.java b/forester/java/src/org/forester/application/simple_node_processor.java index c7e495a..5fc4180 100644 --- a/forester/java/src/org/forester/application/simple_node_processor.java +++ b/forester/java/src/org/forester/application/simple_node_processor.java @@ -43,22 +43,22 @@ public class simple_node_processor { File in = null; File out = null; if ( ( args.length != 2 ) ) { - // System.exit( -1 ); + // System.exit( -1 ); if ( ( args.length == 0 ) ) { - in = new File("C:\\Users\\zma\\dollo.xml"); + in = new File( "C:\\Users\\zma\\dollo.xml" ); out = null; } } try { - System.out.println( "..."); + System.out.println( "..." ); CommandLineArguments cla = null; cla = new CommandLineArguments( args ); - // in = cla.getFile( 0 ); - // out = cla.getFile( 1 ); - // if ( out.exists() ) { - // System.out.println( out + " already exists" ); - // System.exit( -1 ); - // } + // in = cla.getFile( 0 ); + // out = cla.getFile( 1 ); + // if ( out.exists() ) { + // System.out.println( out + " already exists" ); + // System.exit( -1 ); + // } final PhylogenyFactory factory = ParserBasedPhylogenyFactory.getInstance(); final PhyloXmlParser xml_parser = new PhyloXmlParser(); final Phylogeny[] phylogenies_0 = factory.create( in, xml_parser ); diff --git a/forester/java/src/org/forester/archaeopteryx/MainFrameApplication.java b/forester/java/src/org/forester/archaeopteryx/MainFrameApplication.java index 97a7a7a..5c4d546 100644 --- a/forester/java/src/org/forester/archaeopteryx/MainFrameApplication.java +++ b/forester/java/src/org/forester/archaeopteryx/MainFrameApplication.java @@ -245,7 +245,7 @@ public final class MainFrameApplication extends MainFrame { MainFrameApplication.class ); UIManager.setLookAndFeel( synth ); } - catch ( Exception ex ) { + catch ( final Exception ex ) { synth_exception = true; ForesterUtil.printWarningMessage( Constants.PRG_NAME, "could not create synth look and feel: " diff --git a/forester/java/src/org/forester/archaeopteryx/NodeEditPanel.java b/forester/java/src/org/forester/archaeopteryx/NodeEditPanel.java index a485376..f4bbca8 100644 --- a/forester/java/src/org/forester/archaeopteryx/NodeEditPanel.java +++ b/forester/java/src/org/forester/archaeopteryx/NodeEditPanel.java @@ -185,14 +185,11 @@ class NodeEditPanel extends JPanel { PHYLOXML_TAG.CONFIDENCE_TYPE, counter ); String bw = "1"; - if ( phylogeny_node.getBranchData().getBranchWidth() != null - && phylogeny_node.getBranchData().getBranchWidth().getValue() != BranchWidth.BRANCH_WIDTH_DEFAULT_VALUE - ) - { + if ( ( phylogeny_node.getBranchData().getBranchWidth() != null ) + && ( phylogeny_node.getBranchData().getBranchWidth().getValue() != BranchWidth.BRANCH_WIDTH_DEFAULT_VALUE ) ) { bw = ForesterUtil.FORMATTER_3.format( phylogeny_node.getBranchData().getBranchWidth().getValue() ); } addSubelementEditable( category, NodePanel.NODE_BRANCH_WIDTH, bw, PHYLOXML_TAG.NODE_BRANCH_WIDTH ); - } // private void addAnnotation( final DefaultMutableTreeNode top, final Annotation ann, final String name ) { @@ -679,7 +676,7 @@ class NodeEditPanel extends JPanel { try { final double bw = ForesterUtil.parseDouble( value ); if ( bw >= 0 ) { - getMyNode().getBranchData().setBranchWidth( new BranchWidth(bw ) ); + getMyNode().getBranchData().setBranchWidth( new BranchWidth( bw ) ); } } catch ( final ParseException e ) { @@ -690,7 +687,7 @@ class NodeEditPanel extends JPanel { mtn.setUserObject( "" ); } } - break; + break; case CONFIDENCE_VALUE: double confidence = Confidence.CONFIDENCE_DEFAULT_VALUE; if ( !ForesterUtil.isEmpty( value ) ) { diff --git a/forester/java/src/org/forester/archaeopteryx/NodePanel.java b/forester/java/src/org/forester/archaeopteryx/NodePanel.java index 7646342..0cc491c 100644 --- a/forester/java/src/org/forester/archaeopteryx/NodePanel.java +++ b/forester/java/src/org/forester/archaeopteryx/NodePanel.java @@ -226,7 +226,6 @@ class NodePanel extends JPanel implements TreeSelectionListener { addSubelement( category, CONFIDENCE, conf.asText().toString() ); } } - if ( !phylogeny_node.isExternal() ) { addSubelement( category, "Children", String.valueOf( phylogeny_node.getNumberOfDescendants() ) ); addSubelement( category, @@ -261,10 +260,8 @@ class NodePanel extends JPanel implements TreeSelectionListener { ForesterUtil.FORMATTER_3.format( phylogeny_node.getBranchData().getBranchWidth().getValue() ) ); } if ( ( phylogeny_node.getBranchData().getBranchColor() != null ) ) { - Color c = phylogeny_node.getBranchData().getBranchColor().getValue(); - addSubelement( category, - NODE_BRANCH_COLOR, - c.getRed() + ", " + c.getGreen() + ", "+ c.getBlue() ); + final Color c = phylogeny_node.getBranchData().getBranchColor().getValue(); + addSubelement( category, NODE_BRANCH_COLOR, c.getRed() + ", " + c.getGreen() + ", " + c.getBlue() ); } } diff --git a/forester/java/src/org/forester/archaeopteryx/TreePanel.java b/forester/java/src/org/forester/archaeopteryx/TreePanel.java index 086fb1a..9680205 100644 --- a/forester/java/src/org/forester/archaeopteryx/TreePanel.java +++ b/forester/java/src/org/forester/archaeopteryx/TreePanel.java @@ -2436,7 +2436,7 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee final boolean to_pdf, final boolean to_graphics_file ) { final int circ_num_ext_nodes = phy.getNumberOfExternalNodes() - _collapsed_external_nodeid_set.size(); - System.out.println( "# collapsed external = " + _collapsed_external_nodeid_set.size() ); + System.out.println( "# collapsed external = " + _collapsed_external_nodeid_set.size() ); _root = phy.getRoot(); _root.setXcoord( center_x ); _root.setYcoord( center_y ); diff --git a/forester/java/src/org/forester/archaeopteryx/tools/TaxonomyDataObtainer.java b/forester/java/src/org/forester/archaeopteryx/tools/TaxonomyDataObtainer.java index 952d3fa..3101295 100644 --- a/forester/java/src/org/forester/archaeopteryx/tools/TaxonomyDataObtainer.java +++ b/forester/java/src/org/forester/archaeopteryx/tools/TaxonomyDataObtainer.java @@ -48,7 +48,7 @@ public class TaxonomyDataObtainer implements Runnable { public TaxonomyDataObtainer( final MainFrameApplication mf, final TreePanel treepanel, final Phylogeny phy, - boolean delete ) { + final boolean delete ) { _phy = phy; _mf = mf; _treepanel = treepanel; diff --git a/forester/java/src/org/forester/phylogeny/PhylogenyNode.java b/forester/java/src/org/forester/phylogeny/PhylogenyNode.java index dd3dba0..7c272e6 100644 --- a/forester/java/src/org/forester/phylogeny/PhylogenyNode.java +++ b/forester/java/src/org/forester/phylogeny/PhylogenyNode.java @@ -27,17 +27,13 @@ package org.forester.phylogeny; -import java.io.IOException; import java.util.ArrayList; import java.util.List; -import org.forester.archaeopteryx.Archaeopteryx; import org.forester.io.parsers.nhx.NHXFormatException; import org.forester.io.parsers.nhx.NHXParser; import org.forester.phylogeny.data.BranchData; import org.forester.phylogeny.data.NodeData; -import org.forester.phylogeny.factories.ParserBasedPhylogenyFactory; -import org.forester.phylogeny.factories.PhylogenyFactory; import org.forester.phylogeny.iterators.ChildNodeIteratorForward; import org.forester.phylogeny.iterators.PhylogenyNodeIterator; import org.forester.phylogeny.iterators.PreorderTreeIterator; @@ -457,10 +453,7 @@ public class PhylogenyNode implements PhylogenyNodeI, Comparable } return current_node; } - - - - + public final NodeData getNodeData() { if ( _node_data == null ) { _node_data = new NodeData(); diff --git a/forester/java/src/org/forester/ws/uniprot/UniProtTaxonomy.java b/forester/java/src/org/forester/ws/uniprot/UniProtTaxonomy.java index 5e9053a..57a483e 100644 --- a/forester/java/src/org/forester/ws/uniprot/UniProtTaxonomy.java +++ b/forester/java/src/org/forester/ws/uniprot/UniProtTaxonomy.java @@ -100,7 +100,7 @@ public final class UniProtTaxonomy { } } for( int i = 0; i < temp.size(); ++i ) { - if ( i == 0 + if ( ( i == 0 ) && ( temp.get( i ).equalsIgnoreCase( EUKARYOTA ) || temp.get( i ).equalsIgnoreCase( BACTERIA ) || temp .get( i ).equalsIgnoreCase( ARCHAEA ) ) ) { _lineage.add( CELLULAR_ORGANISMS ); @@ -144,7 +144,7 @@ public final class UniProtTaxonomy { final String rank, final String id ) { _lineage = new ArrayList(); - for( String l : lineage ) { + for( final String l : lineage ) { _lineage.add( l ); } _code = code; @@ -187,9 +187,9 @@ public final class UniProtTaxonomy { } public String[] getLineageAsArray() { - String[] str = new String[ _lineage.size() ]; + final String[] str = new String[ _lineage.size() ]; int i = 0; - for( String l : _lineage ) { + for( final String l : _lineage ) { str[ i++ ] = l; } return str; -- 1.7.10.2