Skip to content

Commit c8ac468

Browse files
authored
Merge pull request #185 from LouisLeNezet/csv
Fix csv generation
2 parents 0537a1e + 72ecdda commit c8ac468

File tree

8 files changed

+63
-24
lines changed

8 files changed

+63
-24
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2222
- [#166](https://github.com/nf-core/phaseimpute/pull/166) - Fix depth type to `number` to enable float.
2323
- [#179](https://github.com/nf-core/phaseimpute/pull/179) - Fix VCF usage in `GLIMPSE2`.
2424
- [#183](https://github.com/nf-core/phaseimpute/pull/183) - Remove wrongfully added files in `BAM_EXTRACT_REGION_SAMTOOLS`.
25+
- [#185](https://github.com/nf-core/phaseimpute/pull/185) - Fix CSV generation and check that all mentioned path files exist.
2526

2627
## v1.0.0 - Black Labrador [2024-12-09]
2728

conf/steps/panel_prep.config

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -190,12 +190,6 @@ process {
190190

191191
// Subworkflow: Make chunks
192192
withName: 'NFCORE_PHASEIMPUTE:PHASEIMPUTE:VCF_CHUNK_GLIMPSE:.*' {
193-
publishDir = [
194-
path: { "${params.outdir}/prep_panel/chunks/" },
195-
mode: params.publish_dir_mode,
196-
saveAs: { filename -> filename.equals('versions.yml') ? null : filename },
197-
enabled: true
198-
]
199193
tag = {"${meta.id} ${meta.chr}"}
200194
}
201195

conf/test_all.config

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,28 @@ params {
4848
process {
4949
withName: 'NFCORE_PHASEIMPUTE:PHASEIMPUTE:VCF_CHUNK_GLIMPSE:GLIMPSE_CHUNK' {
5050
ext.args = ["--window-size 10000", "--window-count 400", "--buffer-size 5000", "--buffer-count 30"].join(' ')
51+
ext.prefix = { "${meta.id}_${meta.chr}_chunks_glimpse1" }
52+
publishDir = [
53+
path: { "${params.outdir}/prep_panel/chunks/glimpse1/" },
54+
mode: params.publish_dir_mode,
55+
saveAs: { filename -> filename.equals('versions.yml') ? null : filename },
56+
enabled: true
57+
]
5158
}
5259

5360
withName: 'NFCORE_PHASEIMPUTE:PHASEIMPUTE:VCF_CHUNK_GLIMPSE:GLIMPSE2_CHUNK' {
5461
ext.args = ["--window-mb 0.01", "--window-cm 0.01", "--window-count 200", "--buffer-mb 0.005", "--buffer-cm 0.005", "--buffer-count 30"].join(' ')
62+
ext.prefix = { "${meta.id}_${meta.chr}_chunks_glimpse2" }
63+
publishDir = [
64+
path: { "${params.outdir}/prep_panel/chunks/glimpse2/" },
65+
mode: params.publish_dir_mode,
66+
saveAs: { filename -> filename.equals('versions.yml') ? null : filename },
67+
enabled: true
68+
]
5569
}
5670

5771
withName: 'NFCORE_PHASEIMPUTE:PHASEIMPUTE:VCF_PHASE_SHAPEIT5:GLIMPSE2_CHUNK' {
5872
ext.args = ["--window-mb 0.01", "--window-cm 0.01", "--window-count 200", "--buffer-mb 0.005", "--buffer-cm 0.005", "--buffer-count 30"].join(' ')
73+
ext.prefix = { "${meta.id}_chunks" }
5974
}
6075
}

conf/test_dog.config

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,28 @@ params {
4545
process {
4646
withName: 'NFCORE_PHASEIMPUTE:PHASEIMPUTE:VCF_CHUNK_GLIMPSE:GLIMPSE_CHUNK' {
4747
ext.args = ["--window-size 10000", "--window-count 400", "--buffer-size 5000", "--buffer-count 30"].join(' ')
48+
ext.prefix = { "${meta.id}_${meta.chr}_chunks_glimpse1" }
49+
publishDir = [
50+
path: { "${params.outdir}/prep_panel/chunks/glimpse1/" },
51+
mode: params.publish_dir_mode,
52+
saveAs: { filename -> filename.equals('versions.yml') ? null : filename },
53+
enabled: true
54+
]
4855
}
4956

5057
withName: 'NFCORE_PHASEIMPUTE:PHASEIMPUTE:VCF_CHUNK_GLIMPSE:GLIMPSE2_CHUNK' {
5158
ext.args = ["--window-mb 0.01", "--window-cm 0.01", "--window-count 200", "--buffer-mb 0.005", "--buffer-cm 0.005", "--buffer-count 30"].join(' ')
59+
ext.prefix = { "${meta.id}_${meta.chr}_chunks_glimpse2" }
60+
publishDir = [
61+
path: { "${params.outdir}/prep_panel/chunks/glimpse2/" },
62+
mode: params.publish_dir_mode,
63+
saveAs: { filename -> filename.equals('versions.yml') ? null : filename },
64+
enabled: true
65+
]
5266
}
5367

5468
withName: 'NFCORE_PHASEIMPUTE:PHASEIMPUTE:VCF_PHASE_SHAPEIT5:GLIMPSE2_CHUNK' {
5569
ext.args = ["--window-mb 0.01", "--window-cm 0.01", "--window-count 200", "--buffer-mb 0.005", "--buffer-cm 0.005", "--buffer-count 30"].join(' ')
70+
ext.prefix = { "${meta.id}_chunks" }
5671
}
5772
}

conf/test_panelprep.config

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,28 @@ params {
4141
process {
4242
withName: 'NFCORE_PHASEIMPUTE:PHASEIMPUTE:VCF_CHUNK_GLIMPSE:GLIMPSE_CHUNK' {
4343
ext.args = ["--window-size 10000", "--window-count 400", "--buffer-size 5000", "--buffer-count 30"].join(' ')
44+
ext.prefix = { "${meta.id}_${meta.chr}_chunks_glimpse1" }
45+
publishDir = [
46+
path: { "${params.outdir}/prep_panel/chunks/glimpse1/" },
47+
mode: params.publish_dir_mode,
48+
saveAs: { filename -> filename.equals('versions.yml') ? null : filename },
49+
enabled: true
50+
]
4451
}
4552

4653
withName: 'NFCORE_PHASEIMPUTE:PHASEIMPUTE:VCF_CHUNK_GLIMPSE:GLIMPSE2_CHUNK' {
4754
ext.args = ["--window-mb 0.01", "--window-cm 0.01", "--window-count 200", "--buffer-mb 0.005", "--buffer-cm 0.005", "--buffer-count 30"].join(' ')
55+
ext.prefix = { "${meta.id}_${meta.chr}_chunks_glimpse2" }
56+
publishDir = [
57+
path: { "${params.outdir}/prep_panel/chunks/glimpse2/" },
58+
mode: params.publish_dir_mode,
59+
saveAs: { filename -> filename.equals('versions.yml') ? null : filename },
60+
enabled: true
61+
]
4862
}
4963

5064
withName: 'NFCORE_PHASEIMPUTE:PHASEIMPUTE:VCF_PHASE_SHAPEIT5:GLIMPSE2_CHUNK' {
5165
ext.args = ["--window-mb 0.01", "--window-cm 0.01", "--window-count 200", "--buffer-mb 0.005", "--buffer-cm 0.005", "--buffer-count 30"].join(' ')
66+
ext.prefix = { "${meta.id}_chunks" }
5267
}
5368
}

docs/output.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ The files will be phased if the flag `--phase` is used (with `_phased` suffix).
9898
<summary>Output files</summary>
9999

100100
- `prep_panel/csv/`
101-
- `chunks.csv`: A CSV file containing the list of chunks obtained for each chromosome and panel.
101+
- `chunks_glimpse1.csv`: A CSV file containing the list of chunks obtained for each chromosome and panel.
102102
- `panel.csv`: A CSV file containing the final phased and prepared for each chromosome and input panel.
103103
- `posfile.csv`: A CSV file containing the final list of panel positions, in VCF and TSV files, for each chromosome and input panel.
104104

workflows/phaseimpute/main.nf

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ workflow PHASEIMPUTE {
125125

126126
// Program to filter chromosomes
127127
filter_chr_program = ch_region
128-
.collect{ meta, region -> meta.chr }
128+
.collect{ meta, _region -> meta.chr }
129129
.map { chr ->
130130
"BEGIN { FS=\"\t\";\nsplit(\"" + chr.join(" ") + '", chr, " ");\n' +
131131
'for (i in chr) {\nchr_map[chr[i]] = 1;\n}\n}\n' +
@@ -137,7 +137,6 @@ workflow PHASEIMPUTE {
137137
// Compute coverage of input files
138138
SAMTOOLS_COVERAGE_INP(ch_input_sim, ch_fasta)
139139
ch_versions = ch_versions.mix(SAMTOOLS_COVERAGE_INP.out.versions)
140-
ch_coverage = SAMTOOLS_COVERAGE_INP.out.coverage
141140

142141
FILTER_CHR_INP(
143142
SAMTOOLS_COVERAGE_INP.out.coverage,
@@ -229,18 +228,18 @@ workflow PHASEIMPUTE {
229228
// Posfile
230229
exportCsv(
231230
ch_posfile.map{ meta, vcf, index, hap, legend ->
232-
[meta, [2:"prep_panel/sites", 3:"prep_panel/haplegend", 4:"prep_panel/haplegend"], vcf, index, hap, legend]
231+
[meta, [2:"prep_panel/sites", 3:"prep_panel/sites", 4:"prep_panel/haplegend", 5:"prep_panel/haplegend"], vcf, index, hap, legend]
233232
},
234233
["id", "chr"], "panel,chr,vcf,index,hap,legend",
235234
"posfile.csv", "prep_panel/csv"
236235
)
237236
// Chunks
238237
exportCsv(
239238
VCF_CHUNK_GLIMPSE.out.chunks.map{ meta, file ->
240-
[meta, [2:"prep_panel/chunks"], file]
239+
[meta, [2:"prep_panel/chunks/glimpse1"], file]
241240
},
242241
["id", "chr"], "panel,chr,file",
243-
"chunks.csv", "prep_panel/csv"
242+
"chunks_glimpse1.csv", "prep_panel/csv"
244243
)
245244
}
246245

@@ -424,9 +423,9 @@ workflow PHASEIMPUTE {
424423
// Export all files to csv
425424
exportCsv(
426425
ch_input_validate.map{ meta, file, index ->
427-
[meta, [2:"imputation/${meta.tools}/samples/", 3:"imputation/${meta.tools}/samples/"], file, index]
426+
[meta, [2:"imputation/${meta.tools}/samples", 3:"imputation/${meta.tools}/samples"], file, index]
428427
},
429-
["id", "tools"], "sample,tools,vcf,index",
428+
["id", "tools"], "sample,tools,file,index",
430429
"impute.csv", "imputation/csv"
431430
)
432431
}

workflows/phaseimpute/tests/main.nf.test.snap

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
"prep_panel/chunks/glimpse1/1000GP_chr22_chunks_glimpse1.txt",
9696
"prep_panel/chunks/glimpse2/1000GP_chr21_chunks_glimpse2.txt",
9797
"prep_panel/chunks/glimpse2/1000GP_chr22_chunks_glimpse2.txt",
98-
"prep_panel/csv/chunks.csv",
98+
"prep_panel/csv/chunks_glimpse1.csv",
9999
"prep_panel/csv/panel.csv",
100100
"prep_panel/csv/posfile.csv",
101101
"prep_panel/haplegend/1000GP_chr21.hap.gz",
@@ -166,10 +166,10 @@
166166
]
167167
],
168168
"meta": {
169-
"nf-test": "0.9.2",
169+
"nf-test": "0.9.1",
170170
"nextflow": "24.10.1"
171171
},
172-
"timestamp": "2024-11-27T18:23:38.85114929"
172+
"timestamp": "2025-02-20T11:45:13.538903855"
173173
},
174174
"Check test_validate": {
175175
"content": [
@@ -329,7 +329,7 @@
329329
"prep_panel/chunks/glimpse1/1000GP_chr22_chunks_glimpse1.txt",
330330
"prep_panel/chunks/glimpse2/1000GP_chr21_chunks_glimpse2.txt",
331331
"prep_panel/chunks/glimpse2/1000GP_chr22_chunks_glimpse2.txt",
332-
"prep_panel/csv/chunks.csv",
332+
"prep_panel/csv/chunks_glimpse1.csv",
333333
"prep_panel/csv/panel.csv",
334334
"prep_panel/csv/posfile.csv",
335335
"prep_panel/haplegend/1000GP_chr21.hap.gz",
@@ -349,10 +349,10 @@
349349
]
350350
],
351351
"meta": {
352-
"nf-test": "0.8.4",
353-
"nextflow": "24.04.4"
352+
"nf-test": "0.9.1",
353+
"nextflow": "24.10.1"
354354
},
355-
"timestamp": "2024-10-14T19:19:50.07758554"
355+
"timestamp": "2025-02-20T11:48:45.440753818"
356356
},
357357
"Check test_glimpse2": {
358358
"content": [
@@ -433,7 +433,7 @@
433433
"prep_panel/chunks/glimpse1/658Dog_chr22_chunks_glimpse1.txt",
434434
"prep_panel/chunks/glimpse2/658Dog_chr21_chunks_glimpse2.txt",
435435
"prep_panel/chunks/glimpse2/658Dog_chr22_chunks_glimpse2.txt",
436-
"prep_panel/csv/chunks.csv",
436+
"prep_panel/csv/chunks_glimpse1.csv",
437437
"prep_panel/csv/panel.csv",
438438
"prep_panel/csv/posfile.csv",
439439
"prep_panel/haplegend/658Dog_chr21.hap.gz",
@@ -473,9 +473,9 @@
473473
]
474474
],
475475
"meta": {
476-
"nf-test": "0.9.2",
476+
"nf-test": "0.9.1",
477477
"nextflow": "24.10.1"
478478
},
479-
"timestamp": "2024-11-27T18:25:56.980470563"
479+
"timestamp": "2025-02-20T11:47:19.564681513"
480480
}
481481
}

0 commit comments

Comments
 (0)