GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — MetaFlux/CONTRIBUTING.md at main · iLivius/MetaFlux

Expand file tree

/

CONTRIBUTING.md

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
152 lines (130 loc) · 8.93 KB
/

CONTRIBUTING.md

Copy path

File metadata and controls

152 lines (130 loc) · 8.93 KB
Raw
Copy raw file
Download raw file
Outline
Edit and raw actions

Contributing to MetaFlux

Thank you for taking the time. MetaFlux is maintained by one person next to a day job in a research institute, and it is used by biologists who read the code before they trust it. The rules below follow from that: every change must be easy to read, easy to check, and honest about what it does to a finished run. Questions that are not bug reports go to the Discussions; see also SUPPORT.md.

Reporting a bug

Open an issue with the Bug report form. It asks for what is needed to reproduce the problem without a round of questions:

  • the MetaFlux version (the banner the run prints, or git describe --tags), the mode, and for amplicon runs the marker, method and, for 16S, the SILVA release;
  • your run config (the YAML you pass with --configfile; shorten paths if you like, but keep the keys);
  • the command you ran, and what MetaFlux printed: the [MetaFlux] start-up lines and the error, or the whole dry-run output if the dry run is what fails;
  • the log of the failing job, logs/<rule>/<sample>.log in the output folder;
  • what you expected to happen instead.

Please check the troubleshooting page first: the failures worth knowing about are described there with their fix.

Proposing a change

  • Say what you have in mind before writing much code. Open an issue (the Feature request form) or a discussion. Many things that look like a missing feature are deliberate (the docs usually say why), and a short exchange first saves both sides a rewrite.
  • One change per pull request, branched from main, with a title and description that say what changes for a user. Typos and small documentation fixes do not need an issue first.
  • Say what runs again. Snakemake keeps a record of every finished step in .snakemake/ of the folder it runs from: the text of the step's command (comments included), its parameters, the list of its input files, and its conda environment file with that file's pin. A step that calls a script (script:) is judged by the script file's date, not its text: it runs again whenever the script is newer than the step's outputs. Changing any of them, even a comment inside a shell block, a script or an environment file, makes that step and everything after it run again in the finished output folders of every user who updates with git pull (a fresh clone reruns every script step anyway). That is often right (a correctness fix must reach old folders), but it has to be said in the pull request, and a change that only reorders or reformats a rule should be avoided for that reason.
  • No new dependency without a discussion first. Every tool must be installable from bioconda or conda-forge, pinned where the version changes results, and listed in one of the environment files under workflow/envs/. After editing an environment file, refresh its pin file (workflow/envs/<tool>.linux-64.pin.txt; the installation page says how): as long as the old pin exists, Snakemake installs the old builds from it and never sees the edit. A tool used only by the tests or the checks (pytest, mkdocs) is not a pipeline dependency and is pinned in .github/workflows/ci.yml instead.
  • Run the checks (next section) before you open the pull request, and add a test or a dry-run config when your change can be covered by one.

Running the checks

The same checks run on GitHub for every push and pull request (.github/workflows/ci.yml). Locally, from the repository root:

# 1. The unit tests of the pure-Python parts (start-up checks, reference check,
#    OTU-table builder, read-tracking parsers, taxon lookup, k-mer evidence gate,
#    MIDORI2 conversion and COI screens, orientation table of primer trimming).
#    Needs pytest and PyYAML; the OTU-table tests also need biom-format and numpy
#    (the packages of workflow/envs/biom.yaml) and are skipped without them.
pytest tests

# 2. The dry-run matrix: every marker, method, SILVA release and shotgun profiler
#    on the tiny data under .test/, plus the configs that must stop at start-up.
#    Needs Snakemake on PATH, nothing else; no conda environment is built.
bash .test/run_dry_runs.sh

# 3. The documentation. --strict turns every warning into an error, so a page left
#    out of the nav or a link to a renamed heading fails the build.
pip install mkdocs-material==9.7.7 mkdocs-glightbox==0.5.3
mkdocs build --strict

# 4. Snakemake's own linter, informational: it flags a few long-standing style points
#    that are kept on purpose, so do not try to silence them; read its output for
#    the rules you touched.
snakemake --lint --configfile .test/config/16S_sintax_silva144.yaml
snakemake --lint --configfile .test/config/shotgun_both.yaml

tests/helpers.py explains how the tests reach code that lives in rule files and in scripts that expect Snakemake's snakemake object; .test/README.md explains the dry runs, the stand-in databases and how to add a config. A real run on the test datasets (docs/about/test-datasets.md) is still the final check for anything that changes results; the CI cannot run tools.

Before a release, make one more real run: amplicon mode with a single sample. Copy the read pair of one sample of a test dataset into a folder of its own, point input.fastq_dir at it and output.out_dir at a new, empty folder; any marker will do, since the step being checked is DADA2's. Never point output.out_dir at the folder of a finished run: Snakemake would run that sample's steps again there and then rebuild the run's tables from that one sample. It worked when the run finishes and stats/read_tracking.txt has one row, named after the sample, with a number in every column (an NA there means a step lost the sample's name). None of the checks above can see this case: the unit tests cover the Python parts only, and the dry runs plan the jobs without running them, so no R script runs. Yet one sample is exactly where DADA2 behaves differently: given one sample, derepFastq(), dada() and mergePairs() return that sample's result on its own instead of a list with one result per sample, and dada_seqtab has to put it back into a list.

How the code is written

MetaFlux's readers are biologists with some coding ability, and every line is read and understood by a human before it goes in. The style rules are there to keep that possible:

  • Comment every rule, function, script and block, in plain language, about the biology and the data flow, not the syntax: what the step is for, what it takes in and where that comes from, what it does to it, what it writes, and what reads that next. A comment that turns out to be obvious costs nothing; a missing one costs an hour six months later. Write for a colleague who knows genomics, not software patterns; define a technical term in half a sentence the first time you use it.
  • Prefer the obvious solution. Explicit intermediate variables with meaningful names, plain loops, and one step per line beat chained one-liners and clever abstractions. If a less obvious approach is genuinely better, use it and say why in a comment.
  • Avoid deep nesting and dense functional constructs. Someone must be able to follow a script top to bottom and know what it does without running it.
  • Stop early with a message that says what to do. A wrong config value should stop the run at start-up with the key, the value and the fix named, as the existing sys.exit("[MetaFlux] ...") checks in workflow/rules/shared/00_common.smk do, not surface as a crash three hours in.
  • Scripts are plain Python or R that read the snakemake object and nothing else; MetaFlux scripts never import from each other (each runs in its own conda environment). Where two scripts share a function, they carry a copy and say so, and a test keeps the copies identical.
  • Public text stays general and timeless. The docs, the comments, the commit messages and the changelog name versions, tools and data releases, but no dates of our own work, commit hashes, issue numbers or private discussions. Facts come with how they were measured.
  • Commit messages are plain sentences: a short first line saying what changes for the user, then why, and what runs again in a finished folder if anything does.

Documentation

The site under docs/ is built with MkDocs (mkdocs serve previews it). Every page must be listed in the nav of mkdocs.yml, every link must resolve (the strict build checks links to headings too), and a change in behaviour must reach every page that describes it: the per-marker pages, the configuration reference, the output reference and the troubleshooting page overlap on purpose. The template config/config.yaml is documentation as well: its comments are what most users read first.

License

MetaFlux is released under the MIT License. By contributing you agree that your contribution is released under the same license.

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.