Gatk VariantRecalibrator上的Snakemake

时间:2019-05-30 08:27:03

标签: python bioinformatics snakemake

我是使用蛇制作的新手,在蛇制作上执行步骤gatk VariantRecalibrator时遇到问题,它生成了错误,但是如果使用非蛇制作格式,则脚本可以无错误地运行。

import snakemake.io
import os

REF="/data/data/reference/refs/ucsc.hg19.fasta"
HM="/data/data/variant_call/hapmap_3.3.hg19.sites.vcf"
OMNI="/data/data/variant_call/1000G_omni2.5.hg19.sites.vcf"
SNPS="/data/data/variant_call/1000G_phase1.snps.high_confidence.hg19.sites.vcf"
DBSNP="/data/data/variant_call/dbsnp_138.hg19.vcf"

NAME="CHS"

rule all:
  input:  "VCFs/{name}.recal.vcf".format(name=NAME),
          "VCFs/{name}.output.tranches".format(name=NAME)

rule vqsr:
  input:  vcf="VCFs/SRS008640.raw.vcf",
          ref=REF,
          hm=HM,
          omni=OMNI,
          snps=SNPS,
          dbsnp=DBSNP
  output: recal="VCFs/{name}.recal.vcf".format(name=NAME),
          tranches="VCFs/{name}.output.tranches".format(name=NAME),
          rscript="VCFs/{name}.output.plots.R".format(name=NAME)
  params: java_opts="-Xmx16g"
  shell: "gatk --java-options -Xmx16g VariantRecalibrator \
  -R {input.ref} \
  -V {input.vcf} \
  --resource:hapmap,known=false,training=true,truth=true,prior=15.0 {input.hm} \
  --resource:omni,known=false,training=true,truth=false,prior=12.0 {input.omni} \
  --resource:1000G,known=false,training=true,truth=false,prior=10.0 {input.snps} \
  --resource:dbsnp,known=true,training=false,truth=false,prior=2.0 {input.dbsnp} \
  -an QD -an MQ -an MQRankSum -an ReadPosRankSum -an FS -an SOR \
  -mode SNP \
  -O {output.recal} \
  --tranches-file {output.tranches} \
  --rscript-file {output.rscript}"

错误: 设置系统属性GATK_STACKTRACE_ON_USER_EXCEPTION(--java-options'-DGATK_STACKTRACE_ON_USER_EXCEPTION = true')以打印堆栈跟踪。     [2019年5月30日星期四08:05:30]     规则vqsr中的错误:         职位编号:1         输出:VCF / CHS.recal.vcf,VCF / CHS.output.tranches,VCF / CHS.output.plots.R

RuleException:
CalledProcessError in line 28 of /data/data/Samples/snakemake-example/WGS-test/step7.smk:
    Command ' set -euo pipefail;  gatk --java-options -Xmx16g VariantRecalibrator   -R /data/data/reference/refs/ucsc.hg19.fas ta   -V VCFs/SRS008640.raw.vcf   --resource:hapmap,known=false,training=true,truth=true,prior=15.0 /data/data/variant_call /hapmap_3.3.hg19.sites.vcf   --resource:omni,known=false,training=true,truth=false,prior=12.0 /data/data/variant_call/1000 G_omni2.5.hg19.sites.vcf   --resource:1000G,known=false,training=true,truth=false,prior=10.0 /data/data/variant_call/1000G _phase1.snps.high_confidence.hg19.sites.vcf   --resource:dbsnp,known=true,training=false,truth=false,prior=2.0 /data/data/ variant_call/dbsnp_138.hg19.vcf   -an QD -an MQ -an MQRankSum -an ReadPosRankSum -an FS -an SOR   -mode SNP   -O VCFs/CHS. recal.vcf   --tranches-file VCFs/CHS.output.tranches   --rscript-file VCFs/CHS.output.plots.R ' returned non-zero exit sta tus 2.
      File "/data/data/Samples/snakemake-example/WGS-test/step7.smk", line 28, in __rule_vqsr
      File "/root/miniconda3/envs/bioinfo/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    Removing output files of failed job vqsr since they might be corrupted:
    VCFs/CHS.recal.vcf, VCFs/CHS.output.tranches, VCFs/CHS.output.plots.R
    Shutting down, this might take some time.
    Exiting because a job execution failed. Look above for error message
    Complete log: /data/data/Samples/snakemake-example/WGS-test/.snakemake/log/2019-05-30T065011.676785.snakemake.log

如果我使用相同的代码,则可以运行以创建recal文件和档次,并可以转到下一步applyvqsr,但是,如果将其放在snakemake中,它会出错并且第27行是gatk --java-options -Xmx16g VariantRecalibrator是错误,但我不知道这是什么错误。请指教。

1 个答案:

答案 0 :(得分:0)

我建议您使用--printshellcmds参数运行Snakemake。这将为您提供在外壳程序中运行的确切命令(而不是您从python胆量获得的异常中获得的命令)。您可以复制该命令并手动运行。

让我澄清一下:Snakemake运行的命令不是您在shell部分中指定的,但是它运行一个子进程,添加其他参数并设置环境变量(这取决于外壳程序和操作系统) ,然后使用python工具运行应用程序。使用--printshellcmds参数运行Snakemake将使您看到的命令没有格式问题(当所有通配符都解决时),但没有诸如set -euo pipefail;这样的细节开销。