Skip to content

Add RPKM calculation step; harden RPKM script against zero denominators#41

Merged
mtinti merged 5 commits into
mainfrom
codex/add-rpkm-calculation-step-to-pipeline
Jan 27, 2026
Merged

Add RPKM calculation step; harden RPKM script against zero denominators#41
mtinti merged 5 commits into
mainfrom
codex/add-rpkm-calculation-step-to-pipeline

Conversation

@mtinti

@mtinti mtinti commented Jan 26, 2026

Copy link
Copy Markdown
Owner

Motivation

  • Add a pipeline step to compute RPKM values from featureCounts output so normalized expression matrices are produced alongside count matrices.
  • Ensure RPKM outputs are treated as required outputs and are copied to the results directory and considered when checking whether a sample/run-tag is completed.
  • Make the RPKM calculation robust to edge cases such as zero total reads or zero feature lengths to avoid divide-by-zero warnings.
  • Support featureCounts files processed one-sample-at-a-time (single counting column) without pipeline changes.

Description

  • Added Snakemake rules in rules/counting/rpkm.smk implementing rpkm_* rules for paired and single workflows and completion flags, and included the module in Snakefile via the conditional includes.
  • Added a dedicated lightweight conda environment envs/rpkm.yaml for the RPKM step and wired it into the rules using conda blocks.
  • Implemented rules/scripts/calc_rpkm.py which detects sample columns to the right of Length, computes RPKM for one or more sample columns, logs to Snakemake logs, and writes a tab-delimited RPKM file; the computation now uses numpy.divide(..., where=denominator != 0) to safely handle zero denominators.
  • Updated pipeline wiring: added get_rpkm_flag in rules/common.smk, required rpkm_complete in copy_results in rules/results.smk, copy RPKM files to results, and included RPKM checks in rules/sample_utils.py; also updated README.md and the workflow_steps list in Snakefile.

Testing

  • No automated tests were executed for these changes.

Codex Task

@mtinti mtinti merged commit 04d7b73 into main Jan 27, 2026
1 check passed
@mtinti mtinti deleted the codex/add-rpkm-calculation-step-to-pipeline branch January 27, 2026 10:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant