|
| 1 | +cwlVersion: v1.1 |
| 2 | +class: CommandLineTool |
| 3 | + |
| 4 | +# Extensions |
| 5 | +$namespaces: |
| 6 | + s: https://schema.org/ |
| 7 | + ilmn-tes: https://platform.illumina.com/rdf/ica/ |
| 8 | +$schemas: |
| 9 | + - https://schema.org/version/latest/schemaorg-current-http.rdf |
| 10 | + |
| 11 | +# Metadata |
| 12 | +s:author: |
| 13 | + class: s:Person |
| 14 | + s:name: Alexis Lucattini |
| 15 | + |
| 16 | + s:identifier: https://orcid.org/0000-0001-9754-647X |
| 17 | + |
| 18 | +# ID/Docs |
| 19 | +id: custom-convert-multiqc-json-data-to-qlims-import-csv--1.0.0 |
| 20 | +label: custom-convert-multiqc-json-data-to-qlims-import-csv v(1.0.0) |
| 21 | +doc: | |
| 22 | + Documentation for custom-convert-multiqc-json-data-to-qlims- |
| 23 | + import-csv v1.0.0 |
| 24 | + |
| 25 | +# ILMN V1 Resources Guide: https://illumina.gitbook.io/ica-v1/analysis/a-taskexecution#type-and-size |
| 26 | +# ILMN V2 Resources Guide: https://help.ica.illumina.com/project/p-flow/f-pipelines#compute-types |
| 27 | +hints: |
| 28 | + ResourceRequirement: |
| 29 | + ilmn-tes:resources/tier: standard |
| 30 | + ilmn-tes:resources/type: standard |
| 31 | + ilmn-tes:resources/size: small |
| 32 | + coresMin: 2 |
| 33 | + ramMin: 4000 |
| 34 | + DockerRequirement: |
| 35 | + dockerPull: ghcr.io/umccr/alpine-jq:1.6 |
| 36 | + |
| 37 | +requirements: |
| 38 | + InlineJavascriptRequirement: {} |
| 39 | + InitialWorkDirRequirement: |
| 40 | + listing: |
| 41 | + - entryname: "convert-multiqc-json-data-to-qlims-import-csv.sh" |
| 42 | + entry: | |
| 43 | + jq --raw-output \\ |
| 44 | + --argjson human_genome_size "$(inputs.human_genome_size)" \\ |
| 45 | + ' |
| 46 | + .report_saved_raw_data.multiqc_bclconvert_bysample | to_entries | |
| 47 | + map( |
| 48 | + .key as $sample_name | |
| 49 | + .value.lanes | to_entries | |
| 50 | + map( |
| 51 | + .key as $lane | |
| 52 | + { |
| 53 | + "Sample Name": $sample_name, |
| 54 | + "Coverage": ((.value.yield_q30 / $human_genome_size) * 100 | round / 100), |
| 55 | + "Lane": ($lane[1:] | tonumber), |
| 56 | + "Clusters": .value.clusters, |
| 57 | + "One mismatch index": ((.value.percent_one_mismatch_index_reads) * 100 | round / 100), |
| 58 | + "Yield": .value.yield_ |
| 59 | + } |
| 60 | + ) |
| 61 | + ) | |
| 62 | + flatten | |
| 63 | + # To csv (With ordered keys) |
| 64 | + # https://unix.stackexchange.com/questions/754935/convert-json-to-csv-with-headers-in-jq |
| 65 | + [first|keys_unsorted] + map([.[]]) | .[] | @csv | |
| 66 | + # Remove quotes |
| 67 | + # https://stackoverflow.com/questions/60350315/why-does-the-jq-raw-output-argument-fail-to-remove-quotes-from-csv-output |
| 68 | + gsub("\\""; "") |
| 69 | + ' < "$(inputs.multiqc_data_json.path)" |
| 70 | + |
| 71 | +baseCommand: [ "bash", "convert-multiqc-json-data-to-qlims-import-csv.sh" ] |
| 72 | + |
| 73 | +stdout: "qlims.csv" |
| 74 | + |
| 75 | +inputs: |
| 76 | + human_genome_size: |
| 77 | + label: "Human genome size" |
| 78 | + type: long |
| 79 | + default: 3049315783 |
| 80 | + multiqc_data_json: |
| 81 | + label: "MultiQC JSON data" |
| 82 | + type: File |
| 83 | + |
| 84 | +outputs: |
| 85 | + qlims_csv: |
| 86 | + type: File |
| 87 | + outputBinding: |
| 88 | + glob: "qlims.csv" |
| 89 | + |
| 90 | + |
| 91 | +successCodes: |
| 92 | + - 0 |
0 commit comments