exportGRanges: Export GRanges object in a specified format

Description Usage Arguments Value Note Author(s) References See Also Examples

View source: R/exportGRanges.R

Description

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

Usage

1
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.

Note

The function is used in ripSeek to export desired format and can be used as general purpose function.

Author(s)

Yue Li

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
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")
}

RIPSeeker documentation built on Oct. 31, 2019, 7:29 a.m.