Hi all,
I have several BAM files which I would like to work in R environment. This are big files with more than 100M reads each. Is there any way to convert them in GRanges object and then save it as RData compressed file?
So far what I've tried is the following Rcode:
library(GenomicRanges)
library(Rsamtools)
args = commandArgs(TRUE)
filename <- args[1]
name <- args[2]
## Create GRanges object from the BAM file and save it to disk
param <- ScanBamParam(what=c("qname","flag"))
b <- readGAlignments(filename, format="BAM", param=param);
save(b,file=paste(name,".RData",sep=""), compression_level=9);
This code gave me error messages because R is not able to allocate vectors more than 800 ~ 1000 Mb size, which I understand, but is there any way to create GRanges object of large BAM files?
Thanks for your help!!