diff --git a/CoverageProfiler/CoverageProfiler.inputs.json b/CoverageProfiler/CoverageProfiler.inputs.json new file mode 100644 index 0000000..1961db2 --- /dev/null +++ b/CoverageProfiler/CoverageProfiler.inputs.json @@ -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" +} + diff --git a/CoverageProfiler/CoverageProfiler.wdl b/CoverageProfiler/CoverageProfiler.wdl new file mode 100644 index 0000000..a6e8024 --- /dev/null +++ b/CoverageProfiler/CoverageProfiler.wdl @@ -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: "tag@broadinstitute.org" + 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" + } +} \ No newline at end of file