test_path <- system.file("tests", package = "rtracklayer")
test_2bit <- file.path(test_path, "test.2bit")
test <- import(test_2bit)
test
test_2bit_file <- TwoBitFile(test_2bit)
import(test_2bit_file) # the whole file
which_range <- IRanges(c(10, 40), c(30, 42))
which <- GRanges(names(test), which_range)
import(test_2bit, which = which)
seqinfo(test_2bit_file)
## Not run:
# test_2bit_out <- file.path(tempdir(), "test_out.2bit")
# export(test, test_2bit_out)
#
# ## just a character vector
# test_char <- as.character(test)
# export(test_char, test_2bit_out)
# ## End(Not run)
Run the code above in your browser using DataLab