Skip to content

Commit 0225295

Browse files
committed
address the PR comments
1 parent a44701a commit 0225295

8 files changed

Lines changed: 26 additions & 44 deletions

File tree

payload-gen-variant-processing/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ FROM python:3.7.5-slim-buster
22

33
LABEL org.opencontainers.image.source https://github.com/icgc-argo/data-processing-utility-tools
44

5+
RUN apt-get update && apt-get install -y procps jq
6+
57
RUN groupadd -g 1000 ubuntu &&\
68
useradd -l -u 1000 -g ubuntu ubuntu &&\
79
install -d -m 0755 -o ubuntu -g ubuntu /home/ubuntu

payload-gen-variant-processing/main.nf

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,7 @@ params.files_to_upload = []
4949
params.wf_name = ""
5050
params.wf_short_name = ""
5151
params.wf_version = ""
52-
params.controlled = false
53-
params.process_name = ""
54-
params.analysis_type = ""
52+
params.open = false
5553

5654

5755
process payloadGenVariantProcessing {
@@ -67,19 +65,15 @@ process payloadGenVariantProcessing {
6765
val wf_name
6866
val wf_short_name
6967
val wf_version
70-
val controlled
71-
val process_name
72-
val analysis_type
68+
val open
7369

7470
output: // output, make update as needed
7571
path "*.payload.json", emit: payload
7672
path "out/*{.vcf.gz,.vcf.gz.tbi}", emit: files_to_upload
7773

7874
script:
7975
// add and initialize variables here as needed
80-
arg_controlled = controlled ? "-c" : ""
81-
arg_process_name = process_name ? "-p ${process_name}" : ""
82-
arg_analysis_type = analysis_type ? "-t ${analysis_type}" : ""
76+
arg_open = open ? "-o" : ""
8377

8478
"""
8579
main.py \
@@ -90,7 +84,7 @@ process payloadGenVariantProcessing {
9084
-v ${wf_version} \
9185
-r ${workflow.runName} \
9286
-j ${workflow.sessionId} \
93-
${arg_controlled} ${arg_process_name} ${arg_analysis_type}
87+
${arg_open}
9488
9589
"""
9690
}
@@ -105,8 +99,6 @@ workflow {
10599
params.wf_name,
106100
params.wf_short_name,
107101
params.wf_version,
108-
params.controlled,
109-
params.process_name,
110-
params.analysis_type
102+
params.open
111103
)
112104
}

