[BioC] removing packages from the workspace - is this ok?

J.delasHeras at ed.ac.uk J.delasHeras at ed.ac.uk
Tue Jun 7 17:40:51 CEST 2011


This is more of a general R question, but it concerns in this case  
genomic annotation packages (BSgenome) and I would like to be sure I'm  
using this correctly and not mudling things up inadvertently.

As part of certain checks I'm running, using various IDs and  
coordinates from different genomic builds, I want to extract sequences  
from two different human genomic builds. Sometimes HG18, sometimes HG19.

This sometimes requires removing the annotation package from one build  
and loading the other.

What I do is, for instance:


library(BSgenome.Hsapiens.UCSC.hg18)
seq1<-subseq(Hsapiens$chr1, 11323785, 11323785+20)
as.character(seq1)
[1] "ACACACACCTGGAGAGCCCCA"

# ok, I got those 20 nucleotides.
# now I want to check a sequence in the HG19 build
# to remove HG18, I use
detach("package:BSgenome.Hsapiens.UCSC.hg18", unload=T)

# then I load HG19, and do whatever I want to do with it:
library(BSgenome.Hsapiens.UCSC.hg19)
seq2<-subseq(Hsapiens$chr1, 11401198, 11401198+20)
as.character(seq2)
[1] "ACACACACCTGGAGAGCCCCA"

# the same sequence, good, I verified the coordinates match.
# and now I remove it like I did for HG18:
detach("package:BSgenome.Hsapiens.UCSC.hg19", unload=T)

and I may want to repeat this process a few times, depending on what I get.

my sessionInfo() indicates the packages have been removed that way. My  
only concern is whether there's anything 'invisible' to me that is not  
removed that way, and that when I query one build, I may inadvertenty  
query the wrong one...

I just want to be sure that this is the correct/safe way to remove a  
package from the current workspace... and if it's not the right way,  
what is it?

thank you for your help,

Jose


-- 
Dr. Jose I. de las Heras                      Email: J.delasHeras at ed.ac.uk
The Wellcome Trust Centre for Cell Biology    Phone: +44 (0)131 6507090
Institute for Cell & Molecular Biology        Fax:   +44 (0)131 6507360
Swann Building, Mayfield Road
University of Edinburgh
Edinburgh EH9 3JR
UK


-- 
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.



More information about the Bioconductor mailing list