Fetching Granges from various data source, currently supported objects
are TxDb, EnsDb, GAlignments and BamFile.
Usage
## S4 method for signature 'TxDb'
crunch(obj, which, columns = c("tx_id", "tx_name","gene_id"),
type = c("all", "reduce"), truncate.gaps = FALSE,
truncate.fun = NULL, ratio = 0.0025)
## S4 method for signature 'EnsDb'
crunch(obj, which, columns = c("tx_id", "gene_name","gene_id"),
type = c("all", "reduce"), truncate.gaps = FALSE,
truncate.fun = NULL, ratio = 0.0025)
## S4 method for signature 'GAlignments'
crunch(obj, which, truncate.gaps = FALSE,
truncate.fun = NULL, ratio = 0.0025)
## S4 method for signature 'BamFile'
crunch(obj, which, ..., type = c("gapped.pair", "raw", "all"),
truncate.gaps = FALSE, truncate.fun = NULL, ratio = 0.0025)
Arguments
obj
supported objects are TxDb, GAlignments and BamFile.
which
GRanges object. For TxDb object, could aslo be a list.
For EnsDb, it can also be a single filter object
extending BasicFilter-class or a
list of such objects.
columns
columns to include in the output.
type
default 'all' is to show the full model, 'reduce' is to show a
single model.
truncate.gaps
logical value, default FALSE. Whether to truncate gaps or
not.
truncate.fun
shrinkage function.
ratio
numeric value, shrinking ratio.
...
arguments passed to function readGAlignments.
Value
GRanges object.
Author(s)
Tengfei Yin
Examples
library(biovizBase)
library(TxDb.Hsapiens.UCSC.hg19.knownGene)
data(genesymbol, package = "biovizBase")
txdb <- TxDb.Hsapiens.UCSC.hg19.knownGene
obj <- txdb
temp <- crunch(txdb, which = genesymbol["BRCA1"], type = "all")
temp <- crunch(txdb, which = genesymbol["BRCA1"], type = "reduce")
## Fetching data from a EnsDb object.
library(EnsDb.Hsapiens.v75)
edb <- EnsDb.Hsapiens.v75
gr <- genesymbol["BRCA1"]
seqlevels(gr) <- sub(seqlevels(gr), pattern="chr", replacement="")
temp <- crunch(edb, which=gr)
## Alternatively, use the GenenameFilter from the ensembldb package:
temp <- crunch(edb, which=GenenameFilter("BRCA1"))
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(biovizBase)
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/biovizBase/crunch-method.Rd_%03d_medium.png", width=480, height=480)
> ### Name: crunch
> ### Title: Fetching GRanges from various data source
> ### Aliases: crunch crunch,TxDb-method crunch,EnsDb-method
> ### crunch,GAlignments-method crunch,BamFile-method
>
> ### ** Examples
>
> library(biovizBase)
> library(TxDb.Hsapiens.UCSC.hg19.knownGene)
Loading required package: GenomicFeatures
Loading required package: BiocGenerics
Loading required package: parallel
Attaching package: 'BiocGenerics'
The following objects are masked from 'package:parallel':
clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
clusterExport, clusterMap, parApply, parCapply, parLapply,
parLapplyLB, parRapply, parSapply, parSapplyLB
The following objects are masked from 'package:stats':
IQR, mad, xtabs
The following objects are masked from 'package:base':
Filter, Find, Map, Position, Reduce, anyDuplicated, append,
as.data.frame, cbind, colnames, do.call, duplicated, eval, evalq,
get, grep, grepl, intersect, is.unsorted, lapply, lengths, mapply,
match, mget, order, paste, pmax, pmax.int, pmin, pmin.int, rank,
rbind, rownames, sapply, setdiff, sort, table, tapply, union,
unique, unsplit
Loading required package: S4Vectors
Loading required package: stats4
Attaching package: 'S4Vectors'
The following objects are masked from 'package:base':
colMeans, colSums, expand.grid, rowMeans, rowSums
Loading required package: IRanges
Loading required package: GenomeInfoDb
Loading required package: GenomicRanges
Loading required package: AnnotationDbi
Loading required package: Biobase
Welcome to Bioconductor
Vignettes contain introductory material; view with
'browseVignettes()'. To cite Bioconductor, see
'citation("Biobase")', and for packages 'citation("pkgname")'.
> data(genesymbol, package = "biovizBase")
> txdb <- TxDb.Hsapiens.UCSC.hg19.knownGene
> obj <- txdb
> temp <- crunch(txdb, which = genesymbol["BRCA1"], type = "all")
Parsing transcripts...
Parsing exons...
Parsing cds...
Parsing utrs...
------exons...
------cdss...
------introns...
------utr...
aggregating...
Done
> temp <- crunch(txdb, which = genesymbol["BRCA1"], type = "reduce")
Parsing transcripts...
Parsing exons...
Parsing cds...
Parsing utrs...
------exons...
------cdss...
------introns...
------utr...
aggregating...
Done
>
> ## Fetching data from a EnsDb object.
> library(EnsDb.Hsapiens.v75)
Loading required package: ensembldb
> edb <- EnsDb.Hsapiens.v75
> gr <- genesymbol["BRCA1"]
> seqlevels(gr) <- sub(seqlevels(gr), pattern="chr", replacement="")
> temp <- crunch(edb, which=gr)
Fetching data...OK
Parsing exons...OK
Defining introns...OK
Defining UTRs...OK
Defining CDS...OK
aggregating...
Done
Warning messages:
1: In if (!is.na(genome(which))) { :
the condition has length > 1 and only the first element will be used
2: In if (!(seqlevels(which) %in% seqlevels(obj))) stop(seqlevels(which), :
the condition has length > 1 and only the first element will be used
>
> ## Alternatively, use the GenenameFilter from the ensembldb package:
> temp <- crunch(edb, which=GenenameFilter("BRCA1"))
Fetching data...OK
Parsing exons...OK
Defining introns...OK
Defining UTRs...OK
Defining CDS...OK
aggregating...
Done
>
>
>
>
>
>
> dev.off()
null device
1
>