Learn R Programming

RIPSeeker (version 1.12.0)

exportGRanges: Export GRanges object in a specified format

Description

A wrapper function of export with additional support for exporting tab-delimted format with no re-arrangement of the original GRanges output.

Usage

exportGRanges(gRanges, outfile, exportFormat)

Arguments

gRanges
GRanges object to export.
outfile
File path for output.
exportFormat
Desirable format including "txt" and other formats specified in export.

Value

  • Output the text to the file stream defined in outfile.

References

Michael Lawrence, Vince Carey and Robert Gentleman. rtracklayer: R interface to genome browsers and their annotation tracks. R package version 1.16.3.

See Also

export

Examples

Run this code
if(interactive()) { # need permission to write to the current dir
gr <-
    GRanges(seqnames =
            Rle(c("chr1", "chr2", "chr1", "chr3"), c(1, 3, 2, 4)),
            ranges =
            IRanges(1:10, width = 10:1, names = head(letters,10)),
            strand =
            Rle(strand(c("-", "+", "*", "+", "-")),
                c(1, 2, 2, 3, 2)),
            score = 1:10,
            GC = seq(1, 0, length=10))

	outfile <- paste(getwd(), "/gr.txt", sep="/")

	exportGRanges(gr, outfile=outfile, exportFormat="txt")
}

Run the code above in your browser using DataLab