From e83e6d1a1c0b7016d864eca38047cd7f520c8d6a Mon Sep 17 00:00:00 2001
From: pbardou <philippe.bardou@inra.fr>
Date: Wed, 15 May 2019 15:18:12 +0200
Subject: [PATCH] IMAGE_calling :remove not allowed multithreading in GATK
 command line

---
 Snakemake/IMAGE_calling/Snakefile                  |  6 +++---
 .../IMAGE_calling/resources_SLURM_memGlobal.yaml   |  3 ---
 .../IMAGE_calling/rules/combine_genotypeGVCF.rules | 14 ++++++--------
 Snakemake/IMAGE_calling/rules/realignment.rules    |  8 ++------
 4 files changed, 11 insertions(+), 20 deletions(-)

diff --git a/Snakemake/IMAGE_calling/Snakefile b/Snakemake/IMAGE_calling/Snakefile
index 34abbf6..aa19053 100755
--- a/Snakemake/IMAGE_calling/Snakefile
+++ b/Snakemake/IMAGE_calling/Snakefile
@@ -39,8 +39,8 @@ rule_resources = {
     "bwa_mem" : ["cpu"],
     "sample_merge" : ["mem"],
     "markduplicates" : ["mem"],
-    "RealignerTargetCreator" : ["mem", "cpu"],
-    "IndelRealigner" : ["mem", "cpu"],
+    "RealignerTargetCreator" : ["mem"],
+    "IndelRealigner" : ["mem"],
     "qualimap" : ["mem", "cpu"],
     "BaseRecalibrator_1" : ["mem" , "cpu"],
     "PrintReads" : ["mem" , "cpu"],
@@ -48,7 +48,7 @@ rule_resources = {
     "AnalyzeCovariates" : ["mem"],
     "HaplotypeCaller" : ["mem","cpu"],
     "CombineGVCFs" : ["mem"],
-    "GenotypeGVCFs" : ["mem", "cpu"],
+    "GenotypeGVCFs" : ["mem"],
     "bcftools_stats_gatk": ["cpu"],
     "bcftools_stats_freebayes": ["cpu"],
     "bcftools_stats_mpileup": ["cpu"]
diff --git a/Snakemake/IMAGE_calling/resources_SLURM_memGlobal.yaml b/Snakemake/IMAGE_calling/resources_SLURM_memGlobal.yaml
index d5fb390..06cc295 100644
--- a/Snakemake/IMAGE_calling/resources_SLURM_memGlobal.yaml
+++ b/Snakemake/IMAGE_calling/resources_SLURM_memGlobal.yaml
@@ -19,11 +19,9 @@ markduplicates:
 
 RealignerTargetCreator:
     mem: "30G"
-    cpu : 8
 
 IndelRealigner:
     mem: "30G"
-    cpu : 8
     
 BaseRecalibrator_1:
     mem: "50G"
@@ -55,7 +53,6 @@ CombineGVCFs :
     
 GenotypeGVCFs :
     mem : "60G"
-    cpu : 8
     partition : "unlimitq"
 
 freebayes:
diff --git a/Snakemake/IMAGE_calling/rules/combine_genotypeGVCF.rules b/Snakemake/IMAGE_calling/rules/combine_genotypeGVCF.rules
index 128b1a3..5432602 100644
--- a/Snakemake/IMAGE_calling/rules/combine_genotypeGVCF.rules
+++ b/Snakemake/IMAGE_calling/rules/combine_genotypeGVCF.rules
@@ -61,7 +61,7 @@ def get_cohor_gvcf(wildcards):
 
 rule GenotypeGVCFs:
     input:
-        gvcf=get_cohor_gvcf,
+        gvcfs=get_cohor_gvcf,
         ref=config["reference_genome"]
         
     output:
@@ -70,13 +70,11 @@ rule GenotypeGVCFs:
     log:
         "results/gatk_haplotypecaller/logs/GenotypeGVCFs.log"
     
-    threads: config["GenotypeGVCFs"]["cpu"]
-    
     params:
         mem=config["GenotypeGVCFs"]["mem"]
    
-    shell:
-        """
-        java -Xmx{params.mem} -jar {config[bin][gatk]} -T GenotypeGVCFs -nct {threads} -R {input.ref} --variant {input.gvcf} -o {output} 2> {log}
-        {config[bin][tabix]} -f -p vcf {output}
-        """
+    
+    run:
+        gvcfs=" --variant ".join(input.gvcfs)
+        shell("java -Xmx{params.mem} -jar {config[bin][gatk]} -T GenotypeGVCFs -R {input.ref} --variant {gvcfs} -o {output} 2> {log}")
+        
diff --git a/Snakemake/IMAGE_calling/rules/realignment.rules b/Snakemake/IMAGE_calling/rules/realignment.rules
index 7d6493d..e2bb3d1 100644
--- a/Snakemake/IMAGE_calling/rules/realignment.rules
+++ b/Snakemake/IMAGE_calling/rules/realignment.rules
@@ -16,8 +16,6 @@ rule RealignerTargetCreator:
     output:
         temp("results/gatk_realignment/{sample}.rg.sort.md.intervals")
     
-    threads: config["RealignerTargetCreator"]["cpu"]
-    
     log:
         stderr="results/gatk_realignment/logs/{sample}_RealignerTargetCreator.stderr",
         stdout="results/gatk_realignment/logs/{sample}_RealignerTargetCreator.stdout"
@@ -26,7 +24,7 @@ rule RealignerTargetCreator:
         mem= config["RealignerTargetCreator"]["mem"]
         
     shell:
-        "java -Xmx{params.mem} -jar {config[bin][gatk]} -T RealignerTargetCreator --allow_potentially_misencoded_quality_scores -nct {threads} -R {input.ref} -I {input.bam} -o {output} 2> {log.stderr} > {log.stdout}"
+        "java -Xmx{params.mem} -jar {config[bin][gatk]} -T RealignerTargetCreator --allow_potentially_misencoded_quality_scores -R {input.ref} -I {input.bam} -o {output} 2> {log.stderr} > {log.stdout}"
 
 rule IndelRealigner:
     input:
@@ -38,8 +36,6 @@ rule IndelRealigner:
     output:
         temp("results/gatk_realignment/{sample}.rg.sort.md.real.bai"),
         bam=temp("results/gatk_realignment/{sample}.rg.sort.md.real.bam")
-
-    threads: config["IndelRealigner"]["cpu"]
     
     log:
         stderr="results/gatk_realignment/logs/{sample}_IndelRealigner.stderr",
@@ -49,4 +45,4 @@ rule IndelRealigner:
         mem= config["IndelRealigner"]["mem"]
 
     shell:
-        "java -Xmx{params.mem} -jar {config[bin][gatk]} -T IndelRealigner --allow_potentially_misencoded_quality_scores -nct {threads} -R {input.ref} -I {input.bam} -targetIntervals {input.intervals} -o {output.bam} 2> {log.stderr} > {log.stdout}"
+        "java -Xmx{params.mem} -jar {config[bin][gatk]} -T IndelRealigner --allow_potentially_misencoded_quality_scores -R {input.ref} -I {input.bam} -targetIntervals {input.intervals} -o {output.bam} 2> {log.stderr} > {log.stdout}"
-- 
GitLab