Dear all,
I tried to open a bam file with the following script:
library(Rsamtools)
bam<-scanBam("~/Bamfiles Ivy/W9.1.1.bam")
As a result, a memory error occured:
Error in value[[3L]](cond) :
'Realloc' could not re-allocate memory (209715200 bytes)
file: C:/Users/Diana/Documents/Bamfiles Ivy/W9.1.1.bam
index: NA
Hence, I am trying to split the file into chunks (chromosomes). The official RSamtools introduction states this code:
> summaryFunction <- function(seqname, bamFile,
+ ...) {
+ param <- ScanBamParam(what = c("pos", "qwidth"),
+ which = GRanges(seqname, IRanges(1, 1e+07)),
4
+ flag = scanBamFlag(isUnmappedQuery = FALSE))
+ x <- scanBam(bamFile, ..., param = param)[[1]]
+ coverage(IRanges(x[["pos"]], width = x[["qwidth"]]))
+ }
However, I don't understand how to fill in the position and qwidth, as I can't read the Bamfile. I tried other things as well, including Seqtools, but it won't work.
I would be VERY grateful if someone could help me out!