Description Usage Arguments Value See Also Examples
This is a lightweight wrapper to the export family of functions defined in rtracklayer.
1 2 3 4 5 | write_bed(x, file, index = FALSE)
write_bed_graph(x, file, index = FALSE)
write_narrowpeaks(x, file)
|
x |
A GRanges object |
file |
File name, URL or connection specifying a file to write x to.
Compressed files with extensions such as '.gz' are handled
automatically. If you want to index the file with tabix use the
|
index |
Compress and index the output file with bgzf and tabix (default = FALSE). Note that tabix indexing will sort the data by chromosome and start. |
The write functions return a BED(Graph)File invisibly
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | ## Not run:
test_path <- system.file("tests", package = "rtracklayer")
bed_file <- file.path(test_path, "test.bed")
gr <- read_bed(bed_file)
bed_file_out <- file.path(tempdir(), "new.bed")
write_bed(gr, bed_file_out)
read_bed(bed_file_out)
#' bedgraph
bg_file <- file.path(test_path, "test.bedGraph")
gr <- read_bed_graph(bg_file)
bg_file_out <- file.path(tempdir(), "new.bg")
write_bed(gr, bg_file_out)
read_bed(bg_file_out)
# narrowpeaks
np_file <- system.file("extdata", "demo.narrowPeak.gz",package="rtracklayer")
gr <- read_narrowpeaks(np_file, genome_info = "hg19")
np_file_out <- file.path(tempdir(), "new.bg")
write_narrowpeaks(gr, np_file_out)
read_narrowpeaks(np_file_out)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.