Skip to content
Snippets Groups Projects
Verified Commit 2e4cc629 authored by Laurent Modolo's avatar Laurent Modolo
Browse files

gatk4: change file_prefix definition to handle Map

parent d42ded32
No related branches found
No related tags found
No related merge requests found
version = "4.2.0.0" version = "4.2.0.0"
container_url = "broadinstitute/gatk:${version}" container_url = "broadinstitute/gatk:${version}"
def get_file_prefix(file_id) {
if (file_id instanceof List){
file_prefix = file_id[0]
} else if (file_id instanceof Map) {
library = file_id[0]
file_prefix = file_id[0]
if (file_id.containsKey('library')) {
library = file_id.library
file_prefix = file_id.id
}
} else {
file_prefix = file_id
}
return file_prefix
}
include { include {
index_fasta as samtools_index_fasta; index_fasta as samtools_index_fasta;
} from './../samtools/main.nf' } from './../samtools/main.nf'
...@@ -76,11 +92,7 @@ process index_vcf { ...@@ -76,11 +92,7 @@ process index_vcf {
script: script:
xmx_memory = "${task.memory}" - ~/\s*GB/ xmx_memory = "${task.memory}" - ~/\s*GB/
if (file_id instanceof List){ file_prefix = get_file_prefix(file_id)
file_prefix = file_id[0]
} else {
file_prefix = file_id
}
""" """
gatk --java-options "-Xmx${xmx_memory}G" IndexFeatureFile \ gatk --java-options "-Xmx${xmx_memory}G" IndexFeatureFile \
-I ${vcf} -I ${vcf}
...@@ -100,11 +112,7 @@ process compute_base_recalibration { ...@@ -100,11 +112,7 @@ process compute_base_recalibration {
script: script:
xmx_memory = "${task.memory}" - ~/\s*GB/ xmx_memory = "${task.memory}" - ~/\s*GB/
if (file_id instanceof List){ file_prefix = get_file_prefix(file_id)
file_prefix = file_id[0]
} else {
file_prefix = file_id
}
def vcf_cmd = "" def vcf_cmd = ""
if (vcf instanceof List){ if (vcf instanceof List){
for (vcf_file in vcf){ for (vcf_file in vcf){
...@@ -135,11 +143,7 @@ process apply_base_recalibration { ...@@ -135,11 +143,7 @@ process apply_base_recalibration {
script: script:
xmx_memory = "${task.memory}" - ~/\s*GB/ xmx_memory = "${task.memory}" - ~/\s*GB/
if (file_id instanceof List){ file_prefix = get_file_prefix(file_id)
file_prefix = file_id[0]
} else {
file_prefix = file_id
}
""" """
gatk --java-options "-Xmx${xmx_memory}G" ApplyBQSR \ gatk --java-options "-Xmx${xmx_memory}G" ApplyBQSR \
-R ${fasta} \ -R ${fasta} \
...@@ -163,11 +167,7 @@ process call_variants_per_sample { ...@@ -163,11 +167,7 @@ process call_variants_per_sample {
script: script:
xmx_memory = "${task.memory}" - ~/\s*GB/ xmx_memory = "${task.memory}" - ~/\s*GB/
if (file_id instanceof List){ file_prefix = get_file_prefix(file_id)
file_prefix = file_id[0]
} else {
file_prefix = file_id
}
""" """
gatk --java-options "-Xmx${xmx_memory}G" HaplotypeCaller \ gatk --java-options "-Xmx${xmx_memory}G" HaplotypeCaller \
-R ${fasta} \ -R ${fasta} \
...@@ -215,11 +215,7 @@ process index_gvcf { ...@@ -215,11 +215,7 @@ process index_gvcf {
script: script:
xmx_memory = "${task.memory}" - ~/\s*GB/ xmx_memory = "${task.memory}" - ~/\s*GB/
if (file_id instanceof List){ file_prefix = get_file_prefix(file_id)
file_prefix = file_id[0]
} else {
file_prefix = file_id
}
""" """
gatk --java-options "-Xmx${xmx_memory}G" IndexFeatureFile \ gatk --java-options "-Xmx${xmx_memory}G" IndexFeatureFile \
-I ${gvcf} 2> ${gvcf.simpleName}_IndexFeatureFile_report.txt -I ${gvcf} 2> ${gvcf.simpleName}_IndexFeatureFile_report.txt
...@@ -238,11 +234,7 @@ process validate_gvcf { ...@@ -238,11 +234,7 @@ process validate_gvcf {
script: script:
xmx_memory = "${task.memory}" - ~/\s*GB/ xmx_memory = "${task.memory}" - ~/\s*GB/
if (file_id instanceof List){ file_prefix = get_file_prefix(file_id)
file_prefix = file_id[0]
} else {
file_prefix = file_id
}
""" """
gatk --java-options "-Xmx${xmx_memory}G" ValidateVariants \ gatk --java-options "-Xmx${xmx_memory}G" ValidateVariants \
-V ${gvcf} \ -V ${gvcf} \
...@@ -263,11 +255,7 @@ process consolidate_gvcf { ...@@ -263,11 +255,7 @@ process consolidate_gvcf {
script: script:
xmx_memory = "${task.memory}" - ~/\s*GB/ xmx_memory = "${task.memory}" - ~/\s*GB/
if (file_id instanceof List){ file_prefix = get_file_prefix(file_id)
file_prefix = file_id[0]
} else {
file_prefix = file_id
}
def gvcf_cmd = "" def gvcf_cmd = ""
if (gvcf instanceof List){ if (gvcf instanceof List){
for (gvcf_file in gvcf){ for (gvcf_file in gvcf){
...@@ -302,11 +290,7 @@ process genomic_db_call { ...@@ -302,11 +290,7 @@ process genomic_db_call {
script: script:
xmx_memory = "${task.memory}" - ~/\s*GB/ xmx_memory = "${task.memory}" - ~/\s*GB/
if (file_id instanceof List){ file_prefix = get_file_prefix(file_id)
file_prefix = file_id[0]
} else {
file_prefix = file_id
}
def gvcf_cmd = "" def gvcf_cmd = ""
if (gvcf instanceof List){ if (gvcf instanceof List){
for (gvcf_file in gvcf){ for (gvcf_file in gvcf){
...@@ -343,11 +327,7 @@ process variant_calling { ...@@ -343,11 +327,7 @@ process variant_calling {
script: script:
xmx_memory = "${task.memory}" - ~/\s*GB/ xmx_memory = "${task.memory}" - ~/\s*GB/
if (file_id instanceof List){ file_prefix = get_file_prefix(file_id)
file_prefix = file_id[0]
} else {
file_prefix = file_id
}
""" """
gatk --java-options "-Xmx${xmx_memory}G" HaplotypeCaller \ gatk --java-options "-Xmx${xmx_memory}G" HaplotypeCaller \
${params.variant_calling} \ ${params.variant_calling} \
...@@ -374,11 +354,7 @@ process filter_snp { ...@@ -374,11 +354,7 @@ process filter_snp {
tuple val(file_id), path("*_snp.vcf"), emit: vcf tuple val(file_id), path("*_snp.vcf"), emit: vcf
script: script:
xmx_memory = "${task.memory}" - ~/\s*GB/ xmx_memory = "${task.memory}" - ~/\s*GB/
if (file_id instanceof List){ file_prefix = get_file_prefix(file_id)
file_prefix = file_id[0]
} else {
file_prefix = file_id
}
""" """
gatk --java-options "-Xmx${xmx_memory}G" SelectVariants \ gatk --java-options "-Xmx${xmx_memory}G" SelectVariants \
${params.filter_snp} \ ${params.filter_snp} \
...@@ -406,11 +382,7 @@ process filter_indels { ...@@ -406,11 +382,7 @@ process filter_indels {
tuple val(file_id), path("*_indel.vcf"), emit: vcf tuple val(file_id), path("*_indel.vcf"), emit: vcf
script: script:
xmx_memory = "${task.memory}" - ~/\s*GB/ xmx_memory = "${task.memory}" - ~/\s*GB/
if (file_id instanceof List){ file_prefix = get_file_prefix(file_id)
file_prefix = file_id[0]
} else {
file_prefix = file_id
}
""" """
gatk --java-options "-Xmx${xmx_memory}G" SelectVariants \ gatk --java-options "-Xmx${xmx_memory}G" SelectVariants \
${params.filter_indels} \ ${params.filter_indels} \
...@@ -439,11 +411,7 @@ process high_confidence_snp { ...@@ -439,11 +411,7 @@ process high_confidence_snp {
tuple val(file_id), path("*_snp.vcf"), emit: vcf tuple val(file_id), path("*_snp.vcf"), emit: vcf
script: script:
xmx_memory = "${task.memory}" - ~/\s*GB/ xmx_memory = "${task.memory}" - ~/\s*GB/
if (file_id instanceof List){ file_prefix = get_file_prefix(file_id)
file_prefix = file_id[0]
} else {
file_prefix = file_id
}
""" """
gatk --java-options "-Xmx${xmx_memory}G" VariantFiltration \ gatk --java-options "-Xmx${xmx_memory}G" VariantFiltration \
-R ${fasta} \ -R ${fasta} \
...@@ -471,11 +439,7 @@ process high_confidence_indels { ...@@ -471,11 +439,7 @@ process high_confidence_indels {
tuple val(file_id), path("*_indel.vcf"), emit: vcf tuple val(file_id), path("*_indel.vcf"), emit: vcf
script: script:
xmx_memory = "${task.memory}" - ~/\s*GB/ xmx_memory = "${task.memory}" - ~/\s*GB/
if (file_id instanceof List){ file_prefix = get_file_prefix(file_id)
file_prefix = file_id[0]
} else {
file_prefix = file_id
}
""" """
gatk --java-options "-Xmx${xmx_memory}G" VariantFiltration \ gatk --java-options "-Xmx${xmx_memory}G" VariantFiltration \
-R ${fasta} \ -R ${fasta} \
...@@ -502,11 +466,7 @@ process recalibrate_snp_table { ...@@ -502,11 +466,7 @@ process recalibrate_snp_table {
tuple val(file_id), path("recal_data_table"), emit: recal_table tuple val(file_id), path("recal_data_table"), emit: recal_table
script: script:
xmx_memory = "${task.memory}" - ~/\s*GB/ xmx_memory = "${task.memory}" - ~/\s*GB/
if (file_id instanceof List){ file_prefix = get_file_prefix(file_id)
file_prefix = file_id[0]
} else {
file_prefix = file_id
}
""" """
gatk --java-options "-Xmx${xmx_memory}G" IndexFeatureFile \ gatk --java-options "-Xmx${xmx_memory}G" IndexFeatureFile \
-I ${snp_file} -I ${snp_file}
...@@ -539,11 +499,7 @@ process recalibrate_snp { ...@@ -539,11 +499,7 @@ process recalibrate_snp {
tuple val(file_id), path("*.bam"), emit: bam tuple val(file_id), path("*.bam"), emit: bam
script: script:
xmx_memory = "${task.memory}" - ~/\s*GB/ xmx_memory = "${task.memory}" - ~/\s*GB/
if (file_id instanceof List){ file_prefix = get_file_prefix(file_id)
file_prefix = file_id[0]
} else {
file_prefix = file_id
}
""" """
gatk --java-options "-Xmx${xmx_memory}G" ApplyBQSR \ gatk --java-options "-Xmx${xmx_memory}G" ApplyBQSR \
${params.recalibrate_snp} \ ${params.recalibrate_snp} \
...@@ -571,11 +527,7 @@ process haplotype_caller { ...@@ -571,11 +527,7 @@ process haplotype_caller {
tuple val(file_id), path("*.gvcf"), emit: gvcf tuple val(file_id), path("*.gvcf"), emit: gvcf
script: script:
xmx_memory = "${task.memory}" - ~/\s*GB/ xmx_memory = "${task.memory}" - ~/\s*GB/
if (file_id instanceof List){ file_prefix = get_file_prefix(file_id)
file_prefix = file_id[0]
} else {
file_prefix = file_id
}
""" """
gatk --java-options "-Xmx${xmx_memory}G" HaplotypeCaller \ gatk --java-options "-Xmx${xmx_memory}G" HaplotypeCaller \
${params.haplotype_caller} \ ${params.haplotype_caller} \
...@@ -603,11 +555,7 @@ process gvcf_genotyping { ...@@ -603,11 +555,7 @@ process gvcf_genotyping {
tuple val(file_id), path("*.vcf.gz"), emit: vcf tuple val(file_id), path("*.vcf.gz"), emit: vcf
script: script:
xmx_memory = "${task.memory}" - ~/\s*GB/ xmx_memory = "${task.memory}" - ~/\s*GB/
if (file_id instanceof List){ file_prefix = get_file_prefix(file_id)
file_prefix = file_id[0]
} else {
file_prefix = file_id
}
""" """
gatk --java-options "-Xmx${xmx_memory}G" GenotypeGVCFs \ gatk --java-options "-Xmx${xmx_memory}G" GenotypeGVCFs \
${params.gvcf_genotyping} \ ${params.gvcf_genotyping} \
...@@ -634,11 +582,7 @@ process select_variants_snp { ...@@ -634,11 +582,7 @@ process select_variants_snp {
tuple val(file_id), path("*_joint_snp.vcf"), emit: vcf tuple val(file_id), path("*_joint_snp.vcf"), emit: vcf
script: script:
xmx_memory = "${task.memory}" - ~/\s*GB/ xmx_memory = "${task.memory}" - ~/\s*GB/
if (file_id instanceof List){ file_prefix = get_file_prefix(file_id)
file_prefix = file_id[0]
} else {
file_prefix = file_id
}
""" """
gatk --java-options "-Xmx${xmx_memory}GG" SelectVariants \ gatk --java-options "-Xmx${xmx_memory}GG" SelectVariants \
${params.select_variants_snp} \ ${params.select_variants_snp} \
...@@ -666,11 +610,7 @@ process select_variants_indels { ...@@ -666,11 +610,7 @@ process select_variants_indels {
tuple val(file_id), path("*_joint_indel.vcf"), emit: vcf tuple val(file_id), path("*_joint_indel.vcf"), emit: vcf
script: script:
xmx_memory = "${task.memory}" - ~/\s*GB/ xmx_memory = "${task.memory}" - ~/\s*GB/
if (file_id instanceof List){ file_prefix = get_file_prefix(file_id)
file_prefix = file_id[0]
} else {
file_prefix = file_id
}
""" """
gatk --java-options "-Xmx${xmx_memory}G" SelectVariants \ gatk --java-options "-Xmx${xmx_memory}G" SelectVariants \
${params.select_variants_indels} \ ${params.select_variants_indels} \
...@@ -699,11 +639,7 @@ process personalized_genome { ...@@ -699,11 +639,7 @@ process personalized_genome {
script: script:
xmx_memory = "${task.memory}" - ~/\s*GB/ xmx_memory = "${task.memory}" - ~/\s*GB/
if (file_id instanceof List){ file_prefix = get_file_prefix(file_id)
file_prefix = file_id[0]
} else {
file_prefix = file_id
}
""" """
gatk --java-options "-Xmx${xmx_memory}G" FastaAlternateReferenceMaker\ gatk --java-options "-Xmx${xmx_memory}G" FastaAlternateReferenceMaker\
${params.personalized_genome} \ ${params.personalized_genome} \
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment