*/
package jalview.analysis;
+import jalview.analysis.scoremodels.PIDModel;
import jalview.api.analysis.DistanceScoreModelI;
import jalview.api.analysis.ScoreModelI;
import jalview.api.analysis.SimilarityParamsI;
* 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
{
result = ((SimilarityScoreModelI) scoreModel).findSimilarities(av,
similarityParams);
+ if (scoreModel instanceof PIDModel)
+ {
+ /*
+ * scale % identities to width of alignment for backwards
+ * compatibility with Jalview 2.10.1 SeqSpace PCA calculation
+ */
+ result.multiply(av.getWidth() / 100d);
+ }
}
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);