annotation += ", " + Util.roundDouble(100 * lastP, 1) + "% chance of coverage";
} else if (lastP > 0.01) {
annotation += ", possible to cover";
}
ArrayList<ResidueAnnotation> annotations = new ArrayList<ResidueAnnotation>(1);
annotations.add(new ResidueAnnotation(annotation, null, false));
for (int j = lastIndex; j < i; j++) {
residueAnnotation.put(j, new ArrayList<ResidueAnnotation>(annotations));
}
lastP = p;
lastIndex = i;
}
}
int i = coverage.length;
String annotation = (lastIndex + 1) + "-" + (i);
if (metrics.getPeptideLengthDistribution() != null) {
annotation += ", " + Util.roundDouble(100 * lastP, 1) + "% chance of coverage";
} else if (lastP > 0.01) {
annotation += ", possible to cover";
}
ArrayList<ResidueAnnotation> annotations = new ArrayList<ResidueAnnotation>(1);
annotations.add(new ResidueAnnotation(annotation, null, false));
for (int j = lastIndex; j < i; j++) {
residueAnnotation.put(j, new ArrayList<ResidueAnnotation>(annotations));
}
// batch load the required data
identification.loadPeptideMatches(proteinMatch.getPeptideMatchesKeys(), null);
for (String peptideKey : proteinMatch.getPeptideMatchesKeys()) {
PeptideMatch peptideMatch = identification.getPeptideMatch(peptideKey);
String peptideSequence = peptideMatch.getTheoreticPeptide().getSequence();
boolean enzymaticPeptide = true;
if (!allPeptides) {
enzymaticPeptide = currentProtein.isEnzymaticPeptide(peptideSequence, searchParameters.getEnzyme(),
sequenceMatchingPreferences);
}
if (allPeptides || (enzymatic && enzymaticPeptide) || (!enzymatic && !enzymatic)) {
String modifiedSequence = getTaggedPeptideSequence(peptideMatch, true, false, true);
AminoAcidPattern aminoAcidPattern = new AminoAcidPattern(peptideSequence);
ArrayList<Integer> startIndexes = aminoAcidPattern.getIndexes(sequence, sequenceMatchingPreferences);
for (int index : startIndexes) {
int peptideTempStart = index;
int peptideTempEnd = peptideTempStart + peptideSequence.length();
ResidueAnnotation newAnnotation = new ResidueAnnotation(peptideTempStart + " - " + modifiedSequence + " - " + peptideTempEnd, peptideKey, true);
for (int j = peptideTempStart - 1; j < peptideTempEnd - 1; j++) {
annotations = residueAnnotation.get(j);
if (annotations == null) {
annotations = new ArrayList<ResidueAnnotation>();
residueAnnotation.put(j, annotations);