Add GATK indelrealigner tests

This commit is contained in:
James Fellows Yates 2022-06-08 21:14:08 +02:00
parent e9c29656e6
commit 4d7afa21e2
4 changed files with 35 additions and 26 deletions

View file

@ -22,11 +22,12 @@ process GATK_INDELREALIGNER {
task.ext.when == null || task.ext.when task.ext.when == null || task.ext.when
script: script:
if ("$input" == "${prefix}.bam") error "Input and output names are the same, set prefix in module configuration to disambiguate!"
def args = task.ext.args ?: '' def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}" def prefix = task.ext.prefix ?: "${meta.id}"
def known = known_vcf ? "-known ${known_vcf}" : "" def known = known_vcf ? "-known ${known_vcf}" : ""
if ("$input" == "${prefix}.bam") error "Input and output names are the same, set prefix in module configuration to disambiguate!"
def avail_mem = 3 def avail_mem = 3
if (!task.memory) { if (!task.memory) {
log.info '[GATK IndelRealigner] Available memory not known - defaulting to 3GB. Specify process memory requirements to change this.' log.info '[GATK IndelRealigner] Available memory not known - defaulting to 3GB. Specify process memory requirements to change this.'
@ -39,9 +40,8 @@ process GATK_INDELREALIGNER {
-Xmx${avail_mem}g \\ -Xmx${avail_mem}g \\
-T IndelRealigner \\ -T IndelRealigner \\
-R ${fasta} \\ -R ${fasta} \\
-nt ${task.cpus}
-I ${input} \\ -I ${input} \\
-targetIntervals ${intervals} \\ --targetIntervals ${intervals} \\
${known} \\ ${known} \\
-o ${prefix}.bam \\ -o ${prefix}.bam \\
$args $args

View file

@ -2,21 +2,32 @@
nextflow.enable.dsl = 2 nextflow.enable.dsl = 2
include { GATK_REALIGNERTARGETCREATOR } from '../../../../modules/gatk/realignertargetcreator/main.nf'
include { GATK_INDELREALIGNER } from '../../../../modules/gatk/indelrealigner/main.nf' include { GATK_INDELREALIGNER } from '../../../../modules/gatk/indelrealigner/main.nf'
// TODO add REalignerTargetCrator
workflow test_gatk_indelrealigner { workflow test_gatk_indelrealigner {
input = [
[ id:'test', single_end:false ], // meta map
file(params.test_data['sarscov2']['illumina']['test_paired_end_bam'], checkIfExists: true),
file(params.test_data['sarscov2']['illumina']['test_paired_end_bai'], checkIfExists: true),
GATK_REALIGNERTARGETCREATOR.out.intervals
]
reference = file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) fasta = file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)
fai = file(params.test_data['sarscov2']['genome']['genome_fasta_fai'], checkIfExists: true)
dict = file(params.test_data['sarscov2']['genome']['genome_dict'], checkIfExists: true)
GATK_INDELREALIGNER ( input, reference, [] ) input_realignertargetcreator = [ [ id:'test' ], // meta map
file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam'], checkIfExists: true),
file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam_bai'], checkIfExists: true),
]
GATK_REALIGNERTARGETCREATOR ( input_realignertargetcreator, fasta, fai, dict, [] )
ch_intervals = GATK_REALIGNERTARGETCREATOR.out.intervals
ch_bams_indelrealigner = Channel.of([ [ id:'test' ], // meta map
file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam'], checkIfExists: true),
file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam_bai'], checkIfExists: true)
])
ch_input_indelrealigner = ch_bams_indelrealigner.mix(ch_intervals).groupTuple(by: 0).map{ [it[0], it[1][0], it[2], it[1][1] ] }.dump(tag: "input")
GATK_INDELREALIGNER ( ch_input_indelrealigner, fasta, fai, dict, [] )
} }

View file

@ -1,6 +1,6 @@
process { process {
publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }
ext.prefix = "${meta.id}.realigned" ext.prefix = { "${meta.id}.realigned" }
} }

View file

@ -1,14 +1,12 @@
## TODO nf-core: Please run the following command to build this file: - name: gatk indelrealigner test_gatk_indelrealigner
# nf-core modules create-test-yml gatk/indelrealigner command: nextflow run ./tests/modules/gatk/indelrealigner -entry test_gatk_indelrealigner -c ./tests/config/nextflow.config -c ./tests/modules/gatk/indelrealigner/nextflow.config
- name: "gatk indelrealigner"
command: nextflow run ./tests/modules/gatk/indelrealigner -entry test_gatk_indelrealigner -c ./tests/config/nextflow.config -c ./tests/modules/gatk/indelrealigner/nextflow.config
tags: tags:
- "gatk" - gatk/indelrealigner
# - gatk
- "gatk/indelrealigner"
#
files: files:
- path: "output/gatk/test.bam" - path: output/gatk/test.realigned.bai
md5sum: e667c7caad0bc4b7ac383fd023c654fc md5sum: 85a67df8827fe426e7f3a458134c0551
- path: output/gatk/versions.yml - path: output/gatk/test.realigned.bam
md5sum: a01fe51bc4c6a3a6226fbf77b2c7cf3b md5sum: ea1df6f7fcafc408fae4dc1574813d8a
- path: output/gatk/test.realigned.intervals
md5sum: 7aa7a1b235a510e6591e262382086bf8