import jalview.analysis.AlignmentUtils;
import jalview.analysis.CrossRef;
import jalview.analysis.Dna;
+import jalview.analysis.NJTree;
import jalview.analysis.ParseProperties;
import jalview.analysis.SequenceIdMatcher;
import jalview.api.AlignExportSettingI;
if (nf.getTree() != null)
{
- tp = new TreePanel(alignPanel, "FromFile", title, nf, input);
+ tp = new TreePanel(alignPanel, NJTree.FROM_FILE, title, nf, input);
tp.setSize(w, h);
public void newTreePanel(String treeType, ScoreModelI sm)
{
- String treecalcnm = MessageManager.getString("label.tree_calc_"
- + treeType.toLowerCase());
- String smn = MessageManager.getStringOrReturn("label.score_model_",
- sm.getName());
- final String ttl = MessageManager.formatMessage("label.treecalc_title",
- treecalcnm, smn);
- newTreePanel(treeType, sm.getName(), ttl);
+ String scoreModelName = sm.getName();
+ final String ttl = TreePanel.getPanelTitle(treeType, scoreModelName);
+ newTreePanel(treeType, scoreModelName, ttl);
}
}
// showDistances(true);
}
- /**
- * Creates a new TreePanel object.
- *
- * @param av
- * DOCUMENT ME!
- * @param seqVector
- * DOCUMENT ME!
- * @param newtree
- * DOCUMENT ME!
- * @param type
- * DOCUMENT ME!
- * @param pwtype
- * DOCUMENT ME!
- */
- public TreePanel(AlignmentPanel ap, String type, String pwtype,
- NewickFile newtree)
- {
- super();
- initTreePanel(ap, type, pwtype, newtree, null);
- }
-
public TreePanel(AlignmentPanel av, String type, String pwtype,
NewickFile newtree, AlignmentView inputData)
{
{
CutAndPasteTransfer cap = new CutAndPasteTransfer();
- StringBuffer buffer = new StringBuffer();
-
- if (type.equals(NJTree.AVERAGE_DISTANCE))
- {
- buffer.append("Average distance tree using ");
- }
- else
- {
- buffer.append("Neighbour joining tree using ");
- }
-
- ScoreModelI sm = ScoreModels.getInstance().forName(pwtype);
- buffer.append(sm.getName());
+ String newTitle = getPanelTitle(type, pwtype);
NewickFile fout = new NewickFile(tree.getTopNode());
try
{
cap.setText(fout.print(tree.isHasBootstrap(), tree.isHasDistances(),
tree.isHasRootDistance()));
- Desktop.addInternalFrame(cap, buffer.toString(), 500, 100);
+ Desktop.addInternalFrame(cap, newTitle, 500, 100);
} catch (OutOfMemoryError oom)
{
new OOMWarning("generating newick tree file", oom);
}
});
}
+
+ /**
+ * 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
+ *
+ * @param treeType
+ * NJ or AV or FromFile
+ * @param modelOrFileName
+ * @return
+ */
+ public static String getPanelTitle(String treeType, String modelOrFileName)
+ {
+ if (NJTree.FROM_FILE.equals(treeType))
+ {
+ return modelOrFileName;
+ }
+
+ /*
+ * i18n description of Neighbour Joining or Average Distance method
+ */
+ String treecalcnm = MessageManager.getString("label.tree_calc_"
+ + treeType.toLowerCase());
+
+ /*
+ * i18n description (if any) of score model used
+ */
+ String smn = MessageManager.getStringOrReturn("label.score_model_",
+ modelOrFileName);
+
+ /*
+ * put them together as <method> Using <model>
+ */
+ final String ttl = MessageManager.formatMessage("label.treecalc_title",
+ treecalcnm, smn);
+ return ttl;
+ }
}