/* * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) * Copyright (C) $$Year-Rel$$ The Jalview Authors * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 * of the License, or (at your option) any later version. * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Jalview. If not, see . * The Jalview Authors are detailed in the 'AUTHORS' file. */ package jalview.analysis.scoremodels; import jalview.api.analysis.DistanceScoreModelI; import jalview.api.analysis.SimilarityParamsI; import jalview.datamodel.AlignmentView; import jalview.math.Matrix; import jalview.math.MatrixI; import jalview.util.Comparison; /** * @deprecated superseded by PIDModel */ @Deprecated public class PIDDistanceModel implements DistanceScoreModelI { @Override public MatrixI findDistances(AlignmentView seqData, SimilarityParamsI options) { String[] sequenceString = seqData .getSequenceStrings(Comparison.GAP_SPACE); int noseqs = sequenceString.length; double[][] distance = new double[noseqs][noseqs]; for (int i = 0; i < (noseqs - 1); i++) { for (int j = i; j < noseqs; j++) { if (j == i) { distance[i][i] = 0; } else { distance[i][j] = 100 - Comparison.PID(sequenceString[i], sequenceString[j]); distance[j][i] = distance[i][j]; } } } return new Matrix(distance); } @Override public String getName() { return "PID"; } @Override public boolean isDNA() { return true; } @Override public boolean isProtein() { return true; } @Override public String toString() { return "Percentage identity of sequences"; } }