exportGRangesAsBedFile {chromstaR} | R Documentation

## Export genome browser viewable files

### Description

Export GRanges as genome browser viewable file

### Usage

    exportGRangesAsBedFile(gr, trackname, filename, namecol = "combination",
      scorecol = "score", colorcol = NULL, colors = NULL, header = TRUE,
      append = FALSE)

### Arguments

`gr` | A `GRanges-class` object.
`trackname` | The name that will be used as track name and description in the header.
`filename` | The name of the file that will be written. The ending ".bed.gz". Any existing file will be overwritten.
`namecol` | A character specifying the column that is used as name-column.
`scorecol` | A character specifying the column that is used as score-column. The score should contain integers in the interval [0,1000] for compatibility with the UCSC genome browser convention.
`colorcol` | A character specifying the column that is used for coloring the track. There will be one color for each unique element in `colorcol`.
`colors` | A character vector with the colors that are used for the unique elements in `colorcol`.
`header` | A logical indicating whether the output file will have a heading track line (`TRUE`) or not (`FALSE`).
`append` | Whether or not to append to an existing file.

### Details

Export regions from `GRanges-class` as a file which can be uploaded into a genome browser. Regions are exported in BED format (.bed.gz).

### Value

`NULL`

### Author(s)

Aaron Taudt

### See Also

`exportPeaks`, `exportCounts`, `exportCombinations`

### Examples

    ### Export regions with read counts above 20 ###
    # Get an example BAM file with ChIP-seq reads
    file <- system.file("extdata", "euratrans",
                          "lv-H3K27me3-BN-male-bio2-tech1.bam",
                           package="chromstaRData")
    # Bin the file into bin size 1000bp
    data(rn4_chrominfo)
    binned <- binReads(file, assembly=rn4_chrominfo, binsizes=1000,
                      stepsizes=500, chromosomes='chr12')
    plotHistogram(binned)
    # Export regions with read count above 20
    exportGRangesAsBedFile(binned[binned$counts[,1] > 20], filename=tempfile(),
                 trackname='read counts above 20')

[Package chromstaR version 1.10.0 Index]