On 03/17/2016 10:29 AM, Peter Hickey wrote:
Thanks, Aaron. I implemented a similar workaround, but I think it
would be nice to have in the core Bioconductor implementation. I had a
quick poke around GenomicAlignments::readGAlignmentPairs(), however,
but it looked like I'd have to learn a bit too much about the
underlying Rsamtools::scanBam() in order to implement a quick fix.
The error does come from scanBam
> bf = BamFile(system.file(package="Rsamtools", "extdata", "ex1.bam"))
> gr <- GRanges(paste0("seq", 3), IRanges(1, 1000))
> param <- ScanBamParam(which=gr, what="qname")
> scanBam(bf, param=param)
Error in value[[3L]](cond) : 'scanBam' failed:
record: 0
error: 0
file:
/home/mtmorgan/R/x86_64-pc-linux-gnu-library/3.3/Rsamtools/extdata/ex1.bam
index:
/home/mtmorgan/R/x86_64-pc-linux-gnu-library/3.3/Rsamtools/extdata/ex1.bam.bai
In addition: Warning message:
In doTryCatch(return(expr), name, parentenv, handler) :
space 'seq3' not in BAM header
and it seems like this is an easy fix. Look for it later today.