import jalview.analysis.scoremodels.ScoreMatrix;
import jalview.analysis.scoremodels.ScoreModels;
+import jalview.api.analysis.ScoreModelI;
import jalview.datamodel.AlignmentAnnotation;
import jalview.datamodel.Annotation;
import jalview.datamodel.ResidueCount;
// From Alignment.java in jalview118
public void findQuality()
{
- findQuality(0, maxLength - 1, ScoreModels.getInstance().getBlosum62());
+ findQuality(0, maxLength - 1, getQualitySubstMat());
+ }
+
+ public ScoreMatrix getQualitySubstMat()
+ {
+ return sm;
+ }
+
+ /**
+ * default for quality calc is BLOSUM
+ */
+ private ScoreMatrix sm = ScoreModels.getInstance().getBlosum62();
+
+ /**
+ * set the matrix used for calculating quality scores
+ *
+ * @param scoreMatrix
+ * - must be a valid score matrix able to evaluate all amino acid
+ * substitutions
+ */
+ public void setQualitySubstMat(ScoreMatrix scoreMatrix)
+ {
+ if (scoreMatrix != null && scoreMatrix.isProtein())
+ {
+ sm = scoreMatrix;
+ }
}
/**
List<SequenceI> seqs, int start, int end, boolean positiveOnly,
int maxPercentGaps, boolean calcQuality)
{
+ return calculateConservation(name, seqs, start, end, positiveOnly,
+ maxPercentGaps, calcQuality, null);
+ }
+
+ /**
+ * construct and call the calculation methods on a new Conservation object
+ *
+ * @param name
+ * - name of conservation
+ * @param seqs
+ * @param start
+ * first column in calculation window
+ * @param end
+ * last column in calculation window
+ * @param positiveOnly
+ * calculate positive (true) or positive and negative (false)
+ * conservation
+ * @param maxPercentGaps
+ * percentage of gaps tolerated in column
+ * @param calcQuality
+ * flag indicating if alignment quality should be calculated
+ * @param scoreMatrix
+ * - null or peptide score matrix used for quality calculation
+ * @return Conservation object ready for use in visualization
+ */
+ public static Conservation calculateConservation(String name,
+ List<SequenceI> seqs, int start, int end, boolean positiveOnly,
+ int maxPercentGaps, boolean calcQuality, ScoreMatrix scoreMatrix)
+ {
Conservation cons = new Conservation(name, seqs, start, end);
+ if (scoreMatrix != null)
+ {
+ cons.setQualitySubstMat(scoreMatrix);
+ }
cons.calculate();
cons.verdict(positiveOnly, maxPercentGaps);
package jalview.workers;
import jalview.analysis.Conservation;
+import jalview.analysis.scoremodels.ScoreModels;
import jalview.api.AlignViewportI;
import jalview.api.AlignmentViewPanel;
import jalview.datamodel.AlignmentAnnotation;
}
try
{
+ // TODO - TDI is there a conservation measure ?
cons = Conservation.calculateConservation("All",
alignment.getSequences(), 0, alWidth - 1, false,
- ConsPercGaps, quality != null);
+ ConsPercGaps, quality != null, alignViewport.is3di() ? ScoreModels.getInstance().getFOLDSEEK3DI():ScoreModels.getInstance().getDefaultModel(true));
} catch (IndexOutOfBoundsException x)
{
// probable race condition. just finish and return without any fuss.