import jalview.analysis.TreeBuilder;
import jalview.datamodel.SequenceI;
import jalview.math.MatrixI;
+import jalview.util.MessageManager;
import org.forester.phylogeny.Phylogeny;
import org.forester.phylogeny.PhylogenyNode;
private PhylogenyNode rootNode;
protected MatrixI distances;
+
+ protected TreeBuilder jalviewTree;
+
+ public String treeTitle;
- {
- this.aptxTree = new Phylogeny();
- }
public ArchaeopteryxTreeConverter(TreeBuilder calculatedTree)
{
- this.sequences = calculatedTree.getSequences();
- this.distances = calculatedTree.getDistances();
-
- this.rootNode = new PhylogenyNode();
- this.rootNode.setName("root");
+ this.jalviewTree = calculatedTree;
+ this.sequences = jalviewTree.getSequences();
+ this.distances = jalviewTree.getDistances();
}
- public ArchaeopteryxTreeConverter(PhylogenyNode treeRoot,
- TreeBuilder calculatedTree)
+ public Phylogeny buildAptxTree()
{
- this(calculatedTree);
- this.rootNode = treeRoot;
+ this.rootNode = new PhylogenyNode();
+
+ return buildAptxTree(rootNode);
}
- public Phylogeny buildAptxTree()
+ public Phylogeny buildAptxTree(PhylogenyNode treeRoot)
{
+ this.rootNode = treeRoot;
+
+ this.aptxTree = new Phylogeny();
- this.aptxTree.setName(
- "PLEASE FIX ME reheaheth35yheqhb3q5hyq3bt3q5u4jwqjwuh6");
+ this.treeTitle = generateTreeName();
+ this.aptxTree.setName(treeTitle);
// final NeighborJoiningF nj = NeighborJoiningF.createInstance(false, 5);
*
* @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;
- // }
- // }
+ public String generateTreeName()
+ {
+ if (treeTitle != null) // will currently never happen, loaded tree file will
+ // take a different path
+ {
+ return treeTitle;
+ }
+ else
+ {
+ /*
+ * i18n description of Neighbour Joining or Average Distance method
+ */
+ String treecalcnm = MessageManager
+ .getString("label.tree_calc_" + jalviewTree.getClass()
+ .getSimpleName().substring(0, 2).toLowerCase());
+ /*
+ * short score model name (long description can be too long)
+ */
+ String smn = jalviewTree.getScoreModel().getName();
+
+ /*
+ * put them together as <method> Using <model>
+ */
+ final String ttl = MessageManager
+ .formatMessage("label.treecalc_title", treecalcnm, smn);
+ return ttl;
+ }
+ }
}