Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions RcppTskit/R/Class-TableCollection.R
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ TableCollection <- R6Class(
#' dump_file <- tempfile()
#' tc$dump(dump_file)
#' tc$write(dump_file) # alias
#' \dontshow{file.remove(dump_file)}
dump = function(file) {
tc_ptr_dump(self$pointer, file = file, options = 0L)
},
Expand Down
1 change: 1 addition & 0 deletions RcppTskit/R/Class-TreeSequence.R
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ TreeSequence <- R6Class(
#' dump_file <- tempfile()
#' ts$dump(dump_file)
#' ts$write(dump_file) # alias
#' \dontshow{file.remove(dump_file)}
dump = function(file) {
ts_ptr_dump(self$pointer, file = file, options = 0L)
},
Expand Down
2 changes: 2 additions & 0 deletions RcppTskit/man/TableCollection.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions RcppTskit/man/TreeSequence.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions RcppTskit/src/RcppTskit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ SEXP tc_ptr_load(const std::string file, const int options = 0) {
// ts_ptr <- RcppTskit:::ts_ptr_load(ts_file)
// dump_file <- tempfile()
// RcppTskit:::ts_ptr_dump(ts_ptr, dump_file)
// file.remove(dump_file)
// [[Rcpp::export]]
void ts_ptr_dump(const SEXP ts, const std::string file, const int options = 0) {
const tsk_flags_t dump_options =
Expand All @@ -250,6 +251,7 @@ void ts_ptr_dump(const SEXP ts, const std::string file, const int options = 0) {
// tc_ptr <- RcppTskit:::tc_ptr_load(ts_file)
// dump_file <- tempfile()
// RcppTskit:::tc_ptr_dump(tc_ptr, dump_file)
// file.remove(dump_file)
// [[Rcpp::export]]
void tc_ptr_dump(const SEXP tc, const std::string file, const int options = 0) {
const tsk_flags_t dump_options =
Expand Down
4 changes: 4 additions & 0 deletions RcppTskit/tests/testthat/test_load_summary_and_dump.R
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,7 @@ test_that("ts/tc_load(), ts/tc_summary*(), and ts/tc_dump(x) work", {
ts_ptr_dump(ts_ptr, dump_file)
rm(ts_ptr)
ts_ptr <- ts_ptr_load(dump_file)
file.remove(dump_file)

# Simple comparison of summaries
n <- ts_ptr_summary(ts_ptr)
Expand Down Expand Up @@ -438,6 +439,7 @@ test_that("ts/tc_load(), ts/tc_summary*(), and ts/tc_dump(x) work", {
rm(tc_ptr)
tc_ptr <- tc_ptr_load(dump_file)
ts_ptr <- ts_ptr_load(dump_file)
file.remove(dump_file)

# Simple comparison of summaries
n_ts <- ts_ptr_summary(ts_ptr)
Expand Down Expand Up @@ -474,6 +476,7 @@ test_that("ts/tc_load(), ts/tc_summary*(), and ts/tc_dump(x) work", {
ts$dump(dump_file)
rm(ts)
ts <- ts_load(dump_file)
file.remove(dump_file)

# Simple comparison of summaries
n_ptr <- ts_ptr_summary(ts$pointer)
Expand Down Expand Up @@ -515,6 +518,7 @@ test_that("ts/tc_load(), ts/tc_summary*(), and ts/tc_dump(x) work", {
tc$dump(dump_file)
rm(tc)
tc <- tc_load(dump_file)
file.remove(dump_file)

# Simple comparison of summaries
n_ptr <- tc_ptr_summary(tc$pointer)
Expand Down
1 change: 1 addition & 0 deletions RcppTskit/vignettes/RcppTskit_intro.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ ts$dump(file = ts_file)
# ... and to bring it back to R, use ...
ts2 <- ts_load(ts_file)
ts$num_individuals() # 2 (if you have run the above Python code)
file.remove(ts_file)

# You can work similarly with table collection between R & Python
tc <- ts$dump_tables()
Expand Down
Loading