Skip to content

Commit 2deee3d

Browse files
dltamayoclaude
andcommitted
Fix nextflow lint warnings: deprecated Channel factories, implicit closures,
unused params, single-emit names, and projectDir-in-process Replaces deprecated `Channel.*` factory calls with lowercase `channel.*` across 9 files, declares explicit closure parameters in place of implicit `it` (sc_to_bulk.nf, singlecell.nf), and prefixes unused branch/map closure parameters with `_` in pseudobulk_qc.nf. Removes the emit name on three subworkflows with a single output (COMPARE.shared_cdr3, CONVERT.sample_map_converted, REPORT.rendered_html) and updates every call site accordingly (bulktcr_analysis.nf, tcrtoolkit.nf). CONVERT's conditional assignment is restructured using the ternary-in-emit idiom already established in patient.nf, since its emit couldn't just drop a name while remaining a plain if/else-assigned variable. Fixes cluster_to_sc.nf's discouraged `${projectDir}/bin/...` reference by invoking enrich_seurat.R by bare name instead - it already carries the same shebang and executable bit as every Python script in bin/, so Nextflow's automatic bin/-on-PATH staging resolves it exactly like the rest of the pipeline's scripts, without adding a new process input. Also drops an unused `def sample_stats_agg =` binding in sample.nf, keeping the collectFile/storeDir call for its file-publishing side effect. Warnings: 48 -> 4 (remaining 4 are linter false positives: sample_map/ concat_cdr3 are read via bare `emit:` references, which the linter's "declared but not used" check doesn't detect as usage). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
1 parent af33826 commit 2deee3d

17 files changed

Lines changed: 43 additions & 44 deletions

