Dear Bioc-Community,
I was wondering if it is currently possible to only import the first X
reads rather than all reads from an arbitrary BAM file into a list using
Rsamtools with scanBam? I did not find any parameter in scanBamParam
that seems to capture what I need. Specifically, I do not
Copy and pasted directly from inside gmapR:
guessReadLengthFromBam <- function(x, n=100L) {
ga <- readGAlignments(BamFile(x, yieldSize=n))
readlen <- unique(qwidth(ga))
if (length(readlen) != 1L)
NA_integer_
else readlen
}
On Thu, Jan 21, 2016 at 5:31 AM, Christian Arnold