From 8b2b095f4b8085276b1081e7f676d82e89d41ecd Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 1 Aug 2024 06:36:57 +0000 Subject: [PATCH] Updated .dockstore.yml and packed json to include /home/runner/work/cwl-ica/cwl-ica/workflows/dragen-somatic-with-germline-pipeline/4.2.4/dragen-somatic-with-germline-pipeline__4.2.4.cwl with tags dragen-somatic-with-germline-pipeline/4.2.4, dragen-somatic-with-germline-pipeline/4.2.4__20240801063441 --- .dockstore.yml | 1 + ...h-germline-pipeline__4.2.4.packed.cwl.json | 198 +++++++++++++++--- 2 files changed, 171 insertions(+), 28 deletions(-) diff --git a/.dockstore.yml b/.dockstore.yml index 1f797715..8424a2ce 100644 --- a/.dockstore.yml +++ b/.dockstore.yml @@ -54,6 +54,7 @@ workflows: tags: - dragen-somatic-with-germline-pipeline/4.2.4 - dragen-somatic-with-germline-pipeline/4.2.4__20240627054304 + - dragen-somatic-with-germline-pipeline/4.2.4__20240801063441 - name: rnasum-pipeline_1_0_0 subclass: CWL primaryDescriptorPath: /.dockstore/rnasum-pipeline/1.0.0/rnasum-pipeline__1.0.0.packed.cwl.json diff --git a/.dockstore/dragen-somatic-with-germline-pipeline/4.2.4/dragen-somatic-with-germline-pipeline__4.2.4.packed.cwl.json b/.dockstore/dragen-somatic-with-germline-pipeline/4.2.4/dragen-somatic-with-germline-pipeline__4.2.4.packed.cwl.json index 776ffcb1..17f5773e 100644 --- a/.dockstore/dragen-somatic-with-germline-pipeline/4.2.4/dragen-somatic-with-germline-pipeline__4.2.4.packed.cwl.json +++ b/.dockstore/dragen-somatic-with-germline-pipeline/4.2.4/dragen-somatic-with-germline-pipeline__4.2.4.packed.cwl.json @@ -8,7 +8,7 @@ "requirements": [ { "expressionLib": [ - "/* Author:Alexis Lucattini */\n/* For assistance on generation of typescript expressions */\n/* In CWL, please visit our wiki page at https://github.com/umccr/cwl-ica/wiki/TypeScript */\n/* Imports */\n/* Functions */\nfunction is_not_null(input_obj) {\n /*\n Determine if input object is defined and is not null\n */\n return !(input_obj === null || input_obj === undefined);\n}\nfunction get_attribute_from_optional_input(input_object, attribute) {\n /*\n Get attribute from optional input -\n If input is not defined, then return null\n */\n if (input_object === null || input_object === undefined) {\n return null;\n }\n else {\n return get_optional_attribute_from_object(input_object, attribute);\n }\n}\nfunction get_optional_attribute_from_object(input_object, attribute) {\n /*\n Get attribute from object, if attribute is not defined return null\n Assume the input object is an object of key value pairs where we know the key is of type string\n stackoverflow.com/questions/56833469/typescript-error-ts7053-element-implicitly-has-an-any-type\n */\n if (input_object.hasOwnProperty(attribute)) {\n return input_object[attribute];\n }\n else {\n return null;\n }\n}\nfunction get_bool_value_as_str(input_bool) {\n if (is_not_null(input_bool) && input_bool) {\n return \"true\";\n }\n else {\n return \"false\";\n }\n}\nfunction boolean_to_int(input_bool) {\n if (is_not_null(input_bool) && String(input_bool).toLowerCase() === \"true\") {\n return 1;\n }\n else {\n return 0;\n }\n}\nfunction get_optional_attribute_from_multi_type_input_object(object, attribute) {\n /*\n Get attribute from optional input\n */\n if (object === null || object === undefined) {\n return null;\n }\n else if (typeof object === \"object\") {\n /* Get attribute from optional input */\n return get_attribute_from_optional_input(object, attribute);\n }\n else {\n /* Object is likely actually a str */\n return object;\n }\n}\nfunction get_source_a_or_b(input_a, input_b) {\n /*\n Get the first input parameter if it is not null\n Otherwise return the second parameter\n Otherwise return null\n */\n if (is_not_null(input_a)) {\n return input_a;\n }\n else if (is_not_null(input_b)) {\n return input_b;\n }\n else {\n return null;\n }\n}\nfunction get_first_non_null_input(inputs) {\n /*\n Get first element of the array that is not null\n */\n for (var _i = 0, inputs_1 = inputs; _i < inputs_1.length; _i++) {\n var input_element = inputs_1[_i];\n if (is_not_null(input_element)) {\n return input_element;\n }\n }\n return null;\n}\n" + "/* Author:Alexis Lucattini */\n/* For assistance on generation of typescript expressions */\n/* In CWL, please visit our wiki page at https://github.com/umccr/cwl-ica/wiki/TypeScript */\n/* Imports */\n/* Functions */\nfunction is_not_null(input_obj) {\n /*\n Determine if input object is defined and is not null\n */\n return !(input_obj === null || input_obj === undefined);\n}\nfunction get_attribute_from_optional_input(input_object, attribute) {\n /*\n Get attribute from optional input -\n If input is not defined, then return null\n */\n if (input_object === null || input_object === undefined) {\n return null;\n }\n else {\n return get_optional_attribute_from_object(input_object, attribute);\n }\n}\nfunction get_optional_attribute_from_object(input_object, attribute) {\n /*\n Get attribute from object, if attribute is not defined return null\n Assume the input object is an object of key value pairs where we know the key is of type string\n stackoverflow.com/questions/56833469/typescript-error-ts7053-element-implicitly-has-an-any-type\n */\n if (input_object.hasOwnProperty(attribute)) {\n return input_object[attribute];\n }\n else {\n return null;\n }\n}\nfunction get_bool_value_as_str(input_bool) {\n if (is_not_null(input_bool) && input_bool) {\n return \"true\";\n }\n else {\n return \"false\";\n }\n}\nfunction boolean_to_int(input_bool) {\n if (is_not_null(input_bool) && String(input_bool).toLowerCase() === \"true\") {\n return 1;\n }\n else {\n return 0;\n }\n}\nfunction get_optional_attribute_from_multi_type_input_object(object, attribute) {\n /*\n Get attribute from optional input\n */\n if (object === null || object === undefined) {\n return null;\n }\n else if (typeof object === \"object\") {\n /* Get attribute from optional input */\n return get_attribute_from_optional_input(object, attribute);\n }\n else {\n /* Object is likely actually a str */\n return object;\n }\n}\nfunction get_source_a_or_b(input_a, input_b) {\n /*\n Get the first input parameter if it is not null\n Otherwise return the second parameter\n Otherwise return null\n */\n if (is_not_null(input_a)) {\n return input_a;\n }\n else if (is_not_null(input_b)) {\n return input_b;\n }\n else {\n return null;\n }\n}\nfunction get_first_non_null_input(inputs) {\n /*\n Get first element of the array that is not null\n */\n for (var _i = 0, inputs_1 = inputs; _i < inputs_1.length; _i++) {\n var input_element = inputs_1[_i];\n if (is_not_null(input_element)) {\n return input_element;\n }\n }\n return null;\n}\nfunction get_attribute_list_from_object_list(obj_list, attribute) {\n /*\n Get attribute from list of objects\n If an object is null, it is not included in the return list\n */\n return obj_list.filter(function (x) { return x !== null; }).map(function (x) { return get_optional_attribute_from_object(x, attribute); });\n}\nfunction get_str_list_as_bash_array(input_list, item_wrap) {\n /*\n Convert a list of strings to a bash array, if the list is not defined return null\n */\n if (input_list === null) {\n return null;\n }\n if (item_wrap === null) {\n return \"( \".concat(input_list.map(function (x) { return \"'\".concat(item_wrap).concat(x).concat(item_wrap, \"'\"); }).join(' '), \" )\");\n }\n return \"( \".concat(input_list.map(function (x) { return \"'\".concat(x, \"'\"); }).join(' '), \" )\");\n}\nfunction get_object_attribute_list_as_bash_array(obj_list, attribute) {\n /*\n Get attribute from list of objects and convert to a bash array\n Do not include null values in the array\n */\n return get_str_list_as_bash_array(get_attribute_list_from_object_list(obj_list, attribute).filter(function (x) { return x !== null; }));\n}\n" ], "class": "InlineJavascriptRequirement" } @@ -138,7 +138,7 @@ "listing": [ { "entryname": "$(get_script_path())", - "entry": "#!/usr/bin/env bash\n\n# Fail on non-zero exit of subshell\nset -euo pipefail\n\n# Run partial reconfig\n/opt/edico/bin/dragen \\\\\n --partial-reconfig HMM \\\\\n --ignore-version-check true\n\n# Create directories\nmkdir --parents \\\\\n \"$(get_ref_mount())\" \\\\\n \"$(get_intermediate_results_dir())\" \\\\\n \"$(inputs.output_directory)\"\n\n# untar ref data into scratch space\ntar \\\\\n --directory \"$(get_ref_mount())\" \\\\\n --extract \\\\\n --file \"$(inputs.reference_tar.path)\"\n\n# Confirm either of fastq_list, fastq_list_rows or bam_input is defined\nif [[ \"$(boolean_to_int(is_not_null(inputs.fastq_list)) + boolean_to_int(is_not_null(inputs.fastq_list_rows)) + boolean_to_int(is_not_null(inputs.bam_input)))\" -ne \"1\" ]]; then\n echo \"Please set one and only one of fastq_list, fastq_list_rows and bam_input for normal sample\" 1>&2\n exit 1\nfi\n\n# Run dragen command and import options from cli\n\"$(get_dragen_bin_path())\" \"\\${@}\"\n" + "entry": "#!/usr/bin/env bash\n\n# Fail on non-zero exit of subshell\nset -euo pipefail\n\n# Run partial reconfig\n/opt/edico/bin/dragen \\\\\n --partial-reconfig HMM \\\\\n --ignore-version-check true\n\n# Create directories\nmkdir --parents \\\\\n \"$(get_ref_mount())\" \\\\\n \"$(get_intermediate_results_dir())\" \\\\\n \"$(inputs.output_directory)\"\n\n# untar ref data into scratch space\ntar \\\\\n --directory \"$(get_ref_mount())\" \\\\\n --extract \\\\\n --file \"$(inputs.reference_tar.path)\"\n\n# Confirm either of fastq_list, fastq_list_rows, bam_input or cram_input is defined\nif [[ \"$(boolean_to_int(is_not_null(inputs.fastq_list)) + boolean_to_int(is_not_null(inputs.fastq_list_rows)) + boolean_to_int(is_not_null(inputs.bam_input)) + boolean_to_int(is_not_null(inputs.cram_input)))\" -ne \"1\" ]]; then\n echo \"Please set one and only one of fastq_list, fastq_list_rows and bam_input for normal sample\" 1>&2\n exit 1\nfi\n\n# Run dragen command and import options from cli\n\"$(get_dragen_bin_path())\" \"\\${@}\"\n" }, "${\n return generate_germline_mount_points(inputs);\n}\n" ], @@ -146,13 +146,13 @@ }, { "expressionLib": [ - "/* Author:Alexis Lucattini */\n/* For assistance on generation of typescript expressions */\n/* In CWL, please visit our wiki page at https://github.com/umccr/cwl-ica/wiki/TypeScript */\n/* Imports */\n/* Functions */\nfunction get_script_path() {\n /*\n Abstract script path, can then be referenced in baseCommand attribute too\n Makes things more readable.\n */\n return \"run-dragen-script.sh\";\n}\nfunction get_scratch_mount() {\n /*\n Return the path of the scratch directory space\n */\n return \"/scratch/\";\n}\nfunction get_intermediate_results_dir() {\n /*\n Get intermediate results directory as /scratch for dragen runs\n */\n return get_scratch_mount() + \"intermediate-results/\";\n}\nfunction get_name_root_from_tarball(basename) {\n var tar_ball_regex = /(\\S+)\\.tar\\.gz/g;\n var tar_ball_expression = tar_ball_regex.exec(basename);\n if (tar_ball_expression === null) {\n throw new Error(\"Could not get nameroot from \".concat(basename));\n }\n return tar_ball_expression[1];\n}\nfunction get_ref_path(reference_input_obj) {\n /*\n Get the reference path\n */\n return get_ref_mount() + get_name_root_from_tarball(reference_input_obj.basename) + \"/\";\n}\nfunction get_ref_mount() {\n /*\n Get the reference mount point\n */\n return get_scratch_mount() + \"ref/\";\n}\nfunction get_dragen_bin_path() {\n /*\n Get dragen bin path\n */\n return \"/opt/edico/bin/dragen\";\n}\nfunction get_dragen_eval_line() {\n /*\n Return string\n */\n return \"eval \\\"\" + get_dragen_bin_path() + \"\\\" '\\\"\\$@\\\"' \\n\";\n}\nfunction get_fastq_list_csv_path() {\n /*\n The fastq list path must be placed in working directory\n */\n return \"fastq_list.csv\";\n}\nfunction get_tumor_fastq_list_csv_path() {\n /*\n The tumor fastq list path must be placed in working directory\n */\n return \"tumor_fastq_list.csv\";\n}\nfunction get_normal_name_from_fastq_list_rows(fastq_list_rows) {\n /*\n Get the normal sample name from the fastq list rows object\n */\n /*\n Check fastq list rows is defined\n */\n if (fastq_list_rows === undefined || fastq_list_rows === null) {\n return null;\n }\n /*\n Get RGSM value and return\n */\n return fastq_list_rows[0].rgsm;\n}\nfunction get_normal_name_from_fastq_list_csv(fastq_list_csv) {\n /*\n Get the normal name from the fastq list csv...\n */\n /*\n Check file is defined\n */\n if (fastq_list_csv === undefined || fastq_list_csv === null) {\n return null;\n }\n /*\n Check contents are defined\n */\n if (fastq_list_csv.contents === null || fastq_list_csv.contents === undefined) {\n return null;\n }\n /*\n Confirm fastq list csv is of type File\n */\n if (fastq_list_csv.class !== \"File\") {\n throw new Error(\"Could not confirm input fastq_list_csv is of type File\");\n }\n /*\n Split contents by line\n */\n var contents_by_line = [];\n fastq_list_csv.contents.split(\"\\n\").forEach(function (line_content) {\n var stripped_line_content = line_content.replace(/(\\r\\n|\\n|\\r)/gm, \"\");\n if (stripped_line_content !== \"\") {\n contents_by_line.push(stripped_line_content);\n }\n });\n var column_names = contents_by_line[0].split(\",\");\n /*\n Get RGSM index value (which column is RGSM at?)\n */\n var rgsm_index = column_names.indexOf(\"RGSM\");\n /*\n RGSM is not in index. Return null\n */\n if (rgsm_index === -1) {\n return null;\n }\n /*\n Get RGSM value of first row and return\n */\n return contents_by_line[1].split(\",\")[rgsm_index];\n}\nfunction get_normal_output_prefix(inputs) {\n var _a;\n /*\n Get the normal RGSM value and then add _normal to it\n */\n var normal_name = null;\n var normal_re_replacement = /_normal$/;\n /*\n Check if bam_input is set\n */\n if (inputs.bam_input !== null && inputs.bam_input !== undefined) {\n /* Remove _normal from nameroot if it already exists */\n /* We dont want _normal_normal as a suffix */\n return \"\".concat((_a = inputs.bam_input.nameroot) === null || _a === void 0 ? void 0 :_a.replace(normal_re_replacement, \"\"), \"_normal\");\n }\n /*\n Check if fastq list file is set\n */\n if (inputs.fastq_list !== null && inputs.fastq_list !== undefined) {\n normal_name = get_normal_name_from_fastq_list_csv(inputs.fastq_list);\n if (normal_name !== null) {\n return \"\".concat(normal_name, \"_normal\");\n }\n }\n /*\n Otherwise collect and return from schema object\n */\n normal_name = get_normal_name_from_fastq_list_rows(inputs.fastq_list_rows);\n return \"\".concat(normal_name, \"_normal\");\n}\nfunction build_fastq_list_csv_header(header_names) {\n /*\n Convert lowercase labels to uppercase values\n i.e\n [ \"rgid\", \"rglb\", \"rgsm\", \"lane\", \"read_1\", \"read_2\" ]\n to\n \"RGID,RGLB,RGSM,Lane,Read1File,Read2File\"\n */\n var modified_header_names = [];\n for (var _i = 0, header_names_1 = header_names; _i < header_names_1.length; _i++) {\n var header_name = header_names_1[_i];\n if (header_name.indexOf(\"rg\") === 0) {\n /*\n rgid -> RGID\n */\n modified_header_names.push(header_name.toUpperCase());\n }\n else if (header_name.indexOf(\"read\") === 0) {\n /*\n read_1 -> Read1File\n */\n modified_header_names.push(\"Read\" + header_name.charAt(header_name.length - 1) + \"File\");\n }\n else {\n /*\n lane to Lane\n */\n modified_header_names.push(header_name[0].toUpperCase() + header_name.substr(1));\n }\n }\n /*\n Convert array to comma separated strings\n */\n return modified_header_names.join(\",\") + \"\\n\";\n}\nfunction get_fastq_list_row_as_csv_row(fastq_list_row, row_order) {\n var fastq_list_row_values_array = [];\n /* This for loop is here to ensure were assigning values in the same order as the header */\n for (var _i = 0, row_order_1 = row_order; _i < row_order_1.length; _i++) {\n var item_index = row_order_1[_i];\n var found_item = false;\n /* Find matching attribute in this row */\n for (var _a = 0, _b = Object.getOwnPropertyNames(fastq_list_row); _a < _b.length; _a++) {\n var fastq_list_row_field_name = _b[_a];\n var fastq_list_row_field_value = fastq_list_row[fastq_list_row_field_name];\n if (fastq_list_row_field_value === null) {\n /*\n Item not found, add an empty attribute for this cell in the csv\n */\n continue;\n }\n /* The header value matches the name in the item */\n if (fastq_list_row_field_name === item_index) {\n /*\n If the field value has a class attribute then it's either read_1 or read_2\n */\n if (fastq_list_row_field_value.hasOwnProperty(\"class\")) {\n var fastq_list_row_field_value_file = fastq_list_row_field_value;\n /*\n Assert that this is actually of class file\n */\n if (fastq_list_row_field_value_file.class !== \"File\") {\n continue;\n }\n if (fastq_list_row_field_value_file.path !== null && fastq_list_row_field_value_file.path !== undefined) {\n /*\n Push the path attribute to the fastq list csv row if it is not null\n */\n fastq_list_row_values_array.push(fastq_list_row_field_value_file.path);\n }\n else {\n /*\n Otherwise push the location attribute\n */\n fastq_list_row_values_array.push(fastq_list_row_field_value_file.location);\n }\n }\n else {\n /*\n Push the string attribute to the fastq list csv row\n */\n fastq_list_row_values_array.push(fastq_list_row_field_value.toString());\n }\n found_item = true;\n break;\n }\n }\n if (!found_item) {\n /*\n Push blank cell if no item found\n */\n fastq_list_row_values_array.push(\"\");\n }\n }\n /*\n Convert to string and return as string\n */\n return fastq_list_row_values_array.join(\",\") + \"\\n\";\n}\nfunction generate_fastq_list_csv(fastq_list_rows) {\n /*\n Fastq list rows generation\n */\n var fastq_csv_file = {\n class:\"File\",\n basename:get_fastq_list_csv_path()\n };\n /*\n Set the row order\n */\n var row_order = [];\n /*\n Set the array order\n Make sure we iterate through all rows of the array\n */\n for (var _i = 0, fastq_list_rows_1 = fastq_list_rows; _i < fastq_list_rows_1.length; _i++) {\n var fastq_list_row = fastq_list_rows_1[_i];\n for (var _a = 0, _b = Object.getOwnPropertyNames(fastq_list_row); _a < _b.length; _a++) {\n var fastq_list_row_field_name = _b[_a];\n if (row_order.indexOf(fastq_list_row_field_name) === -1) {\n row_order.push(fastq_list_row_field_name);\n }\n }\n }\n /*\n Make header\n */\n fastq_csv_file.contents = build_fastq_list_csv_header(row_order);\n /*\n For each fastq list row,\n collect the values of each attribute but in the order of the header\n */\n for (var _c = 0, fastq_list_rows_2 = fastq_list_rows; _c < fastq_list_rows_2.length; _c++) {\n var fastq_list_row = fastq_list_rows_2[_c];\n /* Add csv row to file contents */\n fastq_csv_file.contents += get_fastq_list_row_as_csv_row(fastq_list_row, row_order);\n }\n return fastq_csv_file;\n}\nfunction generate_germline_mount_points(inputs) {\n /*\n Create and add in the fastq list csv for the input fastqs\n */\n var e = [];\n if (inputs.fastq_list_rows !== null) {\n e.push({\n \"entryname\":get_fastq_list_csv_path(),\n \"entry\":generate_fastq_list_csv(inputs.fastq_list_rows)\n });\n }\n if (inputs.fastq_list !== null) {\n e.push({\n \"entryname\":get_fastq_list_csv_path(),\n \"entry\":inputs.fastq_list\n });\n }\n /*\n Return file paths\n */\n /* @ts-ignore Type '{ entryname:string; entry:FileProperties; }[]' is not assignable to type 'DirentProperties[]' */\n return e;\n}\nfunction generate_somatic_mount_points(inputs) {\n /*\n Create and add in the fastq list csv for the input fastqs\n */\n var e = [];\n if (inputs.fastq_list_rows !== null) {\n e.push({\n \"entryname\":get_fastq_list_csv_path(),\n \"entry\":generate_fastq_list_csv(inputs.fastq_list_rows)\n });\n }\n if (inputs.tumor_fastq_list_rows !== null) {\n e.push({\n \"entryname\":get_tumor_fastq_list_csv_path(),\n \"entry\":generate_fastq_list_csv(inputs.tumor_fastq_list_rows)\n });\n }\n if (inputs.fastq_list !== null) {\n e.push({\n \"entryname\":get_fastq_list_csv_path(),\n \"entry\":inputs.fastq_list\n });\n }\n if (inputs.tumor_fastq_list !== null) {\n e.push({\n \"entryname\":get_tumor_fastq_list_csv_path(),\n \"entry\":inputs.tumor_fastq_list\n });\n }\n /*\n Return file paths\n */\n /* @ts-ignore Type '{ entryname:string; entry:FileProperties; }[]' is not assignable to type 'DirentProperties[]' */\n return e;\n}\nfunction generate_transcriptome_mount_points(inputs) {\n /*\n Calls another function that generates mount points\n */\n return generate_germline_mount_points(inputs);\n}\n/* Custom functions for dragen reference tarball build */\nfunction get_liftover_dir() {\n /* Hardcoded liftover directory in dragen 4.2 */\n return \"/opt/edico/liftover/\";\n}\nfunction get_mask_dir() {\n /* Hardcoded mask directory in dragen 4.2 */\n return \"/opt/edico/fasta_mask/\";\n}\nfunction get_ref_scratch_dir(reference_name) {\n /* We get the reference scratch directory as a combination of */\n /* the dragen scratch mount and the reference name */\n return get_scratch_mount() + reference_name + \"/\";\n}\n", - "/* Author:Alexis Lucattini */\n/* For assistance on generation of typescript expressions */\n/* In CWL, please visit our wiki page at https://github.com/umccr/cwl-ica/wiki/TypeScript */\n/* Imports */\n/* Functions */\nfunction is_not_null(input_obj) {\n /*\n Determine if input object is defined and is not null\n */\n return !(input_obj === null || input_obj === undefined);\n}\nfunction get_attribute_from_optional_input(input_object, attribute) {\n /*\n Get attribute from optional input -\n If input is not defined, then return null\n */\n if (input_object === null || input_object === undefined) {\n return null;\n }\n else {\n return get_optional_attribute_from_object(input_object, attribute);\n }\n}\nfunction get_optional_attribute_from_object(input_object, attribute) {\n /*\n Get attribute from object, if attribute is not defined return null\n Assume the input object is an object of key value pairs where we know the key is of type string\n stackoverflow.com/questions/56833469/typescript-error-ts7053-element-implicitly-has-an-any-type\n */\n if (input_object.hasOwnProperty(attribute)) {\n return input_object[attribute];\n }\n else {\n return null;\n }\n}\nfunction get_bool_value_as_str(input_bool) {\n if (is_not_null(input_bool) && input_bool) {\n return \"true\";\n }\n else {\n return \"false\";\n }\n}\nfunction boolean_to_int(input_bool) {\n if (is_not_null(input_bool) && String(input_bool).toLowerCase() === \"true\") {\n return 1;\n }\n else {\n return 0;\n }\n}\nfunction get_optional_attribute_from_multi_type_input_object(object, attribute) {\n /*\n Get attribute from optional input\n */\n if (object === null || object === undefined) {\n return null;\n }\n else if (typeof object === \"object\") {\n /* Get attribute from optional input */\n return get_attribute_from_optional_input(object, attribute);\n }\n else {\n /* Object is likely actually a str */\n return object;\n }\n}\nfunction get_source_a_or_b(input_a, input_b) {\n /*\n Get the first input parameter if it is not null\n Otherwise return the second parameter\n Otherwise return null\n */\n if (is_not_null(input_a)) {\n return input_a;\n }\n else if (is_not_null(input_b)) {\n return input_b;\n }\n else {\n return null;\n }\n}\nfunction get_first_non_null_input(inputs) {\n /*\n Get first element of the array that is not null\n */\n for (var _i = 0, inputs_1 = inputs; _i < inputs_1.length; _i++) {\n var input_element = inputs_1[_i];\n if (is_not_null(input_element)) {\n return input_element;\n }\n }\n return null;\n}\n" + "/* Author:Alexis Lucattini */\n/* For assistance on generation of typescript expressions */\n/* In CWL, please visit our wiki page at https://github.com/umccr/cwl-ica/wiki/TypeScript */\n/* Imports */\n/* Functions */\nfunction get_script_path() {\n /*\n Abstract script path, can then be referenced in baseCommand attribute too\n Makes things more readable.\n */\n return \"run-dragen-script.sh\";\n}\nfunction get_scratch_mount() {\n /*\n Return the path of the scratch directory space\n */\n return \"/tmp/\";\n}\nfunction get_intermediate_results_dir() {\n /*\n Get intermediate results directory as /scratch for dragen runs\n */\n return get_scratch_mount() + \"intermediate-results/\";\n}\nfunction get_name_root_from_tarball(basename) {\n var tar_ball_regex = /(\\S+)\\.tar\\.gz/g;\n var tar_ball_expression = tar_ball_regex.exec(basename);\n if (tar_ball_expression === null) {\n throw new Error(\"Could not get nameroot from \".concat(basename));\n }\n return tar_ball_expression[1];\n}\nfunction get_ref_path(reference_input_obj) {\n /*\n Get the reference path\n */\n return get_ref_mount() + get_name_root_from_tarball(reference_input_obj.basename) + \"/\";\n}\nfunction get_ref_mount() {\n /*\n Get the reference mount point\n */\n return get_scratch_mount() + \"ref/\";\n}\nfunction get_dragen_bin_path() {\n /*\n Get dragen bin path\n */\n return \"/opt/edico/bin/dragen\";\n}\nfunction get_dragen_eval_line() {\n /*\n Return string\n */\n return \"eval \\\"\" + get_dragen_bin_path() + \"\\\" '\\\"\\$@\\\"' \\n\";\n}\nfunction get_fastq_list_csv_path() {\n /*\n The fastq list path must be placed in working directory\n */\n return \"fastq_list.csv\";\n}\nfunction get_tumor_fastq_list_csv_path() {\n /*\n The tumor fastq list path must be placed in working directory\n */\n return \"tumor_fastq_list.csv\";\n}\nfunction get_normal_name_from_fastq_list_rows(fastq_list_rows) {\n /*\n Get the normal sample name from the fastq list rows object\n */\n /*\n Check fastq list rows is defined\n */\n if (fastq_list_rows === undefined || fastq_list_rows === null) {\n return null;\n }\n /*\n Get RGSM value and return\n */\n return fastq_list_rows[0].rgsm;\n}\nfunction get_normal_name_from_fastq_list_csv(fastq_list_csv) {\n /*\n Get the normal name from the fastq list csv...\n */\n /*\n Check file is defined\n */\n if (fastq_list_csv === undefined || fastq_list_csv === null) {\n return null;\n }\n /*\n Check contents are defined\n */\n if (fastq_list_csv.contents === null || fastq_list_csv.contents === undefined) {\n return null;\n }\n /*\n Confirm fastq list csv is of type File\n */\n if (fastq_list_csv.class !== \"File\") {\n throw new Error(\"Could not confirm input fastq_list_csv is of type File\");\n }\n /*\n Split contents by line\n */\n var contents_by_line = [];\n fastq_list_csv.contents.split(\"\\n\").forEach(function (line_content) {\n var stripped_line_content = line_content.replace(/(\\r\\n|\\n|\\r)/gm, \"\");\n if (stripped_line_content !== \"\") {\n contents_by_line.push(stripped_line_content);\n }\n });\n var column_names = contents_by_line[0].split(\",\");\n /*\n Get RGSM index value (which column is RGSM at?)\n */\n var rgsm_index = column_names.indexOf(\"RGSM\");\n /*\n RGSM is not in index. Return null\n */\n if (rgsm_index === -1) {\n return null;\n }\n /*\n Get RGSM value of first row and return\n */\n return contents_by_line[1].split(\",\")[rgsm_index];\n}\nfunction get_normal_output_prefix(inputs) {\n var _a, _b;\n /*\n Get the normal RGSM value and then add _normal to it\n */\n var normal_name = null;\n var normal_re_replacement = /_normal$/;\n /*\n Check if bam_input is set\n */\n if (inputs.bam_input !== null && inputs.bam_input !== undefined) {\n /* Remove _normal from nameroot if it already exists */\n /* We dont want _normal_normal as a suffix */\n return \"\".concat((_a = inputs.bam_input.nameroot) === null || _a === void 0 ? void 0 :_a.replace(normal_re_replacement, \"\"), \"_normal\");\n }\n /*\n Check if cram_input is set\n */\n if (inputs.cram_input !== null && inputs.cram_input !== undefined) {\n /* Remove _normal from nameroot if it already exists */\n /* We dont want _normal_normal as a suffix */\n return \"\".concat((_b = inputs.cram_input.nameroot) === null || _b === void 0 ? void 0 :_b.replace(normal_re_replacement, \"\"), \"_normal\");\n }\n /*\n Check if fastq list file is set\n */\n if (inputs.fastq_list !== null && inputs.fastq_list !== undefined) {\n normal_name = get_normal_name_from_fastq_list_csv(inputs.fastq_list);\n if (normal_name !== null) {\n return \"\".concat(normal_name, \"_normal\");\n }\n }\n /*\n Otherwise collect and return from schema object\n */\n normal_name = get_normal_name_from_fastq_list_rows(inputs.fastq_list_rows);\n return \"\".concat(normal_name, \"_normal\");\n}\nfunction build_fastq_list_csv_header(header_names) {\n /*\n Convert lowercase labels to uppercase values\n i.e\n [ \"rgid\", \"rglb\", \"rgsm\", \"lane\", \"read_1\", \"read_2\" ]\n to\n \"RGID,RGLB,RGSM,Lane,Read1File,Read2File\"\n */\n var modified_header_names = [];\n for (var _i = 0, header_names_1 = header_names; _i < header_names_1.length; _i++) {\n var header_name = header_names_1[_i];\n if (header_name.indexOf(\"rg\") === 0) {\n /*\n rgid -> RGID\n */\n modified_header_names.push(header_name.toUpperCase());\n }\n else if (header_name.indexOf(\"read\") === 0) {\n /*\n read_1 -> Read1File\n */\n modified_header_names.push(\"Read\" + header_name.charAt(header_name.length - 1) + \"File\");\n }\n else {\n /*\n lane to Lane\n */\n modified_header_names.push(header_name[0].toUpperCase() + header_name.substr(1));\n }\n }\n /*\n Convert array to comma separated strings\n */\n return modified_header_names.join(\",\") + \"\\n\";\n}\nfunction get_fastq_list_row_as_csv_row(fastq_list_row, row_order) {\n var fastq_list_row_values_array = [];\n /* This for loop is here to ensure were assigning values in the same order as the header */\n for (var _i = 0, row_order_1 = row_order; _i < row_order_1.length; _i++) {\n var item_index = row_order_1[_i];\n var found_item = false;\n /* Find matching attribute in this row */\n for (var _a = 0, _b = Object.getOwnPropertyNames(fastq_list_row); _a < _b.length; _a++) {\n var fastq_list_row_field_name = _b[_a];\n var fastq_list_row_field_value = fastq_list_row[fastq_list_row_field_name];\n if (fastq_list_row_field_value === null) {\n /*\n Item not found, add an empty attribute for this cell in the csv\n */\n continue;\n }\n /* The header value matches the name in the item */\n if (fastq_list_row_field_name === item_index) {\n /*\n If the field value has a class attribute then it's either read_1 or read_2\n */\n if (fastq_list_row_field_value.hasOwnProperty(\"class\")) {\n var fastq_list_row_field_value_file = fastq_list_row_field_value;\n /*\n Assert that this is actually of class file\n */\n if (fastq_list_row_field_value_file.class !== \"File\") {\n continue;\n }\n if (fastq_list_row_field_value_file.path !== null && fastq_list_row_field_value_file.path !== undefined) {\n /*\n Push the path attribute to the fastq list csv row if it is not null\n */\n fastq_list_row_values_array.push(fastq_list_row_field_value_file.path);\n }\n else {\n /*\n Otherwise push the location attribute\n */\n fastq_list_row_values_array.push(fastq_list_row_field_value_file.location);\n }\n }\n else {\n /*\n Push the string attribute to the fastq list csv row\n */\n fastq_list_row_values_array.push(fastq_list_row_field_value.toString());\n }\n found_item = true;\n break;\n }\n }\n if (!found_item) {\n /*\n Push blank cell if no item found\n */\n fastq_list_row_values_array.push(\"\");\n }\n }\n /*\n Convert to string and return as string\n */\n return fastq_list_row_values_array.join(\",\") + \"\\n\";\n}\nfunction generate_fastq_list_csv(fastq_list_rows) {\n /*\n Fastq list rows generation\n */\n var fastq_csv_file = {\n class:\"File\",\n basename:get_fastq_list_csv_path()\n };\n /*\n Set the row order\n */\n var row_order = [];\n /*\n Set the array order\n Make sure we iterate through all rows of the array\n */\n for (var _i = 0, fastq_list_rows_1 = fastq_list_rows; _i < fastq_list_rows_1.length; _i++) {\n var fastq_list_row = fastq_list_rows_1[_i];\n for (var _a = 0, _b = Object.getOwnPropertyNames(fastq_list_row); _a < _b.length; _a++) {\n var fastq_list_row_field_name = _b[_a];\n if (row_order.indexOf(fastq_list_row_field_name) === -1) {\n row_order.push(fastq_list_row_field_name);\n }\n }\n }\n /*\n Make header\n */\n fastq_csv_file.contents = build_fastq_list_csv_header(row_order);\n /*\n For each fastq list row,\n collect the values of each attribute but in the order of the header\n */\n for (var _c = 0, fastq_list_rows_2 = fastq_list_rows; _c < fastq_list_rows_2.length; _c++) {\n var fastq_list_row = fastq_list_rows_2[_c];\n /* Add csv row to file contents */\n fastq_csv_file.contents += get_fastq_list_row_as_csv_row(fastq_list_row, row_order);\n }\n return fastq_csv_file;\n}\nfunction generate_germline_mount_points(inputs) {\n /*\n Create and add in the fastq list csv for the input fastqs\n */\n var e = [];\n if (inputs.fastq_list_rows !== null) {\n e.push({\n \"entryname\":get_fastq_list_csv_path(),\n \"entry\":generate_fastq_list_csv(inputs.fastq_list_rows)\n });\n }\n if (inputs.fastq_list !== null) {\n e.push({\n \"entryname\":get_fastq_list_csv_path(),\n \"entry\":inputs.fastq_list\n });\n }\n /*\n Return file paths\n */\n /* @ts-ignore Type '{ entryname:string; entry:FileProperties; }[]' is not assignable to type 'DirentProperties[]' */\n return e;\n}\nfunction generate_somatic_mount_points(inputs) {\n /*\n Create and add in the fastq list csv for the input fastqs\n */\n var e = [];\n if (inputs.fastq_list_rows !== null) {\n e.push({\n \"entryname\":get_fastq_list_csv_path(),\n \"entry\":generate_fastq_list_csv(inputs.fastq_list_rows)\n });\n }\n if (inputs.tumor_fastq_list_rows !== null) {\n e.push({\n \"entryname\":get_tumor_fastq_list_csv_path(),\n \"entry\":generate_fastq_list_csv(inputs.tumor_fastq_list_rows)\n });\n }\n if (inputs.fastq_list !== null) {\n e.push({\n \"entryname\":get_fastq_list_csv_path(),\n \"entry\":inputs.fastq_list\n });\n }\n if (inputs.tumor_fastq_list !== null) {\n e.push({\n \"entryname\":get_tumor_fastq_list_csv_path(),\n \"entry\":inputs.tumor_fastq_list\n });\n }\n /*\n Return file paths\n */\n /* @ts-ignore Type '{ entryname:string; entry:FileProperties; }[]' is not assignable to type 'DirentProperties[]' */\n return e;\n}\nfunction generate_transcriptome_mount_points(inputs) {\n /*\n Calls another function that generates mount points\n */\n return generate_germline_mount_points(inputs);\n}\n/* Custom functions for dragen reference tarball build */\nfunction get_liftover_dir() {\n /* Hardcoded liftover directory in dragen 4.2 */\n return \"/opt/edico/liftover/\";\n}\nfunction get_mask_dir() {\n /* Hardcoded mask directory in dragen 4.2 */\n return \"/opt/edico/fasta_mask/\";\n}\nfunction get_ref_scratch_dir(reference_name) {\n /* We get the reference scratch directory as a combination of */\n /* the dragen scratch mount and the reference name */\n return get_scratch_mount() + reference_name + \"/\";\n}\n", + "/* Author:Alexis Lucattini */\n/* For assistance on generation of typescript expressions */\n/* In CWL, please visit our wiki page at https://github.com/umccr/cwl-ica/wiki/TypeScript */\n/* Imports */\n/* Functions */\nfunction is_not_null(input_obj) {\n /*\n Determine if input object is defined and is not null\n */\n return !(input_obj === null || input_obj === undefined);\n}\nfunction get_attribute_from_optional_input(input_object, attribute) {\n /*\n Get attribute from optional input -\n If input is not defined, then return null\n */\n if (input_object === null || input_object === undefined) {\n return null;\n }\n else {\n return get_optional_attribute_from_object(input_object, attribute);\n }\n}\nfunction get_optional_attribute_from_object(input_object, attribute) {\n /*\n Get attribute from object, if attribute is not defined return null\n Assume the input object is an object of key value pairs where we know the key is of type string\n stackoverflow.com/questions/56833469/typescript-error-ts7053-element-implicitly-has-an-any-type\n */\n if (input_object.hasOwnProperty(attribute)) {\n return input_object[attribute];\n }\n else {\n return null;\n }\n}\nfunction get_bool_value_as_str(input_bool) {\n if (is_not_null(input_bool) && input_bool) {\n return \"true\";\n }\n else {\n return \"false\";\n }\n}\nfunction boolean_to_int(input_bool) {\n if (is_not_null(input_bool) && String(input_bool).toLowerCase() === \"true\") {\n return 1;\n }\n else {\n return 0;\n }\n}\nfunction get_optional_attribute_from_multi_type_input_object(object, attribute) {\n /*\n Get attribute from optional input\n */\n if (object === null || object === undefined) {\n return null;\n }\n else if (typeof object === \"object\") {\n /* Get attribute from optional input */\n return get_attribute_from_optional_input(object, attribute);\n }\n else {\n /* Object is likely actually a str */\n return object;\n }\n}\nfunction get_source_a_or_b(input_a, input_b) {\n /*\n Get the first input parameter if it is not null\n Otherwise return the second parameter\n Otherwise return null\n */\n if (is_not_null(input_a)) {\n return input_a;\n }\n else if (is_not_null(input_b)) {\n return input_b;\n }\n else {\n return null;\n }\n}\nfunction get_first_non_null_input(inputs) {\n /*\n Get first element of the array that is not null\n */\n for (var _i = 0, inputs_1 = inputs; _i < inputs_1.length; _i++) {\n var input_element = inputs_1[_i];\n if (is_not_null(input_element)) {\n return input_element;\n }\n }\n return null;\n}\nfunction get_attribute_list_from_object_list(obj_list, attribute) {\n /*\n Get attribute from list of objects\n If an object is null, it is not included in the return list\n */\n return obj_list.filter(function (x) { return x !== null; }).map(function (x) { return get_optional_attribute_from_object(x, attribute); });\n}\nfunction get_str_list_as_bash_array(input_list, item_wrap) {\n /*\n Convert a list of strings to a bash array, if the list is not defined return null\n */\n if (input_list === null) {\n return null;\n }\n if (item_wrap === null) {\n return \"( \".concat(input_list.map(function (x) { return \"'\".concat(item_wrap).concat(x).concat(item_wrap, \"'\"); }).join(' '), \" )\");\n }\n return \"( \".concat(input_list.map(function (x) { return \"'\".concat(x, \"'\"); }).join(' '), \" )\");\n}\nfunction get_object_attribute_list_as_bash_array(obj_list, attribute) {\n /*\n Get attribute from list of objects and convert to a bash array\n Do not include null values in the array\n */\n return get_str_list_as_bash_array(get_attribute_list_from_object_list(obj_list, attribute).filter(function (x) { return x !== null; }));\n}\n" ], "class": "InlineJavascriptRequirement" }, { - "tmpdirMin": "${\n /* 1 Tb */\n return 2 ** 20;\n}\n", + "tmpdirMin": "${\n /* 1 Tb */\n return Math.pow(2, 20);\n}\n", "class": "ResourceRequirement" }, { @@ -265,6 +265,44 @@ }, "id": "#dragen-germline__4.2.4.cwl/dragen-germline--4.2.4/cnv_enable_self_normalization" }, + { + "label": "cram input", + "doc": "Input a normal CRAM file for the variant calling stage\n", + "type": [ + "null", + "File" + ], + "inputBinding": { + "prefix": "--cram-input=", + "separate": false + }, + "secondaryFiles": [ + { + "pattern": ".crai", + "required": true + } + ], + "id": "#dragen-germline__4.2.4.cwl/dragen-germline--4.2.4/cram_input" + }, + { + "label": "cram reference", + "doc": "Path to the reference fasta file for the CRAM input.\nRequired only if the input is a cram file AND not the reference in the tarball\n", + "type": [ + "null", + "File" + ], + "inputBinding": { + "prefix": "--cram-reference=", + "separate": false + }, + "secondaryFiles": [ + { + "pattern": ".fai", + "required": true + } + ], + "id": "#dragen-germline__4.2.4.cwl/dragen-germline--4.2.4/cram_reference" + }, { "label": "dbsnp annotation", "doc": "In Germline, Tumor-Normal somatic, or Tumor-Only somatic modes,\nDRAGEN can look up variant calls in a dbSNP database and add annotations for any matches that it finds there.\nTo enable the dbSNP database search, set the --dbsnp option to the full path to the dbSNP database\nVCF or .vcf.gz file, which must be sorted in reference order.\n", @@ -710,7 +748,7 @@ }, { "label": "sv region", - "doc": "Limit the analysis to a specified region of the genome for debugging purposes.\nThis option can be specified multiple times to build a list of regions.\nThe value must be in the format \u201cchr:startPos-endPos\u201d..\n", + "doc": "Limit the analysis to a specified region of the genome for debugging purposes.\nThis option can be specified multiple times to build a list of regions.\nThe value must be in the format \"chr:startPos-endPos\"..\n", "type": [ "null", "string" @@ -738,7 +776,7 @@ }, { "label": "sv tin contam tolerance", - "doc": "Set the Tumor-in-Normal (TiN) contamination tolerance level.\nYou can enter any value between 0\u20131. The default maximum TiN contamination tolerance is 0.15.\n", + "doc": "Set the Tumor-in-Normal (TiN) contamination tolerance level.\nYou can enter any value between 0-1. The default maximum TiN contamination tolerance is 0.15.\n", "type": [ "null", "float" @@ -806,7 +844,7 @@ }, { "label": "vc enable phasing", - "doc": "The \u2013vc-enable-phasing option enables variants to be phased when possible. The default value is true.\n", + "doc": "The -vc-enable-phasing option enables variants to be phased when possible. The default value is true.\n", "type": [ "null", "boolean" @@ -848,7 +886,7 @@ }, { "label": "vc enable vcf output", - "doc": "The \u2013vc-enable-vcf-output option enables VCF file output during a gVCF run. The default value is false.\n", + "doc": "The -vc-enable-vcf-output option enables VCF file output during a gVCF run. The default value is false.\n", "type": [ "null", "boolean" @@ -894,7 +932,7 @@ }, { "label": "vc hard filter", - "doc": "DRAGEN provides post-VCF variant filtering based on annotations present in the VCF records.\nHowever, due to the nature of DRAGEN\u2019s algorithms, which incorporate the hypothesis of correlated errors\nfrom within the core of variant caller, the pipeline has improved capabilities in distinguishing\nthe true variants from noise, and therefore the dependency on post-VCF filtering is substantially reduced.\nFor this reason, the default post-VCF filtering in DRAGEN is very simple\n", + "doc": "DRAGEN provides post-VCF variant filtering based on annotations present in the VCF records.\nHowever, due to the nature of DRAGEN's algorithms, which incorporate the hypothesis of correlated errors\nfrom within the core of variant caller, the pipeline has improved capabilities in distinguishing\nthe true variants from noise, and therefore the dependency on post-VCF filtering is substantially reduced.\nFor this reason, the default post-VCF filtering in DRAGEN is very simple\n", "type": [ "null", "string" @@ -1084,7 +1122,7 @@ "listing": [ { "entryname": "$(get_script_path())", - "entry": "#!/usr/bin/env bash\n\n# Fail on non-zero exit of subshell\nset -euo pipefail\n\n# Confirm not both fastq_list and fastq_list_rows are defined\nif [[ \"$(boolean_to_int(is_not_null(inputs.fastq_list)) + boolean_to_int(is_not_null(inputs.fastq_list_rows)) + boolean_to_int(is_not_null(inputs.bam_input)))\" -gt \"1\" ]]; then\n echo \"Please set no more than one of fastq_list, fastq_list_rows and bam_input for normal sample\" 1>&2\n exit 1\nfi\n\n# Ensure that at least one of tumor_fastq_list and tumor_fastq_list_rows are defined but not both defined (XOR)\nif [[ \"$(boolean_to_int(is_not_null(inputs.tumor_fastq_list)) + boolean_to_int(is_not_null(inputs.tumor_fastq_list_rows)) + boolean_to_int(is_not_null(inputs.tumor_bam_input)))\" -ne \"1\" ]]; then\n echo \"One and only one of inputs tumor_fastq_list, inputs.tumor_fastq_list_rows, inputs.tumor_bam_input must be defined\" 1>&2\n exit 1\nfi\n\n# Reset dragen\n/opt/edico/bin/dragen \\\\\n --partial-reconfig HMM \\\\\n --ignore-version-check true\n\n# Create directories\nmkdir --parents \\\\\n \"$(get_ref_mount())\" \\\\\n \"$(get_intermediate_results_dir())\" \\\\\n \"$(inputs.output_directory)\"\n\n# untar ref data into scratch space\ntar \\\\\n --directory \"$(get_ref_mount())\" \\\\\n --extract \\\\\n --file \"$(inputs.reference_tar.path)\"\n\n# Check if both bam inputs are set\nif [[ \"$(is_not_null(inputs.bam_input))\" == \"true\" && \"$(is_not_null(inputs.tumor_bam_input))\" == \"true\" && \"$(get_bool_value_as_str(inputs.enable_map_align))\" == \"true\" ]]; then\n echo \"More than one bam input is set, need to run enable map align first beforehand then run variant calling in a separate step\" 1>&2\n\n # Collect options relating to map alignment (these options will be popped from the args list and not used in the variant calling step)\n enable_sort_parameter=\"\"\n enable_duplicate_marking_parameter=\"\"\n enable_map_align_output_parameter=\"\"\n dedup_min_qual_parameter=\"\"\n\n # Pop arguments\n # Get args from command line\n # But capture them again since we need them when we actually run dragen\n existing_args_array=()\n while [ $# -gt 0 ]; do\n case \"$1\" in\n --enable-sort=*)\n enable_sort_parameter=\"$1\"\n ;;\n --enable-duplicate-marking=*)\n enable_duplicate_marking_parameter=\"\\${1}\"\n ;;\n --enable-map-align=*)\n : # Just popping from array, we set this by default in these steps but dont want it in final dragen call\n ;;\n --enable-map-align-output=*)\n enable_map_align_output_parameter=\"\\${1}\"\n ;;\n --dedup-min-qual=*)\n dedup_min_qual_parameter=\"\\${1}\"\n ;;\n --bam-input=*)\n : # Just popping from array as we set the new location elsewhere\n ;;\n --tumor-bam-input=*)\n : # Just popping from array as we set the new location elsewhere\n ;;\n *)\n existing_args_array+=(\"\\${1}\")\n esac\n shift 1\n done\n\n # Then run dragen map-align and place the files in the output directories\n # Tumor Then Normal\n echo \"Aligning tumor\" 1>&2\n # Eval prefix required here as some parameters are empty\n eval /opt/edico/bin/dragen \\\\\n --enable-map-align=true \\\\\n \"\\${enable_sort_parameter}\" \\\\\n \"\\${enable_duplicate_marking_parameter}\" \\\\\n \"\\${enable_map_align_output_parameter}\" \\\\\n \"\\${dedup_min_qual_parameter}\" \\\\\n \"--ref-dir=$(get_ref_path(inputs.reference_tar))\" \\\\\n \"--output-directory=$(inputs.output_directory)\" \\\\\n \"--output-file-prefix=$(inputs.output_file_prefix)\" \\\\\n \"--intermediate-results-dir=$(get_intermediate_results_dir())\" \\\\\n \"--tumor-bam-input=$(get_attribute_from_optional_input(inputs.tumor_bam_input, \"path\"))\"\n\n echo \"Aligning normal\" 1>&2\n # Eval prefix required here as some parameters are empty\n eval /opt/edico/bin/dragen \\\\\n --enable-map-align=true \\\\\n \"\\${enable_sort_parameter}\" \\\\\n \"\\${enable_duplicate_marking_parameter}\" \\\\\n \"\\${enable_map_align_output_parameter}\" \\\\\n \"\\${dedup_min_qual_parameter}\" \\\\\n \"--ref-dir=$(get_ref_path(inputs.reference_tar))\" \\\\\n \"--output-directory=$(inputs.output_directory)\" \\\\\n \"--output-file-prefix=$(inputs.output_file_prefix)\" \\\\\n \"--intermediate-results-dir=$(get_intermediate_results_dir())\" \\\\\n \"--bam-input=$(get_attribute_from_optional_input(inputs.bam_input, \"path\"))\"\n\n\n # Pop back in existing arguments into \\${@}\n for existing_arg in \"\\${existing_args_array[@]}\"; do\n set -- \"\\${@}\" \"\\${existing_arg}\"\n done\n\n # Update bam input and tumor bam input parameters\n set -- \"\\${@}\" \"--bam-input=$(inputs.output_directory)/$(inputs.output_file_prefix).bam\"\n set -- \"\\${@}\" \"--tumor-bam-input=$(inputs.output_directory)/$(inputs.output_file_prefix)_tumor.bam\"\n\n # Explicity set enable map align to false\n set -- \"\\${@}\" \"--enable-map-align=false\"\nfi\n\n# Run dragen command and import options from cli\necho \"Running dragen variant calling\" 1>&2\n\"$(get_dragen_bin_path())\" \"\\${@}\"\n\n# Check if fastq_list or fastq_list_rows is set\nif [[ \"$(is_not_null(inputs.fastq_list))\" == \"true\" || \"$(is_not_null(inputs.fastq_list_rows))\" == \"true\" || \"$(is_not_null(inputs.bam_input))\" == \"true\" ]]; then\n # Check if --enable-map-align-output is set\n if [[ ! \"$(get_bool_value_as_str(inputs.enable_map_align_output))\" == \"true\" ]]; then\n echo \"--enable-map-align-output not set, no need to move normal bam file\" 1>&2\n echo \"Exiting\" 1>&2\n exit\n # Check if --enable-map-align is not set AND using inputs.bam_input\n elif [[ \"$(is_not_null(inputs.bam_input))\" == \"true\" && \"$(get_bool_value_as_str(inputs.enable_map_align))\" == \"false\" ]]; then\n echo \"--enable-map-align-output set to true, but using --bam-input AND --enable-map-align set to false so no bam is output, hence no need to move the normal bam file\" 1>&2\n echo \"Exiting\" 1>&2\n exit\n fi\n\n # Ensure that we have a normal RGSM value, otherwise exit.\n if [[ \"$(is_not_null(get_normal_output_prefix(inputs)))\" == \"false\" ]]; then\n echo \"Could not get the normal bam file prefix\" 1>&2\n echo \"Exiting\" 1>&2\n exit\n fi\n\n # Get new normal file name prefix from the fastq_list.csv\n new_normal_file_name_prefix=\"$(get_normal_output_prefix(inputs))\"\n\n # Ensure output normal bam file exists and the destination normal bam file also does not exist yet\n if [[ \"$(is_not_null(inputs.fastq_list))\" == \"true\" || \"$(is_not_null(inputs.fastq_list_rows))\" == \"true\" || \"$(is_not_null(inputs.bam_input))\" == \"true\" ]]; then\n # Move normal bam, normal bam index and normal bam md5sum\n (\n cd \"$(inputs.output_directory)\"\n mv \"$(inputs.output_file_prefix).bam\" \"\\${new_normal_file_name_prefix}.bam\"\n mv \"$(inputs.output_file_prefix).bam.bai\" \"\\${new_normal_file_name_prefix}.bam.bai\"\n mv \"$(inputs.output_file_prefix).bam.md5sum\" \"\\${new_normal_file_name_prefix}.bam.md5sum\"\n )\n fi\nfi\n\n# If --enable-sv has been selected, we need to remove the empty genomeDepth directory\n# https://github.com/umccr-illumina/ica_v2/issues/131\nif [[ \"$(is_not_null(inputs.enable_sv))\" == \"true\" && \"$(get_bool_value_as_str(inputs.enable_sv))\" == \"true\" && -d \"$(inputs.output_directory)/sv/\" ]]; then\n find \"$(inputs.output_directory)/sv/\" -type d -empty -delete\nfi\n" + "entry": "#!/usr/bin/env bash\n\n# Fail on non-zero exit of subshell\nset -euo pipefail\n\n# Confirm not more than one of fastq_list, fastq_list_rows, bam_input and cram_input are defined\nif [[ \"$(boolean_to_int(is_not_null(inputs.fastq_list)) + boolean_to_int(is_not_null(inputs.fastq_list_rows)) + boolean_to_int(is_not_null(inputs.bam_input)) + boolean_to_int(is_not_null(inputs.cram_input)))\" -gt \"1\" ]]; then\n echo \"Please set no more than one of fastq_list, fastq_list_rows, bam_input or cram_input for normal sample\" 1>&2\n exit 1\nfi\n\n# Ensure that at least one (and only one) of tumor_fastq_list, tumor_fastq_list_rows, tumor_bam_input and tumor_cram_input are defined but not both defined (XOR)\nif [[ \"$(boolean_to_int(is_not_null(inputs.tumor_fastq_list)) + boolean_to_int(is_not_null(inputs.tumor_fastq_list_rows)) + boolean_to_int(is_not_null(inputs.tumor_bam_input)) + boolean_to_int(is_not_null(inputs.tumor_cram_input)))\" -ne \"1\" ]]; then\n echo \"One and only one of inputs tumor_fastq_list, tumor_fastq_list_rows, tumor_bam_input, tumor_cram_input must be defined\" 1>&2\n exit 1\nfi\n\n# Reset dragen\n/opt/edico/bin/dragen \\\\\n --partial-reconfig HMM \\\\\n --ignore-version-check true\n\n# Create directories\nmkdir --parents \\\\\n \"$(get_ref_mount())\" \\\\\n \"$(get_intermediate_results_dir())\" \\\\\n \"$(inputs.output_directory)\"\n\n# untar ref data into scratch space\ntar \\\\\n --directory \"$(get_ref_mount())\" \\\\\n --extract \\\\\n --file \"$(inputs.reference_tar.path)\"\n\n# Check if both bam inputs are set\nif [[ \"$(is_not_null(inputs.bam_input))\" == \"true\" && \"$(is_not_null(inputs.tumor_bam_input))\" == \"true\" && ( \"$(get_bool_value_as_str(inputs.enable_map_align))\" == \"true\" || \"$(get_bool_value_as_str(inputs.enable_map_align_output))\" == \"true\" ) ]]; then\n echo \"More than one bam input is set, need to run enable map align first beforehand then run variant calling in a separate step\" 1>&2\n\n # Collect options relating to map alignment (these options will be popped from the args list and not used in the variant calling step)\n enable_sort_parameter=\"\"\n enable_duplicate_marking_parameter=\"\"\n dedup_min_qual_parameter=\"\"\n\n # Pop arguments\n # Get args from command line\n # But capture them again since we need them when we actually run dragen\n existing_args_array=()\n while [ $# -gt 0 ]; do\n case \"$1\" in\n --enable-sort=*)\n enable_sort_parameter=\"$1\"\n ;;\n --enable-duplicate-marking=*)\n enable_duplicate_marking_parameter=\"\\${1}\"\n ;;\n --enable-map-align=*)\n : # Just popping from array, we set this by default in these steps but dont want it in final dragen call\n ;;\n --enable-map-align-output=*)\n : # Just popping from array, we set this by default in these steps but dont want it in final dragen call\n ;;\n --dedup-min-qual=*)\n dedup_min_qual_parameter=\"\\${1}\"\n ;;\n --bam-input=*)\n : # Just popping from array as we set the new location elsewhere\n ;;\n --tumor-bam-input=*)\n : # Just popping from array as we set the new location elsewhere\n ;;\n *)\n existing_args_array+=(\"\\${1}\")\n esac\n shift 1\n done\n\n # Then run dragen map-align and place the files in the output directories\n # Tumor Then Normal\n echo \"Aligning tumor\" 1>&2\n # Eval prefix required here as some parameters are empty\n eval /opt/edico/bin/dragen \\\\\n --enable-map-align=true \\\\\n --enable-map-align-output=true \\\\\n \"\\${enable_sort_parameter}\" \\\\\n \"\\${enable_duplicate_marking_parameter}\" \\\\\n \"\\${dedup_min_qual_parameter}\" \\\\\n \"--ref-dir=$(get_ref_path(inputs.reference_tar))\" \\\\\n \"--output-directory=$(inputs.output_directory)\" \\\\\n \"--output-file-prefix=$(inputs.output_file_prefix)\" \\\\\n \"--intermediate-results-dir=$(get_intermediate_results_dir())\" \\\\\n \"--lic-instance-id-location=$(get_optional_attribute_from_multi_type_input_object(inputs.lic_instance_id_location, \"path\"))\" \\\\\n \"--tumor-bam-input=$(get_attribute_from_optional_input(inputs.tumor_bam_input, \"path\"))\"\n\n echo \"Aligning normal\" 1>&2\n # Eval prefix required here as some parameters are empty\n eval /opt/edico/bin/dragen \\\\\n --enable-map-align=true \\\\\n --enable-map-align-output=true \\\\\n \"\\${enable_sort_parameter}\" \\\\\n \"\\${enable_duplicate_marking_parameter}\" \\\\\n \"\\${dedup_min_qual_parameter}\" \\\\\n \"--ref-dir=$(get_ref_path(inputs.reference_tar))\" \\\\\n \"--output-directory=$(inputs.output_directory)\" \\\\\n \"--output-file-prefix=$(inputs.output_file_prefix)\" \\\\\n \"--intermediate-results-dir=$(get_intermediate_results_dir())\" \\\\\n \"--lic-instance-id-location=$(get_optional_attribute_from_multi_type_input_object(inputs.lic_instance_id_location, \"path\"))\" \\\\\n \"--bam-input=$(get_attribute_from_optional_input(inputs.bam_input, \"path\"))\"\n\n # Pop back in existing arguments into \\${@}\n for existing_arg in \"\\${existing_args_array[@]}\"; do\n set -- \"\\${@}\" \"\\${existing_arg}\"\n done\n\n # Update bam input and tumor bam input parameters\n set -- \"\\${@}\" \"--bam-input=$(inputs.output_directory)/$(inputs.output_file_prefix).bam\"\n set -- \"\\${@}\" \"--tumor-bam-input=$(inputs.output_directory)/$(inputs.output_file_prefix)_tumor.bam\"\n\n # Explicity set enable map align to false\n # Setting --enable-map-align to false, sets --enable-map-align-output to false as well\n set -- \"\\${@}\" \"--enable-map-align=false\"\nfi\n\n# Check if cram inputs are set and enable map align output is set\n# Like bam inputs, we need to run map align first before running variant calling\nif [[ \"$(is_not_null(inputs.cram_input))\" == \"true\" && \"$(is_not_null(inputs.tumor_cram_input))\" == \"true\" && ( \"$(get_bool_value_as_str(inputs.enable_map_align))\" == \"true\" || \"$(get_bool_value_as_str(inputs.enable_map_align_output))\" == \"true\" ) ]]; then\n echo \"More than one cram input is set, need to run enable map align first beforehand then run variant calling in a separate step\" 1>&2\n\n # Collect options relating to map alignment (these options will be popped from the args list and not used in the variant calling step)\n enable_sort_parameter=\"\"\n enable_duplicate_marking_parameter=\"\"\n dedup_min_qual_parameter=\"\"\n cram_reference_parameter=\"\"\n\n # Pop arguments\n # Get args from command line\n # But capture them again since we need them when we actually run dragen\n existing_args_array=()\n while [ $# -gt 0 ]; do\n case \"$1\" in\n --enable-sort=*)\n enable_sort_parameter=\"$1\"\n ;;\n --enable-duplicate-marking=*)\n enable_duplicate_marking_parameter=\"\\${1}\"\n ;;\n --enable-map-align=*)\n : # Just popping from array, we set this by default in these steps but dont want it in final dragen call\n ;;\n --enable-map-align-output=*)\n : # Just popping from array, we set this by default in these steps but dont want it in final dragen call\n ;;\n --dedup-min-qual=*)\n dedup_min_qual_parameter=\"\\${1}\"\n ;;\n --cram-input=*)\n : # Just popping from array as we set the new location elsewhere\n ;;\n --tumor-cram-input=*)\n : # Just popping from array as we set the new location elsewhere\n ;;\n --cram-reference=*)\n cram_reference_parameter=\"\\${1}\"\n ;;\n *)\n existing_args_array+=(\"\\${1}\")\n esac\n shift 1\n done\n\n # Then run dragen map-align and place the files in the output directories\n # Tumor Then Normal\n echo \"Aligning tumor\" 1>&2\n # Eval prefix required here as some parameters are empty\n eval /opt/edico/bin/dragen \\\\\n --enable-map-align=true \\\\\n --enable-map-align-output=true \\\\\n \"\\${enable_sort_parameter}\" \\\\\n \"\\${enable_duplicate_marking_parameter}\" \\\\\n \"\\${dedup_min_qual_parameter}\" \\\\\n \"\\${cram_reference_parameter}\" \\\\\n \"--ref-dir=$(get_ref_path(inputs.reference_tar))\" \\\\\n \"--output-directory=$(inputs.output_directory)\" \\\\\n \"--output-file-prefix=$(inputs.output_file_prefix)\" \\\\\n \"--intermediate-results-dir=$(get_intermediate_results_dir())\" \\\\\n \"--lic-instance-id-location=$(get_optional_attribute_from_multi_type_input_object(inputs.lic_instance_id_location, \"path\"))\" \\\\\n \"--tumor-cram-input=$(get_attribute_from_optional_input(inputs.tumor_cram_input, \"path\"))\"\n\n echo \"Aligning normal\" 1>&2\n # Eval prefix required here as some parameters are empty\n eval /opt/edico/bin/dragen \\\\\n --enable-map-align=true \\\\\n --enable-map-align-output=true \\\\\n \"\\${enable_sort_parameter}\" \\\\\n \"\\${enable_duplicate_marking_parameter}\" \\\\\n \"\\${dedup_min_qual_parameter}\" \\\\\n \"\\${cram_reference_parameter}\" \\\\\n \"--ref-dir=$(get_ref_path(inputs.reference_tar))\" \\\\\n \"--output-directory=$(inputs.output_directory)\" \\\\\n \"--output-file-prefix=$(inputs.output_file_prefix)\" \\\\\n \"--intermediate-results-dir=$(get_intermediate_results_dir())\" \\\\\n \"--lic-instance-id-location=$(get_optional_attribute_from_multi_type_input_object(inputs.lic_instance_id_location, \"path\"))\" \\\\\n \"--cram-input=$(get_attribute_from_optional_input(inputs.cram_input, \"path\"))\"\n\n # Pop back in existing arguments into \\${@}\n for existing_arg in \"\\${existing_args_array[@]}\"; do\n set -- \"\\${@}\" \"\\${existing_arg}\"\n done\n\n # Update bam input and tumor bam input parameters\n # Note that we output bams by default\n set -- \"\\${@}\" \"--bam-input=$(inputs.output_directory)/$(inputs.output_file_prefix).bam\"\n set -- \"\\${@}\" \"--tumor-bam-input=$(inputs.output_directory)/$(inputs.output_file_prefix)_tumor.bam\"\n\n # Explicity set enable map align to false since we have already done the alignment\n # Setting --enable-map-align to false, sets --enable-map-align-output to false as well\n set -- \"\\${@}\" \"--enable-map-align=false\"\nfi\n\n# Run dragen command and import options from cli\necho \"Running dragen variant calling\" 1>&2\n\"$(get_dragen_bin_path())\" \"\\${@}\"\n\n# Check if a normal input is set\nif [[ \"$(is_not_null(inputs.fastq_list))\" == \"true\" || \"$(is_not_null(inputs.fastq_list_rows))\" == \"true\" || \"$(is_not_null(inputs.bam_input))\" == \"true\" || \"$(is_not_null(inputs.cram_input))\" == \"true\" ]]; then\n # --enable-map-align-output is set to false\n if [[ \"$(get_bool_value_as_str(inputs.enable_map_align_output))\" == \"false\" ]]; then\n # No bams output if -enable-map-align-output is false and --enable-map-align is also false\n # if --enable-map-align-output is false and --enable-map-align is false, no bam output\n if [[ \"$(get_bool_value_as_str(inputs.enable_map_align))\" == \"false\" ]]; then\n echo \"--enable-map-align-output and --enable-map-align set to false, no bam output\" 1>&2\n\n # Bams output if --enable-map-align-output is false but --enable-map-align is true\n # And one of tumor_bam_input or tumor_cram_input is set\n # And one of bam_input or cram_input is set\n # Then bam is generated even when --enable-map-align-output is explicitly set to false\n # Since we needed to align the tumor and normal prior to running the variant calling step\n # So when --enable-map-align-output is false under these conditions, we should delete the normal bam file rather than move it\n elif [[ \"$(get_bool_value_as_str(inputs.enable_map_align))\" == \"true\" && ( \"$(is_not_null(inputs.tumor_bam_input))\" == \"true\" || \"$(is_not_null(inputs.tumor_cram_input))\" == \"true\" ) && ( \"$(is_not_null(inputs.bam_input))\" == \"true\" || \"$(is_not_null(inputs.cram_input))\" == \"true\" ) ]]; then\n echo \"--enable-map-align is set to true but --enable-map-align-output is set to false, but we ignored --enable-map-align-output=false because one both tumor and normal inputs were set to true and thus needed to be aligned separately, deleting tumor and normal bam files\" 1>&2\n rm -f \"$(inputs.output_directory)/$(inputs.output_file_prefix).bam\" \"$(inputs.output_directory)/$(inputs.output_file_prefix).bam.bai\" \"$(inputs.output_directory)/$(inputs.output_file_prefix).bam.md5sum\"\n rm -f \"$(inputs.output_directory)/$(inputs.output_file_prefix)_tumor.bam\" \"$(inputs.output_directory)/$(inputs.output_file_prefix)_tumor.bam.bai\" \"$(inputs.output_directory)/$(inputs.output_file_prefix)_tumor.bam.md5sum\"\n fi\n\n # No action required otherwise --enable-map-align-output is false\n\n # --enable-map-align-output is true\n # Move normal bam file to new normal bam file name prefix\n else\n # Ensure that we have a normal RGSM value, otherwise exit.\n if [[ \"$(is_not_null(get_normal_output_prefix(inputs)))\" == \"false\" ]]; then\n echo \"Could not get the normal bam file prefix\" 1>&2\n echo \"Exiting\" 1>&2\n exit\n fi\n\n # Get new normal file name prefix from the fastq_list.csv\n new_normal_file_name_prefix=\"$(get_normal_output_prefix(inputs))\"\n\n # Ensure output normal bam file exists and the destination normal bam file also does not exist yet\n if [[ -f \"$(inputs.output_directory)/$(inputs.output_file_prefix).bam\" && ! -f \"$(inputs.output_directory)/\\${new_normal_file_name_prefix}.bam\" ]]; then\n # Move normal bam, normal bam index and normal bam md5sum\n (\n cd \"$(inputs.output_directory)\"\n mv \"$(inputs.output_file_prefix).bam\" \"\\${new_normal_file_name_prefix}.bam\"\n mv \"$(inputs.output_file_prefix).bam.bai\" \"\\${new_normal_file_name_prefix}.bam.bai\"\n mv \"$(inputs.output_file_prefix).bam.md5sum\" \"\\${new_normal_file_name_prefix}.bam.md5sum\"\n )\n else\n echo \"Error! Expected to move file from $(inputs.output_file_prefix).bam to \\${new_normal_file_name_prefix}.bam but either $(inputs.output_file_prefix).bam does not exist or \\${new_normal_file_name_prefix}.bam already exists\" 1>&2\n fi\n fi\nfi\n\n# If --enable-sv has been selected, we need to remove the empty genomeDepth directory\n# https://github.com/umccr-illumina/ica_v2/issues/131\nif [[ \"$(is_not_null(inputs.enable_sv))\" == \"true\" && \"$(get_bool_value_as_str(inputs.enable_sv))\" == \"true\" && -d \"$(inputs.output_directory)/sv/\" ]]; then\n find \"$(inputs.output_directory)/sv/\" -type d -empty -delete\nfi\n" }, "${\n return generate_somatic_mount_points(inputs);\n}\n" ], @@ -1092,13 +1130,13 @@ }, { "expressionLib": [ - "/* Author:Alexis Lucattini */\n/* For assistance on generation of typescript expressions */\n/* In CWL, please visit our wiki page at https://github.com/umccr/cwl-ica/wiki/TypeScript */\n/* Imports */\n/* Functions */\nfunction get_script_path() {\n /*\n Abstract script path, can then be referenced in baseCommand attribute too\n Makes things more readable.\n */\n return \"run-dragen-script.sh\";\n}\nfunction get_scratch_mount() {\n /*\n Return the path of the scratch directory space\n */\n return \"/scratch/\";\n}\nfunction get_intermediate_results_dir() {\n /*\n Get intermediate results directory as /scratch for dragen runs\n */\n return get_scratch_mount() + \"intermediate-results/\";\n}\nfunction get_name_root_from_tarball(basename) {\n var tar_ball_regex = /(\\S+)\\.tar\\.gz/g;\n var tar_ball_expression = tar_ball_regex.exec(basename);\n if (tar_ball_expression === null) {\n throw new Error(\"Could not get nameroot from \".concat(basename));\n }\n return tar_ball_expression[1];\n}\nfunction get_ref_path(reference_input_obj) {\n /*\n Get the reference path\n */\n return get_ref_mount() + get_name_root_from_tarball(reference_input_obj.basename) + \"/\";\n}\nfunction get_ref_mount() {\n /*\n Get the reference mount point\n */\n return get_scratch_mount() + \"ref/\";\n}\nfunction get_dragen_bin_path() {\n /*\n Get dragen bin path\n */\n return \"/opt/edico/bin/dragen\";\n}\nfunction get_dragen_eval_line() {\n /*\n Return string\n */\n return \"eval \\\"\" + get_dragen_bin_path() + \"\\\" '\\\"\\$@\\\"' \\n\";\n}\nfunction get_fastq_list_csv_path() {\n /*\n The fastq list path must be placed in working directory\n */\n return \"fastq_list.csv\";\n}\nfunction get_tumor_fastq_list_csv_path() {\n /*\n The tumor fastq list path must be placed in working directory\n */\n return \"tumor_fastq_list.csv\";\n}\nfunction get_normal_name_from_fastq_list_rows(fastq_list_rows) {\n /*\n Get the normal sample name from the fastq list rows object\n */\n /*\n Check fastq list rows is defined\n */\n if (fastq_list_rows === undefined || fastq_list_rows === null) {\n return null;\n }\n /*\n Get RGSM value and return\n */\n return fastq_list_rows[0].rgsm;\n}\nfunction get_normal_name_from_fastq_list_csv(fastq_list_csv) {\n /*\n Get the normal name from the fastq list csv...\n */\n /*\n Check file is defined\n */\n if (fastq_list_csv === undefined || fastq_list_csv === null) {\n return null;\n }\n /*\n Check contents are defined\n */\n if (fastq_list_csv.contents === null || fastq_list_csv.contents === undefined) {\n return null;\n }\n /*\n Confirm fastq list csv is of type File\n */\n if (fastq_list_csv.class !== \"File\") {\n throw new Error(\"Could not confirm input fastq_list_csv is of type File\");\n }\n /*\n Split contents by line\n */\n var contents_by_line = [];\n fastq_list_csv.contents.split(\"\\n\").forEach(function (line_content) {\n var stripped_line_content = line_content.replace(/(\\r\\n|\\n|\\r)/gm, \"\");\n if (stripped_line_content !== \"\") {\n contents_by_line.push(stripped_line_content);\n }\n });\n var column_names = contents_by_line[0].split(\",\");\n /*\n Get RGSM index value (which column is RGSM at?)\n */\n var rgsm_index = column_names.indexOf(\"RGSM\");\n /*\n RGSM is not in index. Return null\n */\n if (rgsm_index === -1) {\n return null;\n }\n /*\n Get RGSM value of first row and return\n */\n return contents_by_line[1].split(\",\")[rgsm_index];\n}\nfunction get_normal_output_prefix(inputs) {\n var _a;\n /*\n Get the normal RGSM value and then add _normal to it\n */\n var normal_name = null;\n var normal_re_replacement = /_normal$/;\n /*\n Check if bam_input is set\n */\n if (inputs.bam_input !== null && inputs.bam_input !== undefined) {\n /* Remove _normal from nameroot if it already exists */\n /* We dont want _normal_normal as a suffix */\n return \"\".concat((_a = inputs.bam_input.nameroot) === null || _a === void 0 ? void 0 :_a.replace(normal_re_replacement, \"\"), \"_normal\");\n }\n /*\n Check if fastq list file is set\n */\n if (inputs.fastq_list !== null && inputs.fastq_list !== undefined) {\n normal_name = get_normal_name_from_fastq_list_csv(inputs.fastq_list);\n if (normal_name !== null) {\n return \"\".concat(normal_name, \"_normal\");\n }\n }\n /*\n Otherwise collect and return from schema object\n */\n normal_name = get_normal_name_from_fastq_list_rows(inputs.fastq_list_rows);\n return \"\".concat(normal_name, \"_normal\");\n}\nfunction build_fastq_list_csv_header(header_names) {\n /*\n Convert lowercase labels to uppercase values\n i.e\n [ \"rgid\", \"rglb\", \"rgsm\", \"lane\", \"read_1\", \"read_2\" ]\n to\n \"RGID,RGLB,RGSM,Lane,Read1File,Read2File\"\n */\n var modified_header_names = [];\n for (var _i = 0, header_names_1 = header_names; _i < header_names_1.length; _i++) {\n var header_name = header_names_1[_i];\n if (header_name.indexOf(\"rg\") === 0) {\n /*\n rgid -> RGID\n */\n modified_header_names.push(header_name.toUpperCase());\n }\n else if (header_name.indexOf(\"read\") === 0) {\n /*\n read_1 -> Read1File\n */\n modified_header_names.push(\"Read\" + header_name.charAt(header_name.length - 1) + \"File\");\n }\n else {\n /*\n lane to Lane\n */\n modified_header_names.push(header_name[0].toUpperCase() + header_name.substr(1));\n }\n }\n /*\n Convert array to comma separated strings\n */\n return modified_header_names.join(\",\") + \"\\n\";\n}\nfunction get_fastq_list_row_as_csv_row(fastq_list_row, row_order) {\n var fastq_list_row_values_array = [];\n /* This for loop is here to ensure were assigning values in the same order as the header */\n for (var _i = 0, row_order_1 = row_order; _i < row_order_1.length; _i++) {\n var item_index = row_order_1[_i];\n var found_item = false;\n /* Find matching attribute in this row */\n for (var _a = 0, _b = Object.getOwnPropertyNames(fastq_list_row); _a < _b.length; _a++) {\n var fastq_list_row_field_name = _b[_a];\n var fastq_list_row_field_value = fastq_list_row[fastq_list_row_field_name];\n if (fastq_list_row_field_value === null) {\n /*\n Item not found, add an empty attribute for this cell in the csv\n */\n continue;\n }\n /* The header value matches the name in the item */\n if (fastq_list_row_field_name === item_index) {\n /*\n If the field value has a class attribute then it's either read_1 or read_2\n */\n if (fastq_list_row_field_value.hasOwnProperty(\"class\")) {\n var fastq_list_row_field_value_file = fastq_list_row_field_value;\n /*\n Assert that this is actually of class file\n */\n if (fastq_list_row_field_value_file.class !== \"File\") {\n continue;\n }\n if (fastq_list_row_field_value_file.path !== null && fastq_list_row_field_value_file.path !== undefined) {\n /*\n Push the path attribute to the fastq list csv row if it is not null\n */\n fastq_list_row_values_array.push(fastq_list_row_field_value_file.path);\n }\n else {\n /*\n Otherwise push the location attribute\n */\n fastq_list_row_values_array.push(fastq_list_row_field_value_file.location);\n }\n }\n else {\n /*\n Push the string attribute to the fastq list csv row\n */\n fastq_list_row_values_array.push(fastq_list_row_field_value.toString());\n }\n found_item = true;\n break;\n }\n }\n if (!found_item) {\n /*\n Push blank cell if no item found\n */\n fastq_list_row_values_array.push(\"\");\n }\n }\n /*\n Convert to string and return as string\n */\n return fastq_list_row_values_array.join(\",\") + \"\\n\";\n}\nfunction generate_fastq_list_csv(fastq_list_rows) {\n /*\n Fastq list rows generation\n */\n var fastq_csv_file = {\n class:\"File\",\n basename:get_fastq_list_csv_path()\n };\n /*\n Set the row order\n */\n var row_order = [];\n /*\n Set the array order\n Make sure we iterate through all rows of the array\n */\n for (var _i = 0, fastq_list_rows_1 = fastq_list_rows; _i < fastq_list_rows_1.length; _i++) {\n var fastq_list_row = fastq_list_rows_1[_i];\n for (var _a = 0, _b = Object.getOwnPropertyNames(fastq_list_row); _a < _b.length; _a++) {\n var fastq_list_row_field_name = _b[_a];\n if (row_order.indexOf(fastq_list_row_field_name) === -1) {\n row_order.push(fastq_list_row_field_name);\n }\n }\n }\n /*\n Make header\n */\n fastq_csv_file.contents = build_fastq_list_csv_header(row_order);\n /*\n For each fastq list row,\n collect the values of each attribute but in the order of the header\n */\n for (var _c = 0, fastq_list_rows_2 = fastq_list_rows; _c < fastq_list_rows_2.length; _c++) {\n var fastq_list_row = fastq_list_rows_2[_c];\n /* Add csv row to file contents */\n fastq_csv_file.contents += get_fastq_list_row_as_csv_row(fastq_list_row, row_order);\n }\n return fastq_csv_file;\n}\nfunction generate_germline_mount_points(inputs) {\n /*\n Create and add in the fastq list csv for the input fastqs\n */\n var e = [];\n if (inputs.fastq_list_rows !== null) {\n e.push({\n \"entryname\":get_fastq_list_csv_path(),\n \"entry\":generate_fastq_list_csv(inputs.fastq_list_rows)\n });\n }\n if (inputs.fastq_list !== null) {\n e.push({\n \"entryname\":get_fastq_list_csv_path(),\n \"entry\":inputs.fastq_list\n });\n }\n /*\n Return file paths\n */\n /* @ts-ignore Type '{ entryname:string; entry:FileProperties; }[]' is not assignable to type 'DirentProperties[]' */\n return e;\n}\nfunction generate_somatic_mount_points(inputs) {\n /*\n Create and add in the fastq list csv for the input fastqs\n */\n var e = [];\n if (inputs.fastq_list_rows !== null) {\n e.push({\n \"entryname\":get_fastq_list_csv_path(),\n \"entry\":generate_fastq_list_csv(inputs.fastq_list_rows)\n });\n }\n if (inputs.tumor_fastq_list_rows !== null) {\n e.push({\n \"entryname\":get_tumor_fastq_list_csv_path(),\n \"entry\":generate_fastq_list_csv(inputs.tumor_fastq_list_rows)\n });\n }\n if (inputs.fastq_list !== null) {\n e.push({\n \"entryname\":get_fastq_list_csv_path(),\n \"entry\":inputs.fastq_list\n });\n }\n if (inputs.tumor_fastq_list !== null) {\n e.push({\n \"entryname\":get_tumor_fastq_list_csv_path(),\n \"entry\":inputs.tumor_fastq_list\n });\n }\n /*\n Return file paths\n */\n /* @ts-ignore Type '{ entryname:string; entry:FileProperties; }[]' is not assignable to type 'DirentProperties[]' */\n return e;\n}\nfunction generate_transcriptome_mount_points(inputs) {\n /*\n Calls another function that generates mount points\n */\n return generate_germline_mount_points(inputs);\n}\n/* Custom functions for dragen reference tarball build */\nfunction get_liftover_dir() {\n /* Hardcoded liftover directory in dragen 4.2 */\n return \"/opt/edico/liftover/\";\n}\nfunction get_mask_dir() {\n /* Hardcoded mask directory in dragen 4.2 */\n return \"/opt/edico/fasta_mask/\";\n}\nfunction get_ref_scratch_dir(reference_name) {\n /* We get the reference scratch directory as a combination of */\n /* the dragen scratch mount and the reference name */\n return get_scratch_mount() + reference_name + \"/\";\n}\n", - "/* Author:Alexis Lucattini */\n/* For assistance on generation of typescript expressions */\n/* In CWL, please visit our wiki page at https://github.com/umccr/cwl-ica/wiki/TypeScript */\n/* Imports */\n/* Functions */\nfunction is_not_null(input_obj) {\n /*\n Determine if input object is defined and is not null\n */\n return !(input_obj === null || input_obj === undefined);\n}\nfunction get_attribute_from_optional_input(input_object, attribute) {\n /*\n Get attribute from optional input -\n If input is not defined, then return null\n */\n if (input_object === null || input_object === undefined) {\n return null;\n }\n else {\n return get_optional_attribute_from_object(input_object, attribute);\n }\n}\nfunction get_optional_attribute_from_object(input_object, attribute) {\n /*\n Get attribute from object, if attribute is not defined return null\n Assume the input object is an object of key value pairs where we know the key is of type string\n stackoverflow.com/questions/56833469/typescript-error-ts7053-element-implicitly-has-an-any-type\n */\n if (input_object.hasOwnProperty(attribute)) {\n return input_object[attribute];\n }\n else {\n return null;\n }\n}\nfunction get_bool_value_as_str(input_bool) {\n if (is_not_null(input_bool) && input_bool) {\n return \"true\";\n }\n else {\n return \"false\";\n }\n}\nfunction boolean_to_int(input_bool) {\n if (is_not_null(input_bool) && String(input_bool).toLowerCase() === \"true\") {\n return 1;\n }\n else {\n return 0;\n }\n}\nfunction get_optional_attribute_from_multi_type_input_object(object, attribute) {\n /*\n Get attribute from optional input\n */\n if (object === null || object === undefined) {\n return null;\n }\n else if (typeof object === \"object\") {\n /* Get attribute from optional input */\n return get_attribute_from_optional_input(object, attribute);\n }\n else {\n /* Object is likely actually a str */\n return object;\n }\n}\nfunction get_source_a_or_b(input_a, input_b) {\n /*\n Get the first input parameter if it is not null\n Otherwise return the second parameter\n Otherwise return null\n */\n if (is_not_null(input_a)) {\n return input_a;\n }\n else if (is_not_null(input_b)) {\n return input_b;\n }\n else {\n return null;\n }\n}\nfunction get_first_non_null_input(inputs) {\n /*\n Get first element of the array that is not null\n */\n for (var _i = 0, inputs_1 = inputs; _i < inputs_1.length; _i++) {\n var input_element = inputs_1[_i];\n if (is_not_null(input_element)) {\n return input_element;\n }\n }\n return null;\n}\n" + "/* Author:Alexis Lucattini */\n/* For assistance on generation of typescript expressions */\n/* In CWL, please visit our wiki page at https://github.com/umccr/cwl-ica/wiki/TypeScript */\n/* Imports */\n/* Functions */\nfunction get_script_path() {\n /*\n Abstract script path, can then be referenced in baseCommand attribute too\n Makes things more readable.\n */\n return \"run-dragen-script.sh\";\n}\nfunction get_scratch_mount() {\n /*\n Return the path of the scratch directory space\n */\n return \"/tmp/\";\n}\nfunction get_intermediate_results_dir() {\n /*\n Get intermediate results directory as /scratch for dragen runs\n */\n return get_scratch_mount() + \"intermediate-results/\";\n}\nfunction get_name_root_from_tarball(basename) {\n var tar_ball_regex = /(\\S+)\\.tar\\.gz/g;\n var tar_ball_expression = tar_ball_regex.exec(basename);\n if (tar_ball_expression === null) {\n throw new Error(\"Could not get nameroot from \".concat(basename));\n }\n return tar_ball_expression[1];\n}\nfunction get_ref_path(reference_input_obj) {\n /*\n Get the reference path\n */\n return get_ref_mount() + get_name_root_from_tarball(reference_input_obj.basename) + \"/\";\n}\nfunction get_ref_mount() {\n /*\n Get the reference mount point\n */\n return get_scratch_mount() + \"ref/\";\n}\nfunction get_dragen_bin_path() {\n /*\n Get dragen bin path\n */\n return \"/opt/edico/bin/dragen\";\n}\nfunction get_dragen_eval_line() {\n /*\n Return string\n */\n return \"eval \\\"\" + get_dragen_bin_path() + \"\\\" '\\\"\\$@\\\"' \\n\";\n}\nfunction get_fastq_list_csv_path() {\n /*\n The fastq list path must be placed in working directory\n */\n return \"fastq_list.csv\";\n}\nfunction get_tumor_fastq_list_csv_path() {\n /*\n The tumor fastq list path must be placed in working directory\n */\n return \"tumor_fastq_list.csv\";\n}\nfunction get_normal_name_from_fastq_list_rows(fastq_list_rows) {\n /*\n Get the normal sample name from the fastq list rows object\n */\n /*\n Check fastq list rows is defined\n */\n if (fastq_list_rows === undefined || fastq_list_rows === null) {\n return null;\n }\n /*\n Get RGSM value and return\n */\n return fastq_list_rows[0].rgsm;\n}\nfunction get_normal_name_from_fastq_list_csv(fastq_list_csv) {\n /*\n Get the normal name from the fastq list csv...\n */\n /*\n Check file is defined\n */\n if (fastq_list_csv === undefined || fastq_list_csv === null) {\n return null;\n }\n /*\n Check contents are defined\n */\n if (fastq_list_csv.contents === null || fastq_list_csv.contents === undefined) {\n return null;\n }\n /*\n Confirm fastq list csv is of type File\n */\n if (fastq_list_csv.class !== \"File\") {\n throw new Error(\"Could not confirm input fastq_list_csv is of type File\");\n }\n /*\n Split contents by line\n */\n var contents_by_line = [];\n fastq_list_csv.contents.split(\"\\n\").forEach(function (line_content) {\n var stripped_line_content = line_content.replace(/(\\r\\n|\\n|\\r)/gm, \"\");\n if (stripped_line_content !== \"\") {\n contents_by_line.push(stripped_line_content);\n }\n });\n var column_names = contents_by_line[0].split(\",\");\n /*\n Get RGSM index value (which column is RGSM at?)\n */\n var rgsm_index = column_names.indexOf(\"RGSM\");\n /*\n RGSM is not in index. Return null\n */\n if (rgsm_index === -1) {\n return null;\n }\n /*\n Get RGSM value of first row and return\n */\n return contents_by_line[1].split(\",\")[rgsm_index];\n}\nfunction get_normal_output_prefix(inputs) {\n var _a, _b;\n /*\n Get the normal RGSM value and then add _normal to it\n */\n var normal_name = null;\n var normal_re_replacement = /_normal$/;\n /*\n Check if bam_input is set\n */\n if (inputs.bam_input !== null && inputs.bam_input !== undefined) {\n /* Remove _normal from nameroot if it already exists */\n /* We dont want _normal_normal as a suffix */\n return \"\".concat((_a = inputs.bam_input.nameroot) === null || _a === void 0 ? void 0 :_a.replace(normal_re_replacement, \"\"), \"_normal\");\n }\n /*\n Check if cram_input is set\n */\n if (inputs.cram_input !== null && inputs.cram_input !== undefined) {\n /* Remove _normal from nameroot if it already exists */\n /* We dont want _normal_normal as a suffix */\n return \"\".concat((_b = inputs.cram_input.nameroot) === null || _b === void 0 ? void 0 :_b.replace(normal_re_replacement, \"\"), \"_normal\");\n }\n /*\n Check if fastq list file is set\n */\n if (inputs.fastq_list !== null && inputs.fastq_list !== undefined) {\n normal_name = get_normal_name_from_fastq_list_csv(inputs.fastq_list);\n if (normal_name !== null) {\n return \"\".concat(normal_name, \"_normal\");\n }\n }\n /*\n Otherwise collect and return from schema object\n */\n normal_name = get_normal_name_from_fastq_list_rows(inputs.fastq_list_rows);\n return \"\".concat(normal_name, \"_normal\");\n}\nfunction build_fastq_list_csv_header(header_names) {\n /*\n Convert lowercase labels to uppercase values\n i.e\n [ \"rgid\", \"rglb\", \"rgsm\", \"lane\", \"read_1\", \"read_2\" ]\n to\n \"RGID,RGLB,RGSM,Lane,Read1File,Read2File\"\n */\n var modified_header_names = [];\n for (var _i = 0, header_names_1 = header_names; _i < header_names_1.length; _i++) {\n var header_name = header_names_1[_i];\n if (header_name.indexOf(\"rg\") === 0) {\n /*\n rgid -> RGID\n */\n modified_header_names.push(header_name.toUpperCase());\n }\n else if (header_name.indexOf(\"read\") === 0) {\n /*\n read_1 -> Read1File\n */\n modified_header_names.push(\"Read\" + header_name.charAt(header_name.length - 1) + \"File\");\n }\n else {\n /*\n lane to Lane\n */\n modified_header_names.push(header_name[0].toUpperCase() + header_name.substr(1));\n }\n }\n /*\n Convert array to comma separated strings\n */\n return modified_header_names.join(\",\") + \"\\n\";\n}\nfunction get_fastq_list_row_as_csv_row(fastq_list_row, row_order) {\n var fastq_list_row_values_array = [];\n /* This for loop is here to ensure were assigning values in the same order as the header */\n for (var _i = 0, row_order_1 = row_order; _i < row_order_1.length; _i++) {\n var item_index = row_order_1[_i];\n var found_item = false;\n /* Find matching attribute in this row */\n for (var _a = 0, _b = Object.getOwnPropertyNames(fastq_list_row); _a < _b.length; _a++) {\n var fastq_list_row_field_name = _b[_a];\n var fastq_list_row_field_value = fastq_list_row[fastq_list_row_field_name];\n if (fastq_list_row_field_value === null) {\n /*\n Item not found, add an empty attribute for this cell in the csv\n */\n continue;\n }\n /* The header value matches the name in the item */\n if (fastq_list_row_field_name === item_index) {\n /*\n If the field value has a class attribute then it's either read_1 or read_2\n */\n if (fastq_list_row_field_value.hasOwnProperty(\"class\")) {\n var fastq_list_row_field_value_file = fastq_list_row_field_value;\n /*\n Assert that this is actually of class file\n */\n if (fastq_list_row_field_value_file.class !== \"File\") {\n continue;\n }\n if (fastq_list_row_field_value_file.path !== null && fastq_list_row_field_value_file.path !== undefined) {\n /*\n Push the path attribute to the fastq list csv row if it is not null\n */\n fastq_list_row_values_array.push(fastq_list_row_field_value_file.path);\n }\n else {\n /*\n Otherwise push the location attribute\n */\n fastq_list_row_values_array.push(fastq_list_row_field_value_file.location);\n }\n }\n else {\n /*\n Push the string attribute to the fastq list csv row\n */\n fastq_list_row_values_array.push(fastq_list_row_field_value.toString());\n }\n found_item = true;\n break;\n }\n }\n if (!found_item) {\n /*\n Push blank cell if no item found\n */\n fastq_list_row_values_array.push(\"\");\n }\n }\n /*\n Convert to string and return as string\n */\n return fastq_list_row_values_array.join(\",\") + \"\\n\";\n}\nfunction generate_fastq_list_csv(fastq_list_rows) {\n /*\n Fastq list rows generation\n */\n var fastq_csv_file = {\n class:\"File\",\n basename:get_fastq_list_csv_path()\n };\n /*\n Set the row order\n */\n var row_order = [];\n /*\n Set the array order\n Make sure we iterate through all rows of the array\n */\n for (var _i = 0, fastq_list_rows_1 = fastq_list_rows; _i < fastq_list_rows_1.length; _i++) {\n var fastq_list_row = fastq_list_rows_1[_i];\n for (var _a = 0, _b = Object.getOwnPropertyNames(fastq_list_row); _a < _b.length; _a++) {\n var fastq_list_row_field_name = _b[_a];\n if (row_order.indexOf(fastq_list_row_field_name) === -1) {\n row_order.push(fastq_list_row_field_name);\n }\n }\n }\n /*\n Make header\n */\n fastq_csv_file.contents = build_fastq_list_csv_header(row_order);\n /*\n For each fastq list row,\n collect the values of each attribute but in the order of the header\n */\n for (var _c = 0, fastq_list_rows_2 = fastq_list_rows; _c < fastq_list_rows_2.length; _c++) {\n var fastq_list_row = fastq_list_rows_2[_c];\n /* Add csv row to file contents */\n fastq_csv_file.contents += get_fastq_list_row_as_csv_row(fastq_list_row, row_order);\n }\n return fastq_csv_file;\n}\nfunction generate_germline_mount_points(inputs) {\n /*\n Create and add in the fastq list csv for the input fastqs\n */\n var e = [];\n if (inputs.fastq_list_rows !== null) {\n e.push({\n \"entryname\":get_fastq_list_csv_path(),\n \"entry\":generate_fastq_list_csv(inputs.fastq_list_rows)\n });\n }\n if (inputs.fastq_list !== null) {\n e.push({\n \"entryname\":get_fastq_list_csv_path(),\n \"entry\":inputs.fastq_list\n });\n }\n /*\n Return file paths\n */\n /* @ts-ignore Type '{ entryname:string; entry:FileProperties; }[]' is not assignable to type 'DirentProperties[]' */\n return e;\n}\nfunction generate_somatic_mount_points(inputs) {\n /*\n Create and add in the fastq list csv for the input fastqs\n */\n var e = [];\n if (inputs.fastq_list_rows !== null) {\n e.push({\n \"entryname\":get_fastq_list_csv_path(),\n \"entry\":generate_fastq_list_csv(inputs.fastq_list_rows)\n });\n }\n if (inputs.tumor_fastq_list_rows !== null) {\n e.push({\n \"entryname\":get_tumor_fastq_list_csv_path(),\n \"entry\":generate_fastq_list_csv(inputs.tumor_fastq_list_rows)\n });\n }\n if (inputs.fastq_list !== null) {\n e.push({\n \"entryname\":get_fastq_list_csv_path(),\n \"entry\":inputs.fastq_list\n });\n }\n if (inputs.tumor_fastq_list !== null) {\n e.push({\n \"entryname\":get_tumor_fastq_list_csv_path(),\n \"entry\":inputs.tumor_fastq_list\n });\n }\n /*\n Return file paths\n */\n /* @ts-ignore Type '{ entryname:string; entry:FileProperties; }[]' is not assignable to type 'DirentProperties[]' */\n return e;\n}\nfunction generate_transcriptome_mount_points(inputs) {\n /*\n Calls another function that generates mount points\n */\n return generate_germline_mount_points(inputs);\n}\n/* Custom functions for dragen reference tarball build */\nfunction get_liftover_dir() {\n /* Hardcoded liftover directory in dragen 4.2 */\n return \"/opt/edico/liftover/\";\n}\nfunction get_mask_dir() {\n /* Hardcoded mask directory in dragen 4.2 */\n return \"/opt/edico/fasta_mask/\";\n}\nfunction get_ref_scratch_dir(reference_name) {\n /* We get the reference scratch directory as a combination of */\n /* the dragen scratch mount and the reference name */\n return get_scratch_mount() + reference_name + \"/\";\n}\n", + "/* Author:Alexis Lucattini */\n/* For assistance on generation of typescript expressions */\n/* In CWL, please visit our wiki page at https://github.com/umccr/cwl-ica/wiki/TypeScript */\n/* Imports */\n/* Functions */\nfunction is_not_null(input_obj) {\n /*\n Determine if input object is defined and is not null\n */\n return !(input_obj === null || input_obj === undefined);\n}\nfunction get_attribute_from_optional_input(input_object, attribute) {\n /*\n Get attribute from optional input -\n If input is not defined, then return null\n */\n if (input_object === null || input_object === undefined) {\n return null;\n }\n else {\n return get_optional_attribute_from_object(input_object, attribute);\n }\n}\nfunction get_optional_attribute_from_object(input_object, attribute) {\n /*\n Get attribute from object, if attribute is not defined return null\n Assume the input object is an object of key value pairs where we know the key is of type string\n stackoverflow.com/questions/56833469/typescript-error-ts7053-element-implicitly-has-an-any-type\n */\n if (input_object.hasOwnProperty(attribute)) {\n return input_object[attribute];\n }\n else {\n return null;\n }\n}\nfunction get_bool_value_as_str(input_bool) {\n if (is_not_null(input_bool) && input_bool) {\n return \"true\";\n }\n else {\n return \"false\";\n }\n}\nfunction boolean_to_int(input_bool) {\n if (is_not_null(input_bool) && String(input_bool).toLowerCase() === \"true\") {\n return 1;\n }\n else {\n return 0;\n }\n}\nfunction get_optional_attribute_from_multi_type_input_object(object, attribute) {\n /*\n Get attribute from optional input\n */\n if (object === null || object === undefined) {\n return null;\n }\n else if (typeof object === \"object\") {\n /* Get attribute from optional input */\n return get_attribute_from_optional_input(object, attribute);\n }\n else {\n /* Object is likely actually a str */\n return object;\n }\n}\nfunction get_source_a_or_b(input_a, input_b) {\n /*\n Get the first input parameter if it is not null\n Otherwise return the second parameter\n Otherwise return null\n */\n if (is_not_null(input_a)) {\n return input_a;\n }\n else if (is_not_null(input_b)) {\n return input_b;\n }\n else {\n return null;\n }\n}\nfunction get_first_non_null_input(inputs) {\n /*\n Get first element of the array that is not null\n */\n for (var _i = 0, inputs_1 = inputs; _i < inputs_1.length; _i++) {\n var input_element = inputs_1[_i];\n if (is_not_null(input_element)) {\n return input_element;\n }\n }\n return null;\n}\nfunction get_attribute_list_from_object_list(obj_list, attribute) {\n /*\n Get attribute from list of objects\n If an object is null, it is not included in the return list\n */\n return obj_list.filter(function (x) { return x !== null; }).map(function (x) { return get_optional_attribute_from_object(x, attribute); });\n}\nfunction get_str_list_as_bash_array(input_list, item_wrap) {\n /*\n Convert a list of strings to a bash array, if the list is not defined return null\n */\n if (input_list === null) {\n return null;\n }\n if (item_wrap === null) {\n return \"( \".concat(input_list.map(function (x) { return \"'\".concat(item_wrap).concat(x).concat(item_wrap, \"'\"); }).join(' '), \" )\");\n }\n return \"( \".concat(input_list.map(function (x) { return \"'\".concat(x, \"'\"); }).join(' '), \" )\");\n}\nfunction get_object_attribute_list_as_bash_array(obj_list, attribute) {\n /*\n Get attribute from list of objects and convert to a bash array\n Do not include null values in the array\n */\n return get_str_list_as_bash_array(get_attribute_list_from_object_list(obj_list, attribute).filter(function (x) { return x !== null; }));\n}\n" ], "class": "InlineJavascriptRequirement" }, { - "tmpdirMin": "${\n /* 1 Tb */\n return 2 ** 20;\n}\n", + "tmpdirMin": "${\n /* 1 Tb */\n return Math.pow(2, 20);\n}\n", "class": "ResourceRequirement" }, { @@ -1274,6 +1312,44 @@ }, "id": "#dragen-somatic__4.2.4.cwl/dragen-somatic--4.2.4/cnv_use_somatic_vc_vaf" }, + { + "label": "cram input", + "doc": "Input a normal CRAM file for the variant calling stage\n", + "type": [ + "null", + "File" + ], + "inputBinding": { + "prefix": "--cram-input=", + "separate": false + }, + "secondaryFiles": [ + { + "pattern": ".crai", + "required": true + } + ], + "id": "#dragen-somatic__4.2.4.cwl/dragen-somatic--4.2.4/cram_input" + }, + { + "label": "cram reference", + "doc": "Path to the reference fasta file for the CRAM input.\nRequired only if the input is a cram file AND not the reference in the tarball\n", + "type": [ + "null", + "File" + ], + "inputBinding": { + "prefix": "--cram-reference=", + "separate": false + }, + "secondaryFiles": [ + { + "pattern": ".fai", + "required": true + } + ], + "id": "#dragen-somatic__4.2.4.cwl/dragen-somatic--4.2.4/cram_reference" + }, { "label": "dbsnp annotation", "doc": "In Germline, Tumor-Normal somatic, or Tumor-Only somatic modes,\nDRAGEN can look up variant calls in a dbSNP database and add annotations for any matches that it finds there.\nTo enable the dbSNP database search, set the --dbsnp option to the full path to the dbSNP database\nVCF or .vcf.gz file, which must be sorted in reference order.\n", @@ -1821,7 +1897,7 @@ }, { "label": "sv region", - "doc": "Limit the analysis to a specified region of the genome for debugging purposes.\nThis option can be specified multiple times to build a list of regions.\nThe value must be in the format \u201cchr:startPos-endPos\u201d..\n", + "doc": "Limit the analysis to a specified region of the genome for debugging purposes.\nThis option can be specified multiple times to build a list of regions.\nThe value must be in the format \"chr:startPos-endPos\"..\n", "type": [ "null", "string" @@ -1862,7 +1938,7 @@ }, { "label": "sv tin contam tolerance", - "doc": "Set the Tumor-in-Normal (TiN) contamination tolerance level.\nYou can enter any value between 0\u20131. The default maximum TiN contamination tolerance is 0.15.\n", + "doc": "Set the Tumor-in-Normal (TiN) contamination tolerance level.\nYou can enter any value between 0-1. The default maximum TiN contamination tolerance is 0.15.\n", "type": [ "null", "float" @@ -1918,6 +1994,25 @@ ], "id": "#dragen-somatic__4.2.4.cwl/dragen-somatic--4.2.4/tumor_bam_input" }, + { + "label": "tumor cram input", + "doc": "Input a tumor CRAM file for the variant calling stage\n", + "type": [ + "null", + "File" + ], + "inputBinding": { + "prefix": "--tumor-cram-input=", + "separate": false + }, + "secondaryFiles": [ + { + "pattern": ".crai", + "required": true + } + ], + "id": "#dragen-somatic__4.2.4.cwl/dragen-somatic--4.2.4/tumor_cram_input" + }, { "label": "tumor fastq list", "doc": "CSV file that contains a list of FASTQ files\nto process. read_1 and read_2 components in the CSV file must be presigned urls.\n", @@ -2199,7 +2294,7 @@ "null", "string" ], - "doc": "The artifact type to be filtered can be specified with the --vc-orientation-bias-filter-artifacts option.\nThe default is C/T,G/T, which correspond to OxoG and FFPE artifacts. Valid values include C/T, or G/T, or C/T,G/T,C/A.\nAn artifact (or an artifact and its reverse compliment) cannot be listed twice.\nFor example, C/T,G/A is not valid, because C\u2192G and T\u2192A are reverse compliments.\n", + "doc": "The artifact type to be filtered can be specified with the --vc-orientation-bias-filter-artifacts option.\nThe default is C/T,G/T, which correspond to OxoG and FFPE artifacts. Valid values include C/T, or G/T, or C/T,G/T,C/A.\nAn artifact (or an artifact and its reverse compliment) cannot be listed twice.\nFor example, C/T,G/A is not valid, because C->G and T->A are reverse compliments.\n", "inputBinding": { "prefix": "--vc-enable-orientation-bias-filter-artifacts=", "separate": false, @@ -2209,7 +2304,7 @@ }, { "label": "vc enable phasing", - "doc": "The \u2013vc-enable-phasing option enables variants to be phased when possible. The default value is true.\n", + "doc": "The -vc-enable-phasing option enables variants to be phased when possible. The default value is true.\n", "type": [ "null", "boolean" @@ -2273,7 +2368,7 @@ }, { "label": "vc enable vcf output", - "doc": "The \u2013vc-enable-vcf-output option enables VCF file output during a gVCF run. The default value is false.\n", + "doc": "The -vc-enable-vcf-output option enables VCF file output during a gVCF run. The default value is false.\n", "type": [ "null", "boolean" @@ -2287,7 +2382,7 @@ }, { "label": "vc hard filter", - "doc": "DRAGEN provides post-VCF variant filtering based on annotations present in the VCF records.\nHowever, due to the nature of DRAGEN\u2019s algorithms, which incorporate the hypothesis of correlated errors\nfrom within the core of variant caller, the pipeline has improved capabilities in distinguishing\nthe true variants from noise, and therefore the dependency on post-VCF filtering is substantially reduced.\nFor this reason, the default post-VCF filtering in DRAGEN is very simple\n", + "doc": "DRAGEN provides post-VCF variant filtering based on annotations present in the VCF records.\nHowever, due to the nature of DRAGEN's algorithms, which incorporate the hypothesis of correlated errors\nfrom within the core of variant caller, the pipeline has improved capabilities in distinguishing\nthe true variants from noise, and therefore the dependency on post-VCF filtering is substantially reduced.\nFor this reason, the default post-VCF filtering in DRAGEN is very simple\n", "type": [ "null", "string" @@ -2763,7 +2858,7 @@ "requirements": [ { "expressionLib": [ - "/* Author:Alexis Lucattini */\n/* For assistance on generation of typescript expressions */\n/* In CWL, please visit our wiki page at https://github.com/umccr/cwl-ica/wiki/TypeScript */\n/* Imports */\n/* Functions */\nfunction is_not_null(input_obj) {\n /*\n Determine if input object is defined and is not null\n */\n return !(input_obj === null || input_obj === undefined);\n}\nfunction get_attribute_from_optional_input(input_object, attribute) {\n /*\n Get attribute from optional input -\n If input is not defined, then return null\n */\n if (input_object === null || input_object === undefined) {\n return null;\n }\n else {\n return get_optional_attribute_from_object(input_object, attribute);\n }\n}\nfunction get_optional_attribute_from_object(input_object, attribute) {\n /*\n Get attribute from object, if attribute is not defined return null\n Assume the input object is an object of key value pairs where we know the key is of type string\n stackoverflow.com/questions/56833469/typescript-error-ts7053-element-implicitly-has-an-any-type\n */\n if (input_object.hasOwnProperty(attribute)) {\n return input_object[attribute];\n }\n else {\n return null;\n }\n}\nfunction get_bool_value_as_str(input_bool) {\n if (is_not_null(input_bool) && input_bool) {\n return \"true\";\n }\n else {\n return \"false\";\n }\n}\nfunction boolean_to_int(input_bool) {\n if (is_not_null(input_bool) && String(input_bool).toLowerCase() === \"true\") {\n return 1;\n }\n else {\n return 0;\n }\n}\nfunction get_optional_attribute_from_multi_type_input_object(object, attribute) {\n /*\n Get attribute from optional input\n */\n if (object === null || object === undefined) {\n return null;\n }\n else if (typeof object === \"object\") {\n /* Get attribute from optional input */\n return get_attribute_from_optional_input(object, attribute);\n }\n else {\n /* Object is likely actually a str */\n return object;\n }\n}\nfunction get_source_a_or_b(input_a, input_b) {\n /*\n Get the first input parameter if it is not null\n Otherwise return the second parameter\n Otherwise return null\n */\n if (is_not_null(input_a)) {\n return input_a;\n }\n else if (is_not_null(input_b)) {\n return input_b;\n }\n else {\n return null;\n }\n}\nfunction get_first_non_null_input(inputs) {\n /*\n Get first element of the array that is not null\n */\n for (var _i = 0, inputs_1 = inputs; _i < inputs_1.length; _i++) {\n var input_element = inputs_1[_i];\n if (is_not_null(input_element)) {\n return input_element;\n }\n }\n return null;\n}\n" + "/* Author:Alexis Lucattini */\n/* For assistance on generation of typescript expressions */\n/* In CWL, please visit our wiki page at https://github.com/umccr/cwl-ica/wiki/TypeScript */\n/* Imports */\n/* Functions */\nfunction is_not_null(input_obj) {\n /*\n Determine if input object is defined and is not null\n */\n return !(input_obj === null || input_obj === undefined);\n}\nfunction get_attribute_from_optional_input(input_object, attribute) {\n /*\n Get attribute from optional input -\n If input is not defined, then return null\n */\n if (input_object === null || input_object === undefined) {\n return null;\n }\n else {\n return get_optional_attribute_from_object(input_object, attribute);\n }\n}\nfunction get_optional_attribute_from_object(input_object, attribute) {\n /*\n Get attribute from object, if attribute is not defined return null\n Assume the input object is an object of key value pairs where we know the key is of type string\n stackoverflow.com/questions/56833469/typescript-error-ts7053-element-implicitly-has-an-any-type\n */\n if (input_object.hasOwnProperty(attribute)) {\n return input_object[attribute];\n }\n else {\n return null;\n }\n}\nfunction get_bool_value_as_str(input_bool) {\n if (is_not_null(input_bool) && input_bool) {\n return \"true\";\n }\n else {\n return \"false\";\n }\n}\nfunction boolean_to_int(input_bool) {\n if (is_not_null(input_bool) && String(input_bool).toLowerCase() === \"true\") {\n return 1;\n }\n else {\n return 0;\n }\n}\nfunction get_optional_attribute_from_multi_type_input_object(object, attribute) {\n /*\n Get attribute from optional input\n */\n if (object === null || object === undefined) {\n return null;\n }\n else if (typeof object === \"object\") {\n /* Get attribute from optional input */\n return get_attribute_from_optional_input(object, attribute);\n }\n else {\n /* Object is likely actually a str */\n return object;\n }\n}\nfunction get_source_a_or_b(input_a, input_b) {\n /*\n Get the first input parameter if it is not null\n Otherwise return the second parameter\n Otherwise return null\n */\n if (is_not_null(input_a)) {\n return input_a;\n }\n else if (is_not_null(input_b)) {\n return input_b;\n }\n else {\n return null;\n }\n}\nfunction get_first_non_null_input(inputs) {\n /*\n Get first element of the array that is not null\n */\n for (var _i = 0, inputs_1 = inputs; _i < inputs_1.length; _i++) {\n var input_element = inputs_1[_i];\n if (is_not_null(input_element)) {\n return input_element;\n }\n }\n return null;\n}\nfunction get_attribute_list_from_object_list(obj_list, attribute) {\n /*\n Get attribute from list of objects\n If an object is null, it is not included in the return list\n */\n return obj_list.filter(function (x) { return x !== null; }).map(function (x) { return get_optional_attribute_from_object(x, attribute); });\n}\nfunction get_str_list_as_bash_array(input_list, item_wrap) {\n /*\n Convert a list of strings to a bash array, if the list is not defined return null\n */\n if (input_list === null) {\n return null;\n }\n if (item_wrap === null) {\n return \"( \".concat(input_list.map(function (x) { return \"'\".concat(item_wrap).concat(x).concat(item_wrap, \"'\"); }).join(' '), \" )\");\n }\n return \"( \".concat(input_list.map(function (x) { return \"'\".concat(x, \"'\"); }).join(' '), \" )\");\n}\nfunction get_object_attribute_list_as_bash_array(obj_list, attribute) {\n /*\n Get attribute from list of objects and convert to a bash array\n Do not include null values in the array\n */\n return get_str_list_as_bash_array(get_attribute_list_from_object_list(obj_list, attribute).filter(function (x) { return x !== null; }));\n}\n" ], "class": "InlineJavascriptRequirement" }, @@ -2883,6 +2978,24 @@ ], "id": "#main/cnv_use_somatic_vc_vaf" }, + { + "label": "cram input", + "doc": "Input a normal CRAM file for the variant calling stage\n", + "type": [ + "null", + "File" + ], + "id": "#main/cram_input" + }, + { + "label": "cram reference", + "doc": "Path to the reference fasta file for the CRAM input.\nRequired only if the input is a cram file AND not the reference in the tarball\n", + "type": [ + "null", + "File" + ], + "id": "#main/cram_reference" + }, { "label": "dbsnp annotation", "doc": "In Germline, Tumor-Normal somatic, or Tumor-Only somatic modes,\nDRAGEN can look up variant calls in a dbSNP database and add annotations for any matches that it finds there.\nTo enable the dbSNP database search, set the --dbsnp option to the full path to the dbSNP database\nVCF or .vcf.gz file, which must be sorted in reference order.\n", @@ -3371,7 +3484,7 @@ }, { "label": "sv region", - "doc": "Limit the analysis to a specified region of the genome for debugging purposes.\nThis option can be specified multiple times to build a list of regions.\nThe value must be in the format \u201cchr:startPos-endPos\u201d..\n", + "doc": "Limit the analysis to a specified region of the genome for debugging purposes.\nThis option can be specified multiple times to build a list of regions.\nThe value must be in the format \"chr:startPos-endPos\"..\n", "type": [ "null", "string" @@ -3398,7 +3511,7 @@ }, { "label": "sv tin contam tolerance", - "doc": "Set the Tumor-in-Normal (TiN) contamination tolerance level.\nYou can enter any value between 0\u20131. The default maximum TiN contamination tolerance is 0.15.\n", + "doc": "Set the Tumor-in-Normal (TiN) contamination tolerance level.\nYou can enter any value between 0-1. The default maximum TiN contamination tolerance is 0.15.\n", "type": [ "null", "float" @@ -3438,6 +3551,15 @@ ], "id": "#main/tumor_bam_input" }, + { + "label": "tumor cram input", + "doc": "Input a tumor CRAM file for the variant calling stage\n", + "type": [ + "null", + "File" + ], + "id": "#main/tumor_cram_input" + }, { "label": "tumor fastq list", "doc": "CSV file that contains a list of FASTQ files\nto process.\n", @@ -3645,12 +3767,12 @@ "null", "string" ], - "doc": "The artifact type to be filtered can be specified with the --vc-orientation-bias-filter-artifacts option.\nThe default is C/T,G/T, which correspond to OxoG and FFPE artifacts. Valid values include C/T, or G/T, or C/T,G/T,C/A.\nAn artifact (or an artifact and its reverse compliment) cannot be listed twice.\nFor example, C/T,G/A is not valid, because C\u2192G and T\u2192A are reverse compliments.\n", + "doc": "The artifact type to be filtered can be specified with the --vc-orientation-bias-filter-artifacts option.\nThe default is C/T,G/T, which correspond to OxoG and FFPE artifacts. Valid values include C/T, or G/T, or C/T,G/T,C/A.\nAn artifact (or an artifact and its reverse compliment) cannot be listed twice.\nFor example, C/T,G/A is not valid, because C->G and T->A are reverse compliments.\n", "id": "#main/vc_enable_orientation_bias_filter_artifacts" }, { "label": "vc enable phasing", - "doc": "The \u2013vc-enable-phasing option enables variants to be phased when possible. The default value is true.\n", + "doc": "The -vc-enable-phasing option enables variants to be phased when possible. The default value is true.\n", "type": [ "null", "boolean" @@ -3694,7 +3816,7 @@ }, { "label": "vc enable vcf output", - "doc": "The \u2013vc-enable-vcf-output option enables VCF file output during a gVCF run. The default value is false.\n", + "doc": "The -vc-enable-vcf-output option enables VCF file output during a gVCF run. The default value is false.\n", "type": [ "null", "boolean" @@ -3718,7 +3840,7 @@ }, { "label": "vc hard filter", - "doc": "DRAGEN provides post-VCF variant filtering based on annotations present in the VCF records.\nHowever, due to the nature of DRAGEN\u2019s algorithms, which incorporate the hypothesis of correlated errors\nfrom within the core of variant caller, the pipeline has improved capabilities in distinguishing\nthe true variants from noise, and therefore the dependency on post-VCF filtering is substantially reduced.\nFor this reason, the default post-VCF filtering in DRAGEN is very simple\n", + "doc": "DRAGEN provides post-VCF variant filtering based on annotations present in the VCF records.\nHowever, due to the nature of DRAGEN's algorithms, which incorporate the hypothesis of correlated errors\nfrom within the core of variant caller, the pipeline has improved capabilities in distinguishing\nthe true variants from noise, and therefore the dependency on post-VCF filtering is substantially reduced.\nFor this reason, the default post-VCF filtering in DRAGEN is very simple\n", "type": [ "null", "string" @@ -3906,6 +4028,14 @@ "source": "#main/cnv_enable_self_normalization", "id": "#main/run_dragen_germline_step/cnv_enable_self_normalization" }, + { + "source": "#main/cram_input", + "id": "#main/run_dragen_germline_step/cram_input" + }, + { + "source": "#main/cram_reference", + "id": "#main/run_dragen_germline_step/cram_reference" + }, { "source": "#main/dbsnp_annotation", "id": "#main/run_dragen_germline_step/dbsnp_annotation" @@ -4249,6 +4379,14 @@ "source": "#main/cnv_use_somatic_vc_vaf", "id": "#main/run_dragen_somatic_step/cnv_use_somatic_vc_vaf" }, + { + "source": "#main/cram_input", + "id": "#main/run_dragen_somatic_step/cram_input" + }, + { + "source": "#main/cram_reference", + "id": "#main/run_dragen_somatic_step/cram_reference" + }, { "source": "#main/dbsnp_annotation", "id": "#main/run_dragen_somatic_step/dbsnp_annotation" @@ -4457,6 +4595,10 @@ "source": "#main/tumor_bam_input", "id": "#main/run_dragen_somatic_step/tumor_bam_input" }, + { + "source": "#main/tumor_cram_input", + "id": "#main/run_dragen_somatic_step/tumor_cram_input" + }, { "source": "#main/tumor_fastq_list", "id": "#main/run_dragen_somatic_step/tumor_fastq_list" @@ -4623,7 +4765,7 @@ }, { "source": "#main/vc_target_vaf_somatic", - "id": "#main/run_dragen_somatic_step/vc_target_vaf_somatic" + "id": "#main/run_dragen_somatic_step/vc_target_vaf" }, { "source": "#main/vc_tin_contam_tolerance",