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
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ repos:
hooks:
- id: air-format
name: air format
entry: air format .
entry: RcppTskit/tools/run-local-tool.sh air format .
language: system
pass_filenames: false
files: '\.(R|Rmd|rmd|qmd|Qmd)$'

- id: jarl-lint
name: jarl lint
entry: jarl check .
entry: RcppTskit/tools/run-local-tool.sh jarl check .
language: system
pass_filenames: false
files: '\.(R|Rmd|rmd|qmd|Qmd)$'
Expand Down
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ To install the published release from [CRAN](https://cran.r-project.org) use:
# https://github.com/HighlanderLab/RcppTskit/issues/14
# https://github.com/HighlanderLab/RcppTskit/issues/45
# install.packages("RcppTskit")
# vignette("RcppTskit_intro")
```

To install the latest development version (possibly unstable!) from
Expand All @@ -99,10 +100,14 @@ https://mac.r-project.org/tools for macOS tools.
# remotes::install_github("HighlanderLab/RcppTskit/RcppTskit")

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

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

vignette("RcppTskit_intro")
```

## Development
Expand Down
2 changes: 1 addition & 1 deletion RcppTskit/R/RcppTskit-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#' @importFrom reticulate import is_py_object py_module_available py_require
#'
#' @examples
#' vignette(package="RcppTskit")
#' vignette("RcppTskit_intro")
"_PACKAGE"

#' Provide an inline plugin so we can call the tskit C API with functions like
Expand Down
2 changes: 1 addition & 1 deletion RcppTskit/man/RcppTskit-package.Rd

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

35 changes: 35 additions & 0 deletions RcppTskit/tools/run-local-tool.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env sh
set -eu

if [ "$#" -lt 1 ]; then
echo "Usage: $0 <tool> [args...]" >&2
exit 2
fi

tool="$1"
shift

if command -v "$tool" >/dev/null 2>&1; then
exec "$tool" "$@"
fi

# Follow project guidance by checking user-local bin directories.
if [ -n "${HOME:-}" ]; then
PATH="${HOME}/.local/bin:${HOME}/bin:${PATH}"
export PATH
if command -v "$tool" >/dev/null 2>&1; then
exec "$tool" "$@"
fi
fi

# As a last resort, query the user's login shell PATH.
if [ -n "${SHELL:-}" ] && [ -x "${SHELL:-}" ]; then
resolved="$("${SHELL}" -lc "command -v \"$tool\"" 2>/dev/null || true)"
if [ -n "$resolved" ] && [ -x "$resolved" ]; then
exec "$resolved" "$@"
fi
fi

echo "Executable '$tool' not found on PATH." >&2
echo "Install '$tool' and ensure your shell PATH exports it." >&2
exit 3
13 changes: 6 additions & 7 deletions RcppTskit/vignettes/RcppTskit_intro.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -141,21 +141,20 @@ to record a tree sequence in a multi-generation simulation with many individuals

Given the current tree sequence ecosystem,
the aims of the `RcppTskit` package are to provide an easy-to-install R package
that supports users in four typical cases.
that supports users in four typical cases of working with tree sequences
and table collection.
The authors are open to expanding this scope of `RcppTskit`
depending on user demand and engagement.
The four typical cases are:

1. Load a tree sequence[^ts_and_tc_note] into R and summarise it,
1. Load a tree sequence into R and summarise it,

2. Pass a tree sequence[^ts_and_tc_note] between R and reticulate or standard Python,
2. Pass a tree sequence between R and reticulate or standard Python,

3. Call the `tskit` C API from C++ in an R session or script, and

4. Call the `tskit` C API from C++ in another R package.

[^ts_and_tc_note]: Both tree sequence and table collection types are supported.

Examples for all of these cases are provided below
after we describe the implemented data and class model.

Expand Down Expand Up @@ -213,7 +212,7 @@ if (!test) {
}
```

### 1) Load a tree sequence[^ts_and_tc_note] into R and summarise it
### 1) Load a tree sequence into R and summarise it

```{r}
#| label: use_case_1
Expand All @@ -239,7 +238,7 @@ ts2 <- tc$tree_sequence()
help(package = "RcppTskit")
```

### 2) Pass a tree sequence[^ts_and_tc_note] between R and reticulate or standard Python
### 2) Pass a tree sequence between R and reticulate or standard Python

```{r}
#| label: use_case_2
Expand Down
Loading