Skip to content
This repository was archived by the owner on Jan 27, 2020. It is now read-only.

Commit 5ef1dec

Browse files
authored
Merge pull request #671 from MaxUlysse/Publish
add publishDirMode param and docs
2 parents 18ae58f + 49fdda8 commit 5ef1dec

10 files changed

Lines changed: 56 additions & 33 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,14 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
77

88
## [Unreleased]
99

10+
### `Added`
11+
12+
- [#671](https://github.com/SciLifeLab/Sarek/pull/671) - New `publishDirMode` param and docs
13+
1014
### `Changed`
1115

1216
- [#663](https://github.com/SciLifeLab/Sarek/pull/663) - Update `do_release.sh` script
17+
- [#671](https://github.com/SciLifeLab/Sarek/pull/671) - publishDir modes are now params
1318

1419
### `Fixed`
1520

annotate.nf

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ vcfForVep = vcfForVep.map {
103103
process RunBcftoolsStats {
104104
tag {vcf}
105105

106-
publishDir directoryMap.bcftoolsStats, mode: 'link'
106+
publishDir directoryMap.bcftoolsStats, mode: params.publishDirMode
107107

108108
input:
109109
set variantCaller, file(vcf) from vcfForBCFtools
@@ -124,7 +124,7 @@ if (params.verbose) bcfReport = bcfReport.view {
124124
process RunVcftools {
125125
tag {vcf}
126126

127-
publishDir directoryMap.vcftools, mode: 'link'
127+
publishDir directoryMap.vcftools, mode: params.publishDirMode
128128

129129
input:
130130
set variantCaller, file(vcf) from vcfForVCFtools
@@ -145,7 +145,7 @@ if (params.verbose) vcfReport = vcfReport.view {
145145
process RunSnpeff {
146146
tag {"${variantCaller} - ${vcf}"}
147147

148-
publishDir params.outDir, mode: 'link', saveAs: {
148+
publishDir params.outDir, mode: params.publishDirMode, saveAs: {
149149
if (it == "${vcf.simpleName}_snpEff.csv") "${directoryMap.snpeffReports}/${it}"
150150
else if (it == "${vcf.simpleName}_snpEff.ann.vcf") null
151151
else "${directoryMap.snpeff}/${it}"
@@ -198,7 +198,7 @@ if('merge' in tools) {
198198
process RunVEP {
199199
tag {"${variantCaller} - ${vcf}"}
200200

201-
publishDir params.outDir, mode: 'link', saveAs: {
201+
publishDir params.outDir, mode: params.publishDirMode, saveAs: {
202202
if (it == "${vcf.simpleName}_VEP.summary.html") "${directoryMap.vep}/${it}"
203203
else null
204204
}
@@ -245,7 +245,7 @@ vcfToCompress = snpeffVCF.mix(vepVCF)
245245
process CompressVCF {
246246
tag {"${annotator} - ${vcf}"}
247247

248-
publishDir "${directoryMap."$finalannotator"}", mode: 'link'
248+
publishDir "${directoryMap."$finalannotator"}", mode: params.publishDirMode
249249

250250
input:
251251
set annotator, variantCaller, file(vcf) from vcfToCompress
@@ -268,14 +268,14 @@ if (params.verbose) vcfCompressedoutput = vcfCompressedoutput.view {
268268
}
269269

270270
process GetVersionSnpeff {
271-
publishDir directoryMap.version, mode: 'link'
271+
publishDir directoryMap.version, mode: params.publishDirMode
272272
output: file("v_*.txt")
273273
when: 'snpeff' in tools || 'merge' in tools
274274
script: QC.getVersionSnpEFF()
275275
}
276276

277277
process GetVersionVEP {
278-
publishDir directoryMap.version, mode: 'link'
278+
publishDir directoryMap.version, mode: params.publishDirMode
279279
output: file("v_*.txt")
280280
when: 'vep' in tools || 'merge' in tools
281281
script: QC.getVersionVEP()

buildContainers.nf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ if (params.verbose) containersBuilt = containersBuilt.view {
8686
process PullSingularityContainers {
8787
tag {"${params.repository}/${container}:${params.tag}"}
8888

89-
publishDir "${params.containerPath}", mode: 'move'
89+
publishDir "${params.containerPath}", mode: params.publishDirMode
9090

9191
input:
9292
val container from singularityContainers

buildReferences.nf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ ch_notCompressedfiles
103103
process BuildBWAindexes {
104104
tag {f_reference}
105105

106-
publishDir params.outDir, mode: 'link'
106+
publishDir params.outDir, mode: params.publishDirMode
107107

108108
input:
109109
file(f_reference) from ch_fastaForBWA
@@ -125,7 +125,7 @@ if (params.verbose) bwaIndexes.flatten().view {
125125
process BuildReferenceIndex {
126126
tag {f_reference}
127127

128-
publishDir params.outDir, mode: 'link'
128+
publishDir params.outDir, mode: params.publishDirMode
129129

130130
input:
131131
file(f_reference) from ch_fastaReference
@@ -149,7 +149,7 @@ if (params.verbose) ch_referenceIndex.view {
149149
process BuildSAMToolsIndex {
150150
tag {f_reference}
151151

152-
publishDir params.outDir, mode: 'link'
152+
publishDir params.outDir, mode: params.publishDirMode
153153

154154
input:
155155
file(f_reference) from ch_fastaForSAMTools
@@ -170,7 +170,7 @@ if (params.verbose) ch_samtoolsIndex.view {
170170
process BuildVCFIndex {
171171
tag {f_reference}
172172

173-
publishDir params.outDir, mode: 'link'
173+
publishDir params.outDir, mode: params.publishDirMode
174174

175175
input:
176176
file(f_reference) from ch_vcfFile

conf/base.config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ params {
2727
nucleotidesPerSecond = 1000.0 // To estimate interval size by default
2828
onlyQC = false // All process will be run and not only the QC tools
2929
outDir = "${PWD}" // Path to output directory
30+
publishDirMode = 'link' // publishDir mode is 'link' by default
3031
push = false // Don't push container to DockerHub
3132
repository = wf_repository // DockerHub containers repository
3233
singularity = false // Don't use singularity to build buildContainers.nf

docs/PARAMETERS.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,21 @@ Choose an output directory
2121
Specify a project number ID on a UPPMAX cluster.
2222
(optional if not on such a cluster)
2323

24+
## --publishDirMode
25+
26+
Specify wich mode `publishDir` directive need to follow, in Sarek link is the default mode.
27+
28+
From [Nextflow documentation](https://www.nextflow.io/docs/latest/process.html#publishdir):
29+
30+
| Mode | Description |
31+
|--------------|-------------|
32+
| copy | Copies the output files into the published directory |
33+
| copyNoFollow | Copies the output files into the published directory without following symlinks ie. copies the links themselves |
34+
| link | Creates a hard link in the published directory for each process output file (default) |
35+
| move | Moves the output files into the published directory. Note: this is only supposed to be used for a terminating process i.e. a process whose output is not consumed by any other downstream process |
36+
| rellink | Creates a relative symbolic link in the published directory for each process output file |
37+
| symlink | Creates an absolute symbolic link in the published directory for each process output file |
38+
2439
### --sample `file.tsv`
2540

2641
Use the given TSV file as sample (cf [TSV documentation](TSV.md)).

lib/SarekUtils.groovy

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ class SarekUtils {
7171
'outDir',
7272
'params',
7373
'project',
74+
'publish-dir-mode',
75+
'publishDirMode',
7476
'push',
7577
'ref-dir',
7678
'refDir',

main.nf

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ if (params.verbose) bamFiles = bamFiles.view {
123123
process RunFastQC {
124124
tag {idPatient + "-" + idRun}
125125

126-
publishDir "${directoryMap.fastQC}/${idRun}", mode: 'link'
126+
publishDir "${directoryMap.fastQC}/${idRun}", mode: params.publishDirMode
127127

128128
input:
129129
set idPatient, status, idSample, idRun, file(fastqFile1), file(fastqFile2) from fastqFilesforFastQC
@@ -226,7 +226,7 @@ if (params.verbose) mergedBam = mergedBam.view {
226226
process MarkDuplicates {
227227
tag {idPatient + "-" + idSample}
228228

229-
publishDir params.outDir, mode: 'link',
229+
publishDir params.outDir, mode: params.publishDirMode,
230230
saveAs: {
231231
if (it == "${bam}.metrics") "${directoryMap.markDuplicatesQC}/${it}"
232232
else "${directoryMap.duplicateMarked}/${it}"
@@ -283,7 +283,7 @@ if (params.verbose) duplicateMarkedBams = duplicateMarkedBams.view {
283283
process CreateRecalibrationTable {
284284
tag {idPatient + "-" + idSample}
285285

286-
publishDir directoryMap.duplicateMarked, mode: 'link', overwrite: false
286+
publishDir directoryMap.duplicateMarked, mode: params.publishDirMode, overwrite: false
287287

288288
input:
289289
set idPatient, status, idSample, file(bam), file(bai) from mdBam // realignedBam
@@ -350,7 +350,7 @@ recalTables = recalTables.map { [it[0]] + it[2..-1] } // remove status
350350
process RecalibrateBam {
351351
tag {idPatient + "-" + idSample}
352352

353-
publishDir directoryMap.recalibrated, mode: 'link'
353+
publishDir directoryMap.recalibrated, mode: params.publishDirMode
354354

355355
input:
356356
set idPatient, status, idSample, file(bam), file(bai), file(recalibrationReport) from recalibrationTable
@@ -398,7 +398,7 @@ if (params.verbose) recalibratedBam = recalibratedBam.view {
398398
process RunSamtoolsStats {
399399
tag {idPatient + "-" + idSample}
400400

401-
publishDir directoryMap.samtoolsStats, mode: 'link'
401+
publishDir directoryMap.samtoolsStats, mode: params.publishDirMode
402402

403403
input:
404404
set idPatient, status, idSample, file(bam), file(bai) from bamForSamToolsStats
@@ -419,7 +419,7 @@ if (params.verbose) samtoolsStatsReport = samtoolsStatsReport.view {
419419
process RunBamQC {
420420
tag {idPatient + "-" + idSample}
421421

422-
publishDir directoryMap.bamQC, mode: 'link'
422+
publishDir directoryMap.bamQC, mode: params.publishDirMode
423423

424424
input:
425425
set idPatient, status, idSample, file(bam), file(bai) from bamForBamQC

runMultiQC.nf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ directoryMap = SarekUtils.defineDirectoryMap(params.outDir)
4747
startMessage()
4848

4949
process GetVersionAll {
50-
publishDir directoryMap.multiQC, mode: 'link'
50+
publishDir directoryMap.multiQC, mode: params.publishDirMode
5151

5252
input:
5353
file(versions) from Channel.fromPath("${directoryMap.version}/*").collect().ifEmpty(file ("empty"))
@@ -94,7 +94,7 @@ reportsForMultiQC = Channel.empty()
9494
).collect()
9595

9696
process RunMultiQC {
97-
publishDir directoryMap.multiQC, mode: 'link'
97+
publishDir directoryMap.multiQC, mode: params.publishDirMode
9898

9999
input:
100100
file (multiqcConfig) from createMultiQCconfig()

somaticVC.nf

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ if (params.verbose) recalibratedBam = recalibratedBam.view {
113113
process RunSamtoolsStats {
114114
tag {idPatient + "-" + idSample}
115115

116-
publishDir directoryMap.samtoolsStats, mode: 'link'
116+
publishDir directoryMap.samtoolsStats, mode: params.publishDirMode
117117

118118
input:
119119
set idPatient, status, idSample, file(bam), file(bai) from bamForSamToolsStats
@@ -134,7 +134,7 @@ if (params.verbose) samtoolsStatsReport = samtoolsStatsReport.view {
134134
process RunBamQC {
135135
tag {idPatient + "-" + idSample}
136136

137-
publishDir directoryMap.bamQC, mode: 'link'
137+
publishDir directoryMap.bamQC, mode: params.publishDirMode
138138

139139
input:
140140
set idPatient, status, idSample, file(bam), file(bai) from bamForBamQC
@@ -357,7 +357,7 @@ if (params.verbose) vcfsToMerge = vcfsToMerge.view {
357357
process ConcatVCF {
358358
tag {variantCaller + "_" + idSampleTumor + "_vs_" + idSampleNormal}
359359

360-
publishDir "${directoryMap."$variantCaller"}", mode: 'link'
360+
publishDir "${directoryMap."$variantCaller"}", mode: params.publishDirMode
361361

362362
input:
363363
set variantCaller, idPatient, idSampleNormal, idSampleTumor, file(vcFiles) from vcfsToMerge
@@ -392,7 +392,7 @@ if (params.verbose) vcfConcatenated = vcfConcatenated.view {
392392
process RunStrelka {
393393
tag {idSampleTumor + "_vs_" + idSampleNormal}
394394

395-
publishDir directoryMap.strelka, mode: 'link'
395+
publishDir directoryMap.strelka, mode: params.publishDirMode
396396

397397
input:
398398
set idPatient, idSampleNormal, file(bamNormal), file(baiNormal), idSampleTumor, file(bamTumor), file(baiTumor) from bamsForStrelka
@@ -449,7 +449,7 @@ if (params.verbose) strelkaOutput = strelkaOutput.view {
449449
process RunManta {
450450
tag {idSampleTumor + "_vs_" + idSampleNormal}
451451

452-
publishDir directoryMap.manta, mode: 'link'
452+
publishDir directoryMap.manta, mode: params.publishDirMode
453453

454454
input:
455455
set idPatient, idSampleNormal, file(bamNormal), file(baiNormal), idSampleTumor, file(bamTumor), file(baiTumor) from bamsForManta
@@ -503,7 +503,7 @@ if (params.verbose) mantaOutput = mantaOutput.view {
503503
process RunSingleManta {
504504
tag {idSample + " - Tumor-Only"}
505505

506-
publishDir directoryMap.manta, mode: 'link'
506+
publishDir directoryMap.manta, mode: params.publishDirMode
507507

508508
input:
509509
set idPatient, status, idSample, file(bam), file(bai) from bamsForSingleManta
@@ -562,7 +562,7 @@ bamsForStrelkaBP = bamsForStrelkaBP.map {
562562
process RunStrelkaBP {
563563
tag {idSampleTumor + "_vs_" + idSampleNormal}
564564

565-
publishDir directoryMap.strelkabp, mode: 'link'
565+
publishDir directoryMap.strelkabp, mode: params.publishDirMode
566566

567567
input:
568568
set idPatient, idSampleNormal, file(bamNormal), file(baiNormal), idSampleTumor, file(bamTumor), file(baiTumor), file(mantaCSI), file(mantaCSIi) from bamsForStrelkaBP
@@ -654,7 +654,7 @@ alleleCountOutput = alleleCountOutput.map {
654654
process RunConvertAlleleCounts {
655655
tag {idSampleTumor + "_vs_" + idSampleNormal}
656656

657-
publishDir directoryMap.ascat, mode: 'link'
657+
publishDir directoryMap.ascat, mode: params.publishDirMode
658658

659659
input:
660660
set idPatient, idSampleNormal, idSampleTumor, file(alleleCountNormal), file(alleleCountTumor) from alleleCountOutput
@@ -676,7 +676,7 @@ process RunConvertAlleleCounts {
676676
process RunAscat {
677677
tag {idSampleTumor + "_vs_" + idSampleNormal}
678678

679-
publishDir directoryMap.ascat, mode: 'link'
679+
publishDir directoryMap.ascat, mode: params.publishDirMode
680680

681681
input:
682682
set idPatient, idSampleNormal, idSampleTumor, file(bafNormal), file(logrNormal), file(bafTumor), file(logrTumor) from convertAlleleCountsOutput
@@ -734,7 +734,7 @@ vcfForQC = Channel.empty().mix(
734734
process RunBcftoolsStats {
735735
tag {vcf}
736736

737-
publishDir directoryMap.bcftoolsStats, mode: 'link'
737+
publishDir directoryMap.bcftoolsStats, mode: params.publishDirMode
738738

739739
input:
740740
set variantCaller, file(vcf) from vcfForBCFtools
@@ -757,7 +757,7 @@ bcfReport.close()
757757
process RunVcftools {
758758
tag {vcf}
759759

760-
publishDir directoryMap.vcftools, mode: 'link'
760+
publishDir directoryMap.vcftools, mode: params.publishDirMode
761761

762762
input:
763763
set variantCaller, file(vcf) from vcfForVCFtools
@@ -778,7 +778,7 @@ if (params.verbose) vcfReport = vcfReport.view {
778778
vcfReport.close()
779779

780780
process GetVersionAlleleCount {
781-
publishDir directoryMap.version, mode: 'link'
781+
publishDir directoryMap.version, mode: params.publishDirMode
782782
output: file("v_*.txt")
783783
when: 'ascat' in tools && !params.onlyQC
784784

@@ -789,7 +789,7 @@ process GetVersionAlleleCount {
789789
}
790790

791791
process GetVersionASCAT {
792-
publishDir directoryMap.version, mode: 'link'
792+
publishDir directoryMap.version, mode: params.publishDirMode
793793
output: file("v_*.txt")
794794
when: 'ascat' in tools && !params.onlyQC
795795

0 commit comments

Comments
 (0)