[BioC] exomeCopy - memory error

Martin Morgan mtmorgan at fhcrc.org
Tue Sep 18 18:24:27 CEST 2012


On 09/18/2012 07:43 AM, Lescai, Francesco wrote:
> Hi there,
> I'm encountering a memory error with exomeCopy which might be file-specific (i.e. it's not happening with any of my other batches).
> I'm running it on a cluster.
>
> Initially I had three batches pooled together and I had this error message in my .Rout file
>
> ----------------
>> for (f1 in bamfiles){
> +  sample<-gsub('.bam','',f1)
> +  exome.samples<-c(exome.samples,sample)
> +  rdata[[sample]] <- countBamInGRanges(f1,target.sub)
> + }
> Error in value[[3L]](cond) :
>    Realloc could not re-allocate memory (20971520 bytes)
>    file: /SAN/biomed/biomed14/ICH2/k/bam_batch_3/K_5165129.bam
>    index: /SAN/biomed/biomed14/ICH2/k/bam_batch_3/K_5165129.bam
> Calls: countBamInGRanges ... tryCatch -> tryCatchList -> tryCatchOne -> <Anonymous>
> Execution halted
> ------------------
>
> The index doesn't seem to point to a .bam.bai file, but I checked of course and the .bai is there, same way as for the other bams I'm counting in.

The index uses the samtools naming convention, so '.bam' without the 
explicit '.bai'.

The Realloc error could indicate out-of-memory, or possibly a bug (but I 
would have expected an error about not able to allocate 0 bytes) that is 
fixed in the devel (soon to be release) version of Rsamtools

   http://bioconductor.org/developers/useDevel/

> Then I separated the batches, and run again.
> Two of three didn't display any error,  while the third one (the one that .bam file belongs to) had this (slightly different) error
>
> -------------------------
>> for (f1 in bamfiles){
> +  sample<-gsub('.bam','',f1)
> +  exome.samples<-c(exome.samples,sample)
> +  rdata[[sample]] <- countBamInGRanges(f1,target.sub)
> + }
>
>   *** caught segfault ***
> address 0x4, cause 'memory not mapped'
>
> Traceback:
>   1: .Call(.bamfile_open, path(con), index(con), "rb")
>   2: open.BamFile(BamFile(file, index), "rb")
>   3: open(BamFile(file, index), "rb")
>   4: scanBam(bam.file, param = ScanBamParam(what = scan.what, which = range(granges.subset)))
>   5: scanBam(bam.file, param = ScanBamParam(what = scan.what, which = range(granges.subset)))
>   6: countBamInGRanges(f1, target.sub)
> aborting ...
> -------------------------
>
> Any idea where I could look better, in order to track this error?

but this looks like a different error, unrelated to memory allocation. 
Mike's suggestion to narrow it to invoking essentially step 3 in the 
traceback -- open(BamFile(file, index), "rb") -- is the best way 
forward. To get there, you might say

   trace(scanBam, quote({ print(file); print(param) }))

to figure out where in countBamInGRanges() things are going wrong.

Martin



>
> thanks for your help,
> Francesco
>
>
>
>> sessionInfo()
> R version 2.15.0 (2012-03-30)
> Platform: x86_64-unknown-linux-gnu (64-bit)
>
> locale:
>   [1] LC_CTYPE=en_US.iso885915       LC_NUMERIC=C
>   [3] LC_TIME=en_US.iso885915        LC_COLLATE=en_US.iso885915
>   [5] LC_MONETARY=en_US.iso885915    LC_MESSAGES=en_US.iso885915
>   [7] LC_PAPER=C                     LC_NAME=C
>   [9] LC_ADDRESS=C                   LC_TELEPHONE=C
> [11] LC_MEASUREMENT=en_US.iso885915 LC_IDENTIFICATION=C
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
>
> other attached packages:
> [1] exomeCopy_1.2.0     Rsamtools_1.8.5     Biostrings_2.24.1
> [4] GenomicRanges_1.8.7 IRanges_1.14.4      BiocGenerics_0.2.0
>
> loaded via a namespace (and not attached):
> [1] bitops_1.0-4.1 stats4_2.15.0  zlibbioc_1.2.0
>
> 	[[alternative HTML version deleted]]
>
> _______________________________________________
> Bioconductor mailing list
> Bioconductor at r-project.org
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor
>


-- 
Computational Biology / Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N.
PO Box 19024 Seattle, WA 98109

Location: Arnold Building M1 B861
Phone: (206) 667-2793



More information about the Bioconductor mailing list