import jalview.analysis.AlignmentSorter;
import jalview.analysis.NJTree;
import jalview.analysis.scoremodels.ScoreModels;
-import jalview.api.analysis.DistanceModelI;
+import jalview.analysis.scoremodels.SimilarityParams;
+import jalview.api.analysis.ScoreModelI;
import jalview.api.analysis.ViewBasedAnalysisI;
import jalview.bin.Cache;
import jalview.commands.CommandI;
.println("new alignment sequences vector value is null");
}
- tree.UpdatePlaceHolders((List<SequenceI>) evt.getNewValue());
+ tree.updatePlaceHolders((List<SequenceI>) evt.getNewValue());
treeCanvas.nameHash.clear(); // reset the mapping between canvas
// rectangles and leafnodes
repaint();
seqs = av.getSelectionGroup().getSequencesInOrder(
av.getAlignment());
}
- DistanceModelI sm = ScoreModels.getInstance().forName(pwtype);
- if (sm instanceof ViewBasedAnalysisI)
- {
- try
- {
- sm = sm.getClass().newInstance();
- ((ViewBasedAnalysisI) sm)
- .configureFromAlignmentView(treeCanvas.ap);
- } catch (Exception q)
- {
- Cache.log.error("Couldn't create a scoremodel instance for "
- + sm.getName());
- }
- tree = new NJTree(seqs, seqStrings, type, pwtype, sm, start, end);
- }
- else
- {
- tree = new NJTree(seqs, seqStrings, type, pwtype, null, start,
- end);
- }
+ ScoreModelI sm = configureScoreModel(pwtype);
+ tree = new NJTree(av, type, sm, SimilarityParams.Jalview);
showDistances(true);
}
NewickFile fout = new NewickFile(tree.getTopNode());
try
{
- cap.setText(fout.print(tree.isHasBootstrap(), tree.isHasDistances(),
- tree.isHasRootDistance()));
+ cap.setText(fout.print(tree.hasBootstrap(), tree.hasDistances(),
+ tree.hasRootDistance()));
Desktop.addInternalFrame(cap, newTitle, 500, 100);
} catch (OutOfMemoryError oom)
{
{
jalview.io.NewickFile fout = new jalview.io.NewickFile(
tree.getTopNode());
- String output = fout.print(tree.isHasBootstrap(),
- tree.isHasDistances(), tree.isHasRootDistance());
+ String output = fout.print(tree.hasBootstrap(),
+ tree.hasDistances(), tree.hasRootDistance());
java.io.PrintWriter out = new java.io.PrintWriter(
new java.io.FileWriter(choice));
out.println(output);
treecalcnm, smn);
return ttl;
}
+
+ /**
+ * Gets the score model for the given name. If the score model is one that
+ * requires to get state data from the current view, allow it to do so
+ *
+ * @param sm
+ * @return
+ */
+ protected ScoreModelI configureScoreModel(String modelName)
+ {
+ ScoreModelI sm = ScoreModels.getInstance().forName(modelName);
+ if (sm instanceof ViewBasedAnalysisI)
+ {
+ try
+ {
+ sm = sm.getClass().newInstance();
+ ((ViewBasedAnalysisI) sm).configureFromAlignmentView(treeCanvas.ap);
+ } catch (Exception q)
+ {
+ Cache.log.error("Couldn't create a scoremodel instance for "
+ + sm.getName());
+ }
+ }
+ return sm;
+ }
}