Skip to content

Commit

Permalink
Alignment_Based_CNV_eval
Browse files Browse the repository at this point in the history
  • Loading branch information
yueyaog committed Aug 10, 2023
1 parent 8ad4f4f commit f9f2d15
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .dockstore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,5 +117,10 @@ workflows:
- name: CNV_BLAST
subclass: WDL
primaryDescriptorPath: /CNV_BLAST/cnv_blast.wdl
testParameterFiles:
- /CNV_BLAST/cnv_blast.inputs.json
- name: AlignmentBasedCNVEvaluation
subclass: WDL
primaryDescriptorPath: /AlignmentBasedCNVEvaluation/AlignmentBasedCNVEvaluation.wdl
testParameterFiles:
- /CNV_BLAST/cnv_blast.inputs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"AlignmentBasedCNVEval.reference_fasta": "File",
"AlignmentBasedCNVEval.T2T_last_database": "File",
"AlignmentBasedCNVEval.extract_cnv.mem_size": "Int (optional, default = 4)",
"AlignmentBasedCNVEval.extract_cnv.cpu_num": "Int (optional, default = 1)",
"AlignmentBasedCNVEval.cnv_vcf": "File",
"AlignmentBasedCNVEval.analysis_docker": "String",
"AlignmentBasedCNVEval.reference_last_database": "File",
"AlignmentBasedCNVEval.last_docker": "String",
"AlignmentBasedCNVEval.extract_cnv.disk_size": "Int (optional, default = 10)"
}

60 changes: 60 additions & 0 deletions AlignmentBasedCNVEvaluation/AlignmentBasedCNVEvaluation.wdl
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
version 1.0

workflow AlignmentBasedCNVEval {
input {
File cnv_vcf
File reference_fasta
File reference_last_database
File T2T_last_database
String last_docker
String analysis_docker
}
call extract_cnv {
input:
cnv_vcf = cnv_vcf
}
}

task extract_cnv {
input {
File cnv_vcf
Int cpu_num = 1
Int mem_size = 4
Int disk_size = 10
}
command <<<
set -e

filename=$(basename ~{cnv_vcf})
# Unzip the input file if it is gzipped
if test "${filename##*.}" = "gz"; then
gunzip -c ~{cnv_vcf} > temp.vcf
else
cp ~{cnv_vcf} temp.vcf
fi

# Extract the PASS events from the DRAGEN CNV VCF and save them to a file
cat temp.vcf | grep -v '#' | awk '$7 == "PASS" {print}' | awk '{print $3}' | awk 'BEGIN {FS=":"} {print $1":"$2"\t"$3":"$4}' > pass_cnv_event.txt

# Split CNV intervals to individual files
split -l 100 -d --additional-suffix=_interval.txt pass_cnv_event.txt pass_cnv_chunk_

# Print the number of GAINS and LOSSES that DRAGEN found
cat temp.vcf | grep -v '#' | awk '$7 == "PASS" {print}' | awk '{print $3}' | awk 'BEGIN {FS=":"} {print $2}' | sort | uniq -c | sort
>>>
output {
File uncompressed_cnv_vcf = "temp.vcf"
File cnv_events_file = "pass_cnv_event.txt"
Array[File] cnv_intervals_chucks = glob("pass_cnv_chunk_*")

}
runtime {
docker: "us.gcr.io/broad-dsde-methods/liquidbiopsy:0.0.3.7"
bootDiskSizeGb: 12
cpu: cpu_num
memory: mem_size + " GB"
disks: "local-disk " + disk_size + " HDD"
preemptible: 2
#maxRetries: 3
}
}

0 comments on commit f9f2d15

Please sign in to comment.