[BioC] subsetting transcriptDb

Marc Carlson mcarlson at fhcrc.org
Thu Feb 2 02:35:21 CET 2012


Hi Juliet,

You don't really want to subset the TxDb, but you do want to hide all 
the sequences from things that are not chromosome 9.  So you want to do 
something like this:

## 1st set all the sequences to be inactive:
isActiveSeq(mm9KG)[seqlevels(mm9KG)] <- FALSE
## Then set only "chr9" to be active:
isActiveSeq(mm9KG)["chr9"] <- TRUE
## You can see which are active like this:
isActiveSeq(mm9KG)

## And now if you call exonsBy() etc.  you will get only ranges from 
chromosome 9, (since you have masked all the others).
txExons9 <- exonsBy(mm9KG)

Hope this helps,


  Marc


On 02/01/2012 12:05 PM, Juliet Hannah wrote:
> All,
>
> I am studying "Using the GenomicFeatures package" slides by Marc Carlson.
>
> In the slides, a subset of the following corresponding to chr 9 is used.
>
> library(GenomicFeatures)
> mm9KG<- makeTranscriptDbFromUCSC(genome = "mm9", tablename = "knownGene")
>
> How can I subset this transcriptDb object so that it contains only chr 9.
>
> My goal is to use the statement
>
> txExons<- exonsBy(mm9KGChr9)
>
> where I believe mm9KGChr9 is what I am seeking above.
>
> Apologies if I have missed something obvious.
>
> Thanks,
>
> Juliet
>
>
>> sessionInfo()
> R version 2.14.1 (2011-12-22)
> Platform: x86_64-unknown-linux-gnu (64-bit)
>
> locale:
>   [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
>   [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
>   [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
>   [7] LC_PAPER=C                 LC_NAME=C
>   [9] LC_ADDRESS=C               LC_TELEPHONE=C
> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
>
> other attached packages:
> [1] BiocInstaller_1.2.1   GenomicFeatures_1.6.7 AnnotationDbi_1.16.11
> [4] Biobase_2.14.0        GenomicRanges_1.6.6   IRanges_1.12.5
>
> loaded via a namespace (and not attached):
>   [1] biomaRt_2.10.0     Biostrings_2.22.0  BSgenome_1.22.0    DBI_0.2-5
>   [5] RCurl_1.9-5        RSQLite_0.11.1     rtracklayer_1.14.4 tools_2.14.1
>   [9] XML_3.9-4          zlibbioc_1.0.0
>
> _______________________________________________
> 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



More information about the Bioconductor mailing list