Skip to content

Commit 49e5771

Browse files
authored
Merge pull request #624 from umccr/add-qlims-csv-to-bclconvert-interop-qc-pipeline
2 parents f10607b + f4f342f commit 49e5771

File tree

2 files changed

+138
-0
lines changed

2 files changed

+138
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
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

workflows/bclconvert-interop-qc/1.3.1--1.25.2/bclconvert-interop-qc__1.3.1--1.25.2.cwl

+46
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,43 @@ steps:
122122
- id: output_file
123123
run: ../../../tools/multiqc/1.25.2/multiqc__1.25.2.cwl
124124

125+
# Generate the qlims csv file
126+
generate_qc_csv_step:
127+
label: Generate QLIMS CSV
128+
doc: |
129+
Generate the QLIMS CSV file from the interop directory
130+
in:
131+
multiqc_data_json:
132+
source:
133+
- run_multiqc_step/output_directory
134+
- instrument_run_id
135+
valueFrom: |
136+
${
137+
return {
138+
"class": "File",
139+
"basename": "multiqc_data.json",
140+
"location": self[0].location + "/" + self[1] + "_multiqc_report_data/multiqc_data.json"
141+
};
142+
}
143+
out:
144+
- id: qlims_csv
145+
run: ../../../tools/custom-convert-multiqc-json-data-to-qlims-import-csv/1.0.0/custom-convert-multiqc-json-data-to-qlims-import-csv__1.0.0.cwl
146+
147+
rename_qc_csv_step:
148+
label: Rename QLIMS CSV
149+
doc: |
150+
Rename the QLIMS CSV file to include the instrument run ID
151+
in:
152+
basename:
153+
source: instrument_run_id
154+
valueFrom: "$(self)_multiqc_bclconvert_summary_qlims.csv"
155+
location:
156+
source: generate_qc_csv_step/qlims_csv
157+
valueFrom: "$(self.location)"
158+
out:
159+
- id: output_file
160+
run: ../../../expressions/create-file/1.0.0/create-file__1.0.0.cwl
161+
125162
outputs:
126163
# Collect everything
127164
interop_output_dir:
@@ -142,3 +179,12 @@ outputs:
142179
The HTML report generated by the multiqc step
143180
type: File
144181
outputSource: run_multiqc_step/output_file
182+
multiqc_qlims_csv_report:
183+
label: multiqc qlims csv report
184+
doc: |
185+
The CSV required by qlims for ingestion generated from the multiqc step
186+
type: File
187+
outputSource: rename_qc_csv_step/output_file
188+
189+
190+

0 commit comments

Comments
 (0)