@prefix LoadListingRequirement: <http://commonwl.org/cwltool#LoadListingRequirement/> .
@prefix CommandLineBinding: <https://w3id.org/cwl/cwl#CommandLineBinding/> .
@prefix xsd:   <http://www.w3.org/2001/XMLSchema#> .
@prefix DockerRequirement: <https://w3id.org/cwl/cwl#DockerRequirement/> .
@prefix Workflow: <https://w3id.org/cwl/cwl#Workflow/> .
@prefix sld:   <https://w3id.org/cwl/salad#> .
@prefix rdfs:  <http://www.w3.org/2000/01/rdf-schema#> .
@prefix CommandOutputBinding: <https://w3id.org/cwl/cwl#CommandOutputBinding/> .
@prefix ns1:   <http://commonwl.org/cwltool#> .
@prefix NetworkAccess: <http://commonwl.org/cwltool#NetworkAccess/> .
@prefix rdf:   <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix cwl:   <https://w3id.org/cwl/cwl#> .
@prefix ResourceRequirement: <https://w3id.org/cwl/cwl#ResourceRequirement/> .

<https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/subworkflows/kfdrc_rgbam_to_realnbam.cwl#kfdrc_rgbam_to_realnbam_wf/input_rgbam>
        sld:type  cwl:File .

<https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/subworkflows/kfdrc_process_bam.cwl#kfdrc_process_bam/indexed_reference_fasta>
        cwl:secondaryFiles  []  ;
        cwl:secondaryFiles  []  ;
        cwl:secondaryFiles  []  ;
        cwl:secondaryFiles  []  ;
        cwl:secondaryFiles  []  ;
        cwl:secondaryFiles  []  ;
        cwl:secondaryFiles  []  ;
        sld:type            cwl:File .

<https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/tools/bwa_mem_naive.cwl#bwa_mem_naive>
        a                        cwl:CommandLineTool ;
        rdfs:comment             "The program can handle the following classes of inputs:\n - single end reads (only reads File and rg string provided)\n - reads with mates (reads File, mates File, and rg string provided)\n - interleaved reads (reads File provided, rg string provided, and interleaved set to true)\nThis tool runs the following programs:\n - bwa mem | samblaster | sambamba view | sambamba sort" ;
        ns1:original_cwlVersion  "v1.0" ;
        cwl:arguments            ( [ CommandLineBinding:position    0 ;
                                     CommandLineBinding:shellQuote  false ;
                                     cwl:valueFrom                  "set -eo pipefail\nbwa mem -K 100000000 ${if (inputs.interleaved) {return '-p';} else {return \"\"}} -v 3 -t 36 -Y $(inputs.ref.path) -R '${return inputs.rg}' ${return inputs.reads.path} ${if (inputs.mates != null) {return inputs.mates.path} else {return \"\"}} | /opt/samblaster/samblaster -i /dev/stdin -o /dev/stdout | /opt/sambamba_0.6.3/sambamba_v0.6.3 view -t 36 -f bam -l 0 -S /dev/stdin | /opt/sambamba_0.6.3/sambamba_v0.6.3 sort -t 36 --natural-sort -m 15GiB --tmpdir ./ -o ${if (inputs.reads != null) {return inputs.reads.nameroot} else {return \"\"}}.unsorted.bam -l 5 /dev/stdin"
                                   ]
                                 ) ;
        cwl:baseCommand          ( "/bin/bash" "-c" ) ;
        cwl:cwlVersion           <https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/tools/v1.2> ;
        cwl:hints                [ a                            <https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/tools/NetworkAccess> ;
                                   NetworkAccess:networkAccess  true
                                 ] ;
        cwl:hints                [ a       <https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/tools/LoadListingRequirement> ;
                                   LoadListingRequirement:loadListing
                                           "deep_listing"
                                 ] ;
        cwl:inputs               <https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/tools/bwa_mem_naive.cwl#bwa_mem_naive/rg> , <https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/tools/bwa_mem_naive.cwl#bwa_mem_naive/mates> , <https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/tools/bwa_mem_naive.cwl#bwa_mem_naive/interleaved> , <https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/tools/bwa_mem_naive.cwl#bwa_mem_naive/reads> , <https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/tools/bwa_mem_naive.cwl#bwa_mem_naive/ref> ;
        cwl:outputs              <https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/tools/bwa_mem_naive.cwl#bwa_mem_naive/output> ;
        cwl:requirements         [ a                             cwl:DockerRequirement ;
                                   DockerRequirement:dockerPull  "zhangb1/bwa-kf-bundle:0.1.17"
                                 ] ;
        cwl:requirements         [ a                             cwl:ResourceRequirement ;
                                   ResourceRequirement:coresMin  36 ;
                                   ResourceRequirement:ramMin    50000
                                 ] ;
        cwl:requirements         [ a  cwl:InlineJavascriptRequirement ] ;
        cwl:requirements         [ a  cwl:ShellCommandRequirement ] .