modules/bridges/cluster_to_sc.nf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ process CLUSTER_TO_SC {
4141

4242
script:
4343
"""
44-
Rscript ${projectDir}/bin/enrich_seurat.R \\
44+
enrich_seurat.R \\
4545
--seurat_rds "${seurat_rds}" \\
4646
--export_cells "${export_cells}" \\
4747
--tcrdist_radius ${tcrdist_radius}

subworkflows/bridges/sc_to_bulk.nf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ workflow SC_TO_BULK_SW {
2323
params.condition_col,
2424
params.timepoint_col,
2525
params.batch_col
26-
].findAll { it }.join(',')
26+
].findAll { col -> col }.join(',')
2727

2828
// TCELL_INTEGRATION always exports a standardized 'sample' column;
2929
// params.sample_col is the Seurat metadata name, not the export column name.

subworkflows/local/bulktcr_analysis.nf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ workflow BULKTCR_ANALYSIS {
8686

8787
ch_discovery_report = sample_stats_agg
8888
.combine(ANNOTATE.out.concat_cdr3_sorted)
89-
.combine(COMPARE.out.shared_cdr3)
89+
.combine(COMPARE.out)
9090
.combine(SAMPLE.out.tcrdist_files.map { l -> [l] })
9191
.combine(SAMPLE.out.vdjdb_files.map { l -> [l] })
9292
.combine(convert_files.map { l -> [l] })
@@ -144,7 +144,7 @@ workflow BULKTCR_ANALYSIS {
144144

145145
def details_part2_base = sample_stats_agg
146146
.combine(ANNOTATE.out.concat_cdr3_sorted)
147-
.combine(COMPARE.out.shared_cdr3)
147+
.combine(COMPARE.out)
148148

149149
def run_patient_clustering = levels.contains('patient')
150150
def patient_clustering_notebook = run_patient_clustering
@@ -238,5 +238,5 @@ workflow BULKTCR_ANALYSIS {
238238
gliph2_cluster_member_details = levels.contains('patient') ? PATIENT.out.gliph2_cluster_member_details : channel.value([])
239239
gliph2_global_similarities = levels.contains('patient') ? PATIENT.out.gliph2_global_similarities : channel.value([])
240240

241-
shared_cdr3 = levels.contains('compare') ? COMPARE.out.shared_cdr3 : channel.empty()
241+
shared_cdr3 = levels.contains('compare') ? COMPARE.out : channel.empty()
242242
}

subworkflows/local/compare.nf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,5 @@ workflow COMPARE {
3535
)
3636

3737
emit:
38-
shared_cdr3 = TCRSHARING_CALC.out.shared_cdr3
38+
TCRSHARING_CALC.out.shared_cdr3
3939
}

subworkflows/local/convert.nf

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,8 @@ workflow CONVERT {
2525
file(params.airr_schema),
2626
file(params.imgt_lookup)
2727
)
28-
sample_map_converted = CONVERT_ADAPTIVE.out.adaptive_convert
29-
} else {
30-
sample_map_converted = sample_map
3128
}
3229

3330
emit:
34-
sample_map_converted
31+
input_format == 'adaptive' ? CONVERT_ADAPTIVE.out.adaptive_convert : sample_map
3532
}

subworkflows/local/pseudobulk_qc.nf

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,22 +39,22 @@ workflow PSEUDOBULK_QC_SW {
3939

4040
// Wrap the scalar thresholds as explicit value channels. Nextflow 24.10 does not
4141
// reliably auto-broadcast a bare value passed alongside a queue-channel input.
42-
PSEUDOBULK_QC_CALC( sample_map, Channel.value(min_clones), Channel.value(min_cells) )
42+
PSEUDOBULK_QC_CALC( sample_map, channel.value(min_clones), channel.value(min_cells) )
4343

44-
branched = PSEUDOBULK_QC_CALC.out.scored.branch { meta, file, qc_pass, nc, ce ->
44+
branched = PSEUDOBULK_QC_CALC.out.scored.branch { _meta, _file, qc_pass, _nc, _ce ->
4545
pass: qc_pass == 'PASS'
4646
fail: true
4747
}
4848

4949
// Log every dropped sample
50-
branched.fail.view { meta, file, qc_pass, nc, ce ->
50+
branched.fail.view { meta, _file, _qc_pass, nc, ce ->
5151
"[Pseudobulk QC] DROPPED '${meta.sample}': clones=${nc} (min ${min_clones}), cells=${ce} (min ${min_cells})"
5252
}
5353

5454
// Optional hard-stop: abort the run if any sample fails QC
5555
if (gate_mode == 'hard_stop') {
5656
branched.fail
57-
.map { meta, file, qc_pass, nc, ce -> "${meta.sample} (clones=${nc}, cells=${ce})" }
57+
.map { meta, _file, _qc_pass, nc, ce -> "${meta.sample} (clones=${nc}, cells=${ce})" }
5858
.collect()
5959
.subscribe { failed ->
6060
if (failed) {
@@ -66,7 +66,7 @@ workflow PSEUDOBULK_QC_SW {
6666
}
6767

6868
// Passing samples only -> [meta, file]
69-
passed_map = branched.pass.map { meta, file, qc_pass, nc, ce -> [meta, file] }
69+
passed_map = branched.pass.map { meta, file, _qc_pass, _nc, _ce -> [meta, file] }
7070

7171
// Warn (drop mode) if nothing survived the gate
7272
passed_map.count().subscribe { n ->
@@ -78,7 +78,7 @@ workflow PSEUDOBULK_QC_SW {
7878

7979
// Rebuild concatenated CDR3 from passing samples (for ANNOTATE)
8080
concat_cdr3 = passed_map
81-
.map { meta, file -> file }
81+
.map { _meta, file -> file }
8282
.collectFile(name: 'concat_cdr3.tsv', keepHeader: true, skip: 1)
8383

8484
// ── Reporting (non-redundant): QC summary + V gene-family usage ──────────

subworkflows/local/report.nf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ workflow REPORT {
2727
)
2828

2929
emit:
30-
rendered_html = RENDER_NOTEBOOK.out
30+
RENDER_NOTEBOOK.out
3131
}

subworkflows/local/sample.nf

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ workflow SAMPLE {
3333
def sample_calc_input = processed_samples.join(per_sample_stats)
3434
SAMPLE_CALC( sample_calc_input )
3535

36-
def sample_stats_agg = SAMPLE_CALC.out.sample_csv
36+
// Published as a side effect (storeDir) - the aggregated CSV itself isn't consumed
37+
// further downstream; bulktcr_analysis.nf computes its own in-memory copy for reports.
38+
SAMPLE_CALC.out.sample_csv
3739
.collectFile(name: "sample_stats.csv", keepHeader: true, skip: 1, sort: true, storeDir: "${params.outdir}/sample")
3840

3941
def v_family_agg = SAMPLE_CALC.out.v_family_csv

subworkflows/scratch/conga.nf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ workflow CONGA_SW {
1010
project_name
1111

1212
main:
13-
ch_notebook = Channel.fromPath(
13+
ch_notebook = channel.fromPath(
1414
"${projectDir}/modules/scratch/CONGA/CoNGA_Report.qmd",
1515
checkIfExists: true
1616
)

subworkflows/scratch/consensus_clustering.nf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ workflow CONSENSUS_SW {
1313
project_name
1414

1515
main:
16-
ch_notebook = Channel.fromPath(
16+
ch_notebook = channel.fromPath(
1717
"${projectDir}/modules/scratch/CONSENSUS_CLUSTERING/Clonotype_Clustering_Consensus_Report.qmd",
1818
checkIfExists: true
1919
)

0 commit comments

Comments
 (0)