Merge branch 'develop' of https://source.jalview.org/git/jalview.git into kjvdh/featu...
authorkjvdheide <kjvanderheide@dundee.ac.uk>
Wed, 11 Oct 2017 19:28:38 +0000 (20:28 +0100)
committerkjvdheide <kjvanderheide@dundee.ac.uk>
Wed, 11 Oct 2017 19:28:38 +0000 (20:28 +0100)
19 files changed:
.classpath
.project
.settings/org.eclipse.jdt.core.prefs
.settings/org.eclipse.jdt.ui.prefs
src/jalview/analysis/TreeBuilder.java
src/jalview/analysis/TreeCalculator.java [new file with mode: 0644]
src/jalview/analysis/TreeModel.java
src/jalview/appletgui/TreePanel.java
src/jalview/ext/archaeopteryx/AlignToArchaeopteryxConverter.java [new file with mode: 0644]
src/jalview/ext/archaeopteryx/AlignToTreeViewerConverterI.java [new file with mode: 0644]
src/jalview/ext/archaeopteryx/ArchaeopteryxNewickInit.java [new file with mode: 0644]
src/jalview/ext/archaeopteryx/ArchaeopteryxTreeBuilder.java [new file with mode: 0644]
src/jalview/ext/archaeopteryx/TreeViewerBindingI.java [new file with mode: 0644]
src/jalview/gui/AlignFrame.java
src/jalview/gui/CalculationChooser.java
src/jalview/gui/TreePanel.java
src/jalview/gui/TreeParams.java [new file with mode: 0644]
src/jalview/io/NewickFile.java
test/jalview/io/NewickFileTests.java

index c4a2832..42e9500 100644 (file)
@@ -69,5 +69,6 @@
        <classpathentry kind="lib" path="lib/biojava-core-4.1.0.jar"/>
        <classpathentry kind="lib" path="lib/biojava-ontology-4.1.0.jar"/>
        <classpathentry kind="lib" path="lib/groovy-all-2.4.6-indy.jar"/>
+       <classpathentry combineaccessrules="false" kind="src" path="/forester"/>
        <classpathentry kind="output" path="classes"/>
 </classpath>
index d0dfc7e..b24880a 100644 (file)
--- a/.project
+++ b/.project
@@ -3,6 +3,7 @@
        <name>Jalview Release 2.7</name>
        <comment></comment>
        <projects>
+               <project>forester</project>
        </projects>
        <buildSpec>
                <buildCommand>
index 8a5e7a7..64e4e60 100644 (file)
@@ -10,6 +10,7 @@ org.eclipse.jdt.core.compiler.debug.sourceFile=generate
 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
 org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
 org.eclipse.jdt.core.compiler.source=1.7
+org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647
 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=52
@@ -23,8 +24,10 @@ org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
 org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
 org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16
 org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header=0
 org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
 org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_parameterized_type_references=0
 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
 org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80
@@ -34,6 +37,8 @@ org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration
 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_type_arguments=0
+org.eclipse.jdt.core.formatter.alignment_for_type_parameters=0
 org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16
 org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
 org.eclipse.jdt.core.formatter.blank_lines_after_package=1
@@ -60,6 +65,7 @@ org.eclipse.jdt.core.formatter.brace_position_for_switch=next_line
 org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=next_line
 org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
 org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
+org.eclipse.jdt.core.formatter.comment.count_line_length_from_starting_position=false
 org.eclipse.jdt.core.formatter.comment.format_block_comments=false
 org.eclipse.jdt.core.formatter.comment.format_header=false
 org.eclipse.jdt.core.formatter.comment.format_html=true
@@ -92,6 +98,7 @@ org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
 org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
 org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
 org.eclipse.jdt.core.formatter.indentation.size=8
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_enum_constant=insert
 org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
 org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
 org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
@@ -286,11 +293,24 @@ org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
 org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
 org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
 org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
+org.eclipse.jdt.core.formatter.parentheses_positions_in_annotation=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_catch_clause=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_enum_constant_declaration=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_for_statment=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_if_while_statement=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_lambda_declaration=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_method_delcaration=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_method_invocation=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_switch_statement=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_try_clause=common_lines
 org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
 org.eclipse.jdt.core.formatter.tabulation.char=space
 org.eclipse.jdt.core.formatter.tabulation.size=2
 org.eclipse.jdt.core.formatter.use_on_off_tags=true
 org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
+org.eclipse.jdt.core.formatter.wrap_before_assignment_operator=false
 org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=true
 org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
 org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
+org.eclipse.jdt.core.javaFormatter=org.eclipse.jdt.core.defaultJavaFormatter
index 30e76be..699fd4a 100644 (file)
@@ -1,7 +1,7 @@
 eclipse.preferences.version=1
 editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
 formatter_profile=_Jalview
-formatter_settings_version=12
+formatter_settings_version=13
 org.eclipse.jdt.ui.ignorelowercasenames=true
 org.eclipse.jdt.ui.importorder=jalview;java;javax;org;com;
 org.eclipse.jdt.ui.ondemandthreshold=99
index 0601dd9..728dd62 100644 (file)
@@ -73,7 +73,7 @@ public abstract class TreeBuilder
 
   Vector<SequenceNode> node;
 
