Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions subworkflows/msk/netmhcstabandpan/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,19 @@ def createNETMHCInput(fastas_and_hla, sv_fastas) {
[it[0],it]
}

// remainder: true keeps samples that have no SV data (sv_fastas is empty when no SVs provided)
def merged_mut = fastas_and_hla_channel
.join(sv_fastas_channel, by:0)
.join(sv_fastas_channel, by:0, remainder: true)
.map({
[it[1][0], it[1][1], it[2][1], it[1][3], "MUT"]
def sv = it[2] ?: [null, [], []]
[it[1][0], it[1][1], sv[1], it[1][3], "MUT"]
})

def merged_wt = fastas_and_hla_channel
.join(sv_fastas_channel, by:0)
.join(sv_fastas_channel, by:0, remainder: true)
.map({
[it[1][0], it[1][2], it[2][2], it[1][3], "WT"]
def sv = it[2] ?: [null, [], []]
[it[1][0], it[1][2], sv[2], it[1][3], "WT"]
})
def merged = merged_mut.mix(merged_wt)
return merged
Expand Down
37 changes: 37 additions & 0 deletions subworkflows/msk/netmhcstabandpan/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,43 @@ nextflow_workflow {
}


test("netmhcstabandpan - empty SV channel - fa,hla_str - tsv - stub") {

// Regression test: when no SV files are provided, the upstream NEOSV process
// doesn't run, so the sv_fasta channel emits zero items. The createNETMHCInput
// helper must still emit MUT and WT tuples for each sample.

options "-stub"

when {
workflow {
"""
input[0] = channel.value([
[ id:'test', single_end:false ], // meta map
file('MUT_sequence_fa', checkIfExists: false),
file('WT_sequence_fa', checkIfExists: false),
"HLA-A24:02,HLA-A24:02,HLA-B39:01,HLA-B39:01,HLA-C07:01,HLA-C06:02",
])

input[1] = channel.empty()
"""
}
}

then {
assertAll(
{ assert workflow.success },
{ assert snapshot(workflow.out.tsv[0][0],
file(workflow.out.tsv[0][1]).name,
workflow.out.tsv[1][0],
file(workflow.out.tsv[1][1]).name
).match()
}
)
}
}


test("netmhcstabandpan - fa,hla_str - tsv - stub") {

options "-stub"
Expand Down
25 changes: 25 additions & 0 deletions subworkflows/msk/netmhcstabandpan/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
Expand Up @@ -212,5 +212,30 @@
"nextflow": "25.10.2"
},
"timestamp": "2025-12-19T14:22:41.854041255"
},
"netmhcstabandpan - empty SV channel - fa,hla_str - tsv - stub": {
"content": [
{
"id": "test",
"single_end": false,
"typeMut": false,
"fromStab": false,
"typePan": true
},
"test.WT.PAN.tsv",
{
"id": "test",
"single_end": false,
"typeMut": false,
"fromStab": true,
"typePan": true
},
"test.WT.STAB.tsv"
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.2"
},
"timestamp": "2026-05-13T22:29:19.315483"
}
}
Loading