Skip to content
Snippets Groups Projects
Unverified Commit d8fd7569 authored by Ruben Vorderman's avatar Ruben Vorderman Committed by GitHub
Browse files

Merge pull request #15 from biowdl/BIOWDL-25

Biowdl 25
parents 306d5ec0 fb1a2c68
No related branches found
No related tags found
No related merge requests found
# PLEASE ADD TASKS IN ALPHABETIC ORDER. # PLEASE ADD TASKS IN ALPHABETIC ORDER.
# This makes searching a lot easier. # This makes searching a lot easier.
task BaseCounter { task BaseCounter {
String? preCommand String? preCommand
String tool_jar #Should this be of type File? File toolJar
File bam File bam
File bamIndex
File refFlat File refFlat
String outputDir String outputDir
String prefix String prefix
...@@ -14,9 +16,9 @@ task BaseCounter { ...@@ -14,9 +16,9 @@ task BaseCounter {
Int mem = ceil(select_first([memory, 12.0])) Int mem = ceil(select_first([memory, 12.0]))
command { command {
set -e -o pipefail set -e -o pipefail
${preCommand}
mkdir -p ${outputDir} mkdir -p ${outputDir}
java -Xmx${mem}G -jar ${tool_jar} \ ${preCommand}
java -Xmx${mem}G -jar ${toolJar} \
-b ${bam} \ -b ${bam} \
-r ${refFlat} \ -r ${refFlat} \
-o ${outputDir} \ -o ${outputDir} \
...@@ -61,7 +63,7 @@ task BaseCounter { ...@@ -61,7 +63,7 @@ task BaseCounter {
} }
runtime { runtime {
memory: ceil(mem * select_first([memoryMultiplier, 1.5])) memory: ceil(mem * select_first([memoryMultiplier, 3.0]))
} }
} }
...@@ -121,6 +123,7 @@ task SampleConfig { ...@@ -121,6 +123,7 @@ task SampleConfig {
String? preCommand String? preCommand
String tool_jar String tool_jar
Array[File]+ inputFiles Array[File]+ inputFiles
String keyFilePath
String? sample String? sample
String? library String? library
String? readgroup String? readgroup
...@@ -141,11 +144,12 @@ task SampleConfig { ...@@ -141,11 +144,12 @@ task SampleConfig {
${"--library " + library} \ ${"--library " + library} \
${"--readgroup " + readgroup} \ ${"--readgroup " + readgroup} \
${"--jsonOutput " + jsonOutputPath} \ ${"--jsonOutput " + jsonOutputPath} \
${"--tsvOutput " + tsvOutputPath} ${"--tsvOutput " + tsvOutputPath} \
> ${keyFilePath}
} }
output { output {
File keysFile = stdout() File keysFile = keyFilePath
File? jsonOutput = jsonOutputPath File? jsonOutput = jsonOutputPath
File? tsvOutput = tsvOutputPath File? tsvOutput = tsvOutputPath
} }
...@@ -184,7 +188,7 @@ task ScatterRegions { ...@@ -184,7 +188,7 @@ task ScatterRegions {
} }
runtime { runtime {
memory: ceil(mem * select_first([memoryMultiplier, 2.0])) memory: ceil(mem * select_first([memoryMultiplier, 3.0]))
} }
} }
...@@ -34,7 +34,7 @@ task BaseRecalibrator { ...@@ -34,7 +34,7 @@ task BaseRecalibrator {
} }
runtime { runtime {
memory: ceil(mem * select_first([memoryMultiplier, 1.5])) memory: ceil(mem * select_first([memoryMultiplier, 3.0]))
} }
} }
...@@ -78,7 +78,7 @@ task ApplyBQSR { ...@@ -78,7 +78,7 @@ task ApplyBQSR {
} }
runtime { runtime {
memory: ceil(mem * select_first([memoryMultiplier, 1.5])) memory: ceil(mem * select_first([memoryMultiplier, 3.0]))
} }
} }
...@@ -107,7 +107,7 @@ task GatherBqsrReports { ...@@ -107,7 +107,7 @@ task GatherBqsrReports {
} }
runtime { runtime {
memory: ceil(mem * select_first([memoryMultiplier, 1.5])) memory: ceil(mem * select_first([memoryMultiplier, 3.0]))
} }
} }
...@@ -149,7 +149,7 @@ task HaplotypeCallerGvcf { ...@@ -149,7 +149,7 @@ task HaplotypeCallerGvcf {
} }
runtime { runtime {
memory: ceil(mem * select_first([memoryMultiplier, 1.5])) memory: ceil(mem * select_first([memoryMultiplier, 3.0]))
} }
} }
...@@ -198,7 +198,7 @@ task GenotypeGVCFs { ...@@ -198,7 +198,7 @@ task GenotypeGVCFs {
} }
runtime{ runtime{
memory: ceil(mem * select_first([memoryMultiplier, 1.5])) memory: ceil(mem * select_first([memoryMultiplier, 3.0]))
} }
} }
...@@ -245,7 +245,7 @@ task CombineGVCFs { ...@@ -245,7 +245,7 @@ task CombineGVCFs {
} }
runtime { runtime {
memory: ceil(mem * select_first([memoryMultiplier, 1.5])) memory: ceil(mem * select_first([memoryMultiplier, 3.0]))
} }
} }
...@@ -282,6 +282,6 @@ task SplitNCigarReads { ...@@ -282,6 +282,6 @@ task SplitNCigarReads {
} }
runtime { runtime {
memory: ceil(mem * select_first([memoryMultiplier, 1.5])) memory: ceil(mem * select_first([memoryMultiplier, 3.0]))
} }
} }
...@@ -11,6 +11,7 @@ task HTSeqCount { ...@@ -11,6 +11,7 @@ task HTSeqCount {
command { command {
set -e -o pipefail set -e -o pipefail
mkdir -p ${sub(outputTable, basename(outputTable), "")}
${preCommand} ${preCommand}
htseq-count \ htseq-count \
-f ${default="bam" format} \ -f ${default="bam" format} \
......
...@@ -3,29 +3,38 @@ task MergeCounts { ...@@ -3,29 +3,38 @@ task MergeCounts {
Array[File] inputFiles Array[File] inputFiles
String outputFile String outputFile
String idVar Int featureColumn
String measurementVar Int valueColumn
Boolean inputHasHeader
# Based on a script by Szymon Kielbasa/Ioannis Moustakas # Based on a script by Szymon Kielbasa/Ioannis Moustakas
command <<< command <<<
set -e -o pipefail set -e -o pipefail
mkdir -p ${sub(outputFile, basename(outputFile) + "$", "")}
${preCommand} ${preCommand}
R --no-save --slave <<CODE > ${outputFile} R --no-save <<CODE
library(dplyr) library(dplyr)
library(reshape2) library(reshape2)
listOfFiles <- c("${sep='", "' inputFiles}") listOfFiles <- c("${sep='", "' inputFiles}")
valueI <- ${valueColumn}
featureI <- ${featureColumn}
header <- ${true="TRUE" false="FALSE" inputHasHeader}
d <- do.call(rbind, lapply(listOfFiles, function(file){ d <- do.call(rbind, lapply(listOfFiles, function(file){
d <- read.table(file, header=TRUE, comment.char="#") d <- read.table(file, sep="\t", header=header, comment.char="#")
colI <- grep(${measurementVar}, colnames(d))
colnames(d)[colI] <- strsplit(file, "/")[[1]][3] splitPath <- strsplit(file, "/")[[1]]
d <- d %>% melt(id.vars=${idVar}, measure.vars=colI, colnames(d)[valueI] <- sub("\\\.[^\\\.]*$", "",
variable.name="sample", value.name="count") splitPath[length(splitPath)])
colnames(d)[featureI] <- "feature"
d <- d %>% melt(id.vars=featureI, variable.name="sample", value.name="count")
})) }))
d <- d %>% dcast(paste0(${idVar}, " ~ sample"), value.var="count") d <- d %>% dcast(feature ~ sample, value.var="count")
write.table(d, sep="\t", quote=FALSE, row.names=FALSE) write.table(d, file="${outputFile}", sep="\t", quote=FALSE, row.names=FALSE)
CODE CODE
>>> >>>
......
...@@ -28,7 +28,7 @@ task ScatterIntervalList { ...@@ -28,7 +28,7 @@ task ScatterIntervalList {
} }
runtime { runtime {
memory: ceil(mem * select_first([memoryMultiplier, 1.5])) memory: ceil(mem * select_first([memoryMultiplier, 3.0]))
} }
} }
...@@ -63,7 +63,7 @@ task GatherBamFiles { ...@@ -63,7 +63,7 @@ task GatherBamFiles {
} }
runtime { runtime {
memory: ceil(mem * select_first([memoryMultiplier, 1.5])) memory: ceil(mem * select_first([memoryMultiplier, 3.0]))
} }
} }
...@@ -113,7 +113,7 @@ task MarkDuplicates { ...@@ -113,7 +113,7 @@ task MarkDuplicates {
} }
runtime { runtime {
memory: ceil(mem * select_first([memoryMultiplier, 1.5])) memory: ceil(mem * select_first([memoryMultiplier, 3.0]))
} }
} }
...@@ -148,7 +148,7 @@ task MergeVCFs { ...@@ -148,7 +148,7 @@ task MergeVCFs {
} }
runtime { runtime {
memory: ceil(mem * select_first([memoryMultiplier, 1.5])) memory: ceil(mem * select_first([memoryMultiplier, 3.0]))
} }
} }
...@@ -183,6 +183,6 @@ task SamToFastq { ...@@ -183,6 +183,6 @@ task SamToFastq {
} }
runtime { runtime {
memory: ceil(mem * select_first([memoryMultiplier, 1.5])) memory: ceil(mem * select_first([memoryMultiplier, 3.0]))
} }
} }
\ No newline at end of file
task Index { task Index {
String? preCommand String? preCommand
String bamFilePath File bamFilePath
String? bamIndexPath
command { command {
set -e -o pipefail set -e -o pipefail
${preCommand} ${preCommand}
samtools index ${bamFilePath} samtools index ${bamFilePath} ${bamIndexPath}
} }
output { output {
File indexFile = bamFilePath + ".bai" File indexFile = if defined(bamIndexPath) then select_first([bamIndexPath]) else bamFilePath + ".bai"
} }
} }
...@@ -21,12 +22,7 @@ task Merge { ...@@ -21,12 +22,7 @@ task Merge {
command { command {
set -e -o pipefail set -e -o pipefail
${preCommand} ${preCommand}
if [ ${length(bamFiles)} -gt 1 ] samtools merge ${outputBamPath} ${sep=' ' bamFiles}
then
samtools merge ${outputBamPath} ${sep=' ' bamFiles}
else
ln -sf ${bamFiles} ${outputBamPath}
fi
} }
output { output {
......
...@@ -47,4 +47,19 @@ task Star { ...@@ -47,4 +47,19 @@ task Star {
cpu: select_first([runThreadN, 1]) cpu: select_first([runThreadN, 1])
memory: select_first([memory, 10]) memory: select_first([memory, 10])
} }
} }
\ No newline at end of file
task makeStarRGline {
String sample
String library
String? platform
String readgroup
command {
printf '"ID:${readgroup}" "LB:${library}" "PL:${default="ILLUMINA" platform}" "SM:${sample}"'
}
output {
String rgLine = read_string(stdout())
}
}
...@@ -10,6 +10,7 @@ task Stringtie { ...@@ -10,6 +10,7 @@ task Stringtie {
command { command {
set -e -o pipefail set -e -o pipefail
mkdir -p $(dirname ${assembledTranscriptsFile})
${preCommand} ${preCommand}
stringtie \ stringtie \
${"-p " + threads} \ ${"-p " + threads} \
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment