Skip to content

Commit

Permalink
Merge branch 'master' into ct-viral-core-2.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
tomkinsc authored Dec 3, 2024
2 parents 1a32ff9 + b8bb70b commit e959bc0
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 34 deletions.
3 changes: 2 additions & 1 deletion pipes/WDL/tasks/tasks_nextstrain.wdl
Original file line number Diff line number Diff line change
Expand Up @@ -1373,6 +1373,7 @@ task refine_augur_tree {
File msa_or_vcf
File metadata
Boolean generate_timetree = true
Int? gen_per_year
Float? clock_rate
Float? clock_std_dev
Expand Down Expand Up @@ -1409,7 +1410,7 @@ task refine_augur_tree {
--metadata "~{metadata}" \
--output-tree "~{out_basename}_timetree.nwk" \
--output-node-data "~{out_basename}_branch_lengths.json" \
--timetree \
~{true="--timetree" false="" generate_timetree} \
~{"--clock-rate " + clock_rate} \
~{"--clock-std-dev " + clock_std_dev} \
~{"--coalescent " + coalescent} \
Expand Down
2 changes: 1 addition & 1 deletion pipes/WDL/tasks/tasks_terra.wdl
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ task gcs_copy {

task check_terra_env {
input {
String docker = "quay.io/broadinstitute/viral-core:2.2.2" #skip-global-version-pin
String docker = "quay.io/broadinstitute/viral-core:2.4.0"
}
meta {
description: "task for inspection of backend to determine whether the task is running on Terra and/or GCP"
Expand Down
2 changes: 1 addition & 1 deletion pipes/WDL/workflows/augur_from_mltree.wdl
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,4 @@ workflow augur_from_mltree {
File time_tree = refine_augur_tree.tree_refined
File auspice_input_json = export_auspice_json.virus_json
}
}
}
64 changes: 33 additions & 31 deletions pipes/WDL/workflows/demux_deplete.wdl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ workflow demux_deplete {
Boolean insert_demux_outputs_into_terra_tables=false

File? sample_rename_map
Array[File]? biosample_map_tsvs
Array[File] biosample_map_tsvs = []
Int min_reads_per_bam = 100

String? instrument_model_user_specified
Expand Down Expand Up @@ -183,22 +183,43 @@ workflow demux_deplete {
Pair[String,Int] count_cleaned = (basename(raw_reads, '.bam'), read_count_post_depletion)
}

if (length(flatten(select_all([biosample_map_tsvs]))) > 0) {
if(insert_demux_outputs_into_terra_tables) {
call terra.check_terra_env

if(check_terra_env.is_running_on_terra) {
call terra.create_or_update_sample_tables {
input:
flowcell_run_id = illumina_demux.run_info[0]['run_id'],
workspace_name = check_terra_env.workspace_name,
workspace_namespace = check_terra_env.workspace_namespace,

raw_reads_unaligned_bams = flatten(illumina_demux.raw_reads_unaligned_bams),
cleaned_reads_unaligned_bams = select_all(cleaned_bam_passing),
meta_by_filename_json = meta_filename.merged_json,
read_counts_raw_json = write_json(count_raw),
read_counts_cleaned_json = write_json(count_cleaned)
}
}
}
if (length(biosample_map_tsvs) > 0) {
#### merge biosample attribute tsvs (iff provided with more than one)
if (length(flatten(select_all([biosample_map_tsvs]))) > 1) {
if (length(biosample_map_tsvs) > 1) {
call utils.tsv_join as biosample_map_tsv_join {
input:
input_tsvs = flatten([select_first([biosample_map_tsvs,[]])]),
input_tsvs = biosample_map_tsvs,
id_col = 'accession',
out_suffix = ".tsv",
out_basename = "biosample-attributes-merged"
}
}
File biosample_map_tsv = select_first(flatten([[biosample_map_tsv_join.out_tsv], biosample_map_tsvs]))

#### biosample metadata mapping
call ncbi.biosample_to_table {
input:
biosample_attributes_tsv = select_first([biosample_map_tsv_join.out_tsv, biosample_map_tsvs]),
biosample_attributes_tsv = biosample_map_tsv,
cleaned_bam_filepaths = select_all(cleaned_bam_passing),
demux_meta_json = meta_filename.merged_json
}
Expand All @@ -207,7 +228,7 @@ workflow demux_deplete {
call ncbi.sra_meta_prep {
input:
cleaned_bam_filepaths = select_all(cleaned_bam_passing),
biosample_map = select_first([biosample_map_tsv_join.out_tsv, biosample_map_tsvs]),
biosample_map = biosample_map_tsv,
library_metadata = samplesheet_rename_ids.new_sheet,
platform = "ILLUMINA",
paired = (illumina_demux.run_info[0]['indexes'] == '2'),
Expand All @@ -216,32 +237,13 @@ workflow demux_deplete {
instrument_model = select_first(flatten([[instrument_model_user_specified],[illumina_demux.run_info[0]['sequencer_model']]])),
title = select_first([sra_title])
}
}

if(insert_demux_outputs_into_terra_tables) {
call terra.check_terra_env

if(check_terra_env.is_running_on_terra) {
call terra.create_or_update_sample_tables {
input:
flowcell_run_id = illumina_demux.run_info[0]['run_id'],
workspace_name = check_terra_env.workspace_name,
workspace_namespace = check_terra_env.workspace_namespace,

raw_reads_unaligned_bams = flatten(illumina_demux.raw_reads_unaligned_bams),
cleaned_reads_unaligned_bams = select_all(cleaned_bam_passing),
meta_by_filename_json = meta_filename.merged_json,
read_counts_raw_json = write_json(count_raw),
read_counts_cleaned_json = write_json(count_cleaned)
}
if (length(flatten(select_all([biosample_map_tsvs]))) > 0) {
call terra.upload_entities_tsv as terra_load_biosample_data {
input:
workspace_name = check_terra_env.workspace_name,
terra_project = check_terra_env.workspace_namespace,
tsv_file = select_first([biosample_to_table.sample_meta_tsv])
}
if(insert_demux_outputs_into_terra_tables && select_first([check_terra_env.is_running_on_terra])) {
call terra.upload_entities_tsv as terra_load_biosample_data {
input:
workspace_name = select_first([check_terra_env.workspace_name]),
terra_project = select_first([check_terra_env.workspace_namespace]),
tsv_file = biosample_to_table.sample_meta_tsv
}
}
}
Expand Down

0 comments on commit e959bc0

Please sign in to comment.