--- /dev/null
+package jalview.analysis.scoremodels;
+
+import jalview.api.analysis.SimilarityParamsI;
+
+public class SimilarityParams implements SimilarityParamsI
+{
+ public static final SimilarityParamsI Jalview = new SimilarityParams(
+ true, true, true, true);
+
+ public static final SimilarityParamsI PID1 = new SimilarityParams(false,
+ false, true, false);
+
+ public static final SimilarityParamsI PID2 = new SimilarityParams(false,
+ false, false, false);
+
+ public static final SimilarityParamsI PID3 = new SimilarityParams(false,
+ false, false, true);
+
+ public static final SimilarityParamsI PID4 = new SimilarityParams(false,
+ false, true, true);
+
+ private boolean includeGappedColumns;
+
+ private boolean matchGaps;
+
+ private boolean denominatorIncludesGaps;
+
+ private boolean denominateByShortestLength;
+
+ /**
+ * Constructor
+ *
+ * @param includeGapGap
+ * @param matchGap
+ * @param includeGaps
+ * if true, gapped positions are counted in the PID denominator
+ * @param shortestLength
+ * if true, the denominator is the shorter sequence length (possibly
+ * including gaps)
+ */
+ SimilarityParams(boolean includeGapGap, boolean matchGap,
+ boolean includeGaps, boolean shortestLength)
+ {
+ includeGappedColumns = includeGapGap;
+ matchGaps = matchGap;
+ denominatorIncludesGaps = includeGaps;
+ denominateByShortestLength = shortestLength;
+ }
+
+ @Override
+ public boolean denominatorIncludesGaps()
+ {
+ return denominatorIncludesGaps;
+ }
+
+ @Override
+ public boolean denominateByShortestLength()
+ {
+ return denominateByShortestLength;
+ }
+
+ @Override
+ public boolean includeGappedColumns()
+ {
+ return includeGappedColumns;
+ }
+
+ @Override
+ public boolean matchGaps()
+ {
+ return matchGaps;
+ }
+}
--- /dev/null
+package jalview.api.analysis;
+
+/**
+ * A description of options when computing percentage identity of two aligned
+ * sequences
+ */
+public interface SimilarityParamsI
+{
+ /**
+ * Answers true if gap-gap aligned positions should be included in the
+ * calculation
+ *
+ * @return
+ */
+ boolean includeGappedColumns();
+
+ /**
+ * Answers true if gap-residue alignment is considered a match
+ *
+ * @return
+ */
+ boolean matchGaps();
+
+ /**
+ * Answers true if the demoninator (normalisation factor) of the score count
+ * includes gap-residue positions, false if it only includes residue-residue
+ * aligned positions. Gap-gap positions are included if this and
+ * includeGappedColumns both answer true.
+ *
+ * @return
+ */
+ boolean denominatorIncludesGaps();
+
+ /**
+ * Answers true if only the shortest sequence length is used to divide the
+ * total score, false if the longest sequence length
+ *
+ * @return
+ */
+ boolean denominateByShortestLength();
+}