payload-gen-variant-processing/main.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,14 @@ def get_files_info(file_to_upload, args):
5353
fname = os.path.basename(file_to_upload).split(".")
5454
input_wf = fname[5]
5555
variant_type = fname[7]
56-
process_name = args.process_name if args.process_name else args.wf_short_name
56+
process_name = args.wf_short_name
5757
new_fname = ".".join(fname[0:8]+[process_name, 'vcf.gz']+(['tbi'] if file_to_upload.endswith('.tbi') else []))
5858
file_info = {
5959
'fileName': new_fname,
6060
'fileType': 'VCF' if new_fname.endswith('.vcf.gz') else new_fname.split(".")[-1].upper(),
6161
'fileSize': calculate_size(file_to_upload),
6262
'fileMd5sum': calculate_md5(file_to_upload),
63-
'fileAccess': 'open' if not args.controlled else 'controlled',
63+
'fileAccess': 'open' if args.open else 'controlled',
6464
'info': {
6565
'data_category': variant_type_to_data_type_etc[variant_type][0]
6666
}
@@ -85,7 +85,6 @@ def get_files_info(file_to_upload, args):
8585
pass
8686

8787
dst = os.path.join(os.getcwd(), new_dir, new_fname)
88-
print(dst)
8988
os.symlink(os.path.abspath(file_to_upload), dst)
9089

9190
return file_info
@@ -114,20 +113,18 @@ def main():
114113
parser.add_argument("-v", dest="wf_version", type=str, required=True, help="workflow version")
115114
parser.add_argument("-r", dest="wf_run", type=str, required=True, help="workflow run ID")
116115
parser.add_argument("-j", dest="wf_session", type=str, required=True, help="workflow session ID")
117-
parser.add_argument("-c", dest="controlled", action='store_true', help="set file to be controlled access")
118-
parser.add_argument("-p", dest="process_name", type=str, help="variant process name")
119-
parser.add_argument("-t", dest="analysis_type", type=str, default="variant_processing", help="specify output song analysis type")
116+
parser.add_argument("-o", dest="open", action='store_true', help="set file to be open access")
120117
args = parser.parse_args()
121118

122119
analysis = {}
123120
with open(args.analysis, 'r') as f:
124121
analysis = json.load(f)
125122

126123
input_analysis_type = analysis.get('analysisType').get('name')
127-
124+
analysis_type = "variant_processing"
128125
payload = {
129126
'analysisType': {
130-
'name': args.analysis_type
127+
'name': analysis_type
131128
},
132129
'studyId': analysis.get('studyId'),
133130
'experiment': analysis.get('experiment'),
@@ -154,7 +151,7 @@ def main():
154151
file_info = get_files_info(f, args)
155152
payload['files'].append(file_info)
156153

157-
with open("%s.%s.payload.json" % (str(uuid.uuid4()), args.analysis_type), 'w') as f:
154+
with open("%s.%s.payload.json" % (str(uuid.uuid4()), analysis_type), 'w') as f:
158155
f.write(json.dumps(payload, indent=2))
159156

160157

payload-gen-variant-processing/tests/checker.nf

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,7 @@ params.files_to_upload = []
4848
params.wf_name = ""
4949
params.wf_short_name = ""
5050
params.wf_version = ""
51-
params.controlled = false
52-
params.process_name = ""
53-
params.analysis_type = ""
51+
params.open = false
5452
params.expected_output = ""
5553

5654
include { payloadGenVariantProcessing } from '../main'
@@ -67,8 +65,8 @@ process file_smart_diff {
6765

6866
script:
6967
"""
70-
diff <( cat ${output_file} |sort | sed '/\"run_id\"/d' | sed '/\"session_id\"/d' ) \
71-
<( cat ${expected_file} |sort | sed '/\"run_id\"/d' | sed '/\"session_id\"/d' ) \
68+
diff <( cat ${output_file} | jq -S . | sed '/\"run_id\"/d' | sed '/\"session_id\"/d' ) \
69+
<( cat ${expected_file} | jq -S . | sed '/\"run_id\"/d' | sed '/\"session_id\"/d' ) \
7270
&& ( echo "Test PASSED" && exit 0 ) || ( echo "Test FAILED, output file mismatch." && exit 1 )
7371
"""
7472
}
@@ -81,9 +79,7 @@ workflow checker {
8179
wf_name
8280
wf_short_name
8381
wf_version
84-
controlled
85-
process_name
86-
analysis_type
82+
open
8783
expected_output
8884

8985
main:
@@ -93,9 +89,7 @@ workflow checker {
9389
wf_name,
9490
wf_short_name,
9591
wf_version,
96-
controlled,
97-
process_name,
98-
analysis_type
92+
open
9993
)
10094

10195
file_smart_diff(
@@ -112,9 +106,7 @@ workflow {
112106
params.wf_name,
113107
params.wf_short_name,
114108
params.wf_version,
115-
params.controlled,
116-
params.process_name,
117-
params.analysis_type,
109+
params.open,
118110
file(params.expected_output)
119111
)
120112
}

payload-gen-variant-processing/tests/expected/expected.sanger-wgs.filtered.snv.payload.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"analysisType": {
3-
"name": "variant_annotating"
3+
"name": "variant_processing"
44
},
55
"studyId": "TEST-PR",
66
"experiment": {
@@ -26,7 +26,7 @@
2626
],
2727
"files": [
2828
{
29-
"fileName": "TEST-PR.DO250183.SA610229.wgs.20200513.sanger-wgs.somatic.snv.annotation.vcf.gz",
29+
"fileName": "TEST-PR.DO250183.SA610229.wgs.20200513.sanger-wgs.somatic.snv.open-filter.vcf.gz",
3030
"fileType": "VCF",
3131
"fileSize": 23947,
3232
"fileMd5sum": "1ebce71c8231aeb7ac6c06c92adfd5db",
@@ -41,7 +41,7 @@
4141
"dataType": "Raw SNV Calls"
4242
},
4343
{
44-
"fileName": "TEST-PR.DO250183.SA610229.wgs.20200513.sanger-wgs.somatic.snv.annotation.vcf.gz.tbi",
44+
"fileName": "TEST-PR.DO250183.SA610229.wgs.20200513.sanger-wgs.somatic.snv.open-filter.vcf.gz.tbi",
4545
"fileType": "TBI",
4646
"fileSize": 185,
4747
"fileMd5sum": "7a8482dc43849a4ee8bdd4c9c77fae0c",
@@ -60,8 +60,8 @@
6060
"workflow_name": "Open Access Variant Filtering",
6161
"workflow_short_name": "open-filter",
6262
"workflow_version": "0.1.0",
63-
"run_id": "hopeful_wescoff",
64-
"session_id": "6f1137f4-7e04-4758-bf15-53936d76a1d3",
63+
"run_id": "insane_rubens",
64+
"session_id": "b5dbc2b3-f915-4f56-acbb-97d31df6c1f0",
6565
"inputs": [
6666
{
6767
"input_analysis_id": "3414534a-47a4-492d-9453-4a47a4192d6d",

payload-gen-variant-processing/tests/test-job-1.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88
"wf_name": "open-access-variant-filtering",
99
"wf_short_name": "open-filter",
1010
"wf_version": "0.1.0",
11-
"controlled": true,
12-
"process_name": "annotation",
13-
"analysis_type": "variant_annotating",
1411
"publish_dir": "outdir",
1512
"cpus": 1,
1613
"mem": 0.5

payload-gen-variant-processing/tests/test-job-2.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"wf_name": "open-access-variant-filtering",
99
"wf_short_name": "open-filter",
1010
"wf_version": "0.1.0",
11+
"open": true,
1112
"publish_dir": "outdir",
1213
"cpus": 1,
1314
"mem": 0.5

payload-gen-variant-processing/tests/test-job-3.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"wf_name": "open-access-variant-filtering",
99
"wf_short_name": "open-filter",
1010
"wf_version": "0.1.0",
11+
"open": true,
1112
"publish_dir": "outdir",
1213
"cpus": 1,
1314
"mem": 0.5

0 commit comments

Comments
 (0)