Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tasks
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
biowdl
tasks
Commits
a8523586
Unverified
Commit
a8523586
authored
6 years ago
by
Ruben Vorderman
Committed by
GitHub
6 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #32 from biowdl/BIOWDL-40
style changes and adds task to check file md5
parents
45027f45
cda858f9
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
common.wdl
+60
-47
60 additions, 47 deletions
common.wdl
with
60 additions
and
47 deletions
common.wdl
+
60
−
47
View file @
a8523586
task objectMd5 {
Object the_object
task AppendToStringArray {
Array[String] array
String string
command {
cat ${write_object(the_object)} | md5sum - | sed -e 's/ -//'
echo "${sep='\n' array}
${string}"
}
output {
String md5sum
= read_
string
(stdout())
Array[String] outArray
= read_
lines
(stdout())
}
runtime {
...
...
@@ -14,15 +16,33 @@ task objectMd5 {
}
}
task mapMd5 {
Map[String,String] map
# This task will fail if the MD5sum doesn't match the file.
task CheckFileMD5 {
File file
String MD5sum
command {
cat ${write_map(map)} | md5sum - | sed -e 's/ -//'
set -e -o pipefail
MD5SUM=$(md5sum ${file} | cut -d ' ' -f 1)
[ $MD5SUM = ${MD5sum} ]
}
}
task ConcatenateTextFiles {
Array[File] fileList
String combinedFilePath
Boolean? unzip = false
Boolean? zip = false
command {
set -e -o pipefail
${"mkdir -p $(dirname " + combinedFilePath + ")"}
${true='zcat' false= 'cat' unzip} ${sep=' ' fileList} \
${true="| gzip -c" false="" zip} > ${combinedFilePath}
}
output {
String md5sum = read_string(stdout())
File combinedFile = combinedFilePath
}
runtime {
...
...
@@ -30,38 +50,32 @@ task mapMd5 {
}
}
task stringArrayMd5 {
Array[String] stringArray
task CreateLink {
# Making this of type File will create a link to the copy of the file in the execution
# folder, instead of the actual file.
String inputFile
String outputPath
command {
set -eu -o pipefail
echo ${sep=',' stringArray} | md5sum - | sed -e 's/ -//'
ln -sf ${inputFile} ${outputPath}
}
output {
String md5sum = read_string(stdout())
}
runtime {
memory: 1
File link = outputPath
}
}
task concatenateTextFiles {
Array[File] fileList
String combinedFilePath
Boolean? unzip=false
Boolean? zip=false
# inspired by https://gatkforums.broadinstitute.org/wdl/discussion/9616/is-there-a-way-to-flatten-arrays
task FlattenStringArray {
Array[Array[String]] arrayList
command {
set -e -o pipefail
${"mkdir -p $(dirname " + combinedFilePath + ")"}
${true='zcat' false= 'cat' unzip} ${sep=' ' fileList} \
${true="| gzip -c" false="" zip} > ${combinedFilePath}
for line in $(echo ${sep=', ' arrayList}) ; \
do echo $line | tr -d '"[],' ; done
}
output {
File combinedFile = combinedFilePath
Array[String] flattenedArray = read_lines(stdout())
}
runtime {
...
...
@@ -69,17 +83,15 @@ task concatenateTextFiles {
}
}
# inspired by https://gatkforums.broadinstitute.org/wdl/discussion/9616/is-there-a-way-to-flatten-arrays
task flattenStringArray {
Array[Array[String]] arrayList
task MapMd5 {
Map[String,String] map
command {
for line in $(echo ${sep=', ' arrayList}) ; \
do echo $line | tr -d '"[],' ; done
cat ${write_map(map)} | md5sum - | sed -e 's/ -//'
}
output {
Array[String] flattenedArray
= read_
lines
(stdout())
String md5sum
= read_
string
(stdout())
}
runtime {
...
...
@@ -87,17 +99,16 @@ task flattenStringArray {
}
}
task appendToStringArray {
Array[String] array
String string
task ObjectMd5 {
Object the_object
command {
echo "${sep='\n' array}
${string}"
cat ${write_object(the_object)} | md5sum - | sed -e 's/ -//'
}
output {
Array[String] out_array
= read_
lines
(stdout())
String md5sum
= read_
string
(stdout())
}
runtime {
...
...
@@ -105,17 +116,19 @@ task appendToStringArray {
}
}
task createLink {
# Making this of type File will create a link to the copy of the file in the execution
# folder, instead of the actual file.
String inputFile
String outputPath
task StringArrayMd5 {
Array[String] stringArray
command {
ln -sf ${inputFile} ${outputPath}
set -eu -o pipefail
echo ${sep=',' stringArray} | md5sum - | sed -e 's/ -//'
}
output {
File link = outputPath
String md5sum = read_string(stdout())
}
}
\ No newline at end of file
runtime {
memory: 1
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment