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
36 changes: 36 additions & 0 deletions .cargo/mutants.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Mutation testing configuration.
#
# `cargo mutants` changes the source (flips a comparison, replaces a function
# body with a default) and reports whether the test suite notices. A surviving
# mutant is a piece of logic no test distinguishes: either a test is missing, or
# the logic does not do anything, and both are worth knowing.
#
# It is advisory. A surviving mutant is a question, not a defect, and it never
# fails CI.

# The scientific core plus the readers that feed it. A flipped comparison in an
# estimator changes the distance someone publishes, and a flipped one in a
# reader changes which variants reach the estimator at all, which is the same
# thing one step earlier.
#
# The whole of src/ is examined rather than a subset. At 355 mutants that is
# affordable here, and drawing a boundary would mean maintaining it.
examine_globs = [
"src/**/*.rs",
]

# The test module itself carries no logic under test.
exclude_globs = [
"src/calculation/tests.rs",
]

# The whole suite, unit and integration alike. Integration tests drive the real
# binary through CARGO_BIN_EXE_fstic, which is what covers argument parsing,
# exit codes and the warnings, and none of that is reachable from --lib. It
# costs a rebuild per mutant and is worth it: the orchestration in main.rs is
# reachable no other way.
#
# The suite finishes in about a second, so anything still running after a minute
# is a mutant that made the code loop rather than one under test.
timeout_multiplier = 5.0
minimum_test_timeout = 60
128 changes: 128 additions & 0 deletions .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
# Contributor Covenant Code of Conduct

## Our Pledge

We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, religion, or sexual identity
and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.

## Our Standards

Examples of behavior that contributes to a positive environment for our
community include:

* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the
overall community

Examples of unacceptable behavior include:

* The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Enforcement Responsibilities

Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.

Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.

## Scope

This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
paula.ruiz.rodriguez@csic.es.
All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the
reporter of any incident.

## Enforcement Guidelines

Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:

### 1. Correction

**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.

**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.

### 2. Warning

**Community Impact**: A violation through a single incident or series
of actions.

**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or
permanent ban.

### 3. Temporary Ban

**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.

**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.

### 4. Permanent Ban

**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.

**Consequence**: A permanent ban from any sort of public interaction within
the community.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.0, available at
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.

