Skip to content

Commit 33361d8

Browse files
committed
Depend on RcppTskit 0.3.0
1 parent 5d0f365 commit 33361d8

File tree

6 files changed

+89
-2
lines changed

6 files changed

+89
-2
lines changed

DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ Depends:
1010
R (>= 4.0.0)
1111
Imports:
1212
methods,
13-
RcppTskit (>= 0.2.0)
13+
RcppTskit (>= 0.3.0)
1414
LinkingTo:
1515
Rcpp (>= 0.12.10),
16-
RcppTskit (>= 0.2.0)
16+
RcppTskit (>= 0.3.0)
1717
Encoding: UTF-8
1818
Roxygen: list(markdown = TRUE)
1919
RoxygenNote: 7.3.3

NAMESPACE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Generated by roxygen2: do not edit by hand
22

3+
export(tc_xptr_summary2)
34
export(ts_xptr_num_individuals2)
45
import(RcppTskit)
56
importFrom(methods,is)

R/RcppExports.R

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,19 @@ ts_xptr_num_individuals2 <- function(ts) {
1414
.Call(`_RcppTskitTestLinking_ts_xptr_num_individuals2`, ts)
1515
}
1616

17+
#' @title Summarise `tskit` table collection
18+
#' @param tc an external pointer to a \code{tsk_table_collection_t} object.
19+
#' @return A list.
20+
#' @examples
21+
#' ts_file <- system.file("examples", "test.trees", package = "RcppTskit")
22+
#' tc <- RcppTskit:::tc_xptr_load(ts_file)
23+
#' RcppTskit:::tc_xptr_summary(tc)
24+
#' tc_xptr_summary2(tc) # a bit simpler at this stage ...
25+
#' tc <- RcppTskit::TableCollection$new(ts_file)
26+
#' RcppTskit:::tc_xptr_summary(tc$pointer)
27+
#' tc_xptr_summary2(tc$pointer) # a bit simpler at this stage ...
28+
#' @export
29+
tc_xptr_summary2 <- function(tc) {
30+
.Call(`_RcppTskitTestLinking_tc_xptr_summary2`, tc)
31+
}
32+

man/tc_xptr_summary2.Rd

Lines changed: 26 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/RcppExports.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,21 @@ BEGIN_RCPP
2121
return rcpp_result_gen;
2222
END_RCPP
2323
}
24+
// tc_xptr_summary2
25+
Rcpp::List tc_xptr_summary2(const SEXP tc);
26+
RcppExport SEXP _RcppTskitTestLinking_tc_xptr_summary2(SEXP tcSEXP) {
27+
BEGIN_RCPP
28+
Rcpp::RObject rcpp_result_gen;
29+
Rcpp::RNGScope rcpp_rngScope_gen;
30+
Rcpp::traits::input_parameter< const SEXP >::type tc(tcSEXP);
31+
rcpp_result_gen = Rcpp::wrap(tc_xptr_summary2(tc));
32+
return rcpp_result_gen;
33+
END_RCPP
34+
}
2435

2536
static const R_CallMethodDef CallEntries[] = {
2637
{"_RcppTskitTestLinking_ts_xptr_num_individuals2", (DL_FUNC) &_RcppTskitTestLinking_ts_xptr_num_individuals2, 1},
38+
{"_RcppTskitTestLinking_tc_xptr_summary2", (DL_FUNC) &_RcppTskitTestLinking_tc_xptr_summary2, 1},
2739
{NULL, NULL, 0}
2840
};
2941

src/test.cpp

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,35 @@ int ts_xptr_num_individuals2(const SEXP ts) {
1616
RcppTskit_treeseq_xptr ts_xptr(ts);
1717
return static_cast<int>(tsk_treeseq_get_num_individuals(ts_xptr));
1818
}
19+
20+
//' @title Summarise `tskit` table collection
21+
//' @param tc an external pointer to a \code{tsk_table_collection_t} object.
22+
//' @return A list.
23+
//' @examples
24+
//' ts_file <- system.file("examples", "test.trees", package = "RcppTskit")
25+
//' tc <- RcppTskit:::tc_xptr_load(ts_file)
26+
//' RcppTskit:::tc_xptr_summary(tc)
27+
//' tc_xptr_summary2(tc) # a bit simpler at this stage ...
28+
//' tc <- RcppTskit::TableCollection$new(ts_file)
29+
//' RcppTskit:::tc_xptr_summary(tc$pointer)
30+
//' tc_xptr_summary2(tc$pointer) # a bit simpler at this stage ...
31+
//' @export
32+
// [[Rcpp::export]]
33+
Rcpp::List tc_xptr_summary2(const SEXP tc) {
34+
RcppTskit_table_collection_xptr tc_xptr(tc);
35+
const tsk_table_collection_t *tables = tc_xptr;
36+
return Rcpp::List::create(
37+
Rcpp::_["num_provenances"] = tables->provenances.num_rows,
38+
Rcpp::_["num_populations"] = tables->populations.num_rows,
39+
Rcpp::_["num_migrations"] = tables->migrations.num_rows,
40+
Rcpp::_["num_individuals"] = tables->individuals.num_rows,
41+
Rcpp::_["num_nodes"] = tables->nodes.num_rows,
42+
Rcpp::_["num_edges"] = tables->edges.num_rows,
43+
Rcpp::_["num_sites"] = tables->sites.num_rows,
44+
Rcpp::_["num_mutations"] = tables->mutations.num_rows,
45+
Rcpp::_["sequence_length"] = tables->sequence_length,
46+
Rcpp::_["has_reference_sequence"] = tc_xptr_has_reference_sequence(tc),
47+
Rcpp::_["time_units"] = tc_xptr_time_units(tc),
48+
Rcpp::_["file_uuid"] = tc_xptr_file_uuid(tc),
49+
Rcpp::_["has_index"] = tc_xptr_has_index(tc));
50+
}

0 commit comments

Comments
 (0)