*/
public class NJTree
{
+ public static final String AVERAGE_DISTANCE = "AV";
+
+ public static final String NEIGHBOUR_JOINING = "NJ";
+
Vector<Cluster> cluster;
SequenceI[] sequence;
this.seqData = new AlignmentView(sdata, start);
}
// System.err.println("Made seqData");// dbg
- if (!(type.equals("NJ")))
+ if (!(type.equals(NEIGHBOUR_JOINING)))
{
- type = "AV";
+ type = AVERAGE_DISTANCE;
}
if (sm == null && !(pwtype.equals("PID")))
{
while (noClus > 2)
{
- if (type.equals("NJ"))
+ if (type.equals(NEIGHBOUR_JOINING))
{
findMinNJDistance();
}
ri = findr(i, j);
rj = findr(j, i);
- if (type.equals("NJ"))
+ if (type.equals(NEIGHBOUR_JOINING))
{
findClusterNJDistance(i, j);
}
SequenceNode tmpi = (node.elementAt(i));
SequenceNode tmpj = (node.elementAt(j));
- if (type.equals("NJ"))
+ if (type.equals(NEIGHBOUR_JOINING))
{
findNewNJDistances(tmpi, tmpj, dist);
}
import jalview.analysis.AlignmentSorter;
import jalview.analysis.AnnotationSorter.SequenceAnnotationOrder;
+import jalview.analysis.NJTree;
import jalview.api.AlignViewControllerGuiI;
import jalview.api.AlignViewControllerI;
import jalview.api.AlignViewportI;
public void averageDistanceTreeMenuItem_actionPerformed()
{
- NewTreePanel("AV", "PID", "Average distance tree using PID");
+ NewTreePanel(NJTree.AVERAGE_DISTANCE, "PID",
+ "Average distance tree using PID");
}
public void neighbourTreeMenuItem_actionPerformed()
{
- NewTreePanel("NJ", "PID", "Neighbour joining tree using PID");
+ NewTreePanel(NJTree.NEIGHBOUR_JOINING, "PID",
+ "Neighbour joining tree using PID");
}
protected void njTreeBlosumMenuItem_actionPerformed()
{
- NewTreePanel("NJ", "BL", "Neighbour joining tree using BLOSUM62");
+ NewTreePanel(NJTree.NEIGHBOUR_JOINING, "BL",
+ "Neighbour joining tree using BLOSUM62");
}
protected void avTreeBlosumMenuItem_actionPerformed()
{
- NewTreePanel("AV", "BL", "Average distance tree using BLOSUM62");
+ NewTreePanel(NJTree.AVERAGE_DISTANCE, "BL",
+ "Average distance tree using BLOSUM62");
}
void NewTreePanel(String type, String pwType, String title)
*/
package jalview.gui;
+import jalview.analysis.NJTree;
import jalview.analysis.scoremodels.ScoreModels;
import jalview.api.analysis.ScoreModelI;
import jalview.util.MessageManager;
try
{
frame.setClosed(true);
- String treeType = neighbourJoining.isSelected() ? "NJ" : "AV";
+ String treeType = neighbourJoining.isSelected() ? NJTree.NEIGHBOUR_JOINING
+ : NJTree.AVERAGE_DISTANCE;
ScoreModelI sm = ScoreModels.getInstance().forName(
matrixNames.getSelectedItem().toString());
af.newTreePanel(treeType, sm);
StringBuffer buffer = new StringBuffer();
- if (type.equals("AV"))
+ if (type.equals(NJTree.AVERAGE_DISTANCE))
{
buffer.append("Average distance tree using ");
}
buffer.append("Neighbour joining tree using ");
}
- if (pwtype.equals("BL"))
- {
- buffer.append("BLOSUM62");
- }
- else
- {
- buffer.append("PID");
- }
+ ScoreModelI sm = ScoreModels.getInstance().forName(pwtype);
+ buffer.append(sm.getName());
- jalview.io.NewickFile fout = new jalview.io.NewickFile(
- tree.getTopNode());
+ NewickFile fout = new NewickFile(tree.getTopNode());
try
{
cap.setText(fout.print(tree.isHasBootstrap(), tree.isHasDistances(),
prov.getEntry(0).addParam(new Param());
prov.getEntry(0).getParam(0).setName("treeType");
prov.getEntry(0).getParam(0).setType("utf8");
- prov.getEntry(0).getParam(0).setContent("NJ"); // TODO: type of tree is a
- // general parameter
+ prov.getEntry(0).getParam(0).setContent(NJTree.NEIGHBOUR_JOINING);
+ // TODO: type of tree is a general parameter
int ranges[] = tp.getTree().seqData.getVisibleContigs();
// VisibleContigs are with respect to alignment coordinates. Still need
// offsets