Skip to content
Snippets Groups Projects
Commit b9599951 authored by Mattia Mancini's avatar Mattia Mancini
Browse files

Add download surl utils

parent ee3e5363
No related branches found
No related tags found
2 merge requests!69Change the name of the pre-calibrated output MS,!20Merge request HBA_calibrator to master
$namespaces:
sbg: 'https://www.sevenbridges.com/'
id: create_workflow_input
label: create_workflow_input
class: CommandLineTool
cwlVersion: v1.0
inputs:
- id: msin
type: Directory[]
inputBinding:
position: 0
outputs:
- id: output
type: File
outputBinding:
glob: workflow_input.json
baseCommand:
- python3
- script.py
doc: ''
requirements:
InitialWorkDirRequirement:
listing:
- entryname: script.py
entry: |
#!/usr/bin/env python3
import sys
import json
import os
dir_list = sys.argv[1:]
rendered_leafs = []
for dir in dir_list:
file_name = dir.split(os.path.sep)[-1]
rendered_leaf = {'class': 'Directory', 'path': file_name}
rendered_leafs.append(rendered_leaf)
with open('workflow_input.json', 'w') as fp:
json.dump({'msin': rendered_leafs}, fp)
\ No newline at end of file
class: ExpressionTool
cwlVersion: v1.0
id: read_surl_file
inputs:
- id: surl_list
type: File
doc: input surl file
inputBinding:
loadContents: True
outputs:
- id: surls
type: string[]
expression: |
${
var surl_list = inputs.surl_list.contents.split("\n");
surl_list = surl_list.filter(function (el) { return el != ''; } );
return {'surls': surl_list}
}
label: ReadSurlList
requirements:
- class: InlineJavascriptRequirement
class: CommandLineTool
cwlVersion: v1.0
$namespaces:
sbg: 'https://www.sevenbridges.com/'
id: surl_copy
baseCommand:
- gfal-copy
inputs:
- id: surl
type: string
inputBinding:
position: 0
outputs:
- id: output
type: File
outputBinding:
glob: '*'
doc: Download a file give a surl
label: surl_copy
id: untar
label: untar
class: CommandLineTool
cwlVersion: v1.0
inputs:
- id: tar_file
type: File
inputBinding:
position: 0
outputs:
- id: uncompressed
type: Directory
outputBinding:
glob: 'out/*'
baseCommand:
- 'bash'
- 'untar.sh'
doc: 'Untar a compressed file'
requirements:
InitialWorkDirRequirement:
listing:
- entryname: 'untar.sh'
entry: |
#!/bin/bash
mkdir out
cd out
tar -xvf $1
class: Workflow
cwlVersion: v1.0
id: dowload_surl_and_create_input_file_json
label: dowload_surl_and_create_input_file.json
$namespaces:
sbg: 'https://www.sevenbridges.com/'
inputs:
- id: surl_list
type: File
'sbg:x': -329.7890625
'sbg:y': -35
outputs:
- id: msin
outputSource:
- untar/uncompressed
type: Directory
'sbg:x': 632
'sbg:y': -72
- id: workflow_configuration
outputSource:
- create_workflow_input/output
type: File
'sbg:x': 663
'sbg:y': 137
steps:
- id: read_surl_list
in:
- id: surl_list
source: surl_list
out:
- id: surls
run: ../steps/read_surl_list.cwl
label: ReadSurlList
'sbg:x': -90
'sbg:y': -13
- id: surl_copy
in:
- id: surl
source: read_surl_list/surls
out:
- id: output
run: ../steps/surl_copy.cwl
label: surl_copy
scatter:
- surl
'sbg:x': 170
'sbg:y': -10
- id: untar
in:
- id: tar_file
source: surl_copy/output
out:
- id: uncompressed
run: ../steps/untar.cwl
label: untar
scatter:
- tar_file
'sbg:x': 376
'sbg:y': -12
- id: create_workflow_input
in:
- id: msin
source:
- untar/uncompressed
out:
- id: output
run: ../steps/create_workflow_input.cwl
label: create_workflow_input
'sbg:x': 475
'sbg:y': 135
requirements:
- class: ScatterFeatureRequirement
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