Skip to content

Commit e1b71c2

Browse files
authored
Merge pull request #260 from broadinstitute/ct-guess-instrument-model
guess instrument model in demux; pass to output
2 parents c1d835f + 4916e8e commit e1b71c2

File tree

6 files changed

+33
-14
lines changed

6 files changed

+33
-14
lines changed

pipes/WDL/tasks/tasks_demux.wdl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,8 @@ task illumina_demux {
292292
293293
illumina.py guess_barcodes --expected_assigned_fraction=0 barcodes.txt metrics.txt barcodes_outliers.txt
294294
295+
illumina.py flowcell_metadata --inDir $FLOWCELL_DIR flowcellMetadataFile.tsv
296+
295297
mkdir -p unmatched
296298
mv Unmatched.bam unmatched/
297299
@@ -352,6 +354,10 @@ task illumina_demux {
352354
Int max_ram_gb = ceil(read_float("MEM_BYTES")/1000000000)
353355
Int runtime_sec = ceil(read_float("UPTIME_SEC"))
354356
Int cpu_load_15min = ceil(read_float("LOAD_15M"))
357+
358+
String instrument_model = read_json("~{out_base}-runinfo.json")["sequencer_model"]
359+
String flowcell_lane_count = read_json("~{out_base}-runinfo.json")["lane_count"]
360+
355361
String viralngs_version = read_string("VERSION")
356362

357363
Map[String,Map[String,String]] meta_by_sample = read_json('meta_by_sample.json')

pipes/WDL/workflows/demux_deplete.wdl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ workflow demux_deplete {
2020
File? biosample_map
2121
Int min_reads_per_bam = 100
2222

23-
String? instrument_model
23+
String? instrument_model_user_specified
2424
String? sra_title
2525

2626
File spikein_db
@@ -113,8 +113,9 @@ workflow demux_deplete {
113113
library_metadata = samplesheet_rename_ids.new_sheet,
114114
platform = "ILLUMINA",
115115
paired = (illumina_demux.run_info[0]['indexes'] == '2'),
116+
116117
out_name = "sra_metadata-~{illumina_demux.run_info[0]['run_id']}.tsv",
117-
instrument_model = select_first([instrument_model]),
118+
instrument_model = select_first(flatten([[instrument_model_user_specified],[illumina_demux.run_info[0]['sequencer_model']]])),
118119
title = select_first([sra_title])
119120
}
120121
}
@@ -161,6 +162,8 @@ workflow demux_deplete {
161162
File multiqc_report_cleaned = multiqc_cleaned.multiqc_report
162163
File spikein_counts = spike_summary.count_summary
163164

165+
String instrument_model_inferred = select_first(flatten([[instrument_model_user_specified],[illumina_demux.run_info[0]['sequencer_model']]]))
166+
164167
String run_date = illumina_demux.run_info[0]['run_start_date']
165168
Map[String,String] run_info = illumina_demux.run_info[0]
166169
File run_info_json = illumina_demux.run_info_json[0]

pipes/WDL/workflows/demux_metag.wdl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ workflow demux_metag {
1414
Array[File]? bmtaggerDbs # .tar.gz, .tgz, .tar.bz2, .tar.lz4, .fasta, or .fasta.gz
1515
Array[File]? blastDbs # .tar.gz, .tgz, .tar.bz2, .tar.lz4, .fasta, or .fasta.gz
1616
Array[File]? bwaDbs
17+
String? instrument_model_user_specified
1718

1819
File kraken2_db_tgz
1920
File krona_taxonomy_db_kraken2_tgz
@@ -111,10 +112,12 @@ workflow demux_metag {
111112
Array[Int] read_counts_depleted = deplete.depletion_read_count_post
112113
Array[Int] read_counts_dedup = rmdup_ubam.dedup_read_count_post
113114
Array[Int] read_counts_prespades_subsample = spades.subsample_read_count
115+
114116

115117
File demux_metrics = illumina_demux.metrics
116118
File demux_commonBarcodes = illumina_demux.commonBarcodes
117119
File demux_outlierBarcodes = illumina_demux.outlierBarcodes
120+
String instrument_model_inferred = select_first(flatten([[instrument_model_user_specified],[illumina_demux.run_info['sequencer_model']]]))
118121

119122
File multiqc_report_raw = multiqc_raw.multiqc_report
120123
File multiqc_report_cleaned = multiqc_cleaned.multiqc_report

pipes/WDL/workflows/demux_only.wdl

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ workflow demux_only {
1010
email: "viral-ngs@broadinstitute.org"
1111
}
1212

13+
input {
14+
String? instrument_model_user_specified
15+
}
16+
1317
call tasks_demux.illumina_demux
1418

1519
call reports.MultiQC {
@@ -18,11 +22,12 @@ workflow demux_only {
1822
}
1923
2024
output {
21-
Array[File] raw_reads_unaligned_bams = illumina_demux.raw_reads_unaligned_bams
22-
File demux_metrics = illumina_demux.metrics
23-
File demux_commonBarcodes = illumina_demux.commonBarcodes
24-
File demux_outlierBarcodes = illumina_demux.outlierBarcodes
25-
File multiqc_report_raw = MultiQC.multiqc_report
26-
String demux_viral_core_version = illumina_demux.viralngs_version
25+
Array[File] raw_reads_unaligned_bams = illumina_demux.raw_reads_unaligned_bams
26+
File demux_metrics = illumina_demux.metrics
27+
File demux_commonBarcodes = illumina_demux.commonBarcodes
28+
File demux_outlierBarcodes = illumina_demux.outlierBarcodes
29+
File multiqc_report_raw = MultiQC.multiqc_report
30+
String instrument_model_inferred = select_first(flatten([[instrument_model_user_specified],[illumina_demux.run_info['sequencer_model']]]))
31+
String demux_viral_core_version = illumina_demux.viralngs_version
2732
}
2833
}

pipes/WDL/workflows/demux_plus.wdl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ workflow demux_plus {
2020
Array[File]? bmtaggerDbs # .tar.gz, .tgz, .tar.bz2, .tar.lz4, .fasta, or .fasta.gz
2121
Array[File]? blastDbs # .tar.gz, .tgz, .tar.bz2, .tar.lz4, .fasta, or .fasta.gz
2222
Array[File]? bwaDbs
23+
String? instrument_model_user_specified
2324
}
2425

2526
call demux.illumina_demux as illumina_demux
@@ -85,6 +86,7 @@ workflow demux_plus {
8586
File demux_metrics = illumina_demux.metrics
8687
File demux_commonBarcodes = illumina_demux.commonBarcodes
8788
File demux_outlierBarcodes = illumina_demux.outlierBarcodes
89+
String instrument_model_inferred = select_first(flatten([[instrument_model_user_specified],[illumina_demux.run_info['sequencer_model']]]))
8890

8991
File multiqc_report_raw = multiqc_raw.multiqc_report
9092
File multiqc_report_cleaned = multiqc_cleaned.multiqc_report

pipes/WDL/workflows/sarscov2_illumina_full.wdl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ workflow sarscov2_illumina_full {
4242
String amplicon_bed_prefix
4343

4444
Array[File] biosample_attributes
45-
String instrument_model
45+
String? instrument_model
4646
String sra_title
4747

4848
Int min_genome_bases = 24000
@@ -77,10 +77,10 @@ workflow sarscov2_illumina_full {
7777
### demux, deplete, SRA submission prep, fastqc/multiqc
7878
call demux_deplete.demux_deplete {
7979
input:
80-
flowcell_tgz = flowcell_tgz,
81-
biosample_map = biosample_merge.out_tsv,
82-
instrument_model = instrument_model,
83-
sra_title = sra_title
80+
flowcell_tgz = flowcell_tgz,
81+
biosample_map = biosample_merge.out_tsv,
82+
instrument_model_user_specified = instrument_model,
83+
sra_title = sra_title
8484
}
8585
String flowcell_id = demux_deplete.run_id
8686
@@ -134,7 +134,7 @@ workflow sarscov2_illumina_full {
134134
135135
File passing_assemblies = rename_fasta_header.renamed_fasta
136136
String passing_assembly_ids = orig_name
137-
Array[String] assembly_cmt = [orig_name, "Broad viral-ngs v. " + demux_deplete.demux_viral_core_version, assemble_refbased.assembly_mean_coverage, instrument_model]
137+
Array[String] assembly_cmt = [orig_name, "Broad viral-ngs v. " + demux_deplete.demux_viral_core_version, assemble_refbased.assembly_mean_coverage, demux_deplete.instrument_model_inferred]
138138
139139
# lineage assignment
140140
call sarscov2_lineages.sarscov2_lineages {

0 commit comments

Comments
 (0)