Learn R Programming

RnBeads (version 1.4.0)

rnb.RnBSet.to.bedGraph: rnb.RnBSet.to.bedGraph

Description

Exports the methylation data of an RnBSet object to *.bedGraph files.

Usage

rnb.RnBSet.to.bedGraph(rnb.set, out.dir = ".", reg.type = "sites", parameters = character(), digits = NULL)

Arguments

rnb.set
Dataset as an instance of class RnBSet.
out.dir
One-element character vector signifying the output directory in which to create bedGraph files. Setting this to "." (default) uses the current working directory. If the output directory does not exist, this function attempts to create it. Any existing files in this directory could be overwritten.
reg.type
Site or region type to be exported.
parameters
Named character vector storing parameters (other than "type" and "name") to include in the track definition line. The names of this vector must be the parameter names, and its elements - the corresponding values; missing values (NAs) are allowed neither for names, nor for values. This function does not test if all provided parameter names and values conform to the BedGraph track specification.
digits
Optionally, number of significant digits after the decimal point to round methylation values to. If specified, this parameter must be an integer between 0 and 10.

Value

(invisibly) a summary list containing information on the conversion step. elements are filenames (a table containing information on which sample has been written to what filename) and assembly (a string indicating the assembly used by rnb.set).

Details

The description of the BedGraph track format can be found here. Each methylation site is an entry in the resulting bedGraph file. The Score column corresponds to a site's methylation value in the interval [0,1].

Examples

Run this code

library(RnBeads.hg19)
data(small.example.object)
logger.start(fname=NA)
rnb.RnBSet.to.bedGraph(rnb.set.example,tempdir())

Run the code above in your browser using DataLab