@@ -24,6 +24,8 @@ exports.get_dragen_config_path = get_dragen_config_path;
2424exports . dragen_to_config_toml = dragen_to_config_toml ;
2525exports . generate_sequence_data_mount_points = generate_sequence_data_mount_points ;
2626exports . generate_alignment_data_mount_points = generate_alignment_data_mount_points ;
27+ exports . generate_mv_qc_files_script_mount_points = generate_mv_qc_files_script_mount_points ;
28+ exports . generate_mv_qc_files_script = generate_mv_qc_files_script ;
2729exports . dragen_merge_options = dragen_merge_options ;
2830exports . get_dragen_wgts_dna_alignment_stage_options_from_pipeline = get_dragen_wgts_dna_alignment_stage_options_from_pipeline ;
2931exports . get_dragen_wgts_rna_alignment_stage_options_from_pipeline = get_dragen_wgts_rna_alignment_stage_options_from_pipeline ;
@@ -946,6 +948,105 @@ function generate_alignment_data_mount_points(alignment_data, tumor_alignment_da
946948 // @ts -ignore Type '{ entryname: string; entry: FileProperties; }[]' is not assignable to type 'DirentProperties[]'
947949 return e ;
948950}
951+ function generate_mv_qc_files_script_mount_points ( options_list ) {
952+ /*
953+ If alignment_options.qc_coverage is defined, we generate a script to move the qc files to their name attribute
954+ */
955+ var qc_files_script = generate_mv_qc_files_script ( options_list ) ;
956+ if ( ! qc_files_script ) {
957+ return [ ] ;
958+ }
959+ else {
960+ return [
961+ {
962+ entryname : qc_files_script . basename ,
963+ // @ts -ignore Type '{ entryname: string; entry: FileProperties; }[]' is not assignable to type 'DirentProperties[]'
964+ entry : qc_files_script
965+ }
966+ ] ;
967+ }
968+ }
969+ function generate_mv_qc_files_script ( options_list ) {
970+ /*
971+ Generate mv qc files script
972+ */
973+ /* Check if alignment_options.qc_coverage is defined */
974+ if ( ! options_list . alignment_options . qc_coverage || options_list . alignment_options . qc_coverage . length === 0 ) {
975+ return null ;
976+ }
977+ /* Initialise vars */
978+ var output_file_prefix = options_list . output_file_prefix ;
979+ var output_directory = options_list . output_directory ;
980+ /* Initialise the script */
981+ var mv_qc_files_script = "#!/usr/bin/env bash\n\n" ;
982+ mv_qc_files_script += "# Exit on failure\n" ;
983+ mv_qc_files_script += "set -euo pipefail\n\n" ;
984+ mv_qc_files_script += "# Log start\n" ;
985+ mv_qc_files_script += "echo \"Start Moving QC files\" 1>&2\n\n" ;
986+ /* Arrays to make */
987+ var qc_files_suffixes = [
988+ /* Germline */
989+ "contig_mean_cov.csv" ,
990+ "cov_report.bed" ,
991+ "coverage_metrics.csv" ,
992+ "fine_hist.csv" ,
993+ "hist.csv" ,
994+ "overall_mean_cov.csv" ,
995+ "read_cov_report.bed" ,
996+ /* Somatic */
997+ "contig_mean_cov_normal.csv" ,
998+ "contig_mean_cov_tumor.csv" ,
999+ "cov_report_normal.bed" ,
1000+ "cov_report_tumor.bed" ,
1001+ "coverage_metrics_normal.csv" ,
1002+ "coverage_metrics_tumor.csv" ,
1003+ "fine_hist_normal.csv" ,
1004+ "fine_hist_tumor.csv" ,
1005+ "hist_normal.csv" ,
1006+ "hist_tumor.csv" ,
1007+ "overall_mean_cov_normal.csv" ,
1008+ "overall_mean_cov_tumor.csv" ,
1009+ "read_cov_report_normal.bed" ,
1010+ "read_cov_report_tumor.bed" ,
1011+ "somatic_callable_regions.bed" ,
1012+ ] ;
1013+ var qc_file_names = options_list . alignment_options . qc_coverage . map ( function ( qc_coverage ) { return qc_coverage . name ; } ) ;
1014+ /* Create the qc suffixes array */
1015+ mv_qc_files_script += "# Initialise coverage arrays \n" ;
1016+ mv_qc_files_script += "QC_SUFFIXES=( \\\n" ;
1017+ for ( var _i = 0 , qc_files_suffixes_1 = qc_files_suffixes ; _i < qc_files_suffixes_1 . length ; _i ++ ) {
1018+ var qc_suffix = qc_files_suffixes_1 [ _i ] ;
1019+ mv_qc_files_script += " \"" . concat ( qc_suffix , "\" \\\n" ) ;
1020+ }
1021+ mv_qc_files_script += ")\n\n" ;
1022+ /* QC Array complete */
1023+ /* Create the array of qc names */
1024+ mv_qc_files_script += "QC_COVERAGE_NAMES=( \\\n" ;
1025+ for ( var _a = 0 , qc_file_names_1 = qc_file_names ; _a < qc_file_names_1 . length ; _a ++ ) {
1026+ var qc_coverage_name = qc_file_names_1 [ _a ] ;
1027+ mv_qc_files_script += " \"" . concat ( qc_coverage_name , "\" \\\n" ) ;
1028+ }
1029+ mv_qc_files_script += ")\n\n" ;
1030+ /* Now iterate through each qc name and suffix to move the files */
1031+ mv_qc_files_script += "# Move the QC files to the output directory\n" ;
1032+ mv_qc_files_script += "for qc_name_idx in \"${!QC_COVERAGE_NAMES[@]}\"; do\n" ;
1033+ mv_qc_files_script += " qc_name=\"${QC_COVERAGE_NAMES[$qc_name_idx]}\"\n" ;
1034+ mv_qc_files_script += " for qc_suffix in \"${QC_SUFFIXES[@]}\"; do\n" ;
1035+ mv_qc_files_script += " if [[ -f \"" . concat ( output_directory , "/" ) . concat ( output_file_prefix , ".qc-coverage-region-$((qc_name_idx+1))_${qc_suffix}\" ]]; then\n" ) ;
1036+ mv_qc_files_script += " mv \\\n" ;
1037+ mv_qc_files_script += " \"" . concat ( output_directory , "/" ) . concat ( output_file_prefix , ".qc-coverage-region-$((qc_name_idx+1))_${qc_suffix}\" \\\n" ) ;
1038+ mv_qc_files_script += " \"" . concat ( output_directory , "/" ) . concat ( output_file_prefix , ".qc-coverage-region-${qc_name}_${qc_suffix}\"\n" ) ;
1039+ mv_qc_files_script += " fi\n" ;
1040+ mv_qc_files_script += " done\n" ;
1041+ mv_qc_files_script += "done\n\n" ;
1042+ mv_qc_files_script += "# Log completion\n" ;
1043+ mv_qc_files_script += "echo \"Finish Moving QC files\" 1>&2\n" ;
1044+ return {
1045+ class_ : cwl_ts_auto_1 . File_class . FILE ,
1046+ basename : "mv_qc_files.sh" ,
1047+ contents : mv_qc_files_script
1048+ } ;
1049+ }
9491050function dragen_merge_options ( options_list ) {
9501051 /*
9511052 Merge a list of objects, ignoring null or undefined values
@@ -1159,7 +1260,7 @@ function get_dragen_wgts_rna_variant_calling_stage_options_from_pipeline(props)
11591260 ref_tar : props . reference . tarball ,
11601261 /* Ora reference */
11611262 ora_reference : props . ora_reference ? props . ora_reference : null ,
1162- /* Annotation file, used for a lot of the variant calling optoins */
1263+ /* Annotation file, used for a lot of the variant calling options */
11631264 annotation_file : props . annotation_file ,
11641265 /* Stage specific options */
11651266 /* Use tumor_sample_name if it exists otherwise use the standard sample name */
0 commit comments