crunch {biovizBase} | R Documentation

## Fetching GRanges from various data source

### Description

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 `AnnotationFilter-class`, an `AnnotationFilterList` combining several such objects or a filter expression in form of a `formula` (see `AnnotationFilter` for examples).
`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 AnnotationFilter package:
    temp <- crunch(edb, which = GenenameFilter("BRCA1"))

    ## Or a filter expression
    temp <- crunch(edb, which = ~ genename == "BRCA1")

[Package biovizBase version 1.28.2 Index]