test_path <- system.file("tests", package = "rtracklayer")
test_wig <- file.path(test_path, "step.wig")
## basic import calls
test <- import(test_wig)
test
import.wig(test_wig)
test_wig_file <- WIGFile(test_wig)
import(test_wig_file)
test_wig_con <- file(test_wig)
import(test_wig_con, format = "wig")
close(test_wig_con)
test_wig_con <- file(test_wig)
import(WIGFile(test_wig_con))
close(test_wig_con)
## various options
import(test_wig, genome = "hg19")
import(test_wig, trackLine = FALSE)
which <- as(test[3:4,], "RangesList")
import(test_wig, which = which)
## Not run:
# ## basic export calls
# test_wig_out <- file.path(tempdir(), "test.wig")
# export(test, test_wig_out)
# export.wig(test, test_wig_out)
# test_foo_out <- file.path(tempdir(), "test.foo")
# export(test, test_foo_out, format = "wig")
# test_wig_out_file <- WIGFile(test_wig_out)
# export(test, test_wig_out_file)
#
# ## appending
# test2 <- test
# metadata(test2)$trackLine <- initialize(metadata(test)$trackLine,
# name = "test2")
# export(test2, test_wig_out_file, append = TRUE)
#
# ## passing track line parameters
# export(test, test_wig_out, name = "test2")
#
# ## no track line
# export(test, test_wig_out, trackLine = FALSE)
#
# ## gzip
# test_wig_gz <- paste(test_wig_out, ".gz", sep = "")
# export(test, test_wig_gz)
# ## End(Not run)
Run the code above in your browser using DataLab