aboutsummaryrefslogtreecommitdiff
path: root/workflows/pangenome-generate/merge-metadata.cwl
blob: 4d9c8088d3edab727a56b002e27b1411fc201670 (plain)
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
cwlVersion: v1.1
class: CommandLineTool
hints:
  DockerRequirement:
    dockerPull: commonworkflowlanguage/cwltool_module
inputs:
  metadata: File[]
  subjects: string[]
  metadataSchema:
    type: File
    inputBinding: {position: 2}
  originalLabels:
    type: File
    inputBinding: {position: 3}
  dups:
    type: File?
    inputBinding: {position: 4}
  script:
    type: File
    inputBinding: {position: 1}
    default: {class: File, location: merge-metadata.py}
outputs:
  merged: stdout
stdout: mergedmetadata.ttl
requirements:
  InlineJavascriptRequirement: {}
  InitialWorkDirRequirement:
    listing: |
          ${
          var i = 0;
          var b = 1;
          var out = [];
          for (; i < inputs.metadata.length; i++) {
            var block = [];
            var sub = [];
            for (; i < (b*150) && i < inputs.metadata.length; i++) {
              block.push(inputs.metadata[i]);
              sub.push(inputs.subjects[i]);
            }
            out.push({
              entryname: "block"+b,
              entry: JSON.stringify(block)
            });
            out.push({
              entryname: "subs"+b,
              entry: JSON.stringify(sub)
            });
            b++;
          }
          return out;
          }
baseCommand: python