Skip to content

HighlanderLab/RcppTskit

Repository files navigation

RcppTskit: R access to the tskit C API

Overview

Tskit enables performant storage, manipulation, and analysis of ancestral recombination graphs (ARGs) using succinct tree sequence encoding. The tree sequence encoding of an ARG is described in Wong et al. (2024) <doi:10.1093/genetics/iyae100>, while tskit project is described in Jeffrey et al. (2026) <doi:10.48550/arXiv.2602.09649>. See https://tskit.dev for project news, documentation, and tutorials. Tskit provides Python, C, and Rust application programming interfaces (APIs). The Python API can be called from R via the reticulate R package to seamlessly load and analyse a tree sequence, as described at https://tskit.dev/tutorials/RcppTskit.html. RcppTskit provides R access to the tskit C API for use cases where the reticulate option is not optimal. For example, for high-performance and low-level work with tree sequences. Currently, RcppTskit provides a limited number of functions due to the availability of extensive Python API and the reticulate option. The provided RcppTskit R API mirrors the tskit Python API, while the RcppTskit C++ API mirrors the tskit C API.

See more details on the state of the tree sequence ecosystem and aims of RcppTskit in the introduction vignette (source). The vignette also shows examples on how to use RcppTskit on its own or to develop new R packages that can leverage RcppTskit.

Status

General: Lifecycle: experimental Development Licence

Release: CRAN version Downloads - total GitHub version (main)

R CMD checks: CRAN summary CRAN worst R universe GitHub

Code quality: Codecov test coverage

Contents

  • extern - Git submodule for tskit and instructions on obtaining the latest version and copying the tskit C code into RcppTskit directory. extern is saved outside of the RcppTskit directory because R CMD CHECK complains otherwise (even with .Rbuildignore).

  • RcppTskit - R package RcppTskit.

License

  • See extern/LICENSE for tskit.

  • See RcppTskit/LICENSE* for RcppTskit.

Installation

To install the published release from CRAN use:

# Install
install.packages("RcppTskit")

# Read the introduction to RcppTskit
vignette("RcppTskit_intro")

To install the latest development version (possibly unstable!) from R universe use:

# Install
r_universe_and_cran <- c(
  "https://highlanderlab.r-universe.dev",
  "https://cloud.r-project.org"
  )
install.packages("RcppTskit", repos = r_universe_and_cran)

# Read the introduction to RcppTskit
vignette("RcppTskit_intro")

To install the latest development version (possibly unstable!) from Github use the following code. Note that you will have to compile the C/C++ code and vignette, so you will require the complete build toolchain, including compilers, other R packages, and quarto. See https://r-pkgs.org/setup.html#setup-tools for introduction to this topic, https://cran.r-project.org/bin/windows/Rtools for Windows tools, and https://mac.r-project.org/tools for macOS tools.

# install.packages("remotes") # If you don't have it already

# Install the main branch
remotes::install_github("HighlanderLab/RcppTskit/RcppTskit@main",
  build_vignettes=TRUE)

# Install the development branch
remotes::install_github("HighlanderLab/RcppTskit/RcppTskit@devel",
  build_vignettes=TRUE)

# Install a specific release (say, v0.2.0)
remotes::install_github("HighlanderLab/RcppTskit/RcppTskit@v0.2.0")

# Read the introduction to RcppTskit
vignette("RcppTskit_intro")

Development

See README_DEVEL.md

About

R access to the tskit C API

Resources

Code of conduct

Stars

Watchers

Forks

Packages

 
 
 

Contributors