X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fanalysis%2Fscoremodels%2FSimilarityParams.java;fp=src%2Fjalview%2Fanalysis%2Fscoremodels%2FSimilarityParams.java;h=58b08dd7928f27b8a933a97135b6ccb6c01953d0;hb=9f70ff4b6d193b340031997634c9e3602486bc8e;hp=0000000000000000000000000000000000000000;hpb=76844c43faeeeba369deaf42f1998ca0fb33d956;p=jalview.git diff --git a/src/jalview/analysis/scoremodels/SimilarityParams.java b/src/jalview/analysis/scoremodels/SimilarityParams.java new file mode 100644 index 0000000..58b08dd --- /dev/null +++ b/src/jalview/analysis/scoremodels/SimilarityParams.java @@ -0,0 +1,150 @@ +/* + * 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.SimilarityParamsI; + +/** + * A class to hold parameters that configure the pairwise similarity + * calculation. Based on the paper + * + *
+ * Quantification of the variation in percentage identity for protein sequence alignments
+ * Raghava, GP and Barton, GJ
+ * BMC Bioinformatics. 2006 Sep 19;7:415
+ * 
+ * + * @see https://www.ncbi.nlm.nih.gov/pubmed/16984632 + */ +public class SimilarityParams implements SimilarityParamsI +{ + /** + * Based on Jalview's Comparison.PID method, which includes gaps and counts + * them as matching; it counts over the length of the shorter sequence + */ + public static final SimilarityParamsI Jalview = new SimilarityParams(true, + true, true, true); + + /** + * 'SeqSpace' mode PCA calculation includes gaps but does not count them as + * matching; it uses the longest sequence length + */ + public static final SimilarityParamsI SeqSpace = new SimilarityParams( + true, false, true, true); + + /** + * as described in the Raghava-Barton paper + * + */ + public static final SimilarityParamsI PID1 = new SimilarityParams(false, + false, true, false); + + /** + * as described in the Raghava-Barton paper + * + */ + public static final SimilarityParamsI PID2 = new SimilarityParams(false, + false, false, false); + + /** + * as described in the Raghava-Barton paper + * + */ + public static final SimilarityParamsI PID3 = new SimilarityParams(false, + false, false, true); + + /** + * as described in the Raghava-Barton paper + * + */ + public static final SimilarityParamsI PID4 = new SimilarityParams(false, + false, true, true); + + private boolean includeGappedColumns; + + private boolean matchGaps; + + private boolean includeGaps; + + private boolean denominateByShortestLength; + + /** + * Constructor + * + * @param includeGapGap + * @param matchGapResidue + * @param includeGapResidue + * if true, gapped positions are counted for normalisation by length + * @param shortestLength + * if true, the denominator is the shorter sequence length (possibly + * including gaps) + */ + public SimilarityParams(boolean includeGapGap, boolean matchGapResidue, + boolean includeGapResidue, boolean shortestLength) + { + includeGappedColumns = includeGapGap; + matchGaps = matchGapResidue; + includeGaps = includeGapResidue; + denominateByShortestLength = shortestLength; + } + + @Override + public boolean includeGaps() + { + return includeGaps; + } + + @Override + public boolean denominateByShortestLength() + { + return denominateByShortestLength; + } + + @Override + public boolean includeGappedColumns() + { + return includeGappedColumns; + } + + @Override + public boolean matchGaps() + { + return matchGaps; + } +}