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