Sorry if I'm missing the obvious, but after I perform a pairwise alignment between two strings, I'd like to query positions in the pattern
to learn what position it aligns to in the subject
-- is this functionality already there and I'm missing it, or do I need to rig up a utility function?
For instance, suppose we have this example:
library(Biostrings) (pw <- pairwiseAlignment('GTCA', 'GATACA')) Global PairwiseAlignmentsSingleSubject (1 of 1) pattern: [1] GT--CA subject: [1] GATACA score: -17.95402
I'd like to know that the 3rd (C) letter in pattern aligned to the 5th position in subject.
I can rig up something very basic (and probably breaks around many corner cases) that parses pattern(pw)
(GT--CA
) to count the dashes or whatever to translate one index to the other, but is there something more straightforward (and better thought out) already implemented that I'm missing?
You are a hero. Thanks Hervé!