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

Keep unresolved Manta calls #723

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 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
3 changes: 2 additions & 1 deletion wdl/GatherBatchEvidence.wdl
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,8 @@ workflow GatherBatchEvidence {
File? BAF_stats = MatrixQC.BAF_stats
File? Matrix_QC_plot = MatrixQC.QC_plot

Array[File]? manta_tloc = TinyResolve.tloc_manta_vcf
File? manta_tloc_tar = TinyResolve.manta_tloc_tar
File? manta_unresolved_tar = TinyResolve.manta_unresolved_tar

File? metrics_file_batchevidence = GatherBatchEvidenceMetrics.metrics_file
}
Expand Down
76 changes: 74 additions & 2 deletions wdl/TinyResolve.wdl
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ workflow TinyResolve {
String linux_docker
RuntimeAttr? runtime_attr_resolve
RuntimeAttr? runtime_attr_untar
RuntimeAttr? runtime_attr_concattars
}

scatter (disc in discfile) {
Expand Down Expand Up @@ -73,6 +74,7 @@ workflow TinyResolve {
input:
raw_vcfs=GetShardVcfs.shard_items,
samples=GetShardSamples.shard_items,
shard_number = i,
sv_pipeline_docker = sv_pipeline_docker,
cytoband=cytoband,
cytoband_idx=cytoband_idx,
Expand All @@ -83,8 +85,17 @@ workflow TinyResolve {
}
}

call ConcatTars {
input:
manta_tloc_tars=ResolveManta.manta_tloc_tar,
manta_unresolved_tars=ResolveManta.manta_unresolved_tar,
linux_docker=linux_docker,
runtime_attr_override=runtime_attr_concattars
}

output {
Array[File] tloc_manta_vcf = flatten(ResolveManta.tloc_vcf)
File manta_tloc_tar = ConcatTars.manta_tloc_tar
File manta_unresolved_tar = ConcatTars.manta_unresolved_tar
}
}

Expand All @@ -94,6 +105,7 @@ task ResolveManta {
Array[File] raw_vcfs
Array[String] samples
File cytoband_idx
Int shard_number
Array[File] discfile
Array[File] discfile_idx
File cytoband
Expand Down Expand Up @@ -128,11 +140,18 @@ task ResolveManta {
sample_no=`printf %03d $i`
bash /opt/sv-pipeline/00_preprocessing/scripts/mantatloccheck.sh $vcf $pe ${sample_id} ~{mei_bed} ~{cytoband}
mv ${sample_id}.manta.complex.vcf.gz tloc_${sample_no}.${sample_id}.manta.complex.vcf.gz
bgzip manta.unresolved.vcf
mv manta.unresolved.vcf.gz ${sample_no}.${sample_id}.manta.unresolved.vcf.gz
done
find . -type f -name '*.complex.vcf.gz' \
| tar --create --file='manta_tloc_~{shard_number}.tar' --files-from=-
find . -type f -name '*.unresolved.vcf.gz' \
| tar --create --file='manta_unresolved_~{shard_number}.tar' --files-from=-
>>>

output {
Array[File] tloc_vcf = glob("tloc_*.vcf.gz")
File manta_tloc_tar = 'manta_tloc_${shard_number}.tar'
File manta_unresolved_tar = 'manta_unresolved_${shard_number}.tar'
}

runtime {
Expand All @@ -145,3 +164,56 @@ task ResolveManta {
maxRetries: select_first([runtime_attr.max_retries, default_attr.max_retries])
}
}

task ConcatTars {
input {
Array[File] manta_tloc_tars
Array[File] manta_unresolved_tars
String linux_docker
RuntimeAttr? runtime_attr_override
}

RuntimeAttr default_attr = object {
cpu_cores: 1,
mem_gb: 1.0,
disk_gb: ceil(3 * (size(manta_tloc_tars, "GB") + size(manta_unresolved_tars, "GB"))),
CuriousTim marked this conversation as resolved.
Show resolved Hide resolved
boot_disk_gb: 10,
preemptible_tries: 3,
max_retries: 1
}
RuntimeAttr runtime_attr = select_first([runtime_attr_override, default_attr])

command <<<
set -o errexit
set -o pipefail
set -o nounset

mkdir manta_tloc
while read -r tl; do
tar --extract --file "${tl}" --directory manta_tloc
done < '~{write_lines(manta_tloc_tars)}'
tar --create --gzip --file manta_tloc.tar.gz manta_tloc
rm -rf manta_tloc

mkdir manta_unresolved
while read -r ur; do
tar --extract --file "${ur}" --directory manta_unresolved
done < '~{write_lines(manta_unresolved_tars)}'
tar --create --gzip --file manta_unresolved.tar.gz manta_unresolved
>>>

runtime {
cpu: select_first([runtime_attr.cpu_cores, default_attr.cpu_cores])
memory: select_first([runtime_attr.mem_gb, default_attr.mem_gb]) + " GiB"
disks: "local-disk " + select_first([runtime_attr.disk_gb, default_attr.disk_gb]) + " HDD"
bootDiskSizeGb: select_first([runtime_attr.boot_disk_gb, default_attr.boot_disk_gb])
docker: linux_docker
preemptible: select_first([runtime_attr.preemptible_tries, default_attr.preemptible_tries])
maxRetries: select_first([runtime_attr.max_retries, default_attr.max_retries])
}

output {
File manta_tloc_tar = 'manta_tloc.tar.gz'
File manta_unresolved_tar = 'manta_unresolved.tar.gz'
}
}
Loading