Updating cwl and yml for intervals and other changes
[arvados-tutorial.git] / WGS-processing / cwl / helper / getfastq.cwl
index a38bc9125a60652a71c65e7f58d193a47a6663eb..59c677112791346313f16a73c932fa66c8b6b8e5 100644 (file)
@@ -1,21 +1,28 @@
-$namespaces:
-  arv: "http://arvados.org/cwl#"
-  cwltool: "http://commonwl.org/cwltool#"
 class: ExpressionTool
 cwlVersion: v1.1
-label: Create array of gvcfs to process
+label: Find matching FASTQ pairs
 requirements:
   InlineJavascriptRequirement: {}
+
 inputs:
-  fastjdir:
+  fastqdir:
     type: Directory
-    label: Input directory of fastj
-    loadListing: 'shallow_listing' 
+    label: Input directory of FASTQs
+    loadListing: 'shallow_listing'
+
 outputs:
   fastq1: 
     type: File[]
+    format: edam:format_1930 # FASTQ
+    label: Half set of pair-end FASTQs (R1)
   fastq2:
     type: File[]
+    format: edam:format_1930 # FASTQ
+    label: Half set of pair-end FASTQs (R2)
+  sample:
+    type: string[]
+    label: Sample Names
+
 expression: |
   ${function compare(a, b) {
     var baseA = a.basename;
@@ -32,8 +39,9 @@ expression: |
 
     var fastq1 = [];
     var fastq2 = [];
-    for (var i = 0; i < inputs.fastjdir.listing.length; i++) {
-      var name = inputs.fastjdir.listing[i];
+    for (var i = 0; i < inputs.fastqdir.listing.length; i++) {
+      var name = inputs.fastqdir.listing[i];
+      name.format = 'http://edamontology.org/format_1930'
       if (name.basename.indexOf('_1.fastq.gz') != -1 ) {
         fastq1.push(name);
       }
@@ -44,6 +52,29 @@ expression: |
   
     fastq1 = fastq1.sort(compare)
     fastq2 = fastq2.sort(compare)
+
+    var sample = [];
+
+    for (var i = 0; i < fastq1.length; i++) {
+      var name = fastq1[i].basename;
+      var samplename = name.replace(/_1.fastq.gz/,'');
+      sample.push(samplename);
+      }
+
  
-    return {"fastq1": fastq1, "fastq2": fastq2};
+    return {"fastq1": fastq1, "fastq2": fastq2, "sample": sample};
   }
+
+
+s:codeRepository: https://github.com/arvados/arvados-tutorial
+s:license: https://www.gnu.org/licenses/agpl-3.0.en.html
+
+$namespaces:
+ s: https://schema.org/
+ edam: http://edamontology.org/
+ arv: "http://arvados.org/cwl#"
+ cwltool: "http://commonwl.org/cwltool#"
+
+#$schemas:
+# - https://schema.org/version/latest/schema.rdf
+# - http://edamontology.org/EDAM_1.18.owl