Skip to content

Commit

Permalink
Add intervalToBad task
Browse files Browse the repository at this point in the history
  • Loading branch information
yueyaog committed Jun 17, 2024
1 parent c53b197 commit 5775017
Showing 1 changed file with 29 additions and 3 deletions.
32 changes: 29 additions & 3 deletions CoverageProfiler/CoverageProfiler.wdl
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ workflow coverageProfile {
Int MinMappingQuality = 20
}
if (coverageTool =="Samtools") {
call IntervalListToBed {
input:
intervals = intervals
}
call SamtoolsDepth {
input:
sampleName = sampleName,
Expand All @@ -22,7 +26,7 @@ workflow coverageProfile {
referenceFasta = referenceFasta,
referenceDict = referenceDict,
referenceFai = referenceFai,
intervals = intervals,
target_bed = IntervalListToBed.bed_intervals,
minBaseQuality = MinBaseQuality,
minMappingQuality = MinMappingQuality
}
Expand Down Expand Up @@ -98,7 +102,29 @@ workflow coverageProfile {
disks: "local-disk 500 SSD"
}
}
task IntervalListToBed {
input {
File intervals
}
command <<<
# Create directories for output
mkdir output

# Convert interval list to BED file
# This is necessary because samtools depth requires a BED file as input
gatk IntervalListToBed \
--INPUT ~{intervals} \
--OUTPUT output/intervals.bed
>>>
output {
File bed_intervals = "output/intervals.bed"
}
runtime {
docker: "broadinstitute/gatk:4.5.0.0"
memory: "1 GB"
cpu: 1
}
}

task SamtoolsDepth {
input {
Expand All @@ -108,7 +134,7 @@ workflow coverageProfile {
File referenceFasta
File referenceDict
File referenceFai
File intervals
File target_bed
Int minBaseQuality
Int minMappingQuality
Int? mem_gb
Expand All @@ -122,7 +148,7 @@ workflow coverageProfile {

# Run samtools depth
samtools depth \
-b ~{intervals} \
-b ~{target_bed} \
-f input/bam_path.txt \
--min-BQ ~{minBaseQuality} \
--min-MQ ~{minMappingQuality} \
Expand Down

0 comments on commit 5775017

Please sign in to comment.