Skip to content

Commit d4efd15

Browse files
authored
Merge pull request #495 from nf-core/fix-indices-gatk
Add preserve realign + index
2 parents 8b77a0a + d423a2c commit d4efd15

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
3737
* [#400](https://github.com/nf-core/eager/issues/400) - Set correct recommended bwa mapping parameters from [Schubert et al. 2012](https://doi.org/10.1186/1471-2164-13-178)
3838
* [#410](https://github.com/nf-core/eager/issues/410) - Fixed nf-core/configs not being loaded properly
3939
* [#473](https://github.com/nf-core/eager/issues/473) - Fixed bug in sexdet_process on AWS
40+
* [#444](https://github.com/nf-core/eager/issues/444) - Provide option for preserving realigned bam + index
4041
* Increase MultiQC process memory requirements to ensure enough memory for large runs
4142

4243
### `Dependencies`

main.nf

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2236,21 +2236,21 @@ if ( params.gatk_ug_jar != '' ) {
22362236

22372237
output:
22382238
tuple samplename, libraryid, lane, seqtype, organism, strandedness, udg, file("*vcf.gz") into ch_ug_for_multivcfanalyzer,ch_ug_for_vcf2genome
2239-
tuple samplename, libraryid, lane, seqtype, organism, strandedness, udg, file("*realign.bam") optional true
2239+
tuple samplename, libraryid, lane, seqtype, organism, strandedness, udg, file("*realign.{bam,bai}") optional true
22402240

22412241
script:
22422242
defaultbasequalities = params.gatk_ug_defaultbasequalities == '' ? '' : " --defaultBaseQualities ${params.gatk_ug_defaultbasequalities}"
2243-
keep_realign = params.gatk_ug_keep_realign_bam ? "T" : "F"
2243+
def keep_realign = params.gatk_ug_keep_realign_bam ? "" : "rm ${samplename}.realign.bam"
2244+
def index_realign = params.gatk_ug_keep_realign_bam ? "samtools index ${samplename}.realign.bam" : ""
22442245
if (params.gatk_dbsnp == '')
22452246
"""
22462247
samtools index -b ${bam}
22472248
java -Xmx${task.memory.toGiga()}g -jar ${jar} -T RealignerTargetCreator -R ${fasta} -I ${bam} -nt ${task.cpus} -o ${samplename}.intervals ${defaultbasequalities}
22482249
java -Xmx${task.memory.toGiga()}g -jar ${jar} -T IndelRealigner -R ${fasta} -I ${bam} -targetIntervals ${samplename}.intervals -o ${samplename}.realign.bam ${defaultbasequalities}
22492250
java -Xmx${task.memory.toGiga()}g -jar ${jar} -T UnifiedGenotyper -R ${fasta} -I ${samplename}.realign.bam -o ${samplename}.unifiedgenotyper.vcf -nt ${task.cpus} --genotype_likelihoods_model ${params.gatk_ug_genotype_model} -stand_call_conf ${params.gatk_call_conf} --sample_ploidy ${params.gatk_ploidy} -dcov ${params.gatk_downsample} --output_mode ${params.gatk_ug_out_mode} ${defaultbasequalities}
22502251
2251-
if [[ ${keep_realign} == 'F' ]]; then
2252-
rm ${samplename}.realign.bam
2253-
fi
2252+
$keep_realign
2253+
$index_realign
22542254
22552255
pigz -p ${task.cpus} ${samplename}.unifiedgenotyper.vcf
22562256
"""
@@ -2261,9 +2261,8 @@ if ( params.gatk_ug_jar != '' ) {
22612261
java -jar ${jar} -T IndelRealigner -R ${fasta} -I ${bam} -targetIntervals ${samplenane}.intervals -o ${samplename}.realign.bam ${defaultbasequalities}
22622262
java -jar ${jar} -T UnifiedGenotyper -R ${fasta} -I ${samplename}.realign.bam -o ${samplename}.unifiedgenotyper.vcf -nt ${task.cpus} --dbsnp ${params.gatk_dbsnp} --genotype_likelihoods_model ${params.gatk_ug_genotype_model} -stand_call_conf ${params.gatk_call_conf} --sample_ploidy ${params.gatk_ploidy} -dcov ${params.gatk_downsample} --output_mode ${params.gatk_ug_out_mode} ${defaultbasequalities}
22632263
2264-
if [[ ${keep_realign} == 'F' ]]; then
2265-
rm ${samplename}.realign.bam
2266-
fi
2264+
$keep_realign
2265+
$index_realign
22672266
22682267
pigz -p ${task.cpus} ${samplename}.unifiedgenotyper.vcf
22692268
"""

0 commit comments

Comments
 (0)