import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
+import jalview.api.analysis.ScoreModelI;
import jalview.api.analysis.SimilarityParamsI;
import jalview.datamodel.Alignment;
import jalview.datamodel.AlignmentI;
public void testFeatureScoreModel() throws Exception
{
AlignFrame alf = getTestAlignmentFrame();
- FeatureDistanceModel fsm = new FeatureDistanceModel();
- assertTrue(fsm.configureFromAlignmentView(alf.getCurrentView()
- .getAlignPanel()));
+ ScoreModelI sm = new FeatureDistanceModel();
+ sm = ScoreModels.getInstance().getScoreModel(sm.getName(),
+ alf.getCurrentView().getAlignPanel());
alf.selectAllSequenceMenuItem_actionPerformed(null);
- MatrixI dm = fsm.findDistances(
+ MatrixI dm = sm.findDistances(
alf.getViewport().getAlignmentView(true),
SimilarityParams.Jalview);
assertEquals(dm.getValue(0, 2), 0d,
AlignFrame alf = getTestAlignmentFrame();
// hiding first two columns shouldn't affect the tree
alf.getViewport().hideColumns(0, 1);
- FeatureDistanceModel fsm = new FeatureDistanceModel();
- assertTrue(fsm.configureFromAlignmentView(alf.getCurrentView()
- .getAlignPanel()));
+ ScoreModelI sm = new FeatureDistanceModel();
+ sm = ScoreModels.getInstance().getScoreModel(sm.getName(),
+ alf.getCurrentView().getAlignPanel());
alf.selectAllSequenceMenuItem_actionPerformed(null);
- MatrixI dm = fsm.findDistances(
+ MatrixI dm = sm.findDistances(
alf.getViewport().getAlignmentView(true),
SimilarityParams.Jalview);
assertEquals(dm.getValue(0, 2), 0d,
// hide columns and check tree changes
alf.getViewport().hideColumns(3, 4);
alf.getViewport().hideColumns(0, 1);
- FeatureDistanceModel fsm = new FeatureDistanceModel();
- assertTrue(fsm.configureFromAlignmentView(alf.getCurrentView()
- .getAlignPanel()));
+ // getName() can become static in Java 8
+ ScoreModelI sm = new FeatureDistanceModel();
+ sm = ScoreModels.getInstance().getScoreModel(sm.getName(),
+ alf.getCurrentView().getAlignPanel());
alf.selectAllSequenceMenuItem_actionPerformed(null);
- MatrixI dm = fsm.findDistances(
+ MatrixI dm = sm.findDistances(
alf.getViewport().getAlignmentView(true),
SimilarityParams.Jalview);
assertEquals(
alf.setShowSeqFeatures(true);
alf.getFeatureRenderer().findAllFeatures(true);
- FeatureDistanceModel fsm = new FeatureDistanceModel();
- assertTrue(fsm.configureFromAlignmentView(alf.getCurrentView()
- .getAlignPanel()));
+ ScoreModelI sm = new FeatureDistanceModel();
+ sm = ScoreModels.getInstance().getScoreModel(sm.getName(),
+ alf.getCurrentView().getAlignPanel());
alf.selectAllSequenceMenuItem_actionPerformed(null);
- MatrixI distances = fsm.findDistances(alf.getViewport()
- .getAlignmentView(true), SimilarityParams.Jalview);
+ AlignmentView alignmentView = alf.getViewport()
+ .getAlignmentView(true);
+ MatrixI distances = sm.findDistances(alignmentView,
+ SimilarityParams.Jalview);
assertEquals(distances.width(), 2);
assertEquals(distances.height(), 2);
assertEquals(distances.getValue(0, 0), 0d);
AlignViewport viewport = af.getViewport();
AlignmentView view = viewport.getAlignmentView(false);
- FeatureDistanceModel sm = new FeatureDistanceModel();
- sm.configureFromAlignmentView(af.alignPanel);
-
+ ScoreModelI sm = new FeatureDistanceModel();
+ sm = ScoreModels.getInstance().getScoreModel(sm.getName(),
+ af.alignPanel);
+
/*
* feature distance model always normalises by region width
* gap-gap is always included (but scores zero)