Fix/featurecounts mixed se pe on448 - #2
Closed
NicoDeVeaux wants to merge 6 commits into
Closed
Conversation
Restore subread to the registry version and drop the nf-core patch record. The pin was the stopgap for mixed single-end/paired-end consensus counting; the following commits handle mixed cohorts explicitly, so it is no longer needed. Reverts the pin introduced in nf-core#448.
…ing subread featureCounts (subread >=2.1.0) applies -p to a whole invocation and aborts when single-end and paired-end BAMs are mixed in one call, which broke consensus quantification for mixed cohorts. Rather than rolling subread back to 2.0.1, split the consensus BAMs by library type, count each homogeneous batch with the correct pairing flag (from meta.single_end), then column-bind the per-batch matrices back into one table for DESeq2 and MultiQC. - subworkflows/local/bed_consensus_...: branch consensus BAMs by single_end, run SUBREAD_FEATURECOUNTS per batch, merge via new FEATURECOUNTS_MERGE - modules/local/featurecounts_merge.nf + bin/featurecounts_merge.sh: cbind featureCounts tables on Geneid, preserving the 6-col annotation + comment header layout expected by deseq2_qc.r (count_col 7, skip=1) - conf/modules.config: per-batch featureCounts prefixes (.SE/.PE) to avoid output collisions; publish merged matrix under the canonical consensus prefix Keeps subread at 2.1.1 (no rollback). subread bump therefore stays consistent with modules.json.
The mixed SE/PE rewrite destructured ch_bams.join(ch_peaks) with a fixed
3-arg closure ({ meta, _bam, _peak -> }), but the merged-library caller
passes [ meta, bam, control ], so the joined tuple is 4 elements
([ meta, bam, control, peak ]) and .branch/.map aborted with
'Invalid method invocation doCall ... on _closure' before featureCounts
ever ran. The merged-replicate caller passes [ meta, bams ] (3 after join),
so arities differ between the two instantiations of this shared subworkflow.
Access meta/bam positionally (item[0]/item[1]) so the split tolerates both
shapes, matching the arity-tolerant item[1] indexing the pre-split code used.
Add nf-test for FEATURECOUNTS_MERGE and a pure-bash unit test for bin/featurecounts_merge.sh, pinning the consensus-peak quantification merge logic that fix B relies on: - mixed SE+PE column-bind keyed on Geneid (not row position) - single-file pass-through for homogeneous (all-SE / all-PE) cohorts - usage error on missing input tables - stub nf-test: 3 passed; bash unit test: 4 passed.
Extend the pipeline-level coverage of the mixed single-end/paired-end consensus-peak quantification fix, complementing the FEATURECOUNTS_MERGE unit + module tests: - default.nf.test: assert the merged consensus matrix carries every SE and PE sample column exactly once (no duplicates) — the actual failure-B regression, validated against a real -profile test run (3 SE + 3 PE cols). - consensus_all_se / consensus_all_pe: homogeneous cohorts that exercise the empty-branch -> single featureCounts invocation -> pass-through merge path, asserting the merged matrix carries only the expected library type. Subset samplesheets for the edge cases live in tests/csv/. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The SE/PE split replaced the single sorted BAM list from nf-core#448 with two per-endedness batches plus a merge step, each assembled from an unordered channel collect. Sort all three by filename so the featureCounts column order, the merged count matrix and its snapshot md5 stay reproducible across runs and hosts, preserving the guarantee nf-core#448 established.
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.
copy of nf-core#452, with the benefit of stacking to minimize changed lines