Skip to content

Commit

Permalink
add step to transform BED file into intervals
Browse files Browse the repository at this point in the history
  • Loading branch information
priesgo committed Nov 21, 2021
1 parent 233ab0b commit 76368ed
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
1 change: 0 additions & 1 deletion main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ params.dbsnp = false
params.known_indels1 = false
params.known_indels2 = false
params.intervals = false
params.intervals_bed = false
params.skip_bqsr = false
params.skip_realignment = false
params.skip_deduplication = false
Expand Down
12 changes: 8 additions & 4 deletions modules/03_metrics.nf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ params.collect_hs_metrics_min_base_quality = false
params.collect_hs_metrics_min_mapping_quality = false
params.reference = false
params.output = 'output'
params.intervals_bed = false
params.intervals = false


Expand Down Expand Up @@ -32,12 +31,17 @@ process HS_METRICS {
"""
mkdir tmp
gatk BedToIntervalList \
--INPUT ${params.intervals} \
--OUTPUT ${params.intervals}.intervals \
--SEQUENCE_DICTIONARY ${bam}
gatk CollectHsMetrics \
--java-options '-Xmx${params.metrics_memory} -Djava.io.tmpdir=tmp' \
--INPUT ${bam} \
--OUTPUT ${name}.hs_metrics.txt \
--TARGET_INTERVALS ${params.intervals} \
--BAIT_INTERVALS ${params.intervals} \
--TARGET_INTERVALS ${params.intervals}.intervals \
--BAIT_INTERVALS ${params.intervals}.intervals \
${minimum_base_quality} ${minimum_mapping_quality}
"""
}
Expand Down Expand Up @@ -96,7 +100,7 @@ process COVERAGE_ANALYSIS {
"--min-BQ ${params.collect_hs_metrics_min_base_quality}" : ""
minimum_mapping_quality = params.collect_hs_metrics_min_mapping_quality ?
"--min-MQ ${params.collect_hs_metrics_min_mapping_quality}" : ""
intervals = params.intervals_bed ? "-b ${params.intervals_bed}" : ""
intervals = params.intervals ? "-b ${params.intervals}" : ""
"""
samtools coverage ${minimum_base_quality} ${minimum_mapping_quality} ${bam} > ${name}.coverage.tsv
samtools depth -s -d 0 -H ${intervals} ${bam} > ${name}.depth.tsv
Expand Down
5 changes: 2 additions & 3 deletions nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ profiles {
params.index_memory = "3g"
params.known_indels1 = "$baseDir/test_data/1000G_phase1.indels.hg19.sites.minimal.vcf"
params.known_indels2 = "$baseDir/test_data/Mills_and_1000G_gold_standard.indels.hg19.sites.sorted.minimal.vcf"
params.intervals = "$baseDir/test_data/minimal_intervals.intervals"
params.intervals_bed = "$baseDir/test_data/minimal_intervals.bed"
params.intervals = "$baseDir/test_data/minimal_intervals.bed"
params.dbsnp = "$baseDir/test_data/dbsnp_138.hg19.minimal.vcf"
timeline.enabled = false
report.enabled = false
Expand Down Expand Up @@ -83,7 +82,7 @@ Optional input:
* --dbsnp: path to the dbSNP VCF (required to perform BQSR)
* --known_indels1: path to a VCF of known indels (optional to perform realignment around indels)
* --known_indels2: path to a second VCF of known indels (optional to perform realignment around indels)
* --intervals: path to an intervals file to collect HS metrics from, this can be built with Picard's BedToIntervalList (default: None)
* --intervals: path to a BED file to collect coverage and HS metrics from (default: None)
* --collect_hs_minimum_base_quality: minimum base quality for a base to contribute coverage (default: 20).
* --collect_hs_minimum_mapping_quality: minimum mapping quality for a read to contribute coverage (default: 20).
* --skip_bqsr: optionally skip BQSR (default: false)
Expand Down

0 comments on commit 76368ed

Please sign in to comment.