matchTagsFiltered
In matchTagsFiltered I noticed this comment “if the tag did not match then check for the Bion tag”. Thing is, there was no if clause governing this. It was going ahead and checking for the B ion all the time. I don’t know if this is desired or not, but I added code to make the B ion check dependent on if tags were not matched for the Y ion (hilighted):
// first check for tags and masses for the Y ion type
tagMatched = [self findLongestCommonSubstring:sequenceAsInt seqLen:sequenceLength querySequence:tagAsInt queryLen:[searchArray length] firstPosition:&firstMatchPosition lastPosition:&lastPosition firstTagPos:&firstPosInTag forReverse:YES];
if (tagMatched) {
correctedTag = [ self getCorrectedTag:currentTag sequence:acidSequence peptideMass:_peptideMass firstPosition:firstMatchPosition lastPosition:lastPosition firstPosInTag:firstPosInTag forReverse:YES] ;
if ([correctedTag getNMassMatched] || [correctedTag getCMassMatched]) {
[ matchedTags addObject:correctedTag];
}
}
else {
// if the tag did not match then check for the Bion tag
tagMatched = [ self findLongestCommonSubstring:sequenceAsInt seqLen:sequenceLength querySequence:tagAsInt queryLen:[searchArray length] firstPosition:&firstMatchPosition lastPosition:&lastPosition firstTagPos:&firstPosInTag forReverse:NO];
if (tagMatched) {
correctedTag = [ self getCorrectedTag:currentTag sequence:acidSequence peptideMass:_peptideMass firstPosition:firstMatchPosition lastPosition:lastPosition firstPosInTag:firstPosInTag forReverse:NO] ;
if ([correctedTag getCMassMatched] || [correctedTag getNMassMatched]) {
[matchedTags addObject:correctedTag];
}
}
}
The results are almost identical… Results with old code. Results with new conditional code. An example difference is that “NWRARWK” appears in the old results, but not in the new.
Cursory performance tests show an overall gain of 26% in speed! The question is: are the results less, equally, or more robust?
UPDATE: cannot make this modification. The comment was misleading as both sections need to be run since we do not know the ion type.