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

minor indentation fixes

parent 3bbb0288
......@@ -76,6 +76,7 @@ params["single-end"] = 'NO_FILE'
params["paired-end"] = 'NO_FILE'
params["pacbio"] = 'NO_FILE'
params["nanopore"] = 'NO_FILE'
params["illumina-bam-files"] = 'NO_FILE'
params["pacbio-bam-files"] = 'NO_FILE'
params["nanopore-bam-files"] = 'NO_FILE'
......@@ -151,13 +152,13 @@ boolean genomeSizeEstimation = !skipGenomeSizeEstimation
if(printDebug){
println "Files:"
println " Assembly $assembly "
println " Assembly $assembly"
println " SingleEnd $singleEnd"
println " PairedEnd $pairedEnd"
println " Pacbio $pacbio "
println " Nanopore $nanopore "
println " Pacbio $pacbio"
println " Nanopore $nanopore"
println " IlluminaBamFiles $illuminaBamFiles"
println " PacbioBamFiles $pacbioBamFiles "
println " PacbioBamFiles $pacbioBamFiles"
println " NanoporeBamFiles $nanoporeBamFiles"
println ""
println "Additional Tool Options:"
......@@ -173,7 +174,8 @@ if(printDebug){
println "Misc:"
println " Prefix $prefix"
println " Output folder $output"
println " fileSeparator $fileSeparator "
println " fileSeparator $fileSeparator"
println " Threads $threads"
println " keepTemporaryFiles $keepTemporaryFiles"
println " printVersion $printVersion"
println " printHelp $printHelp"
......@@ -187,7 +189,7 @@ if(printDebug){
println " nanoporeAvailable $nanoporeAvailable"
println " bamAvailable $bamAvailable"
println " illuminaBamsAvailable $illuminaBamsAvailable"
println " pacbioBamsAvailable $pacbioBamsAvailable "
println " pacbioBamsAvailable $pacbioBamsAvailable"
println " nanoporeBamsAvailable $nanoporeBamsAvailable"
println ""
}
......@@ -210,11 +212,13 @@ String BWAINDEX = "${output}/bwa_index"
*/
if(bamAvailable){
//fill bam channels for sorting
chIlluminaBamMerge = (illuminaBamsAvailable) ? Channel.from(illuminaBamFiles).map{files -> files.split(fileSeparator)}.flatten().map{ file(it)} : Channel.empty()
chPacbioBamMerge = (pacbioBamsAvailable) ? Channel.from(pacbioBamFiles).map { files -> files.split(fileSeparator)}.flatten().map{file(it)} : Channel.empty()
chNanoporeBamMerge = (nanoporeBamsAvailable) ? Channel.from(nanoporeBamFiles).map { files -> files.split(fileSeparator)}.flatten().map{file(it)} : Channel.empty()
}else if(assemblyAvailable){ //fi: bamAvailable
chBwaIndexGenome = (pairedAvailable || unpairedAvailable) ? Channel.fromPath(assembly) : Channel.empty()
chUnpairedReadMapping = (unpairedAvailable) ? Channel.from(singleEnd).map{files -> files.split(fileSeparator)}.flatten().map{file it}.collate(1) : Channel.empty()
chPairedReadMapping = (pairedAvailable) ? Channel.from(pairedEnd).map{files -> files.split(fileSeparator)}.flatten().map{file it}.collate(2) : Channel.empty()
......@@ -222,7 +226,7 @@ if(bamAvailable){
chNanoporeReadMapping = (nanoporeAvailable) ? Channel.from(nanopore).map { files -> files.split(fileSeparator)}.flatten().map{file it}.collate(1) : Channel.empty()
chAssembly = Channel.fromPath(assembly).first()
// Create index files for bwa mapping
// Create index files for bwa mapping
process bwaIndexing {
publishDir BWAINDEX, mode: 'copy', pattern: "*{amb,ann,bwt,pac,sa}"
publishDir output, mode: 'copy', pattern: "*.{log,err}"
......@@ -239,9 +243,9 @@ if(bamAvailable){
}//process bwaIndexing
// BWA Mapping with Illuminma unpaired reads
// BWA Mapping with Illuminma unpaired reads
process unpairedMapping {
cpus { 15 > threads ? threads : 15 }
cpus { 8 > threads ? threads : 8 }
if(keepTemporaryFiles){
publishDir output, mode: 'copy'
}
......@@ -259,7 +263,7 @@ if(bamAvailable){
// BWA Mapping with Illumina paired reads
process pairedMapping {
cpus { 15 > threads ? threads : 15 }
cpus { 8 > threads ? threads : 8 }
if(keepTemporaryFiles){
publishDir output, mode: 'copy'
}
......@@ -282,7 +286,7 @@ if(bamAvailable){
if(keepTemporaryFiles){
publishDir output, mode: 'copy'
}
cpus { 15 > threads ? threads : 15 }
cpus { 8 > threads ? threads : 8 }
input:
file pb from chPacbioReadMapping
file gen from chAssembly
......@@ -300,7 +304,7 @@ if(bamAvailable){
if(keepTemporaryFiles){
publishDir output, mode: 'copy'
}
cpus { 15 > threads ? threads : 15 }
cpus { 8 > threads ? threads : 8 }
input:
file ont from chNanoporeReadMapping
file gen from chAssembly
......@@ -321,7 +325,7 @@ process mergeIlluminaBamFiles {
if(keepTemporaryFiles){
publishDir output, mode: 'copy'
}
cpus { 15 > threads ? threads : 15 }
cpus { 8 > threads ? threads : 8 }
input:
path(bams) from chIlluminaBamMerge.collect()
output:
......@@ -337,7 +341,7 @@ process mergePacbioBamFiles {
if(keepTemporaryFiles){
publishDir output, mode: 'copy'
}
cpus { 15 > threads ? threads : 15 }
cpus { 8 > threads ? threads : 8 }
input:
file pbs from chPacbioBamMerge.collect()
output:
......@@ -353,7 +357,7 @@ process mergeNanoporeBamFiles {
if(keepTemporaryFiles){
publishDir output, mode: 'copy'
}
cpus { 15 > threads ? threads : 15 }
cpus { 8 > threads ? threads : 8 }
input:
file onts from chNanoporeBamMerge.collect()
output:
......@@ -368,14 +372,14 @@ process mergeNanoporeBamFiles {
process sortAllBamFiles {
publishDir output, mode: 'copy'
cpus { 15 > threads ? threads : 15 }
cpus { 8 > threads ? threads : 8 }
input:
tuple val(tech), file(bam) from chSortIlluminaBamFile.mix(chSortPacbioBamFile).mix(chSortNanoporeBamFile)
output:
tuple val("$tech"), file("${bam.baseName}.sort.bam") into chQualimapSortedBams, chComputeCoverageSortedBams, chGenomeEstimationSortedBams, chSamtoolsStatsSortedBams
script:
"""
samtools sort -l 9 -@ ${task.cpus} -T ${bam.baseName} -o ${bam.baseName}.sort.bam $bam
samtools sort -l 9 -@ ${task.cpus} -T ${bam.baseName} -o ${bam.baseName}.sort.bam $bam
"""
}//process: sortAllBamFiles
......@@ -385,7 +389,7 @@ if (qualityControl){
publishDir "${output}/", mode: 'copy'
cpus { 15 > threads ? threads : 15 }
cpus { 8 > threads ? threads : 8 }
input:
tuple val(tech), file(bam) from chQualimapSortedBams
output:
......@@ -425,7 +429,7 @@ if(coverageHistogram){
tuple val("$tech"), file("${bam}.cov-hist") into chRCoverageMultiPlot, chRCoverageSinglePlot, chCalculateHistogramPeak
script:
"""
samtools view -b -h -F 256 $bam | bedtools genomecov -ibam stdin -d | awk '{print \$3}' | sort -g | uniq -c | awk '{print \$2"\t"\$1}' > ${bam}.cov-hist
samtools view -b -h -F 256 $bam | bedtools genomecov -ibam stdin -d | awk '{print \$3}' | sort -g | uniq -c | awk '{print \$2"\t"\$1}' > ${bam}.cov-hist
"""
}//process bedtoolsGenomecov
......@@ -474,40 +478,40 @@ if(coverageHistogram){
(sz/2) > 1
script:
"""
#!/usr/bin/env Rscript
library(ggplot2)
library(dplyr)
options(scipen=999)
# Set up variable to control command line arguments
tech_files <- c("${tech_cov.join('","')}")
techs <- tech_files[seq(1,length(tech_files),2)]
files <- tech_files[seq(2,length(tech_files),2)]
df <- data.frame()
for(i in 1:length(files)){
df.current <- read.table(files[i], sep = "\\t")
df.current\$tech <- techs[i]
df <- rbind(df,df.current)
}
#!/usr/bin/env Rscript
library(ggplot2)
library(dplyr)
options(scipen=999)
# Set up variable to control command line arguments
tech_files <- c("${tech_cov.join('","')}")
techs <- tech_files[seq(1,length(tech_files),2)]
files <- tech_files[seq(2,length(tech_files),2)]
df <- data.frame()
for(i in 1:length(files)){
df.current <- read.table(files[i], sep = "\\t")
df.current\$tech <- techs[i]
df <- rbind(df,df.current)
}
df\$tech <- factor(unlist(df\$tech, use.names = TRUE))
colnames(df) <- c("Coverage","Count","tech")
df\$tech <- factor(unlist(df\$tech, use.names = TRUE))
colnames(df) <- c("Coverage","Count","tech")
maxes <- tapply(df\$Count,df\$tech,max)
legend.labels <- sapply(techs, function(x) paste(x, paste0("N(0) = ",maxes[x])))
maxes <- tapply(df\$Count,df\$tech,max)
legend.labels <- sapply(techs, function(x) paste(x, paste0("N(0) = ",maxes[x])))
maintitle <- paste(strsplit(basename("${assembly}"), "(?<=.{60})", perl=T)[[1]], collapse="\n")
p <- ggplot(data = df %>% filter(Coverage !=0 ), mapping = aes(x = Coverage, y = Count, group = tech, color = tech)) +
geom_line() +
scale_x_log10() +
annotation_logticks(base=10, sides="b") +
scale_color_discrete(name = "", breaks = techs, labels = legend.labels) +
theme(legend.position = c(.95, .95), legend.justification = c("right", "top"), legend.box.just = "right", legend.margin = margin(6, 6, 6, 6)) +
ggtitle(maintitle)
maintitle <- paste(strsplit(basename("${assembly}"), "(?<=.{60})", perl=T)[[1]], collapse="\n")
p <- ggplot(data = df %>% filter(Coverage !=0 ), mapping = aes(x = Coverage, y = Count, group = tech, color = tech)) +
geom_line() +
scale_x_log10() +
annotation_logticks(base=10, sides="b") +
scale_color_discrete(name = "", breaks = techs, labels = legend.labels) +
theme(legend.position = c(.95, .95), legend.justification = c("right", "top"), legend.box.just = "right", legend.margin = margin(6, 6, 6, 6)) +
ggtitle(maintitle)
ggsave("${prefix}.plot.all.pdf", plot = p, device = "pdf")
ggsave("${prefix}.plot.all.pdf", plot = p, device = "pdf")
"""
}//process: RMultiCoveragePlot
......@@ -565,7 +569,7 @@ if(coverageHistogram){
env(ASSEMBLY_GENOME_SIZE) into chAssemblyGenomeSize
script:
"""
ASSEMBLY_GENOME_SIZE=\$(grep -v "^>" ${a} | tr -d '\\n' | wc -c)
ASSEMBLY_GENOME_SIZE=\$(grep -v "^>" ${a} | tr -d '\\n' | wc -c)
"""
}//process: assemblyNucleotideCounting
} else {
......
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