Commit 17149463 authored by Raphael Müller's avatar Raphael Müller
Browse files

publishdir is now a map; forgot nums

parent b654b920
......@@ -187,6 +187,7 @@ dependencies:
- r-base
- r-ggplot2
- r-dplyr
- nodejs
```
Perl packages needed for original workflow
......@@ -243,7 +244,24 @@ snakemake --profile sm_profile/ -F
#### Linter
TODO
For this pipeline, we use [npm-groovy-lint](https://www.npmjs.com/package/npm-groovy-lint) as the linter for the nextflow pipeline. Also, check out its [ruleset](https://codenarc.org/)
##### Install
```
conda activate backmap-development
npm install -g npm-groovy-lint
```
##### Run
```
npm-groovy-lint --output "txt" --no-insight --verbose -p nextflow/
```
##### Notes
Consider changing the file `.groovylintrc.json`, if the linter shows unexpected behavior.
----------------------------------------
......
......@@ -2,7 +2,6 @@
final String VERSION = 'v0.4'
final String NO_FILE = 'NO_FILE'
final Map<String, String> COPYMODE = ['mode': 'copy']
final int PROCESSMAXTHREADS = 8
final String HELP = """
......@@ -116,9 +115,6 @@ fileSeparator = params['file-separator']
output = params['output']
//specific subfolders
final String BWAINDEX = "${output} /bwa_index"
prefix = params['prefix']
threads = params['threads']
......@@ -205,6 +201,10 @@ if (printVersion) {
exit 1
}
final Map<String, String> COPYMODE = [path: output, mode: 'copy']
final Map<String, String> COPYMODETMP = [path: output, mode: 'copy', enabled: keepTemporaryFiles]
final Map<String, String> BWAINDEX = [path: "$output/bwa_index", mode: 'copy', pattern: '*{amb,ann,bwt,pac,sa}']
final Map<String, String> LOGFILES = [path: output, mode: 'copy', pattern: '*.{log,err}']
/*
* Process declarations
*/
......@@ -231,8 +231,8 @@ if (bamAvailable) {
// Create index files for bwa mapping
process bwaIndexing {
publishDir BWAINDEX, COPYMODE, pattern: '*{amb,ann,bwt,pac,sa}'
publishDir output, COPYMODE, pattern: '*.{log,err}'
publishDir BWAINDEX
publishDir LOGFILES
cpus 1
input:
file genome from chBwaIndexGenome
......@@ -248,9 +248,7 @@ if (bamAvailable) {
// BWA Mapping with Illuminma unpaired reads
process unpairedMapping {
cpus { PROCESSMAXTHREADS > threads ? threads : PROCESSMAXTHREADS }
if (keepTemporaryFiles) {
publishDir output, COPYMODE
}
publishDir COPYMODETMP
input:
file u from chUnpairedReadMapping
file index_name from chBwaIndexFilesUnpaired.collect()
......@@ -267,9 +265,7 @@ if (bamAvailable) {
// BWA Mapping with Illumina paired reads
process pairedMapping {
cpus { PROCESSMAXTHREADS > threads ? threads : PROCESSMAXTHREADS }
if (keepTemporaryFiles) {
publishDir output, COPYMODE
}
publishDir COPYMODETMP
input:
file p from chPairedReadMapping
file index_name from chBwaIndexFilesPaired.collect()
......@@ -286,9 +282,7 @@ if (bamAvailable) {
// Minimap2 mapping with PacBio reads
process pacbioMapping {
if (keepTemporaryFiles) {
publishDir output, COPYMODE
}
publishDir COPYMODETMP
cpus { PROCESSMAXTHREADS > threads ? threads : PROCESSMAXTHREADS }
input:
file pb from chPacbioReadMapping
......@@ -305,9 +299,7 @@ if (bamAvailable) {
// Minimap2 mapping with Nanopore reads
process nanoporeMapping {
if (keepTemporaryFiles) {
publishDir output, COPYMODE
}
publishDir COPYMODETMP
cpus { PROCESSMAXTHREADS > threads ? threads : PROCESSMAXTHREADS }
input:
file ont from chNanoporeReadMapping
......@@ -329,9 +321,7 @@ if (bamAvailable) {
// Merging of Illumina mapped reads
process mergeIlluminaBamFiles {
if (keepTemporaryFiles) {
publishDir output, COPYMODE
}
publishDir COPYMODETMP
cpus { PROCESSMAXTHREADS > threads ? threads : PROCESSMAXTHREADS }
input:
path(bams) from chIlluminaBamMerge.collect()
......@@ -345,9 +335,7 @@ process mergeIlluminaBamFiles {
// Merging of PacBio mapped reads
process mergePacbioBamFiles {
if (keepTemporaryFiles) {
publishDir output, COPYMODE
}
publishDir COPYMODETMP
cpus { PROCESSMAXTHREADS > threads ? threads : PROCESSMAXTHREADS }
input:
file pbs from chPacbioBamMerge.collect()
......@@ -361,9 +349,7 @@ process mergePacbioBamFiles {
// Merging of Nanopore mapped reads
process mergeNanoporeBamFiles {
if (keepTemporaryFiles) {
publishDir output, COPYMODE
}
publishDir COPYMODETMP
cpus { PROCESSMAXTHREADS > threads ? threads : PROCESSMAXTHREADS }
input:
file onts from chNanoporeBamMerge.collect()
......@@ -377,7 +363,7 @@ process mergeNanoporeBamFiles {
// Sorting all Bam files
process sortAllBamFiles {
publishDir output, COPYMODE
publishDir COPYMODE
cpus { PROCESSMAXTHREADS > threads ? threads : PROCESSMAXTHREADS }
input:
tuple val(tech), file(bam) from chSortIlluminaBamFile.mix(chSortPacbioBamFile).mix(chSortNanoporeBamFile)
......@@ -395,7 +381,7 @@ process sortAllBamFiles {
// Qualimap QC of sorted BAM files
if (qualityControl) {
process qualimap {
publishDir output, COPYMODE
publishDir COPYMODE
cpus { PROCESSMAXTHREADS > threads ? threads : PROCESSMAXTHREADS }
input:
tuple val(tech), file(bam) from chQualimapSortedBams
......@@ -411,7 +397,7 @@ if (qualityControl) {
// Multiqc QC with qualimap results
process multiqc {
publishDir output, COPYMODE
publishDir COPYMODE
cpus 1
input:
file qualis from chMultiqcQualimapResults.collect()
......@@ -428,7 +414,7 @@ if (qualityControl) {
if (coverageHistogram) {
process bedtoolsGenomecov {
cpus { 3 > threads ? threads : 3 }
publishDir output, COPYMODE
publishDir COPYMODE
input:
tuple val(tech), file(bam) from chComputeCoverageSortedBams
output:
......@@ -444,7 +430,7 @@ if (coverageHistogram) {
// R script for single coverage
process RcoveragePlotSingle {
publishDir output, COPYMODE
publishDir COPYMODE
cpus 1
input:
tuple val(tech), file(cov) from chRCoverageSinglePlot
......@@ -487,7 +473,7 @@ if (coverageHistogram) {
// Coverage comparison R script for coverage
process RMultiCoveragePlot {
publishDir output, COPYMODE
publishDir COPYMODE
cpus 1
input:
val(techCov) from chRCoverageMultiPlot.collect()
......@@ -495,7 +481,7 @@ if (coverageHistogram) {
file '*.pdf' into globAll
// only when more than one technology
when:
techoCov.size() / 2 > 1
techCov.size() / 2 > 1
script:
"""
#!/usr/bin/env Rscript
......@@ -543,7 +529,7 @@ if (coverageHistogram) {
if (genomeSizeEstimation) {
//calculate samtools stats
process samtoolsStats {
publishDir output, COPYMODE
publishDir COPYMODE
cpus 1
input:
tuple val(tech), file(bam) from chSamtoolsStatsSortedBams
......@@ -603,8 +589,8 @@ if (coverageHistogram) {
/*
* Print results
*/
chPeakAsInteger = chPeak.map { [num[0], Integer.parseInt(num[1])] }
chTotalNucleotidesAsInteger = chTotalNucleotidesResults.map { [num[0], Integer.parseInt(num[1])] }
chPeakAsInteger = chPeak.map { num -> [num[0], Integer.parseInt(num[1])] }
chTotalNucleotidesAsInteger = chTotalNucleotidesResults.map { num -> [num[0], Integer.parseInt(num[1])] }
chGenomeSizeEstimationResults = chTotalNucleotidesAsInteger
.join(chPeakAsInteger)
.join(chGenomeEstimationSortedBams)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment