[BioC] BSgenome and R memory use
Paul Leo
p.leo at uq.edu.au
Tue Jul 3 15:04:18 CEST 2007
Hi Martin,
Thanks for those tips; I think I can use them to get past this
bottle-neck.
I too have become dependent on this nice package.
Cheers
Paul
-----Original Message-----
From: Martin Morgan [mailto:mtmorgan at fhcrc.org]
Sent: Tuesday, 3 July 2007 9:32 PM
To: Paul Leo
Cc: bioconductor at stat.math.ethz.ch
Subject: Re: [BioC] BSgenome and R memory use
Hi Paul --
See class?BSgenome
I think what happens is that
> use.chromo <- Mmusculus[[chr.search[j]]]
causes the data to be loaded, and a 'view' to be created.
> rm(use.chromo)
removes the view, but does not unload the data. So you'll need to also
> unload(Mmusculus, chr.search[j])
I've found these packages very useful, thanks Herve!
Martin
"Paul Leo" <p.leo at uq.edu.au> writes:
> I have a bit of a problem with R running out of memory with BSgenome .
I
> have distilled it down to the bare bones. Basically I am just calling
up
> different mouse chromosomes and putting them into an object
> (use.chromo). I then immediately remove it with the simplistic idea
that
> this will free up the space that this object required. I always use
the
> same object and I do nothing with it.
>
> The memory is rapidly depleted. I would love to know what tricks are
out
> there for cleaning up after removed objects. And in general what the
> origin of this behavior is....and ideas now to avoid it.
>
> Until the loop below is stated I have enough memory to load any single
> mouse chromosome.
>
> Thanks
> Paul
>
>
> ### set up the test
> library(BSgenome.Mmusculus.UCSC.mm8)
> chromos<-c(1:19,"X","Y")
> chr.search<-paste("chr",chromos,sep="")
> #> chr.search
> # [1] "chr1" "chr2" "chr3" "chr4" "chr5" "chr6" "chr7" "chr8"
> "chr9" "chr10" "chr11" "chr12" "chr13"
> #[14] "chr14" "chr15" "chr16" "chr17" "chr18" "chr19" "chrX" "chrY"
>
> ##### run the test
> k<-0
> for (i in 1:10){
> for (j in 1:length(chr.search)){
> use.chromo <- Mmusculus[[chr.search[j]]]
> rm(use.chromo)
> k<-k+1 } } # k is between 6 and 8 typically when this fails
> Error: cannot allocate vector of size 138.4 Mb
>
> ## note same behavior for R2.5 and earlier version of BS genome
> ## I am using the standard memory location for windows (1.5GB) I don't
> think increasing this will help much
>
> If you replace
> use.chromo <- Mmusculus[[chr.search[j]]]
> in the above loop with
> p<- getSeq(Mmusculus, chr.search[j], 100,1000)
> a similar failure occurs.
>
>
> sessionInfo()
> R version 2.6.0 Under development (unstable) (2007-06-26 r42066)
> i386-pc-mingw32
>
> locale:
>
LC_COLLATE=English_Australia.1252;LC_CTYPE=English_Australia.1252;LC_MON
>
ETARY=English_Australia.1252;LC_NUMERIC=C;LC_TIME=English_Australia.1252
>
> attached base packages:
> [1] tools stats graphics grDevices utils datasets
methods
>
> [8] base
>
> other attached packages:
> [1] BSgenome.Mmusculus.UCSC.mm8_1.3.0 BSgenome_1.5.0
> [3] Biobase_1.15.17 Biostrings_2.5.11
>>
>
>
>
>
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> Bioconductor mailing list
> Bioconductor at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives:
http://news.gmane.org/gmane.science.biology.informatics.conductor
--
Martin Morgan
Bioconductor / Computational Biology
http://bioconductor.org
More information about the Bioconductor
mailing list