-  private AlignmentView seqStrings;
+  private AlignmentView seqStrings; // redundant? (see seqData)
 
   /**
    * Constructor
@@ -364,7 +364,7 @@ public abstract class TreeBuilder
 
   protected void init(AlignmentView seqView, int start, int end)
   {
-    this.node = new Vector<SequenceNode>();
+    this.node = new Vector<>();
     if (seqView != null)
     {
       this.seqData = seqView;
@@ -458,7 +458,7 @@ public abstract class TreeBuilder
    */
   void makeLeaves()
   {
-    clusters = new Vector<BitSet>();
+    clusters = new Vector<>();
 
     for (int i = 0; i < noseqs; i++)
     {
@@ -467,6 +467,7 @@ public abstract class TreeBuilder
       sn.setElement(sequences[i]);
       sn.setName(sequences[i].getName());
       node.addElement(sn);
+
       BitSet bs = new BitSet();
       bs.set(i);
       clusters.addElement(bs);
diff --git a/src/jalview/analysis/TreeCalculator.java b/src/jalview/analysis/TreeCalculator.java
new file mode 100644 (file)
index 0000000..84deba2
--- /dev/null
@@ -0,0 +1,105 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer ($Version-Rel$)
+ * Copyright (C) $Year-Rel$ The Jalview Authors
+ * 
+ * This file is part of Jalview.
+ * 
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License 
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *  
+ * Jalview is distributed in the hope that it will be useful, but 
+ * WITHOUT ANY WARRANTY; without even the implied warranty 
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
+ * PURPOSE.  See the GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.analysis;
+
+import jalview.analysis.scoremodels.ScoreModels;
+import jalview.api.analysis.ScoreModelI;
+import jalview.api.analysis.SimilarityParamsI;
+import jalview.gui.AlignViewport;
+
+/**
+ * @author kjvanderheide
+ *
+ */
+public class TreeCalculator extends Thread// add threading
+{
+  SimilarityParamsI similarityParams;
+
+  String treeType;
+
+  String scoreModelName; // if tree computed
+
+  /**
+   * 
+   * @param treeAlgo
+   * @param substitutionMatrix
+   * @param calculateParams
+   */
+  public TreeCalculator(String treeAlgo, String substitutionMatrix,
+          SimilarityParamsI calculateParams)
+  {
+    this.treeType = treeAlgo;
+    this.scoreModelName = substitutionMatrix;
+    this.similarityParams = calculateParams;
+  }
+
+  /**
+   * 
+   * @param alignViewport
+   * @return
+   */
+  public TreeBuilder makeTree(AlignViewport alignViewport)
+  {
+    ScoreModelI sm = ScoreModels.getInstance().getScoreModel(scoreModelName,
+            alignViewport.getAlignPanel());
+
+    TreeBuilder builtTree = treeType.equals(TreeBuilder.NEIGHBOUR_JOINING)
+            ? new NJTree(alignViewport, sm, similarityParams)
+            : new AverageDistanceTree(alignViewport, sm, similarityParams);
+
+    return builtTree;
+
+  }
+
+  public SimilarityParamsI getSimilarityParams()
+  {
+    return similarityParams;
+  }
+
+  public void setSimilarityParams(SimilarityParamsI similarityParams)
+  {
+    this.similarityParams = similarityParams;
+  }
+
+  public String getTreeType()
+  {
+    return treeType;
+  }
+
+  public void setTreeType(String treeType)
+  {
+    this.treeType = treeType;
+  }
+
+  public String getScoreModelName()
+  {
+    return scoreModelName;
+  }
+
+  public void setScoreModelName(String scoreModelName)
+  {
+    this.scoreModelName = scoreModelName;
+  }
+
+
+
+
+}
index a50634e..b6c9caa 100644 (file)
@@ -80,8 +80,8 @@ public class TreeModel
   public TreeModel(SequenceI[] seqs, AlignmentView odata,
           NewickFile treefile)
   {
-    this(seqs, treefile.getTree(), treefile.HasDistances(),
-            treefile.HasBootstrap(), treefile.HasRootDistance());
+    this(seqs, treefile.getTree(), treefile.hasDistances(),
+            treefile.hasBootstrap(), treefile.hasRootDistance());
     seqData = odata;
 
     associateLeavesToSequences(seqs);
@@ -97,6 +97,7 @@ public class TreeModel
     this(tree.getSequences(), tree.getTopNode(), tree.hasDistances(),
             tree.hasBootstrap(), tree.hasRootDistance());
     seqData = tree.getOriginalData();
+
   }
 
   /**
@@ -136,7 +137,7 @@ public class TreeModel
     SequenceNode j;
     SequenceI nam;
     String realnam;
-    Vector<SequenceI> one2many = new Vector<SequenceI>();
+    Vector<SequenceI> one2many = new Vector<>();
     // int countOne2Many = 0;
     while (i < leaves.size())
     {
@@ -295,7 +296,7 @@ public class TreeModel
    */
   public Vector<SequenceNode> findLeaves(SequenceNode nd)
   {
-    Vector<SequenceNode> leaves = new Vector<SequenceNode>();
+    Vector<SequenceNode> leaves = new Vector<>();
     findLeaves(nd, leaves);
     return leaves;
   }
@@ -389,7 +390,7 @@ public class TreeModel
    */
   public List<SequenceNode> groupNodes(float threshold)
   {
-    List<SequenceNode> groups = new ArrayList<SequenceNode>();
+    List<SequenceNode> groups = new ArrayList<>();
     _groupNodes(groups, getTopNode(), threshold);
     return groups;
   }
index b5e3342..f6bc265 100644 (file)
@@ -207,12 +207,12 @@ public class TreePanel extends EmbmenuFrame
       {
         // Set default view, paying lip service to any overriding tree view
         // parameter settings
-        boolean showDist = newtree.HasDistances()
+        boolean showDist = newtree.hasDistances()
                 && av.applet.getDefaultParameter("showTreeDistances",
-                        newtree.HasDistances());
-        boolean showBoots = newtree.HasBootstrap()
+                        newtree.hasDistances());
+        boolean showBoots = newtree.hasBootstrap()
                 && av.applet.getDefaultParameter("showTreeBootstraps",
-                        newtree.HasBootstrap());
+                        newtree.hasBootstrap());
         distanceMenu.setState(showDist);
         bootstrapMenu.setState(showBoots);
         treeCanvas.setShowBootstrap(showBoots);
diff --git a/src/jalview/ext/archaeopteryx/AlignToArchaeopteryxConverter.java b/src/jalview/ext/archaeopteryx/AlignToArchaeopteryxConverter.java
new file mode 100644 (file)
index 0000000..b90cf4b
--- /dev/null
@@ -0,0 +1,6 @@
+package jalview.ext.archaeopteryx;
+
+public class AlignToArchaeopteryxConverter
+{
+
+}
diff --git a/src/jalview/ext/archaeopteryx/AlignToTreeViewerConverterI.java b/src/jalview/ext/archaeopteryx/AlignToTreeViewerConverterI.java
new file mode 100644 (file)
index 0000000..60a4a1f
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
+ * 
+ * This file is part of Jalview.
+ * 
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License 
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *  
+ * Jalview is distributed in the hope that it will be useful, but 
+ * WITHOUT ANY WARRANTY; without even the implied warranty 
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
+ * PURPOSE.  See the GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.ext.archaeopteryx;
+
+import java.util.Collection;
+
+interface AlignToTreeViewerConverterI
+{
+  public void rootNode(Object node);
+
+  public Object makeTreeNode(String nodeName);
+
+  public Object addNodeChild(Object childNode, Object parentNode);
+  
+  public Collection<?> getNodes();
+
+}
diff --git a/src/jalview/ext/archaeopteryx/ArchaeopteryxNewickInit.java b/src/jalview/ext/archaeopteryx/ArchaeopteryxNewickInit.java
new file mode 100644 (file)
index 0000000..eb4af6f
--- /dev/null
@@ -0,0 +1,123 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
+ * 
+ * This file is part of Jalview.
+ * 
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License 
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *  
+ * Jalview is distributed in the hope that it will be useful, but 
+ * WITHOUT ANY WARRANTY; without even the implied warranty 
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
+ * PURPOSE.  See the GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.ext.archaeopteryx;
+
+import jalview.analysis.TreeModel;
+import jalview.io.NewickFile;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.PrintWriter;
+
+import org.forester.archaeopteryx.Archaeopteryx;
+
+public class ArchaeopteryxNewickInit
+{
+  private String filePath = "/tmp/jalviewtree.nwk";
+
+  private TreeModel tree;
+
+  private NewickFile newickTree;
+
+  public ArchaeopteryxNewickInit(TreeModel jalviewTreeModel)
+  {
+    this.tree = jalviewTreeModel;
+    this.newickTree = treeToNewick(tree);
+  }
+
+  public ArchaeopteryxNewickInit(NewickFile newickTreeModel)
+  {
+    this.newickTree = newickTreeModel;
+  }
+
+  public void startArchaeopteryx()
+  {
+    String newickOutput = newickTree.print(newickTree.hasBootstrap(),
+            newickTree.hasDistances(), newickTree.hasRootDistance());
+
+    File newickFile = new File(filePath);
+    PrintWriter writer;
+
+    try
+    {
+      writer = new PrintWriter(newickFile);
+      writer.println(newickOutput);
+
+      writer.close();
+
+      String[] commandLineArgs = { "-open", newickFile.getCanonicalPath() };
+      Archaeopteryx.main(commandLineArgs);
+
+    } catch (FileNotFoundException e)
+    {
+      // TODO Auto-generated catch block
+      e.printStackTrace();
+    } catch (IOException e)
+    {
+      // TODO Auto-generated catch block
+      e.printStackTrace();
+    }
+
+
+  }
+
+
+  public String getFilePath()
+  {
+    return filePath;
+  }
+
+  public void setFilePath(String newFilePath)
+  {
+    this.filePath = newFilePath;
+  }
+
+  public TreeModel getTree()
+  {
+    return tree;
+  }
+
+  public void setTree(TreeModel newTree)
+  {
+    this.tree = newTree;
+  }
+
+  public NewickFile getNewickTree()
+  {
+    return newickTree;
+  }
+
+  public void setNewickTree(NewickFile newNewickTree)
+  {
+    this.newickTree = newNewickTree;
+  }
+
+  public static NewickFile treeToNewick(TreeModel tree)
+  {
+    NewickFile newickTree = new NewickFile(tree.getTopNode(),
+            tree.hasBootstrap(), tree.hasDistances(),
+            tree.hasRootDistance());
+
+    return newickTree;
+  }
+
+}
\ No newline at end of file
diff --git a/src/jalview/ext/archaeopteryx/ArchaeopteryxTreeBuilder.java b/src/jalview/ext/archaeopteryx/ArchaeopteryxTreeBuilder.java
new file mode 100644 (file)
index 0000000..fb1ebe3
--- /dev/null
@@ -0,0 +1,108 @@
+package jalview.ext.archaeopteryx;
+
+import jalview.analysis.TreeBuilder;
+import jalview.datamodel.SequenceI;
+import jalview.math.MatrixI;
+
+import org.forester.io.parsers.SymmetricalDistanceMatrixParser;
+import org.forester.msa.Msa;
+import org.forester.phylogeny.Phylogeny;
+import org.forester.phylogeny.PhylogenyNode;
+
+public class ArchaeopteryxTreeBuilder // cannot inherit
+                                                        // TreeBuilder as that
+                                                        // demands the use of
+                                                        // SequenceNode (instead
+                                                        // of PhylogenyNode)
+{
+  protected SequenceI[] sequences;
+
+  private Phylogeny aptxTree;
+
+  private PhylogenyNode rootNode;
+
+  protected MatrixI distances;
+
+  protected Msa msa;
+
+  protected SymmetricalDistanceMatrixParser distanceParser = SymmetricalDistanceMatrixParser
+          .createInstance();
+
+
+  public ArchaeopteryxTreeBuilder()
+  {
+
+    this.rootNode = new PhylogenyNode();
+    this.aptxTree = new Phylogeny();
+
+  }
+
+  public ArchaeopteryxTreeBuilder(PhylogenyNode treeRoot)
+  {
+
+    this.rootNode = treeRoot;
+    this.aptxTree = new Phylogeny();
+
+  }
+
+  public Phylogeny buildAptxTree(TreeBuilder tree)
+  {
+    this.sequences = tree.getSequences();
+    aptxTree.setName("word");
+    return buildAptxTree(sequences);
+
+  }
+
+  public Phylogeny buildAptxTree(SequenceI[] sequences)
+  {
+
+    for (SequenceI sequence : sequences)
+    {
+      PhylogenyNode treeNode = new PhylogenyNode();
+      treeNode.setName(sequence.getName());
+      rootNode.addAsChild(treeNode);
+
+    }
+
+    aptxTree.setRoot(rootNode);
+    return aptxTree;
+
+  }
+
+  /**
+   * Formats a localised title for the tree panel, like
+   * <p>
+   * Neighbour Joining Using BLOSUM62
+   * <p>
+   * For a tree loaded from file, just uses the file name
+   * 
+   * @return
+   */
+  // public String getPanelTitle()
+  // {
+  // if (treeTitle != null)
+  // {
+  // return treeTitle;
+  // }
+  // else
+  // {
+  // /*
+  // * i18n description of Neighbour Joining or Average Distance method
+  // */
+  // String treecalcnm = MessageManager
+  // .getString("label.tree_calc_" + treeType.toLowerCase());
+  //
+  // /*
+  // * short score model name (long description can be too long)
+  // */
+  // String smn = substitutionMatrix;
+  //
+  // /*
+  // * put them together as <method> Using <model>
+  // */
+  // final String ttl = MessageManager
+  // .formatMessage("label.treecalc_title", treecalcnm, smn);
+  // return ttl;
+  // }
+  // }
+}
diff --git a/src/jalview/ext/archaeopteryx/TreeViewerBindingI.java b/src/jalview/ext/archaeopteryx/TreeViewerBindingI.java
new file mode 100644 (file)
index 0000000..eb35894
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
+ * 
+ * This file is part of Jalview.
+ * 
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License 
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *  
+ * Jalview is distributed in the hope that it will be useful, but 
+ * WITHOUT ANY WARRANTY; without even the implied warranty 
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
+ * PURPOSE.  See the GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.ext.archaeopteryx;
+
+interface TreeViewerBindingI
+{
+
+}
index 13b715e..8f10621 100644 (file)
@@ -26,6 +26,7 @@ import jalview.analysis.CrossRef;
 import jalview.analysis.Dna;
 import jalview.analysis.ParseProperties;
 import jalview.analysis.SequenceIdMatcher;
+import jalview.analysis.TreeModel;
 import jalview.api.AlignExportSettingI;
 import jalview.api.AlignViewControllerGuiI;
 import jalview.api.AlignViewControllerI;
@@ -34,7 +35,6 @@ import jalview.api.AlignmentViewPanel;
 import jalview.api.FeatureSettingsControllerI;
 import jalview.api.SplitContainerI;
 import jalview.api.ViewStyleI;
-import jalview.api.analysis.SimilarityParamsI;
 import jalview.bin.Cache;
 import jalview.bin.Jalview;
 import jalview.commands.CommandI;
@@ -3553,18 +3553,19 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
     viewport.followSelection = listenToViewSelections.isSelected();
   }
 
