2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ The Jalview Authors
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
21 package jalview.analysis.scoremodels;
23 import jalview.api.analysis.SimilarityParamsI;
26 * A class to hold parameters that configure the pairwise similarity
27 * calculation. Based on the paper
30 * Quantification of the variation in percentage identity for protein sequence alignments
31 * Raghava, GP and Barton, GJ
32 * BMC Bioinformatics. 2006 Sep 19;7:415
35 * @see https://www.ncbi.nlm.nih.gov/pubmed/16984632
37 public class SimilarityParams implements SimilarityParamsI
40 * Based on Jalview's Comparison.PID method, which includes gaps and counts
41 * them as matching; it counts over the length of the shorter sequence
43 public static final SimilarityParamsI Jalview = new SimilarityParams(true,
47 * 'SeqSpace' mode PCA calculation includes gaps but does not count them as
48 * matching; it uses the longest sequence length
50 public static final SimilarityParamsI SeqSpace = new SimilarityParams(
51 true, false, true, true);
54 * as described in the Raghava-Barton paper
56 * <li>ignores gap-gap</li>
57 * <li>does not score gap-residue</li>
58 * <li>includes gap-residue in lengths</li>
59 * <li>matches on longer of two sequences</li>
62 public static final SimilarityParamsI PID1 = new SimilarityParams(false,
66 * as described in the Raghava-Barton paper
68 * <li>ignores gap-gap</li>
69 * <li>ignores gap-residue</li>
70 * <li>matches on longer of two sequences</li>
73 public static final SimilarityParamsI PID2 = new SimilarityParams(false,
77 * as described in the Raghava-Barton paper
79 * <li>ignores gap-gap</li>
80 * <li>ignores gap-residue</li>
81 * <li>matches on shorter of sequences only</li>
84 public static final SimilarityParamsI PID3 = new SimilarityParams(false,
88 * as described in the Raghava-Barton paper
90 * <li>ignores gap-gap</li>
91 * <li>does not score gap-residue</li>
92 * <li>includes gap-residue in lengths</li>
93 * <li>matches on shorter of sequences only</li>
96 public static final SimilarityParamsI PID4 = new SimilarityParams(false,
99 private boolean includeGappedColumns;
101 private boolean matchGaps;
103 private boolean includeGaps;
105 private boolean denominateByShortestLength;
107 private String secondaryStructureSource;
112 * @param includeGapGap
113 * @param matchGapResidue
114 * @param includeGapResidue
115 * if true, gapped positions are counted for normalisation by length
116 * @param shortestLength
117 * if true, the denominator is the shorter sequence length (possibly
120 public SimilarityParams(boolean includeGapGap, boolean matchGapResidue,
121 boolean includeGapResidue, boolean shortestLength)
123 includeGappedColumns = includeGapGap;
124 matchGaps = matchGapResidue;
125 includeGaps = includeGapResidue;
126 denominateByShortestLength = shortestLength;
130 public boolean includeGaps()
136 public boolean denominateByShortestLength()
138 return denominateByShortestLength;
142 public boolean includeGappedColumns()
144 return includeGappedColumns;
148 public boolean matchGaps()
154 * IDE-generated hashCode method
157 public int hashCode()
159 final int prime = 31;
161 result = prime * result + (denominateByShortestLength ? 1231 : 1237);
162 result = prime * result + (includeGappedColumns ? 1231 : 1237);
163 result = prime * result + (includeGaps ? 1231 : 1237);
164 result = prime * result + (matchGaps ? 1231 : 1237);
169 * IDE-generated equals method
172 public boolean equals(Object obj)
182 if (getClass() != obj.getClass())
186 SimilarityParams other = (SimilarityParams) obj;
187 if (denominateByShortestLength != other.denominateByShortestLength)
191 if (includeGappedColumns != other.includeGappedColumns)
195 if (includeGaps != other.includeGaps)
199 if (matchGaps != other.matchGaps)
207 public String getSecondaryStructureSource()
209 return secondaryStructureSource;
213 public void setSecondaryStructureSource(String secondaryStructureSource)
215 this.secondaryStructureSource = secondaryStructureSource;