-
Notifications
You must be signed in to change notification settings - Fork 0
/
score.cwl
55 lines (50 loc) · 1.42 KB
/
score.cwl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/env cwl-runner
#
# Example score submission file
#
cwlVersion: v1.0
class: CommandLineTool
baseCommand: python
inputs:
- id: inputfile
type: File
- id: status
type: string
arguments:
- valueFrom: score.py
- valueFrom: $(inputs.inputfile)
prefix: -f
- valueFrom: $(inputs.status)
prefix: -s
- valueFrom: results.json
prefix: -r
requirements:
- class: InlineJavascriptRequirement
- class: InitialWorkDirRequirement
listing:
- entryname: score.py
entry: |
#!/usr/bin/env python
import synapseclient
import argparse
import os
import json
parser = argparse.ArgumentParser()
parser.add_argument("-f", "--submissionFile", required=True, help="Submission File")
parser.add_argument("-s", "--status", required=True, help="Submission status")
parser.add_argument("-r", "--results", required=True, help="scoring results")
args = parser.parse_args()
if args.status == "VALIDATED":
predictionFileStatus = "SCORED"
score = 3
else:
predictionFileStatus = args.status
score = -1
result = {'score':score,'predictionFileStatus':predictionFileStatus}
with open(args.results, 'w') as o:
o.write(json.dumps(result))
outputs:
- id: results
type: File
outputBinding:
glob: results.json