+
   /**
    * Constructs a tree panel and adds it to the desktop
    * 
-   * @param type
-   *          tree type (NJ or AV)
-   * @param modelName
-   *          name of score model used to compute the tree
-   * @param options
-   *          parameters for the distance or similarity calculation
+   * @param params
+   * @param treeAlgo
+   * 
+   * @param tree
+   * 
+   * 
    */
-  void newTreePanel(String type, String modelName,
-          SimilarityParamsI options)
+  void newTreePanel(TreeModel tree, String treeAlgo,
+          String substitutionMatrix)
   {
     String frameTitle = "";
     TreePanel tp;
@@ -3600,7 +3601,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
       }
     }
 
-    tp = new TreePanel(alignPanel, type, modelName, options);
+    tp = new TreePanel(alignPanel, tree, treeAlgo, substitutionMatrix);
     frameTitle = tp.getPanelTitle() + (onSelection ? " on region" : "");
 
     frameTitle += " from ";
@@ -4031,6 +4032,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
           final JMenu seqsrchmenu = new JMenu("Sequence Database Search");
           final JMenu analymenu = new JMenu("Analysis");
           final JMenu dismenu = new JMenu("Protein Disorder");
+          final JMenu phylogenmenu = new JMenu("Phylogenetic inference");
+
           // JAL-940 - only show secondary structure prediction services from
           // the legacy server
           if (// Cache.getDefault("SHOW_JWS1_SERVICES", true)
@@ -4071,6 +4074,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
           wsmenu.add(secstrmenu);
           wsmenu.add(dismenu);
           wsmenu.add(analymenu);
+          wsmenu.add(phylogenmenu);
           // No search services yet
           // wsmenu.add(seqsrchmenu);
 
index a9f3966..1192fc8 100644 (file)
 package jalview.gui;
 
 import jalview.analysis.TreeBuilder;
+import jalview.analysis.TreeCalculator;
+import jalview.analysis.TreeModel;
 import jalview.analysis.scoremodels.ScoreModels;
 import jalview.analysis.scoremodels.SimilarityParams;
 import jalview.api.analysis.ScoreModelI;
 import jalview.api.analysis.SimilarityParamsI;
 import jalview.datamodel.SequenceGroup;
+import jalview.ext.archaeopteryx.ArchaeopteryxTreeBuilder;
 import jalview.util.MessageManager;
 
 import java.awt.BorderLayout;
@@ -60,6 +63,9 @@ import javax.swing.JRadioButton;
 import javax.swing.event.InternalFrameAdapter;
 import javax.swing.event.InternalFrameEvent;
 
+import org.forester.archaeopteryx.Archaeopteryx;
+import org.forester.phylogeny.Phylogeny;
+
 /**
  * A dialog where a user can choose and action Tree or PCA calculation options
  */
@@ -103,7 +109,7 @@ public class CalculationChooser extends JPanel
 
   final ComboBoxTooltipRenderer renderer = new ComboBoxTooltipRenderer();
 
-  List<String> tips = new ArrayList<String>();
+  List<String> tips = new ArrayList<>();
 
   /**
    * Constructor
@@ -370,7 +376,7 @@ public class CalculationChooser extends JPanel
    */
   protected JComboBox<String> buildModelOptionsList()
   {
-    final JComboBox<String> scoreModelsCombo = new JComboBox<String>();
+    final JComboBox<String> scoreModelsCombo = new JComboBox<>();
     scoreModelsCombo.setRenderer(renderer);
 
     /*
@@ -413,7 +419,7 @@ public class CalculationChooser extends JPanel
   {
     Object curSel = comboBox.getSelectedItem();
     toolTips.clear();
-    DefaultComboBoxModel<String> model = new DefaultComboBoxModel<String>();
+    DefaultComboBoxModel<String> model = new DefaultComboBoxModel<>();
 
     /*
      * now we can actually add entries to the combobox,
@@ -460,34 +466,46 @@ public class CalculationChooser extends JPanel
   protected void calculate_actionPerformed()
   {
     boolean doPCA = pca.isSelected();
-    String modelName = modelNames.getSelectedItem().toString();
+    String substitutionMatrix = modelNames.getSelectedItem().toString();
     SimilarityParamsI params = getSimilarityParameters(doPCA);
 
     if (doPCA)
     {
-      openPcaPanel(modelName, params);
+      openPcaPanel(substitutionMatrix, params);
     }
     else
     {
-      openTreePanel(modelName, params);
+
+      String treeAlgo = determineTreeAlgo();
+      TreeCalculator treeCalculator = new TreeCalculator(treeAlgo,
+              substitutionMatrix, params);
+      TreeBuilder calculatedTree = treeCalculator
+              .makeTree(af.getViewport());
+      TreeModel tree = new TreeModel(calculatedTree);
+      openTreePanel(tree, treeAlgo, substitutionMatrix);
+
+      ArchaeopteryxTreeBuilder aptxTreeBuilder = new ArchaeopteryxTreeBuilder();
+      Phylogeny aptxTree = aptxTreeBuilder.buildAptxTree(calculatedTree);
+      Archaeopteryx.createApplication(aptxTree);
+
+
     }
 
     // closeFrame();
   }
 
-  /**
-   * Open a new Tree panel on the desktop
-   * 
-   * @param modelName
-   * @param params
-   */
-  protected void openTreePanel(String modelName, SimilarityParamsI params)
+  protected String determineTreeAlgo() // to be modified & expanded
+  {
+    String treeAlgorithm = neighbourJoining.isSelected()
+            ? TreeBuilder.NEIGHBOUR_JOINING
+            : TreeBuilder.AVERAGE_DISTANCE;
+
+    return treeAlgorithm;
+
+  }
+
+  protected void checkEnoughSequences(AlignViewport viewport)
   {
-    /*
-     * gui validation shouldn't allow insufficient sequences here, but leave
-     * this check in in case this method gets exposed programmatically in future
-     */
-    AlignViewport viewport = af.getViewport();
     SequenceGroup sg = viewport.getSelectionGroup();
     if (sg != null && sg.getSize() < MIN_TREE_SELECTION)
     {
@@ -499,11 +517,25 @@ public class CalculationChooser extends JPanel
               JvOptionPane.WARNING_MESSAGE);
       return;
     }
+  }
 
-    String treeType = neighbourJoining.isSelected()
-            ? TreeBuilder.NEIGHBOUR_JOINING
-            : TreeBuilder.AVERAGE_DISTANCE;
-    af.newTreePanel(treeType, modelName, params);
+  /**
+   * Open a new Tree panel on the desktop
+   * 
+   * @param tree
+   * @param params
+   * @param treeAlgo
+   */
+  protected void openTreePanel(TreeModel tree, String treeAlgo,
+          String substitutionMatrix)
+  {
+    /*
+     * gui validation shouldn't allow insufficient sequences here, but leave
+     * this check in in case this method gets exposed programmatically in future
+     */
+    checkEnoughSequences(af.getViewport());
+
+    af.newTreePanel(tree, treeAlgo, substitutionMatrix);
   }
 
   /**
@@ -576,6 +608,7 @@ public class CalculationChooser extends JPanel
      */
     boolean matchGap = doPCA ? false : treeMatchGaps;
 
+
     return new SimilarityParams(includeGapGap, matchGap, includeGapResidue,
             matchOnShortestLength);
   }
