exportToBed {CAGEr} | R Documentation

## Create BED tracks of TSSs and clusters of TSSs

### Description

Creates BED file(s) with track(s) of individual CTSSs, tag clusters or consensus clusters. CTSSs and consensus clusters can be optionally colored in the color of their expression class. Tag clusters and consensus clusters can be displayed in a gene-like representation with a line showing full span on the cluster, filled block showing interquantile range and a thick box denoting position of the dominant (most frequently used TSS.

### Usage

    exportToBed(object, what = c("CTSS", "tagClusters", "consensusClusters"),
      qLow = NULL, qUp = NULL, colorByExpressionProfile = FALSE,
      oneFile = TRUE)

    ## S4 method for signature 'CAGEr'
    exportToBed(object, what = c("CTSS", "tagClusters",
      "consensusClusters"), qLow = NULL, qUp = NULL,
      colorByExpressionProfile = FALSE, oneFile = TRUE)

### Arguments

`object` | A `CAGEr` object.
`what` | Which elements should be exported to BED track. `CTSS` to export individual CTSSs, `tagClusters` to export tag clusters or `consensusClusters` to export consensus clusters.
`qLow, qUp` | Position of which "lower" (resp. "upper") quantile should be used as 5' (resp. 3') boundary of the filled block in gene-like representation of the cluster. Default value `NULL` uses start (resp. end) position of the cluster. Ignored when `what = "CTSS"`.
`colorByExpressionProfile` | Logical, should blocks be colored in the color of their corresponding expression class. Ignored when `what = "tagClusters"`.
`oneFile` | Logical, should all CAGE datasets be exported as individual tracks into the same BED file (`TRUE`) or into separate BED files (`FALSE`). Ignored when `what = "CTSS"`, which by default produces only one track.

### Details

The BED representations of CTSSs, tag cluster and consensus clusters can be directly visualised in the ZENBU or UCSC Genome Browsers.

When `what = "CTSS"`, one BED file with single track of 1 bp blocks representing all detected CTSSs (in all CAGE samples) is created. CTSSs can be colored according to their expression class (provided the expression profiling of CTSSs was done by calling `getExpressionProfiles` function). Colors of expression classes match the colors in which they are shown in the plot returned by the `plotExpressionProfiles` function. For `colorByExpressionProfile = FALSE`, CTSSs included in the clusters are shown in black and CTSSs that were filtered out in gray.

When `what = "tagClusters"`, one track per CAGE dataset is created, which can be exported to a single BED file (by setting `oneFile = TRUE`) or separate BED files (`FALSE`). If no quantile boundaries were provided (`qLow` and `qUp` are `NULL`, TCs are represented as simple blocks showing the full span of TC fromthe start to the end. Setting `qLow` and/or `qUp` parameters to a value of the desired quantile creates a gene-like representation with a line showing full span of the TC, filled block showing specified interquantile range and a thick 1 bp block denoting position of the dominant (most frequently used) TSS. All TCs in one track (one CAGE dataset) are shown in the same color.

When `what = "consensusClusters"` consensus clusters are exported to BED file. Since there is only one set of consensus clusters common to all CAGE datasets, only one track is created in case of a simple representation. This means that when `qLow = NULL` and `qUp = NULL` one track with blocks showing the full span of consensus cluster from the start to the end is created. However, the distribution of the CAGE signal within consensus cluster can be different in different CAGE samples, resulting in different positions of quantiles and dominant TSS. Thus, when `qLow` and/or `qUp` parameters are set to a value of the desired quantile, a separate track with a gene-like representation is created for every CAGE dataset. These tracks can be exported to a single BED file (by setting `oneFile = TRUE`) or separate BED files (by setting `oneFile = FALSE`). The gene-like representation is analogous to the one described above for the TCs. In all cases consensus clusters can be colored according to their expression class (provided the expression profiling of consensus clusters was done by calling `getExpressionProfiles` function). Colors of expression classes match the colors in which they are shown in the plot returned by the `plotExpressionProfiles` function. For `colorByExpressionProfile = FALSE` all consensus clusters are shown in black.

### Value

Creates BED file(s) in the working directory.

### Author(s)

Vanja Haberle

### See Also

Other CAGEr export functions: `exportCTSStoBedGraph`

### Examples

    ### exporting CTSSs colored by expression class
    exportToBed(object = exampleCAGEset, what = "CTSS", colorByExpressionProfile = TRUE)

    ### exporting tag clusters in gene-like representation
    exportToBed( object = exampleCAGEset, what = "tagClusters"
               , qLow = 0.1, qUp = 0.9, oneFile = TRUE)

    exportToBed( object = exampleCAGEexp, what = "tagClusters"
               , qLow = 0.1, qUp = 0.9, oneFile = TRUE)

[Package CAGEr version 1.34.0 Index]