<https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/tools/bwa_mem_naive.cwl#bwa_mem_naive/output>
        cwl:outputBinding  [ CommandOutputBinding:glob
                          "*.bam" ] ;
        sld:type           cwl:File .

<https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/tools/bwa_mem_naive.cwl#bwa_mem_naive/reads>
        rdfs:comment  "Primary reads file" ;
        sld:type      cwl:File .

<https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/subworkflows/kfdrc_process_bam.cwl#kfdrc_process_bam/samtools_split>
        cwl:in   <https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/subworkflows/kfdrc_process_bam.cwl#kfdrc_process_bam/samtools_split/input_bam> , <https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/subworkflows/kfdrc_process_bam.cwl#kfdrc_process_bam/samtools_split/reference> ;
        cwl:out  <https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/subworkflows/kfdrc_process_bam.cwl#kfdrc_process_bam/samtools_split/bam_files> ;
        cwl:run  <https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/tools/samtools_split.cwl> .

<https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/subworkflows/kfdrc_rgbam_to_realnbam.cwl#kfdrc_rgbam_to_realnbam_wf/bwa_mem_naive_bam/ref>
        cwl:source  <https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/subworkflows/kfdrc_rgbam_to_realnbam.cwl#kfdrc_rgbam_to_realnbam_wf/indexed_reference_fasta> .

<https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/subworkflows/kfdrc_rgbam_to_realnbam.cwl#kfdrc_rgbam_to_realnbam_wf/bwa_mem_naive_bam/reads>
        cwl:source  <https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/subworkflows/kfdrc_rgbam_to_realnbam.cwl#kfdrc_rgbam_to_realnbam_wf/bamtofastq_chomp/output> .

<https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/subworkflows/kfdrc_process_bam.cwl#kfdrc_process_bam>
        a                        cwl:Workflow ;
        ns1:original_cwlVersion  "v1.0" ;
        Workflow:steps           <https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/subworkflows/kfdrc_process_bam.cwl#kfdrc_process_bam/realign_split_bam> , <https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/subworkflows/kfdrc_process_bam.cwl#kfdrc_process_bam/samtools_split> ;
        cwl:cwlVersion           <https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/subworkflows/v1.2> ;
        cwl:hints                [ a                            <https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/subworkflows/NetworkAccess> ;
                                   NetworkAccess:networkAccess  true
                                 ] ;
        cwl:hints                [ a       <https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/subworkflows/LoadListingRequirement> ;
                                   LoadListingRequirement:loadListing
                                           "deep_listing"
                                 ] ;
        cwl:inputs               <https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/subworkflows/kfdrc_process_bam.cwl#kfdrc_process_bam/input_bam> , <https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/subworkflows/kfdrc_process_bam.cwl#kfdrc_process_bam/indexed_reference_fasta> , <https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/subworkflows/kfdrc_process_bam.cwl#kfdrc_process_bam/sample_name> ;
        cwl:outputs              <https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/subworkflows/kfdrc_process_bam.cwl#kfdrc_process_bam/unsorted_bams> ;
        cwl:requirements         [ a  cwl:ScatterFeatureRequirement ] ;
        cwl:requirements         [ a  cwl:SubworkflowFeatureRequirement ] .

<https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/subworkflows/kfdrc_process_bam.cwl#kfdrc_process_bam/samtools_split/input_bam>
        cwl:source  <https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/subworkflows/kfdrc_process_bam.cwl#kfdrc_process_bam/input_bam> .

<https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/tools/bwa_mem_naive.cwl#bwa_mem_naive/mates>
        rdfs:comment  "Mates file for the reads" ;
        sld:type      cwl:File , sld:null .

<https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/tools/samtools_split.cwl#samtools_split/input_bam>
        rdfs:comment  "Input bam file" ;
        sld:type      cwl:File .