index 5e14fce..5fab37f 100755 (executable)
 package jalview.gui;
 
 import jalview.analysis.AlignmentSorter;
-import jalview.analysis.AverageDistanceTree;
-import jalview.analysis.NJTree;
-import jalview.analysis.TreeBuilder;
 import jalview.analysis.TreeModel;
-import jalview.analysis.scoremodels.ScoreModels;
-import jalview.api.analysis.ScoreModelI;
-import jalview.api.analysis.SimilarityParamsI;
 import jalview.bin.Cache;
 import jalview.commands.CommandI;
 import jalview.commands.OrderCommand;
@@ -41,6 +35,7 @@ import jalview.datamodel.NodeTransformI;
 import jalview.datamodel.SequenceFeature;
 import jalview.datamodel.SequenceI;
 import jalview.datamodel.SequenceNode;
+import jalview.ext.archaeopteryx.ArchaeopteryxNewickInit;
 import jalview.io.JalviewFileChooser;
 import jalview.io.JalviewFileView;
 import jalview.io.NewickFile;
@@ -74,14 +69,12 @@ import org.jibble.epsgraphics.EpsGraphics2D;
  */
 public class TreePanel extends GTreePanel
 {
-  String treeType;
+  String substitutionMatrix;
 
-  String scoreModelName; // if tree computed
+  String treeType;
 
   String treeTitle; // if tree loaded
 
-  SimilarityParamsI similarityParams;
-
   TreeCanvas treeCanvas;
 
   TreeModel tree;
@@ -92,28 +85,38 @@ public class TreePanel extends GTreePanel
    * Creates a new TreePanel object.
    * 
    * @param ap
-   * @param type
-   * @param modelName
-   * @param options
+   * @param tree
+   * @param treeType
+   * @param substitutionMatrix
    */
-  public TreePanel(AlignmentPanel ap, String type, String modelName,
-          SimilarityParamsI options)
+  public TreePanel(AlignmentPanel ap, TreeModel tree, String treeType,
+          String substitutionMatrix)
   {
     super();
-    this.similarityParams = options;
-    initTreePanel(ap, type, modelName, null, null);
+    this.treeType = treeType;
+    this.substitutionMatrix = substitutionMatrix;
+    this.tree = tree;
+    initNewTreePanel(ap, tree);
 
     // We know this tree has distances. JBPNote TODO: prolly should add this as
     // a userdefined default
     // showDistances(true);
   }
 
+  /**
+   * Creates a new TreePanel object.
+   * 
+   * @param alignPanel
+   * @param newtree
+   * @param theTitle
+   * @param inputData
+   */
   public TreePanel(AlignmentPanel alignPanel, NewickFile newtree,
           String theTitle, AlignmentView inputData)
   {
     super();
     this.treeTitle = theTitle;
-    initTreePanel(alignPanel, null, null, newtree, inputData);
+    initLoadedTreePanel(alignPanel, newtree, inputData);
   }
 
   public AlignmentI getAlignment()
@@ -126,17 +129,30 @@ public class TreePanel extends GTreePanel
     return treeCanvas.av;
   }
 
