[Bioc-devel] Rsamtools: How to import only the first 1000 or so reads

2016-01-21 Thread Christian Arnold
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

Re: [Bioc-devel] Rsamtools: How to import only the first 1000 or so reads

2016-01-21 Thread Michael Lawrence
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