Repository navigation
feat: add --tools to run only selected tools - #222
Merged
Merged
Conversation
`rustqc rna --tools samtools_stats,flagstat` runs only the named tools. Names are the config section names; the list can also be set as `rna.tools` in the config. A tool list overrides the `enabled` toggles, `--tools` replaces the config list, and `--skip-*` flags still apply. `--gtf` is now required only when a selected tool uses the annotation. Without dupRadar and featureCounts the counting pass skips gene overlap, counting and mate pairing, and the samtools stats counters are only collected when samtools_stats runs. The duplicate-marking check only runs for dupRadar. Default runs are byte-identical to main, and subset outputs are byte-identical to the same files from a full run. Closes #173 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Dec 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #173.
Adds
--toolstorustqc rna, so you can run only the analyses you need. The issue's example, samtools stats on a large BAM, becomes:No GTF is needed for that, and the deselected tools do no work.
Design
--tools a,b, comma-separated, repeatable, or both (--tools samtools_stats --tools flagstat). AlsoRUSTQC_TOOLS.dupradar,featurecounts,qualimap,bam_stat,infer_experiment,read_duplication,read_distribution,junction_annotation,junction_saturation,inner_distance,tin,gene_body_coverage,read_gc,split_bam,preseq,flagstat,idxstats,samtools_stats,bigwig.ValueEnum(config::Tool), so an unknown name fails at parse time with the full list of valid names and a "similar value" hint (samtools-statssuggestssamtools_stats).rna.tools: [samtools_stats, flagstat]does the same in the YAML config. It is a serde enum, so a bad name fails with the list of valid names.--toolsreplaces a configtools:list.enabledtoggles are ignored (CLI and list win overenabled: false).--skip-*flags apply last and still remove tools:--tools flagstat,read_gc --skip-read-gcruns flagstat only.enabledtoggle. When deselected, all their output files are switched off. When selected, their per-file toggles are kept.split_bamselected without a BED (--split-bam-bedorsplit_bam.bed).dupradar,featurecounts,qualimap,infer_experiment,read_distribution,junction_annotation,junction_saturation,inner_distance,tin,gene_body_coverage. Each one builds its index from the parsed genes.bam_stat,read_duplication(positions and sequences only),read_gc,split_bam(BED only),preseq,flagstat,idxstats,samtools_stats,bigwig(header lengths only).--gtf, if a selected tool needs it:--gtf is required by: tin.plus the list of tools that need no annotation. With no--tools, the default run of everything still requires--gtf.--gtfis given but no selected tool needs it, the GTF is not parsed.What deselected tools cost
Nonewhen disabled, and the dispatch skips it. Selection only sets the existing toggles, so this holds.count_readshas a newcount_genesswitch, false when neitherdupradarnorfeaturecountsis selected. It then skips building the gene interval index, the per-read gene-overlap query, featureCounts / biotype / dupRadar counting and paired-end mate buffering. The loop only decodes records and feeds the selected accumulators.bam_stataccumulator serves bam_stat, flagstat, idxstats and samtools stats. The expensive part (CHK checksums, per-cycle histograms, GC-depth, coverage pileup) now only runs whensamtools_statsis selected.--tools flagstatis about 1.7x faster than--tools samtools_statsbecause of this.--tools featurecounts,flagstaton an unmarked BAM works.cram.decode_md: autoalready followedsamtools_stats.enabled, so--tools flagstaton CRAM regenerates no tags and--tools samtools_statsregeneratesNMonly.count_genesoff, the console summary box shows total reads only, and the JSON summary omits thecountingblock.Timing
Benchmark BAM (
RustQC-benchmarks/test-data/rna/small/test.bam, 52.8K reads) withchr6.gtf.gzand the flags frommodules/local/rustqc_rna.nf(--paired --stranded reverse --threads 2 --preseq-seed 408 --preseq-seg-len 100000000 --tin-seed 1 --junction-saturation-seed 1). Wall time in seconds, median of 5 after one warm-up run, Apple M-series laptop:--tools samtools_stats,flagstat,idxstats(no GTF)--tools samtools_stats(no GTF)--tools flagstat(no GTF)--tools featurecountsThat BAM is small, so fixed costs (GTF parse, plots, preseq bootstraps) dominate. To see per-read scaling I also ran the same commands on a 2.1M-read BAM made by writing each benchmark record 40 times with a renamed read (same coordinates, so still sorted):
--tools samtools_stats,flagstat,idxstats(no GTF)--tools samtools_stats(no GTF)--tools flagstat(no GTF)--tools featurecountsThe full-run difference between main and the branch is within run-to-run noise (overlapping ranges). The synthetic BAM has 40 copies of each read at the same position, which inflates the work of some tools (duplication, junction and TIN accumulators), so the full-run number overstates a real 2M-read BAM. The subset numbers are mostly record decoding plus the selected accumulator.
Byte-identity checks
Outputs compared byte for byte across the whole output tree. Only embedded output paths, the git hash in
CITATIONS.md, and Qualimap's "Analysis date" were masked.--tools)tests/data/test.bam+test.gtf(71 files; 72 with--split-bam-bed) and on the benchmark BAM with its flags (79 files; 80 with--split-bam-bed).samtools_stats,flagstat,idxstats,dupradar,tin,featurecounts,read_distributionandbam_stat,flagstat, on both datasets: every file the subset run writes equals the same file from the full run (50 comparisons). Tools that need no GTF were run without--gtf.test_tools_subset_outputs_match_full_run:--tools samtools_stats --tools flagstatwithout--gtfwrites only those two files (plusCITATIONS.md) and they match the full run;--tools featurecounts,read_distributionmatches too.test_tools_needing_gtf_without_gtf_errors,test_tools_dup_check_only_for_dupradar,test_tools_config_list_and_precedence.--gtf. Config unit tests forselect_tools,enabled_tools,needs_gtf, the YAML list and CRAM tag selection after a selection.Other changes
any_rseqc_output()now includesgene_body_coverageandread_gc, so--tools read_gcstill cites RSeQC inCITATIONS.md. Default runs are unaffected.--tools, like it already omits the--skip-*flags. This keeps a subset's counts file byte-identical to a full run's.count_readsgains acount_genes: boolargument, andRseqcConfigasamtools_stats_enabledfield. The library is 0.x and documents that minor releases can break the API.tools:andRUSTQC_TOOLS), introduction, quick start, samtools page, README, AGENTS.md and CHANGELOG.🤖 Generated with Claude Code