-  void initTreePanel(AlignmentPanel ap, String type, String modelName,
+  void initNewTreePanel(AlignmentPanel ap, TreeModel tree)
+  {
+    buildTreeCanvas(ap);
+
+    TreeLoader tl = new TreeLoader(null, null);
+    tl.start();
+
+  }
+  void initLoadedTreePanel(AlignmentPanel ap, 
           NewickFile newTree, AlignmentView inputData)
   {
+    buildTreeCanvas(ap);
 
-    av = ap.av;
-    this.treeType = type;
-    this.scoreModelName = modelName;
+    TreeLoader tl = new TreeLoader(newTree, inputData);
+    tl.start();
+  }
+
+public void buildTreeCanvas(AlignmentPanel ap) { 
+     av = ap.av;
 
     treeCanvas = new TreeCanvas(this, ap, scrollPane);
     scrollPane.setViewportView(treeCanvas);
 
+
     PaintRefresher.Register(this, ap.av.getSequenceSetId());
 
     buildAssociatedViewMenu();
@@ -170,8 +186,8 @@ public class TreePanel extends GTreePanel
       }
     });
 
-    TreeLoader tl = new TreeLoader(newTree, inputData);
-    tl.start();
+
+  
 
   }
 
@@ -243,57 +259,61 @@ public class TreePanel extends GTreePanel
 
   class TreeLoader extends Thread
   {
-    private NewickFile newtree;
+    private NewickFile newTree;
 
     private AlignmentView odata = null;
 
     public TreeLoader(NewickFile newickFile, AlignmentView inputData)
     {
-      this.newtree = newickFile;
+      this.newTree = newickFile;
       this.odata = inputData;
 
-      if (newickFile != null)
+      if (newTree != null)
       {
         // Must be outside run(), as Jalview2XML tries to
         // update distance/bootstrap visibility at the same time
-        showBootstrap(newickFile.HasBootstrap());
-        showDistances(newickFile.HasDistances());
+        showBootstrap(newTree.hasBootstrap());
+        showDistances(newTree.hasDistances());
+
       }
+
     }
 
     @Override
     public void run()
     {
 
-      if (newtree != null)
+      if (newTree != null)
       {
         tree = new TreeModel(av.getAlignment().getSequencesArray(), odata,
-                newtree);
+                newTree);
         if (tree.getOriginalData() == null)
         {
           originalSeqData.setVisible(false);
         }
+
+
+
       }
-      else
-      {
-        ScoreModelI sm = ScoreModels.getInstance()
-                .getScoreModel(scoreModelName, treeCanvas.ap);
-        TreeBuilder njtree = treeType.equals(TreeBuilder.NEIGHBOUR_JOINING)
-                ? new NJTree(av, sm, similarityParams)
-                : new AverageDistanceTree(av, sm, similarityParams);
-        tree = new TreeModel(njtree);
-        showDistances(true);
-      }
+      showTree(tree);
 
+    }
+      
+    public void showTree(TreeModel tree)
+    {
       tree.reCount(tree.getTopNode());
       tree.findHeight(tree.getTopNode());
       treeCanvas.setTree(tree);
       treeCanvas.repaint();
+
       av.setCurrentTree(tree);
       if (av.getSortByTree())
       {
         sortByTree_actionPerformed();
       }
+
+      ArchaeopteryxNewickInit archae = new ArchaeopteryxNewickInit(tree);
+      archae.startArchaeopteryx();
     }
   }
 
@@ -493,7 +513,7 @@ public class TreePanel extends GTreePanel
 
     if (treeCanvas.applyToAllViews)
     {
-      final ArrayList<CommandI> commands = new ArrayList<CommandI>();
+      final ArrayList<CommandI> commands = new ArrayList<>();
       for (AlignmentPanel ap : PaintRefresher
               .getAssociatedPanels(av.getSequenceSetId()))
       {
@@ -828,29 +848,31 @@ public class TreePanel extends GTreePanel
    * 
    * @return
    */
-  public String getPanelTitle()
+  public String getPanelTitle() // to be moved/fixed
   {
     if (treeTitle != null)
     {
       return treeTitle;
     }
-
-    /*
-     * i18n description of Neighbour Joining or Average Distance method
-     */
-    String treecalcnm = MessageManager
-            .getString("label.tree_calc_" + treeType.toLowerCase());
-
-    /*
-     * short score model name (long description can be too long)
-     */
-    String smn = scoreModelName;
-
-    /*
-     * put them together as <method> Using <model>
-     */
-    final String ttl = MessageManager.formatMessage("label.treecalc_title",
-            treecalcnm, smn);
-    return ttl;
+    else
+    {
+      /*
+       * i18n description of Neighbour Joining or Average Distance method
+       */
+      String treecalcnm = MessageManager
+              .getString("label.tree_calc_" + treeType.toLowerCase());
+
+      /*
+       * short score model name (long description can be too long)
+       */
+      String smn = substitutionMatrix;
+
+      /*
+       * put them together as <method> Using <model>
+       */
+      final String ttl = MessageManager
+              .formatMessage("label.treecalc_title", treecalcnm, smn);
+      return ttl;
+    }
   }
 }
diff --git a/src/jalview/gui/TreeParams.java b/src/jalview/gui/TreeParams.java
new file mode 100644 (file)
index 0000000..4f481d9
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer ($Version-Rel$)
+ * Copyright (C) $Year-Rel$ The Jalview Authors
+ * 
+ * This file is part of Jalview.
+ * 
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License 
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *  
+ * Jalview is distributed in the hope that it will be useful, but 
+ * WITHOUT ANY WARRANTY; without even the implied warranty 
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
+ * PURPOSE.  See the GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.gui;
+
+/**
+ * @author kjvanderheide
+ *
+ */
+public class TreeParams implements OptsParametersContainerI
+{
+
+  @Override
+  public void refreshParamLayout()
+  {
+    // TODO Auto-generated method stub
+
+  }
+
+  @Override
+  public void argSetModified(Object modifiedElement, boolean b)
+  {
+    // TODO Auto-generated method stub
+
+  }
+
+}
index c414145..7444b5f 100755 (executable)
@@ -76,14 +76,14 @@ public class NewickFile extends FileParse
 {
   SequenceNode root;
 
-  private boolean HasBootstrap = false;
+  private boolean hasBootstrap = false;
 
-  private boolean HasDistances = false;
+  private boolean hasDistances = false;
 
-  private boolean RootHasDistance = false;
+  private boolean rootHasDistance = false;
 
   // File IO Flags
-  boolean ReplaceUnderscores = false;
+  boolean replaceUnderscores = false;
 
   boolean printRootInfo = true;
 
@@ -156,7 +156,7 @@ public class NewickFile extends FileParse
    */
   public NewickFile(SequenceNode newtree, boolean bootstrap)
   {
-    HasBootstrap = bootstrap;
+    hasBootstrap = bootstrap;
     root = newtree;
   }
 
@@ -174,8 +174,8 @@ public class NewickFile extends FileParse
           boolean distances)
   {
     root = newtree;
-    HasBootstrap = bootstrap;
-    HasDistances = distances;
+    hasBootstrap = bootstrap;
+    hasDistances = distances;
   }
 
   /**
@@ -194,9 +194,9 @@ public class NewickFile extends FileParse
           boolean distances, boolean rootdistance)
   {
     root = newtree;
-    HasBootstrap = bootstrap;
-    HasDistances = distances;
-    RootHasDistance = rootdistance;
+    hasBootstrap = bootstrap;
+    hasDistances = distances;
+    rootHasDistance = rootdistance;
   }
 
   /**
@@ -226,9 +226,9 @@ public class NewickFile extends FileParse
 
   // @tree annotations
   // These are set automatically by the reader
-  public boolean HasBootstrap()
+  public boolean hasBootstrap()
   {
-    return HasBootstrap;
+    return hasBootstrap;
   }
 
   /**
@@ -236,14 +236,14 @@ public class NewickFile extends FileParse
    * 
    * @return DOCUMENT ME!
    */
-  public boolean HasDistances()
+  public boolean hasDistances()
   {
-    return HasDistances;
+    return hasDistances;
   }
 
-  public boolean HasRootDistance()
+  public boolean hasRootDistance()
   {
-    return RootHasDistance;
+    return rootHasDistance;
   }
 
   /**
@@ -446,7 +446,7 @@ public class NewickFile extends FileParse
         {
           if (nodename == null)
           {
-            if (ReplaceUnderscores)
+            if (replaceUnderscores)
             {
               nodename = uqnodename.stringMatched(1).replace('_', ' ');
             }
@@ -479,7 +479,7 @@ public class NewickFile extends FileParse
             {
               bootstrap = (new Integer(nbootstrap.stringMatched(1)))
                       .intValue();
-              HasBootstrap = true;
+              hasBootstrap = true;
             } catch (Exception e)
             {
               Error = ErrorStringrange(Error, "Can't parse bootstrap value",
@@ -495,7 +495,7 @@ public class NewickFile extends FileParse
           try
           {
             distance = (new Float(ndist.stringMatched(1))).floatValue();
-            HasDistances = true;
+            hasDistances = true;
             nodehasdistance = true;
           } catch (Exception e)
           {
@@ -510,12 +510,12 @@ public class NewickFile extends FileParse
           // Write node info here
           c.setName(nodename);
           // Trees without distances still need a render distance
-          c.dist = (HasDistances) ? distance : DefDistance;
+          c.dist = (hasDistances) ? distance : DefDistance;
           // be consistent for internal bootstrap defaults too
-          c.setBootstrap((HasBootstrap) ? bootstrap : DefBootstrap);
+          c.setBootstrap((hasBootstrap) ? bootstrap : DefBootstrap);
           if (c == realroot)
           {
-            RootHasDistance = nodehasdistance; // JBPNote This is really
+            rootHasDistance = nodehasdistance; // JBPNote This is really
             // UGLY!!! Ensure root node gets
             // its given distance
           }
@@ -526,8 +526,8 @@ public class NewickFile extends FileParse
         {
           // Find a place to put the leaf
           SequenceNode newnode = new SequenceNode(null, c, nodename,
-                  (HasDistances) ? distance : DefDistance,
-                  (HasBootstrap) ? bootstrap : DefBootstrap, false);
+                  (hasDistances) ? distance : DefDistance,
+                  (hasBootstrap) ? bootstrap : DefBootstrap, false);
           parseNHXNodeProps(c, commentString2);
           commentString2 = null;
 
@@ -546,7 +546,7 @@ public class NewickFile extends FileParse
               // Insert a dummy node for polytomy
               // dummy nodes have distances
               SequenceNode newdummy = new SequenceNode(null, c, null,
-                      (HasDistances ? 0 : DefDistance), 0, true);
+                      (hasDistances ? 0 : DefDistance), 0, true);
               newdummy.SetChildren(c.left(), newnode);
               c.setLeft(newdummy);
             }
@@ -624,9 +624,9 @@ public class NewickFile extends FileParse
     // (root.right()!=null && root.isDummy())
     root = (SequenceNode) root.right().detach(); // remove the imaginary root.
 
-    if (!RootHasDistance)
+    if (!rootHasDistance)
     {
-      root.dist = (HasDistances) ? 0 : DefDistance;
+      root.dist = (hasDistances) ? 0 : DefDistance;
     }
   }
 
@@ -665,7 +665,7 @@ public class NewickFile extends FileParse
               v = iv.intValue(); // jalview only does integer bootstraps
               // currently
               c.setBootstrap(v);
-              HasBootstrap = true;
+              hasBootstrap = true;
             }
             // more codes here.
           } catch (Exception e)
@@ -722,11 +722,11 @@ public class NewickFile extends FileParse
   {
     synchronized (this)
     {
-      boolean boots = this.HasBootstrap;
-      this.HasBootstrap = withbootstraps;
+      boolean boots = this.hasBootstrap;
+      this.hasBootstrap = withbootstraps;
 
       String rv = print();
-      this.HasBootstrap = boots;
+      this.hasBootstrap = boots;
 
       return rv;
     }
@@ -748,11 +748,11 @@ public class NewickFile extends FileParse
   {
     synchronized (this)
     {
-      boolean dists = this.HasDistances;
-      this.HasDistances = withdists;
+      boolean dists = this.hasDistances;
+      this.hasDistances = withdists;
 
       String rv = print(withbootstraps);
-      this.HasDistances = dists;
+      this.hasDistances = dists;
 
       return rv;
     }
@@ -842,10 +842,10 @@ public class NewickFile extends FileParse
   private String printNodeField(SequenceNode c)
   {
     return ((c.getName() == null) ? "" : nodeName(c.getName()))
-            + ((HasBootstrap) ? ((c.getBootstrap() > -1)
+            + ((hasBootstrap) ? ((c.getBootstrap() > -1)
                     ? ((c.getName() != null ? " " : "") + c.getBootstrap())
                     : "") : "")
-            + ((HasDistances) ? (":" + c.dist) : "");
+            + ((hasDistances) ? (":" + c.dist) : "");
   }
 
   /**
@@ -860,13 +860,13 @@ public class NewickFile extends FileParse
   {
     return (printRootInfo)
             ? (((root.getName() == null) ? "" : nodeName(root.getName()))
-                    + ((HasBootstrap)
+                    + ((hasBootstrap)
                             ? ((root.getBootstrap() > -1)
                                     ? ((root.getName() != null ? " " : "")
                                             + +root.getBootstrap())
                                     : "")
                             : "")
-                    + ((RootHasDistance) ? (":" + root.dist) : ""))
+                    + ((rootHasDistance) ? (":" + root.dist) : ""))
             : "";
   }
 
index a92f5fb..1cbe5ac 100644 (file)
@@ -109,8 +109,8 @@ public class NewickFileTests
       SequenceNode tree = nf.getTree();
       AssertJUnit.assertTrue(stage + "Null Tree", tree != null);
       stage = "Creating newick file from testTree " + treename;
-      String gentree = new NewickFile(tree).print(nf.HasBootstrap(),
-              nf.HasDistances());
+      String gentree = new NewickFile(tree).print(nf.hasBootstrap(),
+              nf.hasDistances());
       AssertJUnit.assertTrue(stage + "Empty string generated",
               gentree != null && gentree.trim().length() > 0);
       stage = "Parsing regenerated testTree " + treename;