Skip to content

Commit feb57ee

Browse files
author
Pablo Riesgo Ferreiro
committed
Merge branch 'develop' into 'master'
Release 1.6.0 See merge request tron/tron-bam-preprocessing!21
2 parents 33d7f66 + 6be9be4 commit feb57ee

File tree

5 files changed

+15
-28
lines changed

5 files changed

+15
-28
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2019 TRON
3+
Copyright (c) 2019-2021 TRON
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

Makefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ test:
1313
nextflow main.nf -profile test,conda --skip_deduplication --output output/test4
1414
nextflow main.nf -profile test,conda --output output/test5 --skip_deduplication --skip_bqsr --skip_metrics --known_indels1 false --known_indels2 false
1515
nextflow main.nf -profile test,conda --output output/test6 --intervals false --skip_deduplication --skip_bqsr --skip_realignment
16-
nextflow main.nf -profile test,conda --output output/test7 --hs_metrics_target_coverage target_coverage.txt --hs_metrics_per_base_coverage per_base_coverage.txt --skip_bqsr --skip_realignment
17-
nextflow main.nf -profile test,conda --output output/test8 --hs_metrics_target_coverage target_coverage.txt --hs_metrics_per_base_coverage per_base_coverage.txt --collect_hs_metrics_min_base_quality 10 --collect_hs_metrics_min_mapping_quality 10 --remove_duplicates false --skip_bqsr --skip_realignment
16+
nextflow main.nf -profile test,conda --output output/test7 --skip_bqsr --skip_realignment
17+
nextflow main.nf -profile test,conda --output output/test8 --collect_hs_metrics_min_base_quality 10 --collect_hs_metrics_min_mapping_quality 10 --remove_duplicates false --skip_bqsr --skip_realignment
1818
nextflow main.nf -profile test,conda --output output/test9 --skip_deduplication --skip_bqsr --skip_realignment --input_files false --input_bam test_data/TESTX_S1_L001.bam
1919

2020
check:
@@ -48,6 +48,8 @@ check:
4848
test -s output/test7/sample2/TESTX_S1_L002.preprocessed.bai || { echo "Missing test 7 output file!"; exit 1; }
4949
test -s output/test8/sample1/TESTX_S1_L001.preprocessed.bam || { echo "Missing test 8 output file!"; exit 1; }
5050
test -s output/test8/sample1/TESTX_S1_L001.preprocessed.bai || { echo "Missing test 8 output file!"; exit 1; }
51+
test -s output/test8/sample1/metrics/TESTX_S1_L001.prepared.dedup.hs_metrics.txt || { echo "Missing test 8 output file!"; exit 1; }
52+
test -s output/test8/sample1/metrics/TESTX_S1_L001.prepared.dedup_metrics.txt || { echo "Missing test 8 output file!"; exit 1; }
5153
test -s output/test8/sample2/TESTX_S1_L002.preprocessed.bam || { echo "Missing test 8 output file!"; exit 1; }
5254
test -s output/test8/sample2/TESTX_S1_L002.preprocessed.bai || { echo "Missing test 8 output file!"; exit 1; }
5355
test -s output/test9/TESTX_S1_L001/TESTX_S1_L001.preprocessed.bam || { echo "Missing test 9 output file!"; exit 1; }

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,6 @@ Optional input:
7070
* --known_indels1: path to a VCF of known indels (optional to perform realignment around indels)
7171
* --known_indels2: path to a second VCF of known indels (optional to perform realignment around indels)
7272
* --intervals: path to an intervals file to collect HS metrics from, this can be built with Picard's BedToIntervalList (default: None)
73-
* --hs_metrics_target_coverage: name of output file for target HS metrics (default: None)
74-
* --hs_metrics_per_base_coverage: name of output file for per base HS metrics (default: None)
7573
* --collect_hs_minimum_base_quality: minimum base quality for a base to contribute coverage (default: 20).
7674
* --collect_hs_minimum_mapping_quality: minimum mapping quality for a read to contribute coverage (default: 20).
7775
* --skip_bqsr: optionally skip BQSR (default: false)

main.nf

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ params.dbsnp = false
1010
params.known_indels1 = false
1111
params.known_indels2 = false
1212
params.intervals = false
13-
params.hs_metrics_target_coverage = false
14-
params.hs_metrics_per_base_coverage = false
1513
params.skip_bqsr = false
1614
params.skip_realignment = false
1715
params.skip_deduplication = false
@@ -136,7 +134,7 @@ if (!params.skip_deduplication) {
136134
cpus "${params.mark_duplicates_cpus}"
137135
memory "${params.mark_duplicates_memory}"
138136
tag "${name}"
139-
publishDir "${publish_dir}/${name}/metrics", mode: "copy", pattern: "*.dedup_metrics"
137+
publishDir "${publish_dir}/${name}/metrics", mode: "copy", pattern: "*.dedup_metrics.txt"
140138

141139
input:
142140
set name, bam_name, type, file(bam) from prepared_bams
@@ -145,10 +143,10 @@ if (!params.skip_deduplication) {
145143
set val(name), val(bam_name), val(type),
146144
file("${bam.baseName}.dedup.bam"), file("${bam.baseName}.dedup.bam.bai") into deduplicated_bams,
147145
deduplicated_bams_for_metrics, deduplicated_bams_for_hs_metrics
148-
file("${bam.baseName}.dedup_metrics") optional true into deduplication_metrics
146+
file("${bam.baseName}.dedup_metrics.txt") optional true
149147

150148
script:
151-
dedup_metrics = params.skip_metrics ? "": "--metrics-file ${bam.baseName}.dedup_metrics"
149+
dedup_metrics = params.skip_metrics ? "": "--metrics-file ${bam.baseName}.dedup_metrics.txt"
152150
remove_duplicates = params.remove_duplicates ? "--remove-all-duplicates true" : "--remove-all-duplicates false"
153151
"""
154152
mkdir tmp
@@ -157,9 +155,7 @@ if (!params.skip_deduplication) {
157155
--java-options '-Xmx${params.mark_duplicates_memory} -Djava.io.tmpdir=tmp' \
158156
--input ${bam} \
159157
--output ${bam.baseName}.dedup.bam \
160-
--conf 'spark.executor.cores=${task.cpus}' \
161-
${remove_duplicates} \
162-
${dedup_metrics}
158+
--conf 'spark.executor.cores=${task.cpus}' ${remove_duplicates} ${dedup_metrics}
163159
"""
164160
}
165161
}
@@ -202,18 +198,11 @@ if (! params.skip_metrics) {
202198
set name, bam_name, type, file(bam), file(bai) from deduplicated_bams_for_hs_metrics
203199

204200
output:
205-
file("*_metrics") optional true into txt_hs_metrics
206-
file("*.pdf") optional true into pdf_hs_metrics
207-
file(params.hs_metrics_target_coverage) optional true into target_hs_metrics
208-
file(params.hs_metrics_per_base_coverage) optional true into per_base_hs_metrics
201+
file("*_metrics") optional true
202+
file("*.pdf") optional true
203+
file("${bam.baseName}.hs_metrics.txt")
209204

210205
script:
211-
hs_metrics_target_coverage= params.hs_metrics_target_coverage ?
212-
"--PER_TARGET_COVERAGE ${params.hs_metrics_target_coverage} --REFERENCE_SEQUENCE ${params.reference}" :
213-
""
214-
hs_metrics_per_base_coverage= params.hs_metrics_per_base_coverage ?
215-
"--PER_BASE_COVERAGE ${params.hs_metrics_per_base_coverage}" :
216-
""
217206
minimum_base_quality = params.collect_hs_metrics_min_base_quality ?
218207
"--MINIMUM_BASE_QUALITY ${params.collect_hs_metrics_min_base_quality}" : ""
219208
minimum_mapping_quality = params.collect_hs_metrics_min_mapping_quality ?
@@ -224,10 +213,10 @@ if (! params.skip_metrics) {
224213
gatk CollectHsMetrics \
225214
--java-options '-Xmx${params.metrics_memory} -Djava.io.tmpdir=tmp' \
226215
--INPUT ${bam} \
227-
--OUTPUT ${bam.baseName} \
216+
--OUTPUT ${bam.baseName}.hs_metrics.txt \
228217
--TARGET_INTERVALS ${params.intervals} \
229218
--BAIT_INTERVALS ${params.intervals} \
230-
${hs_metrics_target_coverage} ${hs_metrics_per_base_coverage} ${minimum_base_quality} ${minimum_mapping_quality}
219+
${minimum_base_quality} ${minimum_mapping_quality}
231220
"""
232221
}
233222
}

nextflow.config

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ process.shell = ['/bin/bash', '-euo', 'pipefail']
4646

4747
cleanup = true
4848

49-
VERSION = '1.5.0'
49+
VERSION = '1.6.0'
5050
DOI = 'https://zenodo.org/badge/latestdoi/358400957'
5151

5252
manifest {
@@ -83,8 +83,6 @@ Optional input:
8383
* --known_indels1: path to a VCF of known indels (optional to perform realignment around indels)
8484
* --known_indels2: path to a second VCF of known indels (optional to perform realignment around indels)
8585
* --intervals: path to an intervals file to collect HS metrics from, this can be built with Picard's BedToIntervalList (default: None)
86-
* --hs_metrics_target_coverage: name of output file for target HS metrics (default: None)
87-
* --hs_metrics_per_base_coverage: name of output file for per base HS metrics (default: None)
8886
* --collect_hs_minimum_base_quality: minimum base quality for a base to contribute coverage (default: 20).
8987
* --collect_hs_minimum_mapping_quality: minimum mapping quality for a read to contribute coverage (default: 20).
9088
* --skip_bqsr: optionally skip BQSR (default: false)

0 commit comments

Comments
 (0)