<https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/tools/bamtofastq_chomp.cwl#bamtofastq_chomp/input_bam>
        rdfs:comment  "Input bam file" ;
        sld:type      cwl:File .

<https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/subworkflows/kfdrc_rgbam_to_realnbam.cwl#kfdrc_rgbam_to_realnbam_wf>
        a                        cwl:Workflow ;
        ns1:original_cwlVersion  "v1.0" ;
        Workflow:steps           <https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/subworkflows/kfdrc_rgbam_to_realnbam.cwl#kfdrc_rgbam_to_realnbam_wf/bwa_mem_naive_bam> , <https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/subworkflows/kfdrc_rgbam_to_realnbam.cwl#kfdrc_rgbam_to_realnbam_wf/bamtofastq_chomp> ;
        cwl:cwlVersion           <https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/subworkflows/v1.2> ;
        cwl:hints                [ a  <https://sevenbridges.commaxNumberOfParallelInstances> ] ;
        cwl:hints                [ a                            <https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/subworkflows/NetworkAccess> ;
                                   NetworkAccess:networkAccess  true
                                 ] ;
        cwl:hints                [ a       <https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/subworkflows/LoadListingRequirement> ;
                                   LoadListingRequirement:loadListing
                                           "deep_listing"
                                 ] ;
        cwl:inputs               <https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/subworkflows/kfdrc_rgbam_to_realnbam.cwl#kfdrc_rgbam_to_realnbam_wf/sample_name> , <https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/subworkflows/kfdrc_rgbam_to_realnbam.cwl#kfdrc_rgbam_to_realnbam_wf/indexed_reference_fasta> , <https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/subworkflows/kfdrc_rgbam_to_realnbam.cwl#kfdrc_rgbam_to_realnbam_wf/input_rgbam> ;
        cwl:outputs              <https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/subworkflows/kfdrc_rgbam_to_realnbam.cwl#kfdrc_rgbam_to_realnbam_wf/unsorted_bams> ;
        cwl:requirements         [ a  cwl:ScatterFeatureRequirement ] .

<https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/subworkflows/kfdrc_rgbam_to_realnbam.cwl#kfdrc_rgbam_to_realnbam_wf/bamtofastq_chomp>
        cwl:in   <https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/subworkflows/kfdrc_rgbam_to_realnbam.cwl#kfdrc_rgbam_to_realnbam_wf/bamtofastq_chomp/input_bam> , <https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/subworkflows/kfdrc_rgbam_to_realnbam.cwl#kfdrc_rgbam_to_realnbam_wf/bamtofastq_chomp/sample> ;
        cwl:out  <https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/subworkflows/kfdrc_rgbam_to_realnbam.cwl#kfdrc_rgbam_to_realnbam_wf/bamtofastq_chomp/rg_string> , <https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/subworkflows/kfdrc_rgbam_to_realnbam.cwl#kfdrc_rgbam_to_realnbam_wf/bamtofastq_chomp/output> ;
        cwl:run  <https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/tools/bamtofastq_chomp.cwl> .

<https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/tools/bamtofastq_chomp.cwl#bamtofastq_chomp/sample>
        rdfs:comment  "String name of the sample used to relabel the rg string" ;
        sld:type      xsd:string .

<https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/tools/bamtofastq_chomp.cwl#bamtofastq_chomp/max_size>
        rdfs:comment  "The maximum size (in bytes) that an input bam can be before the FASTQ is split" ;
        cwl:default   20000000000 ;
        sld:type      xsd:long .

<https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/subworkflows/kfdrc_process_bam.cwl#kfdrc_process_bam/sample_name>
        sld:type  xsd:string .

<https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/subworkflows/kfdrc_rgbam_to_realnbam.cwl#kfdrc_rgbam_to_realnbam_wf/bwa_mem_naive_bam/rg>
        cwl:source  <https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/subworkflows/kfdrc_rgbam_to_realnbam.cwl#kfdrc_rgbam_to_realnbam_wf/bamtofastq_chomp/rg_string> .

<https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/subworkflows/kfdrc_process_bam.cwl#kfdrc_process_bam/samtools_split/reference>
        cwl:source  <https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/subworkflows/kfdrc_process_bam.cwl#kfdrc_process_bam/indexed_reference_fasta> .

<https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/tools/samtools_split.cwl#samtools_split/reference>
        rdfs:comment  "Reference fasta file" ;
        sld:type      cwl:File .

<https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/subworkflows/kfdrc_rgbam_to_realnbam.cwl#kfdrc_rgbam_to_realnbam_wf/bamtofastq_chomp/sample>
        cwl:source  <https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/subworkflows/kfdrc_rgbam_to_realnbam.cwl#kfdrc_rgbam_to_realnbam_wf/sample_name> .

<https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/subworkflows/kfdrc_rgbam_to_realnbam.cwl#kfdrc_rgbam_to_realnbam_wf/bwa_mem_naive_bam>
        cwl:in       <https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/subworkflows/kfdrc_rgbam_to_realnbam.cwl#kfdrc_rgbam_to_realnbam_wf/bwa_mem_naive_bam/interleaved> , <https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/subworkflows/kfdrc_rgbam_to_realnbam.cwl#kfdrc_rgbam_to_realnbam_wf/bwa_mem_naive_bam/rg> , <https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/subworkflows/kfdrc_rgbam_to_realnbam.cwl#kfdrc_rgbam_to_realnbam_wf/bwa_mem_naive_bam/reads> , <https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/subworkflows/kfdrc_rgbam_to_realnbam.cwl#kfdrc_rgbam_to_realnbam_wf/bwa_mem_naive_bam/ref> ;
        cwl:out      <https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/subworkflows/kfdrc_rgbam_to_realnbam.cwl#kfdrc_rgbam_to_realnbam_wf/bwa_mem_naive_bam/output> ;
        cwl:run      <https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/tools/bwa_mem_naive.cwl> ;
        cwl:scatter  ( <https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/subworkflows/kfdrc_rgbam_to_realnbam.cwl#kfdrc_rgbam_to_realnbam_wf/bwa_mem_naive_bam/reads> ) .

<https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/tools/samtools_split.cwl#samtools_split>
        a                        cwl:CommandLineTool ;
        rdfs:comment             "This tool splits the input bam input read group bams if it has more than one readgroup.\nPrograms run in this tool:\n  - samtools view | grep\n  - samtools split\nUsing samtools view and grep count the header lines starting with @RG. If that number is\nnot one, split the bam file into read group bams using samtools." ;
        ns1:original_cwlVersion  "v1.0" ;
        cwl:arguments            ( [ CommandLineBinding:position    0 ;
                                     CommandLineBinding:shellQuote  false ;
                                     cwl:valueFrom                  "set -eo pipefail\nRG_NUM=`samtools view -H $(inputs.input_bam.path) | grep -c ^@RG`\nif [ $RG_NUM != 1 ]; then\n  samtools split -f '%!.bam' -@ 36 --reference $(inputs.reference.path) $(inputs.input_bam.path)\nfi"
                                   ]
                                 ) ;
        cwl:baseCommand          ( "/bin/bash" "-c" ) ;
        cwl:cwlVersion           <https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/tools/v1.2> ;
        cwl:hints                [ a       <https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/tools/LoadListingRequirement> ;
                                   LoadListingRequirement:loadListing
                                           "deep_listing"
                                 ] ;
        cwl:hints                [ a                            <https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/tools/NetworkAccess> ;
                                   NetworkAccess:networkAccess  true
                                 ] ;
        cwl:inputs               <https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/tools/samtools_split.cwl#samtools_split/input_bam> , <https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/tools/samtools_split.cwl#samtools_split/reference> ;
        cwl:outputs              <https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/tools/samtools_split.cwl#samtools_split/bam_files> ;
        cwl:requirements         [ a  cwl:InlineJavascriptRequirement ] ;
        cwl:requirements         [ a                             cwl:DockerRequirement ;
                                   DockerRequirement:dockerPull  "kfdrc/samtools:1.9"
                                 ] ;
        cwl:requirements         [ a  cwl:ShellCommandRequirement ] .

<https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/subworkflows/kfdrc_rgbam_to_realnbam.cwl#kfdrc_rgbam_to_realnbam_wf/indexed_reference_fasta>
        cwl:secondaryFiles  []  ;
        cwl:secondaryFiles  []  ;
        cwl:secondaryFiles  []  ;
        cwl:secondaryFiles  []  ;
        cwl:secondaryFiles  []  ;
        cwl:secondaryFiles  []  ;
        cwl:secondaryFiles  []  ;
        sld:type            cwl:File .

<https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/subworkflows/kfdrc_process_bam.cwl#kfdrc_process_bam/realign_split_bam/input_rgbam>
        cwl:source  <https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/subworkflows/kfdrc_process_bam.cwl#kfdrc_process_bam/samtools_split/bam_files> .

<https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/subworkflows/kfdrc_rgbam_to_realnbam.cwl#kfdrc_rgbam_to_realnbam_wf/bamtofastq_chomp/input_bam>
        cwl:source  <https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/subworkflows/kfdrc_rgbam_to_realnbam.cwl#kfdrc_rgbam_to_realnbam_wf/input_rgbam> .

<https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/subworkflows/kfdrc_process_bam.cwl#kfdrc_process_bam/realign_split_bam>
        cwl:in       <https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/subworkflows/kfdrc_process_bam.cwl#kfdrc_process_bam/realign_split_bam/indexed_reference_fasta> , <https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/subworkflows/kfdrc_process_bam.cwl#kfdrc_process_bam/realign_split_bam/sample_name> , <https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/subworkflows/kfdrc_process_bam.cwl#kfdrc_process_bam/realign_split_bam/input_rgbam> ;
        cwl:out      <https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/subworkflows/kfdrc_process_bam.cwl#kfdrc_process_bam/realign_split_bam/unsorted_bams> ;
        cwl:run      <https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/subworkflows/kfdrc_rgbam_to_realnbam.cwl> ;
        cwl:scatter  ( <https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/subworkflows/kfdrc_process_bam.cwl#kfdrc_process_bam/realign_split_bam/input_rgbam> ) .

<https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/subworkflows/kfdrc_rgbam_to_realnbam.cwl#kfdrc_rgbam_to_realnbam_wf/unsorted_bams>
        cwl:outputSource  <https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/subworkflows/kfdrc_rgbam_to_realnbam.cwl#kfdrc_rgbam_to_realnbam_wf/bwa_mem_naive_bam/output> ;
        sld:type          [ sld:items  cwl:File ;
                            sld:type   sld:array
                          ] .

<https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/subworkflows/kfdrc_process_bam.cwl#kfdrc_process_bam/realign_split_bam/indexed_reference_fasta>
        cwl:source  <https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/subworkflows/kfdrc_process_bam.cwl#kfdrc_process_bam/indexed_reference_fasta> .

<https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/tools/bamtofastq_chomp.cwl#bamtofastq_chomp/output>
        cwl:outputBinding  [ CommandOutputBinding:glob
                          "*.fq" ] ;
        sld:type           [ sld:items  cwl:File ;
                             sld:type   sld:array
                           ] .

<https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/tools/samtools_split.cwl#samtools_split/bam_files>
        cwl:outputBinding  [ CommandOutputBinding:glob  "*.bam" ;
                             CommandOutputBinding:outputEval
                                     "${\n  if (self.length == 0) return [inputs.input_bam]\n  else return self\n}"
                           ] ;
        sld:type           [ sld:items  cwl:File ;
                             sld:type   sld:array
                           ] .

<https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/subworkflows/kfdrc_rgbam_to_realnbam.cwl#kfdrc_rgbam_to_realnbam_wf/sample_name>
        sld:type  xsd:string .

<https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/tools/bwa_mem_naive.cwl#bwa_mem_naive/rg>
        rdfs:comment  "Formatted RG header to use in the resulting BAM, check BWA for formatting guidelines (e.g. escaped tabs '\\t')" ;
        sld:type      xsd:string .

<https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/tools/bwa_mem_naive.cwl#bwa_mem_naive/interleaved>
        rdfs:comment  "The reads input is interleaved" ;
        cwl:default   false ;
        sld:type      xsd:boolean .

<https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/subworkflows/kfdrc_process_bam.cwl#kfdrc_process_bam/input_bam>
        sld:type  cwl:File .

<https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/subworkflows/kfdrc_process_bam.cwl#kfdrc_process_bam/realign_split_bam/sample_name>
        cwl:source  <https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/subworkflows/kfdrc_process_bam.cwl#kfdrc_process_bam/sample_name> .

<https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/tools/bwa_mem_naive.cwl#bwa_mem_naive/ref>
        rdfs:comment        "Reference fasta file with associated indexes" ;
        cwl:secondaryFiles  []  ;
        cwl:secondaryFiles  []  ;
        cwl:secondaryFiles  []  ;
        cwl:secondaryFiles  []  ;
        cwl:secondaryFiles  []  ;
        cwl:secondaryFiles  []  ;
        cwl:secondaryFiles  []  ;
        cwl:secondaryFiles  []  ;
        cwl:secondaryFiles  []  ;
        cwl:secondaryFiles  []  ;
        cwl:secondaryFiles  []  ;
        cwl:secondaryFiles  []  ;
        cwl:secondaryFiles  []  ;
        sld:type            cwl:File .

<https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/tools/bamtofastq_chomp.cwl#bamtofastq_chomp/rg_string>
        cwl:outputBinding  [ CommandOutputBinding:glob  "rg.txt" ;
                             CommandOutputBinding:outputEval
                                     "${ var arr = self[0].contents.split('\\n')[0].split('\\t'); for (var i=1; i<arr.length; i++){ if (arr[i].startsWith('SM')){ arr[i] = 'SM:' + inputs.sample; } } return arr.join('\\\\t'); }" ;
                             cwl:loadContents           true
                           ] ;
        sld:type           xsd:string .

<https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/subworkflows/kfdrc_rgbam_to_realnbam.cwl#kfdrc_rgbam_to_realnbam_wf/bwa_mem_naive_bam/interleaved>
        cwl:default  true .

<https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/tools/bamtofastq_chomp.cwl#bamtofastq_chomp>
        a                        cwl:CommandLineTool ;
        rdfs:comment             "If the input BAM is not provided the program will simply exit without failing.\nThis tool runs two programs:\n  - samtools view && biobambam2 bamtofastq\nThe program will first grab the RG header from the input BAM and put it in a file.\nThis RG header in the text file is later parsed into a string.\nNext it will convert the bam to fastq. If the file is over the max_size, it will\nchunk the output FASTQ into 680 million line FASTQs (85 million read pairs)." ;
        ns1:original_cwlVersion  "v1.0" ;
        cwl:arguments            ( [ CommandLineBinding:position    0 ;
                                     CommandLineBinding:shellQuote  false ;
                                     cwl:valueFrom                  "set -eo pipefail\n\nsamtools view -H $(inputs.input_bam.path) | grep ^@RG > rg.txt\n\nif [ $(inputs.input_bam.size) -gt $(inputs.max_size) ]; then\n  bamtofastq tryoq=1 filename=$(inputs.input_bam.path) | split -dl 680000000 - reads-\n  ls reads-* | xargs -i mv {} {}.fq\nelse\n  bamtofastq tryoq=1 filename=$(inputs.input_bam.path) > reads-00.fq\nfi"
                                   ]
                                 ) ;
        cwl:baseCommand          ( "/bin/bash" "-c" ) ;
        cwl:cwlVersion           <https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/tools/v1.2> ;
        cwl:hints                [ a       <https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/tools/LoadListingRequirement> ;
                                   LoadListingRequirement:loadListing
                                           "deep_listing"
                                 ] ;
        cwl:hints                [ a                            <https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/tools/NetworkAccess> ;
                                   NetworkAccess:networkAccess  true
                                 ] ;
        cwl:inputs               <https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/tools/bamtofastq_chomp.cwl#bamtofastq_chomp/input_bam> , <https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/tools/bamtofastq_chomp.cwl#bamtofastq_chomp/max_size> , <https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/tools/bamtofastq_chomp.cwl#bamtofastq_chomp/sample> ;
        cwl:outputs              <https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/tools/bamtofastq_chomp.cwl#bamtofastq_chomp/rg_string> , <https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/tools/bamtofastq_chomp.cwl#bamtofastq_chomp/output> ;
        cwl:requirements         [ a  cwl:ShellCommandRequirement ] ;
        cwl:requirements         [ a                             cwl:DockerRequirement ;
                                   DockerRequirement:dockerPull  "kfdrc/bwa-bundle:dev"
                                 ] ;
        cwl:requirements         [ a  cwl:InlineJavascriptRequirement ] ;
        cwl:requirements         [ a                           cwl:ResourceRequirement ;
                                   ResourceRequirement:ramMin  1000
                                 ] .

<https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/subworkflows/kfdrc_process_bam.cwl#kfdrc_process_bam/unsorted_bams>
        cwl:outputSource  <https://w3id.org/cwl/view/git/3fba930f3eca7880320fa19744e377a9d5dca9d5/subworkflows/kfdrc_process_bam.cwl#kfdrc_process_bam/realign_split_bam/unsorted_bams> ;
        sld:type          [ sld:items  [ sld:items  cwl:File ;
                                         sld:type   sld:array
                                       ] ;
                            sld:type   sld:array
                          ] .
