Skip to content
Snippets Groups Projects
Commit c9c2fc44 authored by Ruben Vorderman's avatar Ruben Vorderman
Browse files

common to 1.0

parent 37f0afb7
No related branches found
No related tags found
1 merge request!34Move all files to version 1.0
task AppendToStringArray { version 1.0
Array[String] array
String string
task AppendToStringArray {
input {
Array[String] array
String string
}
command { command {
echo "${sep='\n' array} echo "~{sep='\n' array}
${string}" ~{string}"
} }
output { output {
...@@ -18,27 +21,29 @@ task AppendToStringArray { ...@@ -18,27 +21,29 @@ task AppendToStringArray {
# This task will fail if the MD5sum doesn't match the file. # This task will fail if the MD5sum doesn't match the file.
task CheckFileMD5 { task CheckFileMD5 {
File file input {
String MD5sum File file
String MD5sum
}
command { command {
set -e -o pipefail set -e -o pipefail
MD5SUM=$(md5sum ${file} | cut -d ' ' -f 1) MD5SUM=$(md5sum ~{file} | cut -d ' ' -f 1)
[ $MD5SUM = ${MD5sum} ] [ $MD5SUM = ~{MD5sum} ]
} }
} }
task ConcatenateTextFiles { task ConcatenateTextFiles {
Array[File] fileList input {
String combinedFilePath Array[File] fileList
Boolean? unzip = false String combinedFilePath
Boolean? zip = false Boolean? unzip = false
Boolean? zip = false
}
command { command {
set -e -o pipefail set -e -o pipefail
${"mkdir -p $(dirname " + combinedFilePath + ")"} ~{"mkdir -p $(dirname " + combinedFilePath + ")"}
${true='zcat' false= 'cat' unzip} ${sep=' ' fileList} \ ~{true='zcat' false= 'cat' unzip} ~{sep=' ' fileList} \
${true="| gzip -c" false="" zip} > ${combinedFilePath} ~{true="| gzip -c" false="" zip} > ~{combinedFilePath}
} }
output { output {
...@@ -53,11 +58,12 @@ task ConcatenateTextFiles { ...@@ -53,11 +58,12 @@ task ConcatenateTextFiles {
task CreateLink { task CreateLink {
# Making this of type File will create a link to the copy of the file in the execution # Making this of type File will create a link to the copy of the file in the execution
# folder, instead of the actual file. # folder, instead of the actual file.
String inputFile input {
String outputPath String inputFile
String outputPath
}
command { command {
ln -sf ${inputFile} ${outputPath} ln -sf ~{inputFile} ~{outputPath}
} }
output { output {
...@@ -65,29 +71,17 @@ task CreateLink { ...@@ -65,29 +71,17 @@ task CreateLink {
} }
} }
# inspired by https://gatkforums.broadinstitute.org/wdl/discussion/9616/is-there-a-way-to-flatten-arrays # DEPRECATED. USE BUILT-IN FLATTEN FUNCTION
task FlattenStringArray { # task FlattenStringArray {}
Array[Array[String]] arrayList # Commented out to let pipelines that depend on this fail.
command {
for line in $(echo ${sep=', ' arrayList}) ; \
do echo $line | tr -d '"[],' ; done
}
output {
Array[String] flattenedArray = read_lines(stdout())
}
runtime {
memory: 1
}
}
task MapMd5 { task MapMd5 {
Map[String,String] map input {
Map[String,String] map
}
command { command {
cat ${write_map(map)} | md5sum - | sed -e 's/ -//' cat ~{write_map(map)} | md5sum - | sed -e 's/ -//'
} }
output { output {
...@@ -101,10 +95,11 @@ task MapMd5 { ...@@ -101,10 +95,11 @@ task MapMd5 {
task ObjectMd5 { task ObjectMd5 {
Object the_object input {
Object the_object
}
command { command {
cat ${write_object(the_object)} | md5sum - | sed -e 's/ -//' cat ~{write_object(the_object)} | md5sum - | sed -e 's/ -//'
} }
output { output {
...@@ -117,11 +112,12 @@ task ObjectMd5 { ...@@ -117,11 +112,12 @@ task ObjectMd5 {
} }
task StringArrayMd5 { task StringArrayMd5 {
Array[String] stringArray input {
Array[String] stringArray
}
command { command {
set -eu -o pipefail set -eu -o pipefail
echo ${sep=',' stringArray} | md5sum - | sed -e 's/ -//' echo ~{sep=',' stringArray} | md5sum - | sed -e 's/ -//'
} }
output { output {
......
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