From: gmungoc Date: Fri, 24 Feb 2017 15:20:20 +0000 (+0000) Subject: JAL-838 first version of PID parameters model X-Git-Tag: Release_2_10_2~3^2~105^2~2^2~89 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=a4015623cfd1057095d5d54043de462d9163af4b;p=jalview.git JAL-838 first version of PID parameters model --- diff --git a/src/jalview/analysis/scoremodels/SimilarityParams.java b/src/jalview/analysis/scoremodels/SimilarityParams.java new file mode 100644 index 0000000..8b6b7d0 --- /dev/null +++ b/src/jalview/analysis/scoremodels/SimilarityParams.java @@ -0,0 +1,73 @@ +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; + } +} diff --git a/src/jalview/api/analysis/SimilarityParamsI.java b/src/jalview/api/analysis/SimilarityParamsI.java new file mode 100644 index 0000000..9ec2151 --- /dev/null +++ b/src/jalview/api/analysis/SimilarityParamsI.java @@ -0,0 +1,41 @@ +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(); +}