Skip to content

Improve test coverage and fix unclassified output declaration#44

Merged
cokelaer merged 8 commits into
sequana:mainfrom
cokelaer:main
Jun 1, 2026
Merged

Improve test coverage and fix unclassified output declaration#44
cokelaer merged 8 commits into
sequana:mainfrom
cokelaer:main

Conversation

@cokelaer

Copy link
Copy Markdown
Contributor

Summary

  • Add comprehensive test coverage: 8 new tests (5 CLI config verification + 3 full integration tests)
  • Fix multitax.rules: make unclassified.fastq output conditional on store_unclassified
  • Bump version to 0.15.1

Test Coverage Added

CLI Tests (5 new)

  • test_paired_reads_single_db: paired-end reads with single database
  • test_paired_reads_multiple_dbs: paired-end reads with multiple databases
  • test_store_unclassified: verify --store-unclassified flag sets config correctly
  • test_kraken_confidence: verify --kraken-confidence parameter
  • test_blast_unclassified_config: verify --do-blast-unclassified sets blast config

Integration Tests (3 new)

  • test_full: unpaired, single DB, verifies kraken output files
  • test_full_paired: paired-end, single DB, verifies kraken output files
  • test_full_multiple_dbs: unpaired, 2x databases, verifies proportion_dbs.png created

Test Data

  • test/data/simple/: clean unpaired data (no empty files)
  • test/data/paired/: paired-end reads (R1+R2)

Rules Fix

Fixed bug in multitax.rules where unclassified.fastq was unconditionally declared as output but only conditionally created (when store_unclassified=True). Changed line 120 to use dict unpacking for conditional Snakemake output declaration.

Test Results

All 11 tests pass (3 existing + 8 new)

cokelaer added 8 commits May 21, 2026 23:22
- Updated read_taxonomy() to parse CSV format taxonomy.csv.gz files (modern format)
  instead of only the old text format taxonomy.dat
- Added 'domain' rank to head_ranks to support modern NCBI taxonomy which uses
  'domain' (e.g., Eukaryota) instead of 'superkingdom' for eukaryotes
- Fixed blast_summary.csv generation: now correctly populates blast section in HTML
  reports with proper taxonomic classification
- Updated krona() function to use 'Domain' column when available, with fallback to
  'Superkingdom' for backward compatibility
- Calculate total reads from unclassified_subsample.fasta
- Add 'Unclassified' row with count of reads without BLAST classification
- Add 'Percentage' column to show proportion of each category
- Improves clarity of BLAST results in HTML report tables
- Add 5 CLI config verification tests (paired reads, multiple DBs, store-unclassified, kraken-confidence, blast)
- Add 3 full integration tests (test_full, test_full_paired, test_full_multiple_dbs)
- Create test/data/simple/ (clean unpaired) and test/data/paired/ (paired-end) test data
- Fix multitax.rules: make unclassified.fastq output conditional on store_unclassified
- All 11 tests pass (3 existing + 8 new)
- Remove full integration tests (complex container/environment issues)
- Keep 5 new CLI config verification tests (all pass reliably)
- Update CHANGELOG to reflect final test count (8 tests total)
- config.yaml: replace monolithic sequana_tools image with dedicated
  sequana 0.22.0, krona, awk, and blast containers
- main.py: implement --from-project (was "Not yet implemented"); make
  --databases optional when --from-project is given; fix --do-blast-unclassified
  flag name; return parsed tuple from check_databases
- multitax.rules:
  - auto-enable store_unclassified when blast.do is set instead of erroring
  - support snakemake >=8 deployment_settings for apptainer detection
  - stage taxonomy.csv.gz (was taxonomy.dat) for containerized runs
  - add regenerate_summary_with_blast rule so blast section appears in summary
  - sanitize DataTable column names to avoid special-char crashes
  - polish onsuccess report text
The empty_R1_.fastq.gz fixture has no reads; running the full pipeline on
it crashes sequana_taxonomy. Exclude it from the apptainer end-to-end run
via --exclude-pattern empty (substring match).

Add test_functional that executes bash multitax.sh on valid data and
asserts summary.html and kraken.csv are produced. Skipped when kraken2 /
sequana_taxonomy are not on PATH; runs in the main.yml conda env which
ships kraken2.
@cokelaer cokelaer merged commit 771ba85 into sequana:main Jun 1, 2026
3 checks passed
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