* Computes a pairwise similarity matrix for the given sequence regions using
* the configured score model. If the score model is a similarity model, then
* it computes the result directly. If it is a distance model, then use it to
- * compute pairwise distances, and convert these to similarity scores by
- * substracting from the maximum value.
+ * compute pairwise distances, and convert these to similarity scores.
*
* @param av
* @return
}
else if (scoreModel instanceof DistanceScoreModelI)
{
+ /*
+ * find distances and convert to similarity scores
+ * reverseRange(false) preserves but reverses the min-max range
+ */
result = ((DistanceScoreModelI) scoreModel).findDistances(av,
similarityParams);
result.reverseRange(false);
{
/*
* compute similarity and invert it to give a distance measure
+ * reverseRange(true) converts maximum similarity to zero distance
*/
MatrixI result = ((SimilarityScoreModelI) sm).findSimilarities(
seqData, scoreOptions);
import jalview.math.MatrixI;
import jalview.util.Comparison;
+/**
+ * @deprecated superseded by PIDModel
+ */
+@Deprecated
public class PIDDistanceModel implements DistanceScoreModelI
{
* of symbols. The matrix should be square and of the same size as the
* alphabet, for example 20x20 for a 20 symbol alphabet.
*
- * @param name
+ * @param theName
* Unique, human readable name for the matrix
* @param alphabet
* the symbols to which scores apply
- * @param matrix
+ * @param values
* Pairwise scores indexed according to the symbol alphabet
*/
- public ScoreMatrix(String name, char[] alphabet, float[][] matrix)
+ public ScoreMatrix(String theName, char[] alphabet, float[][] values)
{
- if (alphabet.length != matrix.length)
+ if (alphabet.length != values.length)
{
throw new IllegalArgumentException(
"score matrix size must match alphabet size");
}
- for (float[] row : matrix)
+ for (float[] row : values)
{
if (row.length != alphabet.length)
{
}
}
- this.matrix = matrix;
- this.name = name;
+ this.matrix = values;
+ this.name = theName;
this.symbols = alphabet;
symbolIndex = buildSymbolIndex(alphabet);
* <ul>
* <li>BLOSUM62</li>
* <li>PAM250</li>
- * <li>SeqSpace (identity matrix)</li>
+ * <li>PID</li>
* <li>DNA</li>
* <li>Sequence Feature Similarity</li>
- * <li>Percentage Identity</li>
* </ul>
*/
private ScoreModels()
registerScoreModel(new PIDModel());
DNA = loadScoreMatrix("scoreModel/dna.scm");
registerScoreModel(new FeatureDistanceModel());
- // registerScoreModel(new PIDDistanceModel()); // superseded by PIDModel
}
/**
package jalview.api.analysis;
-import jalview.datamodel.AlignmentView;
-import jalview.math.MatrixI;
-
public interface ScoreModelI
{
/**
* <p>
* If parameter <code>maxToZero</code> is true, then the maximum value becomes
* zero, i.e. all values are subtracted from the maximum. This is consistent
- * with converting a similarity score to a distance score - the most similar
- * (identity) corresponds to zero distance. However note that the operation is
- * not reversible (unless the original minimum value is zero). For example a
- * range of 10-40 would become 30-0, which would reverse a second time to
- * 0-30. Also note that a similarity measure (such as BLOSUM) may give
- * different identity scores for different sequences, so they cannot all
- * convert to zero distance.
+ * with converting an identity similarity score to a distance score - the most
+ * similar (identity) corresponds to zero distance. However note that the
+ * operation is not reversible (unless the original minimum value is zero).
+ * For example a range of 10-40 would become 30-0, which would reverse a
+ * second time to 0-30. Also note that a general similarity measure (such as
+ * BLOSUM) may give different 'identity' scores for different sequences, so
+ * they cannot all convert to zero distance.
* <p>
* If parameter <code>maxToZero</code> is false, then the values are reflected
* about the average of {min, max} (effectively swapping min and max). This