Skip to content

refactor: extract assay-agnostic analyses into src/common/ - #152

Open
BenjaminDEMAILLE wants to merge 5 commits into
seqeralabs:mainfrom
BenjaminDEMAILLE:feat/dna-common-extract
Open

refactor: extract assay-agnostic analyses into src/common/#152
BenjaminDEMAILLE wants to merge 5 commits into
seqeralabs:mainfrom
BenjaminDEMAILLE:feat/dna-common-extract

Conversation

@BenjaminDEMAILLE

@BenjaminDEMAILLE BenjaminDEMAILLE commented Aug 28, 2026

Copy link
Copy Markdown

Part of #157.

Groundwork for a forthcoming rustqc dna subcommand. Pure refactor: no behaviour change, no new dependency, no public API break.

What moves

From To
src/rna/bam_flags.rs src/common/bam_flags.rs
src/rna/cpp_rng.rs src/common/cpp_rng.rs
src/rna/preseq.rs src/common/preseq.rs
src/rna/rseqc/bam_stat.rs src/common/bam_stat.rs
src/rna/rseqc/{stats,flagstat,idxstats}.rs src/common/samtools/
BamStatAccum (from src/rna/rseqc/accumulators.rs) src/common/bam_stat_accum.rs

None of these need a gene annotation or a library strand protocol. bam_stat is read-level, the samtools writers consume its result type, and BamStatAccum::process_read takes only a record and a MAPQ cutoff, so a DNA pipeline can drive the same accumulator unchanged. merge_vec_arrays moves with BamStatAccum, being its only consumer.

src/rna re-exports every moved item, so rustqc::rna::preseq, rustqc::rna::rseqc::stats and friends keep resolving for library users on 0.2.x. A new compat_tests module pins those paths so the shims cannot break silently.

src/rna/rseqc/accumulators.rs drops from 2784 to 1481 lines.

How it is verified

Beyond the existing suite (233 tests green, up from 232 by the one added compat test): rustqc rna was run over tests/data/ before and after the refactor and all 61 output files compared byte for byte, plus the JSON summary compared field by field.

Every file is identical once two build-and-run artefacts are normalised away: the output directory path, which several outputs embed by design (the featureCounts header command line, the RSeQC .r plotting scripts), and the analysis timestamp plus git commit hash in the Qualimap report and the JSON summary. No metric, count or histogram changed.

Follow-up

This is the first of a stack. The src/dna/ tree and the dna subcommand itself land in later PRs; nothing here adds DNA code.

🤖 Generated with Claude Code

BenjaminDEMAILLE and others added 5 commits August 28, 2026 18:26
These three modules carry no RNA-specific logic and are needed by the
forthcoming dna subcommand. src/rna re-exports them so every existing
crate::rna::... path and the published 0.2.x library surface keep working.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
bam_stat is read-level and needs no annotation, and the samtools stats,
flagstat and idxstats writers consume its result type, so all four move
together into src/common/. src/rna/rseqc re-exports them.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
BamStatAccum gathers the read-level counters behind bam_stat and the
samtools writers. Its process_read takes only a record and a MAPQ cutoff,
so it is assay-agnostic and the dna pipeline will drive the same struct.
The merge_vec_arrays helper moves with it, being its only consumer.
rna::rseqc::accumulators re-exports the type.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Also corrects the AGENTS.md claim that the crate has no lib.rs, which has
been untrue since seqeralabs#101.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant