diff --git a/main.nf b/main.nf index a96d951..fab5149 100755 --- a/main.nf +++ b/main.nf @@ -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 diff --git a/modules/03_metrics.nf b/modules/03_metrics.nf index a7be35a..839f047 100644 --- a/modules/03_metrics.nf +++ b/modules/03_metrics.nf @@ -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 @@ -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} """ } @@ -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 diff --git a/nextflow.config b/nextflow.config index a5ed186..72739fa 100644 --- a/nextflow.config +++ b/nextflow.config @@ -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 @@ -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)