Skip to content

Commit

Permalink
first commit coverageProfiler wdl
Browse files Browse the repository at this point in the history
  • Loading branch information
yueyaog committed Jun 12, 2024
1 parent d507386 commit ecba43f
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 0 deletions.
12 changes: 12 additions & 0 deletions CoverageProfiler/CoverageProfiler.inputs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"coverageProfile.referenceFasta": "File",
"coverageProfile.DepthOfCoverage.gatk_docker": "String (optional, default = \"broadinstitute/gatk:4.5.0.0\")",
"coverageProfile.intervals": "File",
"coverageProfile.alignedBam": "File",
"coverageProfile.DepthOfCoverage.command_mem_mb": "Int? (optional)",
"coverageProfile.DepthOfCoverage.cpu": "Int? (optional)",
"coverageProfile.DepthOfCoverage.machine_mem_mb": "Int? (optional)",
"coverageProfile.DepthOfCoverage.mem_gb": "Int? (optional)",
"coverageProfile.sampleName": "String"
}

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

workflow coverageProfile {
input {
String sampleName
File alignedBam
File referenceFasta
File intervals
}
call DepthOfCoverage {
input:
sampleName = sampleName,
alignedBam = alignedBam,
referenceFasta = referenceFasta,
intervals = intervals
}
output {
File coveragebyInterval = DepthOfCoverage.sample_interval_summary
Float meanCoverage = DepthOfCoverage.mean_coverage
}
meta {
author: "Yueyao Gao"
email: "[email protected]"
description: "Calculates the depth of coverage of an input sample using GATK's DepthOfCoverage tool."

}
}
task DepthOfCoverage {
input {
String sampleName
File alignedBam
File referenceFasta
File intervals
Int? mem_gb
Int? cpu
Int machine_mem_mb = select_first([mem_gb, 7]) * 1000
Int command_mem_mb = machine_mem_mb - 1000
String gatk_docker = "broadinstitute/gatk:4.5.0.0"
}
command <<<
mkdir output
gatk --java-options "-Xmx~{command_mem_mb}m" DepthOfCoverage \
-L ~{intervals} \
--input ~{alignedBam} \
--reference ~{referenceFasta} \
--output output/~{sampleName}

cat output/~{sampleName}.sample_interval_summary | awk 'BEGIN {FS = ","}{print $3}' | tail -n 1 > output/mean_coverage.txt
>>>
output {
File sample_interval_summary = "output/${sampleName}.sample_interval_summary"
Float mean_coverage = read_float("output/mean_coverage.txt")
}
runtime {
memory: machine_mem_mb + " MB"
cpu: select_first([cpu, 1])
docker: gatk_docker
disks: "local-disk 500 HDD"
}
}

0 comments on commit ecba43f

Please sign in to comment.