Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Intersect target and truth for P&S [VS-1460] #8931

Merged
merged 6 commits into from
Aug 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .dockstore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ workflows:
branches:
- master
- ah_var_store
- vs_1460_intersect_target_truth_ps
tags:
- /.*/
- name: GvsQuickstartVcfIntegration
Expand Down
48 changes: 46 additions & 2 deletions scripts/variantstore/wdl/GvsCalculatePrecisionAndSensitivity.wdl
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,24 @@ workflow GvsCalculatePrecisionAndSensitivity {
gotc_imputation_docker = effective_gotc_imputation_docker,
}

if (defined(target_interval_list)) {
call IntersectTargetIntervalListWithTruthBed {
input:
truth_bed = truth_beds[i],
target_interval_list = select_first([target_interval_list]),
gatk_docker = effective_gatk_docker,
}
}

File effective_truth_bed = select_first([IntersectTargetIntervalListWithTruthBed.intersected_truth_bed, truth_beds[i]])

call EvaluateVcf as EvaluateVcfFiltered {
input:
input_vcf = BgzipAndTabix.output_vcf,
input_vcf_index = BgzipAndTabix.output_vcf_index,
truth_vcf = truth_vcfs[i],
truth_vcf_index = truth_vcf_indices[i],
truth_bed = truth_beds[i],
truth_bed = effective_truth_bed,
vcf_eval_bed_file = vcf_eval_bed_file,
chromosomes = chromosomes,
output_basename = sample_name + "-bq_roc_filtered",
Expand All @@ -153,7 +164,7 @@ workflow GvsCalculatePrecisionAndSensitivity {
input_vcf_index = BgzipAndTabix.output_vcf_index,
truth_vcf = truth_vcfs[i],
truth_vcf_index = truth_vcf_indices[i],
truth_bed = truth_beds[i],
truth_bed = effective_truth_bed,
vcf_eval_bed_file = vcf_eval_bed_file,
chromosomes = chromosomes,
all_records = true,
Expand Down Expand Up @@ -524,3 +535,36 @@ task CountInputVcfs {
docker: basic_docker
}
}


task IntersectTargetIntervalListWithTruthBed {
input {
File truth_bed
File target_interval_list
String gatk_docker
}
command <<<
# Prepend date, time and pwd to xtrace log entries.
PS4='\D{+%F %T} \w $ '
set -o errexit -o nounset -o pipefail -o xtrace

# `basename` so the output ends up in $PWD (/cromwell_root) and not wherever the inputs were localized.
# The outputs of these transformations need to be in a place where the `glob` expression will find them.
target_bed="$(basename ~{target_interval_list})"
target_bed="${target_bed%%.interval_list}.bed"

gatk IntervalListToBed -I ~{target_interval_list} -O "${target_bed}" --SORT

truth_bed="~{truth_bed}"
intersected_truth_bed="$(basename ${truth_bed%%.bed})"
intersected_truth_bed="${intersected_truth_bed}_intersected.bed"

bedtools intersect -a "${target_bed}" -b ${truth_bed} > ${intersected_truth_bed}
>>>
runtime {
docker: gatk_docker
}
output {
File intersected_truth_bed = glob("*_intersected.bed")[0]
}
}
Loading