Skip to content

Commit aa49361

Browse files
Merge pull request #43 from HighlanderLab:gregorgorjanc/issue10
Add a vignette
2 parents 67a3a8e + 55b167b commit aa49361

17 files changed

Lines changed: 866 additions & 545 deletions

.gitignore

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
1-
*.Rproj
1+
.DS_Store
22
.Rproj.user
33
.Rhistory
44
.RData
55
.Ruserdata
66
.vscode
7+
*.Rproj
8+
RcppTskit/**/.quarto/
9+
RcppTskit/inst/doc
710
RcppTskit/src/*.o
811
RcppTskit/src/tskit/*.o
912
RcppTskit/src/*.so
1013
RcppTskit/src/*.dll*
1114
RcppTskit/src/Makevars
1215
RcppTskit/src/Makevars.win
16+
RcppTskit/vignettes/*.html
17+
RcppTskit/vignettes/*.R
18+
RcppTskit/vignettes/*_files
1319
test.trees
14-
.DS_Store
15-
*.html

CODE_OF_CONDUCT.md

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
We as members, contributors, and leaders pledge to make participation in our
6+
community a harassment-free experience for everyone, regardless of age, body
7+
size, visible or invisible disability, ethnicity, sex characteristics, gender
8+
identity and expression, level of experience, education, socio-economic status,
9+
nationality, personal appearance, race, caste, color, religion, or sexual
10+
identity and orientation.
11+
12+
We pledge to act and interact in ways that contribute to an open, welcoming,
13+
diverse, inclusive, and healthy community.
14+
15+
## Our Standards
16+
17+
Examples of behavior that contributes to a positive environment for our
18+
community include:
19+
20+
* Demonstrating empathy and kindness toward other people
21+
* Being respectful of differing opinions, viewpoints, and experiences
22+
* Giving and gracefully accepting constructive feedback
23+
* Accepting responsibility and apologizing to those affected by our mistakes,
24+
and learning from the experience
25+
* Focusing on what is best not just for us as individuals, but for the overall
26+
community
27+
28+
Examples of unacceptable behavior include:
29+
30+
* The use of sexualized language or imagery, and sexual attention or advances of
31+
any kind
32+
* Trolling, insulting or derogatory comments, and personal or political attacks
33+
* Public or private harassment
34+
* Publishing others' private information, such as a physical or email address,
35+
without their explicit permission
36+
* Other conduct which could reasonably be considered inappropriate in a
37+
professional setting
38+
39+
## Enforcement Responsibilities
40+
41+
Community leaders are responsible for clarifying and enforcing our standards of
42+
acceptable behavior and will take appropriate and fair corrective action in
43+
response to any behavior that they deem inappropriate, threatening, offensive,
44+
or harmful.
45+
46+
Community leaders have the right and responsibility to remove, edit, or reject
47+
comments, commits, code, wiki edits, issues, and other contributions that are
48+
not aligned to this Code of Conduct, and will communicate reasons for moderation
49+
decisions when appropriate.
50+
51+
## Scope
52+
53+
This Code of Conduct applies within all community spaces, and also applies when
54+
an individual is officially representing the community in public spaces.
55+
Examples of representing our community include using an official e-mail address,
56+
posting via an official social media account, or acting as an appointed
57+
representative at an online or offline event.
58+
59+
## Enforcement
60+
61+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
62+
reported to the community leaders responsible for enforcement at gregor.gorjanc@gmail.com.
63+
All complaints will be reviewed and investigated promptly and fairly.
64+
65+
All community leaders are obligated to respect the privacy and security of the
66+
reporter of any incident.
67+
68+
## Enforcement Guidelines
69+
70+
Community leaders will follow these Community Impact Guidelines in determining
71+
the consequences for any action they deem in violation of this Code of Conduct:
72+
73+
### 1. Correction
74+
75+
**Community Impact**: Use of inappropriate language or other behavior deemed
76+
unprofessional or unwelcome in the community.
77+
78+
**Consequence**: A private, written warning from community leaders, providing
79+
clarity around the nature of the violation and an explanation of why the
80+
behavior was inappropriate. A public apology may be requested.
81+
82+
### 2. Warning
83+
84+
**Community Impact**: A violation through a single incident or series of
85+
actions.
86+
87+
**Consequence**: A warning with consequences for continued behavior. No
88+
interaction with the people involved, including unsolicited interaction with
89+
those enforcing the Code of Conduct, for a specified period of time. This
90+
includes avoiding interactions in community spaces as well as external channels
91+
like social media. Violating these terms may lead to a temporary or permanent
92+
ban.
93+
94+
### 3. Temporary Ban
95+
96+
**Community Impact**: A serious violation of community standards, including
97+
sustained inappropriate behavior.
98+
99+
**Consequence**: A temporary ban from any sort of interaction or public
100+
communication with the community for a specified period of time. No public or
101+
private interaction with the people involved, including unsolicited interaction
102+
with those enforcing the Code of Conduct, is allowed during this period.
103+
Violating these terms may lead to a permanent ban.
104+
105+
### 4. Permanent Ban
106+
107+
**Community Impact**: Demonstrating a pattern of violation of community
108+
standards, including sustained inappropriate behavior, harassment of an
109+
individual, or aggression toward or disparagement of classes of individuals.
110+
111+
**Consequence**: A permanent ban from any sort of public interaction within the
112+
community.
113+
114+
## Attribution
115+
116+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
117+
version 2.1, available at
118+
<https://www.contributor-covenant.org/version/2/1/code_of_conduct.html>.
119+
120+
Community Impact Guidelines were inspired by
121+
[Mozilla's code of conduct enforcement ladder][https://github.com/mozilla/inclusion].
122+
123+
For answers to common questions about this code of conduct, see the FAQ at
124+
<https://www.contributor-covenant.org/faq>. Translations are available at <https://www.contributor-covenant.org/translations>.
125+
126+
[homepage]: https://www.contributor-covenant.org

README.md

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,15 @@ Tskit provides Python, C, and Rust APIs. The Python API can be called from R
99
via the `reticulate` R package to seamlessly load and analyse a tree sequence,
1010
as described at https://tskit.dev/tutorials/RcppTskit.html.
1111
`RcppTskit` provides R access to the `tskit` C API for use cases where the
12-
`reticulate` approach is not optimal. For example, for high-performance and
13-
low-level work with tree sequences. Currently, `RcppTskit` provides a very limited
12+
`reticulate` option is not optimal. For example, for high-performance and
13+
low-level work with tree sequences. Currently, `RcppTskit` provides a limited
1414
number of R functions due to the availability of extensive Python API and
15-
the `reticulate` approach.
15+
the `reticulate` option.
1616

17-
See more details on the state of the tree sequence ecosystem and aims for
18-
`RcppTskit` in [RcppTskit/inst/STATE_and_AIMS.md](RcppTskit/inst/STATE_and_AIMS.md),
19-
including examples on how to use it on its own or to develop new R packages.
20-
21-
TODO: Think how to best point to use cases. Probably best to point to vignette and pkgdown!?
22-
https://github.com/HighlanderLab/RcppTskit/issues/10
17+
See more details on the state of the tree sequence ecosystem and aims of
18+
`RcppTskit` in [RcppTskit/vignettes/RcppTskit_intro.qmd](RcppTskit/vignettes/RcppTskit_intro.qmd).
19+
The vignette also shows examples on how to use `RcppTskit` on its own or
20+
to develop new R packages.
2321

2422
## Status
2523

@@ -31,13 +29,17 @@ TODO: Think how to best point to use cases. Probably best to point to vignette a
3129
[![CRAN version](https://www.r-pkg.org/badges/version/RcppTskit)](https://CRAN.R-project.org/package=RcppTskit) <!-- Row 2, Col 1 --> ![GitHub version (main)](https://img.shields.io/github/r-package/v/HighlanderLab/RcppTskit/main?filename=RcppTskit%2FDESCRIPTION&label=Github) <!-- Row 2, Col 2 --> [![Downloads - total](https://cranlogs.r-pkg.org/badges/grand-total/RcppTskit)](https://cranlogs.r-pkg.org/badges/grand-total/RcppTskit) <!-- Row 2, Col 3 -->
3230

3331
<!-- line break 2 -->
34-
[![CRAN R CMD check](https://cranchecks.info/badges/summary/RcppTskit)](https://cran.r-project.org/web/checks/check_results_RcppTskit.html) <!-- Row 3, Col 1 --> ![GitHub R CMD check](https://img.shields.io/github/actions/workflow/status/HighlanderLab/RcppTskit/R-CMD-check.yaml?label=GitHub%20R%20CMD%20check) <!-- Row 3, Col 2 --> [![Codecov test coverage](https://codecov.io/gh/HighlanderLab/RcppTskit/graph/badge.svg)](https://app.codecov.io/gh/HighlanderLab/RcppTskit) <!-- Row 3, Col 3 -->
32+
[![CRAN R CMD check](https://cranchecks.info/badges/summary/RcppTskit)](https://cran.r-project.org/web/checks/check_results_RcppTskit.html) <!-- Row 3, Col 1 --> [![GitHub R CMD check](https://img.shields.io/github/actions/workflow/status/HighlanderLab/RcppTskit/R-CMD-check.yaml?label=GitHub%20R%20CMD%20check)](https://github.com/HighlanderLab/RcppTskit/actions/workflows/R-CMD-check.yaml) <!-- Row 3, Col 2 --> [![Codecov test coverage](https://codecov.io/gh/HighlanderLab/RcppTskit/graph/badge.svg)](https://app.codecov.io/gh/HighlanderLab/RcppTskit) <!-- Row 3, Col 3 -->
3533

3634
<!-- badges: end -->
3735

3836
## Contents
3937

40-
* `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.
38+
* `extern` - Git submodule for `tskit` and instructions on
39+
obtaining the latest version and copying the `tskit` C code into
40+
`RcppTskit` directory.
41+
`extern` is saved outside of the `RcppTskit` directory
42+
because `R CMD CHECK` complains otherwise.
4143

4244
* `RcppTskit` - R package `RcppTskit`.
4345

@@ -67,22 +69,26 @@ https://mac.r-project.org/tools for macOS tools.
6769
```
6870
# install.packages("remotes") # If you don't have it already
6971
70-
# Release (TODO)
72+
# Release
7173
# TODO: Tag a release #15
7274
# https://github.com/HighlanderLab/RcppTskit/issues/15
7375
# remotes::install_github("HighlanderLab/RcppTskit/RcppTskit")
7476
7577
# Main branch
76-
remotes::install_github("HighlanderLab/RcppTskit/RcppTskit")
78+
remotes::install_github("HighlanderLab/RcppTskit/RcppTskit@main")
7779
7880
# Development branch
79-
# TODO: Create a devel branch #16
80-
# https://github.com/HighlanderLab/RcppTskit/issues/16
81-
# remotes::install_github("HighlanderLab/RcppTskit/RcppTskit@devel")
81+
remotes::install_github("HighlanderLab/RcppTskit/RcppTskit@devel")
8282
```
8383

8484
## Development
8585

86+
### Code of Conduct
87+
88+
Please note that the `RcppTskit` project is released with a
89+
[Contributor Code of Conduct](https://contributor-covenant.org/version/2/1/CODE_OF_CONDUCT.html).
90+
By contributing to this project, you agree to abide by its terms.
91+
8692
### Clone
8793

8894
First clone the repository:
@@ -93,7 +99,8 @@ git clone https://github.com/HighlanderLab/RcppTskit.git
9399

94100
### Pre-commit install
95101

96-
We use [pre-commit](https://pre-commit.com) hooks to ensure code quality. Specifically, we use:
102+
We use [pre-commit](https://pre-commit.com) hooks to ensure code quality.
103+
Specifically, we use:
97104
* [air](https://github.com/posit-dev/air) to format R code,
98105
* [jarl](https://github.com/etiennebacher/jarl) to lint R code,
99106
* [clang-format](https://clang.llvm.org/docs/ClangFormat.html) to format C/C++ code, and
@@ -111,7 +118,8 @@ If you plan to update `tskit`, follow instructions in `extern/README.md`.
111118

112119
### RcppTskit
113120

114-
Then open `RcppTskit` package directory in your favourite R IDE (Positron, RStudio, text-editor-of-your-choice, etc.) and implement your changes.
121+
Then open `RcppTskit` package directory in your favourite R IDE
122+
(Positron, RStudio, text-editor-of-your-choice, etc.) and implement your changes.
115123

116124
You should routinely check your changes (in R):
117125

@@ -161,6 +169,8 @@ pre-commit run --all-files
161169

162170
### Continuous integration
163171

164-
We use Github Actions to run continuous integration (CI) checks on each push and pull request. Specifically, we run:
172+
We use Github Actions to run continuous integration (CI) checks
173+
on each push and pull request.
174+
Specifically, we run:
165175
* [R CMD check](.github/workflows/R-CMD-check.yaml) on multiple platforms and
166176
* [covr test coverage](.github/workflows/covr.yaml).

RcppTskit/.Rbuildignore

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,12 @@
99
^\.clang-format$
1010
^\.covrignore$
1111
^\.github$
12-
^pkg_dev_notes\.md$
1312
^codecov\.yaml$
14-
^notes_pkg_dev\.Rmd$
1513
^inst/examples/create_test\.trees\.R$
1614
^inst/examples/create_test\.trees\.py$
15+
^notes_pkg_dev\.Rmd$
16+
^pkg_dev_notes\.md$
17+
^tests/testthat/_snaps$
18+
^vignettes/\.quarto$
19+
^vignettes/*_files$
20+
^\.\.$

RcppTskit/DESCRIPTION

Lines changed: 35 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,44 @@
1-
Package: RcppTskit
21
Type: Package
2+
Package: RcppTskit
33
Title: R access to the tskit C API
44
Version: 0.1.0
55
Date: 2026-01-2607
66
Authors@R:
7-
person(given = "Gregor", family = "Gorjanc",
8-
email = "gregor.gorjanc@gmail.com",
9-
role = c("aut", "cre"),
10-
comment = c(ORCID = "0000-0001-8008-2787"))
7+
person("Gregor", "Gorjanc", , "gregor.gorjanc@gmail.com", role = c("aut", "cre"),
8+
comment = c(ORCID = "0000-0001-8008-2787"))
119
Description: Tskit enables performant storage, manipulation, and analysis
12-
of ancestral recombination graphs (ARGs) using succinct tree sequence encoding.
13-
See https://tskit.dev for project news, documentation, and tutorials.
14-
Tskit provides Python, C, and Rust APIs. The Python API can be called from R
15-
via the `reticulate` R package to seamlessly load and analyse
16-
a tree sequence as described at https://tskit.dev/tutorials/RcppTskit.html.
17-
`RcppTskit` provides R access to the `tskit` C API for use cases where the
18-
`reticulate` approach is not optimal. For example, for high-performance and
19-
low-level work with tree sequences. Currently, `RcppTskit` provides a very
20-
limited number of R functions due to the availability of extensive Python API
21-
and the `reticulate` approach.
22-
URL: https://github.com/highlanderlab/RcppTskit
10+
of ancestral recombination graphs (ARGs) using succinct tree sequence
11+
encoding. See https://tskit.dev for project news, documentation, and
12+
tutorials. Tskit provides Python, C, and Rust APIs. The Python API
13+
can be called from R via the `reticulate` R package to seamlessly load
14+
and analyse a tree sequence as described at
15+
https://tskit.dev/tutorials/RcppTskit.html. `RcppTskit` provides R
16+
access to the `tskit` C API for use cases where the `reticulate`
17+
option is not optimal. For example, for high-performance and low-level
18+
work with tree sequences. Currently, `RcppTskit` provides a limited
19+
number of R functions due to the availability of extensive Python API
20+
and the `reticulate` option.
2321
License: MIT + file LICENSE
24-
Depends: R (>= 4.0.0)
25-
Imports: methods, R6, Rcpp (>= 1.1.0), reticulate
26-
LinkingTo: Rcpp
27-
Suggests: covr, spelling, testthat
28-
RoxygenNote: 7.3.3
22+
URL: https://github.com/HighlanderLab/RcppTskit
23+
BugReports: https://github.com/HighlanderLab/RcppTskit/issues
24+
Depends:
25+
R (>= 4.0.0)
26+
Imports:
27+
methods,
28+
R6,
29+
Rcpp (>= 1.1.0),
30+
reticulate
31+
Suggests:
32+
covr,
33+
knitr,
34+
quarto,
35+
spelling,
36+
testthat (>= 3.0.0)
37+
LinkingTo:
38+
Rcpp
39+
VignetteBuilder:
40+
quarto
41+
Config/testthat/edition: 3
2942
Encoding: UTF-8
3043
Language: en-GB
44+
RoxygenNote: 7.3.3

RcppTskit/NEWS.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,11 @@ This is the first release.
1313
- Initial version of RcppTskit using the tskit C API (version 1.3.0).
1414
- TreeSequence R6 class so R code looks Pythonic.
1515
- `ts_load()` or `TreeSequence$new()` to load a tree sequence from file into R.
16-
- Methods to summarise a tree sequence and its contents `ts$print()`, `ts$num_nodes()`, etc.
16+
- Methods to summarise a tree sequence and its contents `ts$print()`,
17+
`ts$num_nodes()`, etc.
1718
- Method to save a tree sequence to a file `ts$dump()`.
18-
- Method to push tree sequence between R and reticulate Python (TODO).
19-
- Most methods have underlying C++ function that work with a pointer to tree sequence object,
20-
for example, `RcppTskit:::ts_load_ptr()`.
19+
- Method to push tree sequence between R and reticulate Python
20+
`ts$r_to_py()` and `ts_py_to_r()`.
21+
- Most methods have an underlying (unexported) C++ function that works with
22+
a pointer to tree sequence object,for example, `RcppTskit:::ts_load_ptr()`.
23+
- All implemented functionality is documented and demonstrated with a vignette.

0 commit comments

Comments
 (0)