Community Impact Guidelines were inspired by [Mozilla's code of conduct
enforcement ladder](https://github.com/mozilla/diversity).

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see the FAQ at
https://www.contributor-covenant.org/faq. Translations are available at
https://www.contributor-covenant.org/translations.
65 changes: 65 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Contributing

The full guide lives with the rest of the documentation, at
[pathogenomics-lab.github.io/fstic/about/contributing](https://pathogenomics-lab.github.io/fstic/about/contributing/).
This file is the short version, and the parts specific to working in the
repository itself.

## Reporting a bug

Use the [bug report form](https://github.com/PathoGenOmics-Lab/fstic/issues/new?template=bug_report.yml).
The two things that make a report actionable are the exact command and the
stderr output: Fstic counts everything it drops and prints it before the
summary, so that block usually says what happened.

A wrong number is worth reporting even without a reproducer. Say what you
expected and why: the estimators have variants that differ in ways easy to
mistake for a bug in either direction.

## Before opening a pull request

```bash
cargo test
cargo clippy --all-targets
cargo fmt --check
```

CI runs those, plus a build on the minimum supported Rust version and a check
that the output does not change with the thread count.

## Things worth knowing

**A test that cannot fail is not a test.** Several here once asserted that the
output contained `0.000000`, which the hard-coded zero diagonal satisfies on any
matrix at all. If you add a test with a behaviour change, break the change on
purpose once and check the test notices.

**Identity and fixed-difference cases rarely distinguish two estimators.** Both
send identical samples to 0 and complete differences to 1 or infinity. The case
that tells them apart is an intermediate frequency, which is where the Reynolds
defect hid for a release.

**Use the shared helpers.** `get_all_freqs_at_pos` is where the "an absent
record means reference" rule lives, and `sum_per_locus` is what keeps a
reduction from depending on the thread count. A plain `par_iter().sum()` will
pass the unit tests and fail the determinism job.

**Behaviour changes move with their documentation.** The pages under `docs/`
and the entry in `CHANGELOG.md` are part of the change, not follow-up work. CI
builds the site with `--strict`, so a link to a heading you renamed fails there.

## Mutation testing

Advisory, and run by hand:

```bash
cargo mutants
```

It reports logic no test distinguishes. Configuration is in
`.cargo/mutants.toml`, and the same run is available as a workflow under
Actions.

## Licence

GPL-3.0. Contributions are accepted under the same terms.
35 changes: 35 additions & 0 deletions .github/DISCUSSION_TEMPLATE/q-a.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
labels: ["question"]
body:
- type: markdown
attributes:
value: |
Before asking, the two pages that answer most questions are
[choosing an estimator](https://pathogenomics-lab.github.io/fstic/guide/metrics/)
and [the model](https://pathogenomics-lab.github.io/fstic/how-it-works/model/).
The second one covers what an absent record means and why a pairwise
distance does not move when another sample joins the run.

- type: textarea
id: question
attributes:
label: What would you like to know?
validations:
required: true

- type: textarea
id: context
attributes:
label: Your data and command
description: >
The kind of data (consensus calls, within-host frequencies, pooled),
roughly how many samples and sites, and the command you ran. The stderr
block is useful here too: the warning counts often answer the question
on their own.
render: shell

- type: dropdown
id: formula
attributes:
label: Which estimator are you using?
multiple: true
options: [fst, gst, nei, chord, bray-curtis, jost_d, reynolds, rogers, "not sure yet"]
40 changes: 40 additions & 0 deletions .github/DISCUSSION_TEMPLATE/studies-using-fstic.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
labels: ["studies"]
body:
- type: markdown
attributes:
value: |
If Fstic was part of an analysis you published or presented, we would
like to hear about it. Seeing which estimators people actually reach for,
and on what kind of data, is what tells us where the tool needs work.

- type: input
id: study
attributes:
label: The study
description: Title, and a DOI or link if there is one.
validations:
required: true

- type: textarea
id: use
attributes:
label: What did you use it for?
description: The organism, the kind of data, and what the distances fed into.
validations:
required: true

- type: dropdown
id: formula
attributes:
label: Which estimator
multiple: true
options: [fst, gst, nei, chord, bray-curtis, jost_d, reynolds, rogers]

- type: textarea
id: friction
attributes:
label: Anything that got in the way?
description: >
A step you had to script around, an output you had to reshape, a
default that was wrong for your data. This is the most useful box on
the form.
87 changes: 87 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: Bug report
description: A wrong number, a crash, or something that does not do what the docs say
labels: ["bug"]
body:
- type: markdown
attributes:
value: |
Thanks for reporting. The two things that make a report actionable are
the exact command and the stderr output: Fstic counts everything it
drops and prints it before the summary, so that block usually says what
happened.

For a wrong number, say what you expected and why. Several of the
estimators have variants that differ in ways easy to mistake for a bug
in either direction, so the reasoning matters as much as the value.

- type: input
id: version
attributes:
label: Version
description: Output of `fstic --version`
placeholder: fstic 1.0.1
validations:
required: true

- type: dropdown
id: install
attributes:
label: How did you install it?
options:
- Bioconda
- Built from source with cargo
- Other
validations:
required: true

- type: textarea
id: command
attributes:
label: The command you ran
render: shell
placeholder: fstic --vcf sample*.vcf --output d.csv --formula gst --min-depth 50
validations:
required: true

- type: textarea
id: stderr
attributes:
label: What it printed
description: >
The whole stderr block, including the filter echo at the top, any
warnings, and the summary. Capture it with `2> run.log` if it is long.
render: text
validations:
required: true

- type: textarea
id: expected
attributes:
label: What you expected instead
description: For a wrong number, the value you expected and where it comes from.
validations:
required: true

- type: textarea
id: input
attributes:
label: Input
description: >
A couple of small VCFs or a few table rows that show the problem, if you
can share them. A synthetic file that reproduces it is worth more than a
description of a real one you cannot attach. Please do not paste
identifiable sample data.
render: text

- type: dropdown
id: formula
attributes:
label: Which estimator
multiple: true
options: [fst, gst, nei, chord, bray-curtis, jost_d, reynolds, rogers, "not estimator-specific"]

- type: input
id: platform
attributes:
label: Platform
placeholder: Ubuntu 24.04 / macOS 15 arm64 / Windows 11
Loading
Loading