b6f2ba22fd18fb76df7bfe799f32db2ebe5dac76
[jalview.git] / src / jalview / analysis / scoremodels / SimilarityParams.java
1 package jalview.analysis.scoremodels;
2
3 import jalview.api.analysis.SimilarityParamsI;
4
5 public class SimilarityParams implements SimilarityParamsI
6 {
7   /**
8    * Based on Jalview's Comparison.PID method, which includes gaps and counts
9    * them as matching; it counts over the length of the shorter sequence
10    */
11   public static final SimilarityParamsI Jalview = new SimilarityParams(
12           true, true, true, true);
13
14   /**
15    * 'SeqSpace' mode PCA calculation includes gaps but does not count them as
16    * matching; it uses the longest sequence length
17    */
18   public static final SimilarityParamsI SeqSpace = new SimilarityParams(
19           true, false, true, true);
20
21   /**
22    * as described in the Raghava-Barton paper; considers pairwise similarity
23    * only (excludes gap-gap) and does not match gaps
24    */
25   public static final SimilarityParamsI PID1 = new SimilarityParams(false,
26           false, true, false);
27
28   /**
29    * as described in the Raghava-Barton paper; considers pairwise similarity
30    * only (excludes gap-gap) and does not match gaps
31    */
32   public static final SimilarityParamsI PID2 = new SimilarityParams(false,
33           false, false, false);
34
35   /**
36    * as described in the Raghava-Barton paper; considers pairwise similarity
37    * only (excludes gap-gap) and does not match gaps
38    */
39   public static final SimilarityParamsI PID3 = new SimilarityParams(false,
40           false, false, true);
41
42   /**
43    * as described in the Raghava-Barton paper; considers pairwise similarity
44    * only (excludes gap-gap) and does not match gaps
45    */
46   public static final SimilarityParamsI PID4 = new SimilarityParams(false,
47           false, true, true);
48
49   private boolean includeGappedColumns;
50
51   private boolean matchGaps;
52
53   private boolean denominatorIncludesGaps;
54
55   private boolean denominateByShortestLength;
56
57   /**
58    * Constructor
59    * 
60    * @param includeGapGap
61    * @param matchGap
62    * @param includeGaps
63    *          if true, gapped positions are counted in the PID denominator
64    * @param shortestLength
65    *          if true, the denominator is the shorter sequence length (possibly
66    *          including gaps)
67    */
68   public SimilarityParams(boolean includeGapGap, boolean matchGap,
69           boolean includeGaps, boolean shortestLength)
70   {
71     includeGappedColumns = includeGapGap;
72     matchGaps = matchGap;
73     denominatorIncludesGaps = includeGaps;
74     denominateByShortestLength = shortestLength;
75   }
76
77   @Override
78   public boolean denominatorIncludesGaps()
79   {
80     return denominatorIncludesGaps;
81   }
82
83   @Override
84   public boolean denominateByShortestLength()
85   {
86     return denominateByShortestLength;
87   }
88
89   @Override
90   public boolean includeGappedColumns()
91   {
92     return includeGappedColumns;
93   }
94
95   @Override
96   public boolean matchGaps()
97   {
98     return matchGaps;
99   }
100 }