[Bioc-devel] vmatchPattern Returns Out of Bounds Indices

Dario Strbenac dstr7320 at uni.sydney.edu.au
Thu Nov 17 01:00:11 CET 2016


Hello,

If using vmatchPattern to find a sequence in another sequence, the resulting end index can be beyond the length of the subject XStringSet. For example:

forwardPrimer <- "TCTTGTGGAAAGGACGAAACACCG"
> range(width(reads))
[1] 75 75
primerEnds <- vmatchPattern(forwardPrimer, reads, max.mismatch = 1)
> range(unlist(endIndex(primerEnds))
[1] 23 76

This causes problems if using extractAt to obtain the sequences within each read. For example:

sequences = extractAt(reads, locations)
Error in .normarg_at2(at, x) : 
  some ranges in 'at' are off-limits with respect to their corresponding sequence
  in 'x'

It's rare, but still a problem, nonetheless.

> table(unlist(endIndex(primerLocations)) >  75)

 FALSE   TRUE 
366225      2

This happens with Biostrings 2.42.0.

--------------------------------------
Dario Strbenac
University of Sydney
Camperdown NSW 2050
Australia



More information about the Bioc-devel mailing list