MultiQC: add sourmash module (compare + gather)#8112
Conversation
Expose the native MultiQC sourmash module via a new sourmash_plugin.xml. - compare: stages the numpy similarity matrix and its NAME.labels.txt with a shared basename so MultiQC's compare module (search pattern *.labels.txt) finds both and renders the clustered similarity heatmap. - gather: stages gather CSV(s) for the gather submodule. Bumps VERSION_SUFFIX 1 -> 2; adds a test with real sourmash compare output.
| #end for | ||
| ]]></token> | ||
| <xml name="sourmash_form"> | ||
| <repeat name="output" title="sourmash output" min="1"> |
There was a problem hiding this comment.
Why do we have repeat here with min=1?
There was a problem hiding this comment.
Is one enough but wyou can provide 2 different one? What happens if you provide two gathers?
There was a problem hiding this comment.
This <repeat name="output" min="1"> mirrors the established pattern used by the other MultiQC plugins in this tool (bismark, deeptools, fastqc, gatk, picard, rseqc, samtools, star, vcftools all use the identical <repeat name="output" ... min="1">). min="1" just requires that a sourmash result block contributes at least one output — otherwise nothing would be staged for that block.
The repeat is there precisely so you can provide more than one output and/or mix types: e.g. one compare plus one gather, or several gathers. Each repeat entry is uniquely indexed in the staged filename, so there are no collisions:
- compare:
compare_<i>_<j>+compare_<i>_<j>.labels.txt - gather:
gather_<i>_<j>_<k>_<identifier>.csv
I verified two gather entries end-to-end: they stage as gather_0_0_0_*.csv and gather_0_1_0_*.csv, and MultiQC reports Found 2 gather results and renders both. So providing two gathers (or two compares, or any mix) works as expected.
Note also that within a single gather entry the input param already has multiple="true", so a user can either add multiple files to one entry or add multiple repeat entries — both are handled.
bgruening
left a comment
There was a problem hiding this comment.
Lgtm! I'm just wondering about the repeat, and what happens if a user just provides one, or multiple times the same. Should ir have a max=2?
|
Thanks @bgruening! On the On the edge cases you raised, I verified both locally:
So there's no crash/collision risk that a |
|
Sourmash is WIP here: #7491 I will push it to get is merged in coming days |
What
Adds a sourmash module to the IUC MultiQC wrapper, exposing MultiQC's native
sourmashmodule (present in MultiQC core since 1.x but not previously selectablein this wrapper). Implemented as a new
sourmash_plugin.xmlfollowing thetemplate_plugin.xmlpattern, plus the usual five wiring points inmultiqc.xml.Two submodules are supported:
sourmash/comparemodule searches for*.labels.txtand then loads the matrix from the same path minus
.labels.txt(
numpy.load). The plugin therefore symlinks the matrix produced bysourmash compare -o NAMEand its accompanyingNAME.labels.txtinto thesoftware dir under a shared basename, so both are discovered and the
clustered sample-similarity heatmap is rendered.
sourmash gatherCSV(s) for thesourmash/gathersubmodule (content-matched header).
Why
sourmash compareproduces an N×N genome/sample similarity matrix; surfacing itsclustered heatmap inside a MultiQC report is a natural QC summary for
multi-genome / multi-sample panels. Until now Galaxy users had to embed the PNG
via custom/image content; this wires up the real interactive MultiQC module.
Changes
tools/multiqc/sourmash_plugin.xml(@SOURMASH_COMMAND@token +sourmash_form+sourmash_test).tools/multiqc/multiqc.xml:<import>, command#elif, software<option>,<when>, and<expand macro="sourmash_test"/>.tools/multiqc/macros.xml:@VERSION_SUFFIX@1 → 2.sourmash_compare_matrix+sourmash_compare.labels.txt(realsourmash compareoutput over the existing-style tiny k=21 signatures) andsourmash_gather.csv.Testing
planemo lint tools/multiqc/multiqc.xml→ passes (no errors/warnings).comparemodule find both matrix + labels and the
gathermodule parse the CSV; thereport contains
sourmash-compare-heatmapandSample similarity(the test's
<assert_contents>).🤖 Generated with Claude Code