private IEnumerable <FlankingMassMatch> GetBackwardMatches( MatchedTag matchedTag, ShiftedSequenceGraph backwardGraph, double?featureMass = null ) { for (var j = matchedTag.StartIndex - 1; j >= -1; j--) { var residue = j >= 0 ? _proteinSequence[j] : AminoAcid.ProteinNTerm.Residue; var location = j > 0 ? SequenceLocation.Everywhere : SequenceLocation.ProteinNTerm; if (!backwardGraph.AddAminoAcid(residue, location)) { yield break; } if (j == 0) { continue; } var backwardMatch = GetBestMatchInTheGraph(backwardGraph, _spec, featureMass); if (backwardMatch != null) { backwardMatch.Index = Math.Max(j, 0); yield return(backwardMatch); } } }
// private readonly int _minProductIonCharge; // private readonly int _maxProductIonCharge; private IEnumerable <FlankingMassMatch> GetForwardMatches( MatchedTag matchedTag, ShiftedSequenceGraph forwardGraph, double?featureMass = null ) { for (var i = matchedTag.EndIndex; i <= _proteinSequence.Length; i++) { var residue = i < _proteinSequence.Length ? _proteinSequence[i] : AminoAcid.ProteinCTerm.Residue; var location = i < _proteinSequence.Length - 1 ? SequenceLocation.Everywhere : SequenceLocation.ProteinCTerm; if (!forwardGraph.AddAminoAcid(residue, location)) { yield break; } if (i == _proteinSequence.Length - 1) { continue; } var forwardMatch = GetBestMatchInTheGraph(forwardGraph, _spec, featureMass); if (forwardMatch != null) { forwardMatch.Index = Math.Min(i + 1, _proteinSequence.Length); yield return(forwardMatch); } } }