# Comment line with symbols is provided as a guide
# Values may be integer or floating point, delimited by tab, space, comma or combinations
#
-# A C G T U I X R Y N -
+# A C G T U I X R Y N -
#
10 -8 -8 -8 -8 1 1 1 -8 1 1 1
-8 10 -8 -8 -8 1 1 -8 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1
#
-# A C G T U I X R Y N -
+# A C G T U I X R Y N -
package jalview.analysis;
import jalview.analysis.scoremodels.ScoreModels;
-import jalview.api.analysis.ScoreModelI;
+import jalview.api.analysis.DistanceModelI;
import jalview.datamodel.AlignmentView;
import jalview.datamodel.BinaryNode;
import jalview.datamodel.CigarArray;
* DOCUMENT ME!
*/
public NJTree(SequenceI[] sequence, AlignmentView seqData, String type,
- String pwtype, ScoreModelI sm, int start, int end)
+ String pwtype, DistanceModelI sm, int start, int end)
{
this.sequence = sequence;
this.node = new Vector<SequenceNode>();
*
* @return similarity matrix used to compute tree
*/
- public float[][] findDistances(ScoreModelI _pwmatrix)
+ public float[][] findDistances(DistanceModelI _pwmatrix)
{
float[][] dist = new float[noseqs][noseqs];
*/
package jalview.analysis;
+import jalview.analysis.scoremodels.PairwiseDistanceModel;
import jalview.analysis.scoremodels.ScoreMatrix;
import jalview.analysis.scoremodels.ScoreModels;
import jalview.datamodel.BinarySequence;
String sm = s_m;
if (sm != null)
{
- smtrx = (ScoreMatrix) ScoreModels.getInstance().forName(sm);
+ smtrx = (ScoreMatrix) ((PairwiseDistanceModel) ScoreModels
+ .getInstance()
+ .forName(sm)).getScoreModel();
}
if (smtrx == null)
{
// either we were given a non-existent score matrix or a scoremodel that
// isn't based on a pairwise symbol score matrix
- smtrx = (ScoreMatrix) ScoreModels.getInstance().forName(
- sm = (nucleotides ? "DNA" : "BLOSUM62"));
+ smtrx = ScoreModels.getInstance().getDefaultModel(!nucleotides);
}
details.append("PCA calculation using " + sm
+ " sequence similarity matrix\n========\n\n");
*/
package jalview.analysis.scoremodels;
-import jalview.api.analysis.ScoreModelI;
+import jalview.api.analysis.DistanceModelI;
import jalview.api.analysis.ViewBasedAnalysisI;
import jalview.datamodel.AlignmentView;
import jalview.datamodel.SeqCigar;
import java.util.Map;
import java.util.Set;
-public class FeatureScoreModel implements ScoreModelI, ViewBasedAnalysisI
+public class FeatureDistanceModel implements DistanceModelI, ViewBasedAnalysisI
{
jalview.api.FeatureRenderer fr;
*/
package jalview.analysis.scoremodels;
-import jalview.api.analysis.ScoreModelI;
+import jalview.api.analysis.DistanceModelI;
import jalview.datamodel.AlignmentView;
import jalview.util.Comparison;
-public class PIDScoreModel implements ScoreModelI
+public class PIDDistanceModel implements DistanceModelI
{
@Override
public float[][] findDistances(AlignmentView seqData)
{
String[] sequenceString = seqData
- .getSequenceStrings(Comparison.GapChars.charAt(0));
+ .getSequenceStrings(Comparison.GAP_SPACE);
int noseqs = sequenceString.length;
float[][] distance = new float[noseqs][noseqs];
for (int i = 0; i < (noseqs - 1); i++)
*/
package jalview.analysis.scoremodels;
-import jalview.api.analysis.ScoreModelI;
+import jalview.api.analysis.DistanceModelI;
import jalview.datamodel.AlignmentView;
import jalview.util.Comparison;
-public abstract class PairwiseSeqScoreModel implements ScoreModelI
+public class PairwiseDistanceModel implements DistanceModelI
{
- abstract public float getPairwiseScore(char c, char d);
+ PairwiseScoreModelI scoreModel;
+ /**
+ * Constructor given something to provide pairwise scores for residues
+ *
+ * @param sm
+ */
+ public PairwiseDistanceModel(PairwiseScoreModelI sm)
+ {
+ scoreModel = sm;
+ }
+
+ /**
+ * Returns a matrix of [i][j] values representing distances between pairs of
+ * sequences
+ */
@Override
public float[][] findDistances(AlignmentView seqData)
{
String[] sequenceString = seqData
- .getSequenceStrings(Comparison.GapChars.charAt(0));
+ .getSequenceStrings(Comparison.GAP_SPACE);
int noseqs = sequenceString.length;
float[][] distance = new float[noseqs][noseqs];
+ /*
+ * calculate similarity scores for the upper half of the matrix
+ * as [i, j] = the sum of pairwise scores of corresponding
+ * positions of sequence[i] and sequence[j]
+ */
float maxscore = 0;
int end = sequenceString[0].length();
for (int i = 0; i < (noseqs - 1); i++)
{
try
{
- score += getPairwiseScore(sequenceString[i].charAt(k),
+ score += scoreModel.getPairwiseScore(
+ sequenceString[i].charAt(k),
sequenceString[j].charAt(k));
} catch (Exception ex)
{
}
}
+ /*
+ * subtract similarity scores from the maximum value to
+ * convert to a distance measure; also populate the lower
+ * half of the result matrix with this value
+ */
+ // FIXME this assumes the score matrix is symmetric - it may not be?
for (int i = 0; i < (noseqs - 1); i++)
{
for (int j = i; j < noseqs; j++)
return distance;
}
- abstract public float[][] getMatrix();
+ @Override
+ public String getName()
+ {
+ return scoreModel.getName();
+ }
+
+ @Override
+ public boolean isDNA()
+ {
+ return scoreModel.isDNA();
+ }
+
+ @Override
+ public boolean isProtein()
+ {
+ return scoreModel.isProtein();
+ }
+
+ public PairwiseScoreModelI getScoreModel()
+ {
+ return scoreModel;
+ }
}
--- /dev/null
+package jalview.analysis.scoremodels;
+
+/**
+ * An interface that describes classes that can compute similarity (aka
+ * substitution) scores for pairs of residues
+ */
+public interface PairwiseScoreModelI
+{
+ /**
+ * Answers a similarity score between two sequence characters (for
+ * substitution of the first by the second). Typically the highest scores are
+ * for identity, and the lowest for substitution of a residue by one with very
+ * different properties.
+ *
+ * @param c
+ * @param d
+ * @return
+ */
+ abstract public float getPairwiseScore(char c, char d);
+
+ /**
+ * Returns a readable name for the model, suitable for display in menus
+ *
+ * @return
+ */
+ String getName();
+
+ /**
+ * Answers true if the model is applicable to nucleotide data
+ *
+ * @return
+ */
+ boolean isDNA();
+
+ /**
+ * Answers true if the model is applicable to peptide data
+ *
+ * @return
+ */
+ boolean isProtein();
+
+}
package jalview.analysis.scoremodels;
import jalview.analysis.AlignSeq;
-import jalview.api.analysis.ScoreModelI;
+import jalview.api.analysis.DistanceModelI;
import jalview.datamodel.AlignmentView;
import jalview.datamodel.SequenceI;
import jalview.util.Comparison;
-public class SWScoreModel implements ScoreModelI
+public class SWDistanceModel implements DistanceModelI
{
@Override
public float[][] findDistances(AlignmentView seqData)
{
SequenceI[] sequenceString = seqData.getVisibleAlignment(
- Comparison.GapChars.charAt(0)).getSequencesArray();
+ Comparison.GAP_SPACE).getSequencesArray();
int noseqs = sequenceString.length;
float[][] distance = new float[noseqs][noseqs];
as.calcScoreMatrix();
as.traceAlignment();
as.printAlignment(System.out);
- distance[i][j] = (float) as.maxscore;
+ distance[i][j] = as.maxscore;
if (max < distance[i][j])
{
return true;
}
+ @Override
public String toString()
{
return "Score between two sequences aligned with Smith Waterman with default Peptide/Nucleotide matrix";
import java.util.Arrays;
-public class ScoreMatrix extends PairwiseSeqScoreModel
+public class ScoreMatrix implements PairwiseScoreModelI
{
public static final short UNMAPPED = (short) -1;
return peptide;
}
- @Override
+ /**
+ * Returns the score matrix as used in getPairwiseScore. If using this matrix
+ * directly, callers <em>must</em> also call <code>getMatrixIndex</code> in
+ * order to get the matrix index for each character (symbol).
+ *
+ * @return
+ * @see #getMatrixIndex(char)
+ */
public float[][] getMatrix()
{
return matrix;
}
/**
+ * Answers the matrix index for a given character, or -1 if unmapped in the
+ * matrix. Use this method only if using <code>getMatrix</code> in order to
+ * compute scores directly (without symbol lookup) for efficiency.
+ *
+ * @param c
+ * @return
+ * @see #getMatrix()
+ */
+ public int getMatrixIndex(char c)
+ {
+ if (c < symbolIndex.length)
+ {
+ return symbolIndex[c];
+ }
+ else
+ {
+ return UNMAPPED;
+ }
+ }
+
+ /**
* Returns the pairwise score for substituting c with d, or zero if c or d is
* an unscored or unexpected character
*/
@Override
public float getPairwiseScore(char c, char d)
{
- if (c > MAX_ASCII)
+ if (c >= symbolIndex.length)
{
System.err.println(String.format(BAD_ASCII_ERROR, c));
return 0;
}
- if (d > MAX_ASCII)
+ if (d >= symbolIndex.length)
{
System.err.println(String.format(BAD_ASCII_ERROR, d));
return 0;
package jalview.analysis.scoremodels;
-import jalview.api.analysis.ScoreModelI;
+import jalview.api.analysis.DistanceModelI;
import jalview.io.DataSourceType;
import jalview.io.FileParse;
import jalview.io.ScoreMatrixFile;
private final ScoreMatrix PAM250;
+ private final ScoreMatrix DNA;
+
private static ScoreModels instance = new ScoreModels();
- private Map<String, ScoreModelI> models;
+ private Map<String, DistanceModelI> models;
public static ScoreModels getInstance()
{
/*
* using LinkedHashMap keeps models ordered as added
*/
- models = new LinkedHashMap<String, ScoreModelI>();
+ models = new LinkedHashMap<String, DistanceModelI>();
BLOSUM62 = loadScoreMatrix("scoreModel/blosum62.scm");
PAM250 = loadScoreMatrix("scoreModel/pam250.scm");
- loadScoreMatrix("scoreModel/dna.scm");
loadScoreMatrix("scoreModel/seqspace.scm");
- registerScoreModel(new FeatureScoreModel());
- registerScoreModel(new PIDScoreModel());
+ // drop seqspace.scm for IdentityScoreModel once JAL-2379 merged in?
+ // registerScoreModel(new IdentityScoreModel());
+ DNA = loadScoreMatrix("scoreModel/dna.scm");
+ registerScoreModel(new FeatureDistanceModel());
+ registerScoreModel(new PIDDistanceModel());
}
/**
}
/**
+ * Registers a pairwise score model
+ *
+ * @param sm
+ */
+ public void registerScoreModel(PairwiseScoreModelI sm)
+ {
+ registerScoreModel(new PairwiseDistanceModel(sm));
+ }
+
+ /**
* Answers an iterable set of the registered score models. Currently these are
* returned in the order in which they were registered.
*
* @return
*/
- public Iterable<ScoreModelI> getModels()
+ public Iterable<DistanceModelI> getModels()
{
return models.values();
}
- public ScoreModelI forName(String s)
+ public DistanceModelI forName(String s)
{
return models.get(s);
}
- public void registerScoreModel(ScoreModelI sm)
+ public void registerScoreModel(DistanceModelI sm)
{
- ScoreModelI sm2 = models.get(sm.getName());
+ DistanceModelI sm2 = models.get(sm.getName());
if (sm2 != null)
{
System.err.println("Warning: replacing score model " + sm2.getName());
* @param forPeptide
* @return
*/
- public PairwiseSeqScoreModel getDefaultModel(boolean forPeptide)
+ public ScoreMatrix getDefaultModel(boolean forPeptide)
{
- return (PairwiseSeqScoreModel) (forPeptide ? forName("BLOSUM62")
- : forName("DNA"));
+ return forPeptide ? BLOSUM62 : DNA;
}
public ScoreMatrix getBlosum62()
import jalview.datamodel.AlignmentView;
-public interface ScoreModelI
+/**
+ * An interface that describes classes that can compute distances between pairs
+ * of sequences in an alignment
+ */
+public interface DistanceModelI
{
float[][] findDistances(AlignmentView seqData);
import jalview.analysis.NJTree;
import jalview.analysis.scoremodels.ScoreModels;
-import jalview.api.analysis.ScoreModelI;
+import jalview.api.analysis.DistanceModelI;
import jalview.api.analysis.ViewBasedAnalysisI;
import jalview.datamodel.Alignment;
import jalview.datamodel.AlignmentView;
seqs = av.getSelectionGroup().getSequencesInOrder(
av.getAlignment());
}
- ScoreModelI sm = ScoreModels.getInstance().forName(pwtype);
+ DistanceModelI sm = ScoreModels.getInstance().forName(pwtype);
if (sm instanceof ViewBasedAnalysisI)
{
try
/**
* ancode using substitution matrix given in matrix
*
- * @param matrix
+ * @param smtrx
*/
- public void matrixEncode(final ScoreMatrix matrix)
+ public void matrixEncode(final ScoreMatrix smtrx)
throws InvalidSequenceTypeException
{
- if (isNa != matrix.isDNA())
+ if (isNa != smtrx.isDNA())
{
throw new InvalidSequenceTypeException("matrix "
- + matrix.getClass().getCanonicalName()
+ + smtrx.getClass().getCanonicalName()
+ " is not a valid matrix for "
+ (isNa ? "nucleotide" : "protein") + "sequences");
}
- matrixEncode(matrix.isDNA() ? ResidueProperties.nucleotideIndex
- : ResidueProperties.aaIndex, matrix.getMatrix());
+ matrixEncode(smtrx.isDNA() ? ResidueProperties.nucleotideIndex
+ : ResidueProperties.aaIndex, smtrx.getMatrix());
}
private void matrixEncode(final int[] aaIndex, final float[][] matrix)
import jalview.api.FeatureSettingsControllerI;
import jalview.api.SplitContainerI;
import jalview.api.ViewStyleI;
-import jalview.api.analysis.ScoreModelI;
+import jalview.api.analysis.DistanceModelI;
import jalview.bin.Cache;
import jalview.bin.Jalview;
import jalview.commands.CommandI;
ColourMenuHelper.setColourSelected(colourMenu, schemeName);
}
- public void newTreePanel(String treeType, ScoreModelI sm)
+ public void newTreePanel(String treeType, DistanceModelI sm)
{
String scoreModelName = sm.getName();
final String ttl = TreePanel.getPanelTitle(treeType, scoreModelName);
*/
package jalview.gui;
-import jalview.analysis.scoremodels.ScoreMatrix;
+import jalview.analysis.scoremodels.PairwiseDistanceModel;
import jalview.analysis.scoremodels.ScoreModels;
-import jalview.api.analysis.ScoreModelI;
+import jalview.api.analysis.DistanceModelI;
import jalview.datamodel.Alignment;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.AlignmentView;
protected void scoreMatrix_menuSelected()
{
scoreMatrixMenu.removeAll();
- for (ScoreModelI sm : ScoreModels.getInstance().getModels())
+ for (DistanceModelI sm : ScoreModels.getInstance().getModels())
{
- if (sm instanceof ScoreMatrix)
+ if (sm instanceof PairwiseDistanceModel)
{
final String name = sm.getName();
// create an entry for this score matrix for use in PCA
jm.setText(MessageManager.getStringOrReturn("label.score_model_",
name));
jm.setSelected(pcaModel.getScore_matrix().equals(name));
- if ((!pcaModel.isNucleotide() && !sm.isDNA())
- || (pcaModel.isNucleotide() && sm.isDNA()))
+ if ((pcaModel.isNucleotide() && sm.isDNA())
+ || (!pcaModel.isNucleotide() && sm.isProtein()))
{
jm.addActionListener(new ActionListener()
{
import jalview.analysis.NJTree;
import jalview.analysis.scoremodels.ScoreModels;
-import jalview.api.analysis.ScoreModelI;
+import jalview.api.analysis.DistanceModelI;
import jalview.util.MessageManager;
import java.awt.Color;
matrixNames = new JComboBox<String>();
ScoreModels scoreModels = ScoreModels.getInstance();
- for (ScoreModelI sm : scoreModels.getModels())
+ for (DistanceModelI sm : scoreModels.getModels())
{
boolean nucleotide = af.getViewport().getAlignment().isNucleotide();
if (sm.isDNA() && nucleotide || sm.isProtein() && !nucleotide)
frame.setClosed(true);
String treeType = neighbourJoining.isSelected() ? NJTree.NEIGHBOUR_JOINING
: NJTree.AVERAGE_DISTANCE;
- ScoreModelI sm = ScoreModels.getInstance().forName(
+ DistanceModelI sm = ScoreModels.getInstance().forName(
matrixNames.getSelectedItem().toString());
af.newTreePanel(treeType, sm);
} catch (Exception ex)
import jalview.analysis.AlignmentSorter;
import jalview.analysis.NJTree;
import jalview.analysis.scoremodels.ScoreModels;
-import jalview.api.analysis.ScoreModelI;
+import jalview.api.analysis.DistanceModelI;
import jalview.api.analysis.ViewBasedAnalysisI;
import jalview.bin.Cache;
import jalview.commands.CommandI;
seqs = av.getSelectionGroup().getSequencesInOrder(
av.getAlignment());
}
- ScoreModelI sm = ScoreModels.getInstance().forName(pwtype);
+ DistanceModelI sm = ScoreModels.getInstance().forName(pwtype);
if (sm instanceof ViewBasedAnalysisI)
{
try
*/
package jalview.schemes;
-import jalview.analysis.scoremodels.PairwiseSeqScoreModel;
+import jalview.analysis.scoremodels.PairwiseScoreModelI;
import jalview.analysis.scoremodels.ScoreModels;
import jalview.datamodel.AnnotatedCollectionI;
import jalview.datamodel.SequenceCollectionI;
public Color findColour(char res, int j, SequenceI seq,
String consensusResidue, float pid)
{
- PairwiseSeqScoreModel sm = ScoreModels.getInstance().getBlosum62();
+ PairwiseScoreModelI sm = ScoreModels.getInstance().getBlosum62();
/*
* compare as upper case; note consensusResidue is
for (char consensus : consensusResidue.toCharArray())
{
score += sm.getPairwiseScore(consensus, res);
- // score += ResidueProperties.getBLOSUM62(consensus, res);
}
if (score > 0)
package jalview.ws.sifts;
import jalview.analysis.AlignSeq;
-import jalview.analysis.scoremodels.PairwiseSeqScoreModel;
+import jalview.analysis.scoremodels.ScoreMatrix;
import jalview.analysis.scoremodels.ScoreModels;
import jalview.api.DBRefEntryI;
import jalview.api.SiftsClientI;
output.append(String.valueOf(pdbEnd));
output.append(NEWLINE).append(NEWLINE);
- PairwiseSeqScoreModel pam250 = ScoreModels.getInstance().getPam250();
+ ScoreMatrix pam250 = ScoreModels.getInstance().getPam250();
int matchedSeqCount = 0;
for (int j = 0; j < nochunks; j++)
{
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
-public class FeatureScoreModelTest
+public class FeatureDistanceModelTest
{
@BeforeClass(alwaysRun = true)
public void testFeatureScoreModel() throws Exception
{
AlignFrame alf = getTestAlignmentFrame();
- FeatureScoreModel fsm = new FeatureScoreModel();
+ FeatureDistanceModel fsm = new FeatureDistanceModel();
Assert.assertTrue(fsm.configureFromAlignmentView(alf.getCurrentView()
.getAlignPanel()));
alf.selectAllSequenceMenuItem_actionPerformed(null);
AlignFrame alf = getTestAlignmentFrame();
// hiding first two columns shouldn't affect the tree
alf.getViewport().hideColumns(0, 1);
- FeatureScoreModel fsm = new FeatureScoreModel();
+ FeatureDistanceModel fsm = new FeatureDistanceModel();
Assert.assertTrue(fsm.configureFromAlignmentView(alf.getCurrentView()
.getAlignPanel()));
alf.selectAllSequenceMenuItem_actionPerformed(null);
// hide columns and check tree changes
alf.getViewport().hideColumns(3, 4);
alf.getViewport().hideColumns(0, 1);
- FeatureScoreModel fsm = new FeatureScoreModel();
+ FeatureDistanceModel fsm = new FeatureDistanceModel();
Assert.assertTrue(fsm.configureFromAlignmentView(alf.getCurrentView()
.getAlignPanel()));
alf.selectAllSequenceMenuItem_actionPerformed(null);
alf.setShowSeqFeatures(true);
alf.getFeatureRenderer().findAllFeatures(true);
- FeatureScoreModel fsm = new FeatureScoreModel();
+ FeatureDistanceModel fsm = new FeatureDistanceModel();
Assert.assertTrue(fsm.configureFromAlignmentView(alf.getCurrentView()
.getAlignPanel()));
alf.selectAllSequenceMenuItem_actionPerformed(null);
}
}
}
+
+ @Test(groups = "Functional")
+ public void testGetMatrixIndex()
+ {
+ ScoreMatrix sm = ScoreModels.getInstance().getBlosum62();
+ assertEquals(sm.getMatrixIndex('A'), 0);
+ assertEquals(sm.getMatrixIndex('R'), 1);
+ assertEquals(sm.getMatrixIndex('r'), 1);
+ assertEquals(sm.getMatrixIndex('N'), 2);
+ assertEquals(sm.getMatrixIndex('D'), 3);
+ assertEquals(sm.getMatrixIndex('X'), 22);
+ assertEquals(sm.getMatrixIndex('x'), 22);
+ assertEquals(sm.getMatrixIndex(' '), 23);
+ assertEquals(sm.getMatrixIndex('*'), 24);
+ assertEquals(sm.getMatrixIndex('.'), -1);
+ assertEquals(sm.getMatrixIndex('-'), -1);
+ assertEquals(sm.getMatrixIndex('?'), -1);
+ assertEquals(sm.getMatrixIndex((char) 128), -1);
+ }
}
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue;
-import jalview.api.analysis.ScoreModelI;
+import jalview.api.analysis.DistanceModelI;
import java.util.Iterator;
@Test
public void testConstructor()
{
- Iterator<ScoreModelI> models = ScoreModels.getInstance().getModels()
+ Iterator<DistanceModelI> models = ScoreModels.getInstance().getModels()
.iterator();
assertTrue(models.hasNext());
/*
* models are served in order of addition
*/
- ScoreModelI sm = models.next();
- assertTrue(sm instanceof ScoreMatrix);
+ DistanceModelI sm = models.next();
+ assertTrue(sm instanceof PairwiseDistanceModel);
assertEquals(sm.getName(), "BLOSUM62");
- assertEquals(((ScoreMatrix) sm).getPairwiseScore('I', 'R'), -3f);
+ assertEquals(((PairwiseDistanceModel) sm).getScoreModel()
+ .getPairwiseScore('I', 'R'), -3f);
sm = models.next();
- assertTrue(sm instanceof ScoreMatrix);
+ assertTrue(sm instanceof PairwiseDistanceModel);
assertEquals(sm.getName(), "PAM250");
- assertEquals(((ScoreMatrix) sm).getPairwiseScore('R', 'C'), -4f);
+ assertEquals(((PairwiseDistanceModel) sm).getScoreModel()
+ .getPairwiseScore('R', 'C'), -4f);
sm = models.next();
- assertTrue(sm instanceof ScoreMatrix);
+ assertTrue(sm instanceof PairwiseDistanceModel);
assertEquals(sm.getName(), "Identity (SeqSpace)");
- assertEquals(((ScoreMatrix) sm).getPairwiseScore('R', 'C'), 0f);
- assertEquals(((ScoreMatrix) sm).getPairwiseScore('R', 'r'), 1f);
+ assertEquals(((PairwiseDistanceModel) sm).getScoreModel()
+ .getPairwiseScore('R', 'C'), 0f);
+ assertEquals(((PairwiseDistanceModel) sm).getScoreModel()
+ .getPairwiseScore('R', 'r'), 1f);
sm = models.next();
- assertTrue(sm instanceof ScoreMatrix);
+ assertTrue(sm instanceof PairwiseDistanceModel);
assertEquals(sm.getName(), "DNA");
- assertEquals(((ScoreMatrix) sm).getPairwiseScore('c', 'x'), 1f);
+ assertEquals(((PairwiseDistanceModel) sm).getScoreModel()
+ .getPairwiseScore('c', 'x'), 1f);
sm = models.next();
- assertFalse(sm instanceof ScoreMatrix);
+ assertFalse(sm instanceof PairwiseDistanceModel);
assertEquals(sm.getName(), "Sequence Feature Similarity");
sm = models.next();
- assertFalse(sm instanceof ScoreMatrix);
+ assertFalse(sm instanceof PairwiseDistanceModel);
assertEquals(sm.getName(), "PID");
}
}
import jalview.analysis.scoremodels.ScoreMatrix;
import jalview.analysis.scoremodels.ScoreModels;
-import jalview.api.analysis.ScoreModelI;
+import jalview.api.analysis.DistanceModelI;
import jalview.gui.JvOptionPane;
import org.testng.annotations.BeforeClass;
@Test(groups = { "Functional" })
public void printAllMatrices()
{
- for (ScoreModelI sm : ScoreModels.getInstance().getModels())
+ for (DistanceModelI sm : ScoreModels.getInstance().getModels())
{
System.out.println("Matrix " + sm.getName());
System.out.println(sm.toString());
@Test(groups = { "Functional" })
public void printHTMLMatrices()
{
- for (ScoreModelI sm : ScoreModels.getInstance().getModels())
+ for (DistanceModelI sm : ScoreModels.getInstance().getModels())
{
if (sm instanceof ScoreMatrix)
{