Large BAM File
1
0
Entering edit mode
yogi • 0
@yogi-8920
Last seen 8.6 years ago
Canada

Hi,

I have a >30GB BAM file. How do I load into an R console?

I tried using Rsamtools, but getting following error message.

Error in value[[3L]](cond) : 
  'Realloc' could not re-allocate memory (62914560 bytes)
  file: test.sorted.bam
  index: 
In addition: Warning messages:
1: In doTryCatch(return(expr), name, parentenv, handler) :
  Reached total allocation of 3991Mb: see help(memory.size)
2: In doTryCatch(return(expr), name, parentenv, handler) :
  Reached total allocation of 3991Mb: see help(memory.size)

Thanks in advance.

 

 

rsamtools • 1.0k views
ADD COMMENT
1
Entering edit mode
@herve-pages-1542
Last seen 18 hours ago
Seattle, WA, United States

Hi,

How much memory do you have on your machine? If you really want to be able to load the entire file in R you will need to have a lot of memory. However, most of the times you don't need to do that. Depending on what you want to do with your alignments, you might be able to do it by processing the file by chunk, which will reduce memory usage a lot and also improve performance. Please check the man page for BamFile in the Rsamtools package and at its yieldSize argument for more information about this. Also the man page for readGAlignments() in the GenomicAlignments package has some examples of how to load and process a BAM file by chunk.

H.

ADD COMMENT

Login before adding your answer.

Traffic: 637 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6