Skip to content

Commit

Permalink
update localization commands
Browse files Browse the repository at this point in the history
  • Loading branch information
yueyaog committed Jun 12, 2024
1 parent 2dee841 commit 4d999f4
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions CoverageProfiler/CoverageProfiler.wdl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ workflow coverageProfile {
String sampleName
File alignedBam
File referenceFasta
File referenceDict
File referenceFai
File intervals
}
call DepthOfCoverage {
Expand All @@ -30,6 +32,8 @@ workflow coverageProfile {
String sampleName
File alignedBam
File referenceFasta
File referenceDict
File referenceFai
File intervals
Int? mem_gb
Int? cpu
Expand All @@ -38,11 +42,26 @@ workflow coverageProfile {
Int machine_mem_mb = select_first([mem_gb, 7]) * 1000
Int command_mem_mb = machine_mem_mb - 1000
command <<<
# Create directories for input, output, reference localization
mkdir input
mkdir output
mkdir reference

# Localize Reference Files and BAM
mv ~{referenceFasta} reference/reference.fasta
mv ~{referenceDict} reference/reference.dict
mv ~{referenceFai} reference/reference.fai
mv ~{alignedBam} input/~{sampleName}.bam

# Index BAM file
gatk BuildBamIndex \
--INPUT input/~{sampleName}.bam

# Run DepthOfCoverage
gatk --java-options "-Xmx~{command_mem_mb}m" DepthOfCoverage \
-L ~{intervals} \
--input ~{alignedBam} \
--reference ~{referenceFasta} \
--input input/~{sampleName}.bam \
--reference reference/reference.fasta \
--output output/~{sampleName}

cat output/~{sampleName}.sample_interval_summary | awk 'BEGIN {FS = ","}{print $3}' | tail -n 1 > output/mean_coverage.txt
Expand Down

0 comments on commit 4d999f4

Please sign in to comment.