Python 在(';正确的';)conda环境中向集群提交蛇制造作业

Python 在(';正确的';)conda环境中向集群提交蛇制造作业,python,python-3.x,conda,snakemake,Python,Python 3.x,Conda,Snakemake,我正在编写一个蛇形文件,该文件将对多个样本执行多个操作。在我验证了本地计算机上运行的工作流之后,我现在正在集群上运行工作流 我的前两条规则彼此独立,第一条使用fastqc,另一条使用bwamem 这两条规则看起来像(此时,我只在单个示例上调用工作流='NIPT-PearlPPlasma-03-PPx_S3downSample'): 但当我打电话时: snakemake -p -s Snakefile_v4_ngs_bngs05b --cluster qsub -j 5 --use-conda

我正在编写一个蛇形文件,该文件将对多个样本执行多个操作。在我验证了本地计算机上运行的工作流之后,我现在正在集群上运行工作流

我的前两条规则彼此独立,第一条使用
fastqc
,另一条使用
bwamem

这两条规则看起来像(此时,我只在单个
示例上调用工作流='NIPT-PearlPPlasma-03-PPx_S3downSample'
):

但当我打电话时:

snakemake -p -s Snakefile_v4_ngs_bngs05b --cluster qsub -j 5 --use-conda
我得到:

Error in rule bwa_map:
    jobid: 10
    output: aligned/NIPT-PearlPPlasma-03-PPx_S3downSample.bam
    log: logs/bwa_mem/NIPT-PearlPPlasma-03-PPx_S3downSample.log (check log file(s) for error message)
    conda-env: /nexusb/nipt/200311_A00154_0454_AHHHKMDRXX/testMetrics/outSnakeMake_test/.snakemake/conda/38107c2c
    shell:
        bwa mem /home/ngs/data/genomes/b37/human_g1k_v37.fasta /nexusb/Novaseq/200311_A00154_0454_AHHHKMDRXX/Unaligned/NIPT-PearlPPlasma-03-PPx_S3downSample_R1_001.fastq.gz /nexusb/Novaseq/200311_A00154_0454_AHHHKMDRXX/Unaligned/NIPT-PearlPPlasma-03-PPx_S3downSample_R2_001.fastq.gz | samtools view -Sb - > aligned/NIPT-PearlPPlasma-03-PPx_S3downSample.bam 2> logs/bwa_mem/NIPT-PearlPPlasma-03-PPx_S3downSample.log
        (one of the commands exited with non-zero exit code; note that snakemake uses bash strict mode!)
    cluster_jobid: Your job 381368 ("snakejob.bwa_map.10.sh") has been submitted

Error executing rule bwa_map on cluster (jobid: 10, external: Your job 381368 ("snakejob.bwa_map.10.sh") has been submitted, jobscript: /nexusb/nipt/200311_A00154_0454_AHHHKMDRXX/testMetrics/outSnakeMake_test/.snakemake/tmp.bnhr7qck/snakejob.bwa_map.10.sh). For error details see the cluster log and the log files of the involved rule(s).
[Wed Apr  8 17:21:45 2020]
Error in rule fastQC:
    jobid: 1
    output: fastQC/NIPT-PearlPPlasma-03-PPx_S3downSample
    log: logs/fastQC/NIPT-PearlPPlasma-03-PPx_S3downSample.log (check log file(s) for error message)
    conda-env: /nexusb/nipt/200311_A00154_0454_AHHHKMDRXX/testMetrics/outSnakeMake_test/.snakemake/conda/38107c2c
    shell:
        mkdir -p fastQC/NIPT-PearlPPlasma-03-PPx_S3downSample | fastqc --outdir fastQC/NIPT-PearlPPlasma-03-PPx_S3downSample -f fastq /nexusb/Novaseq/200311_A00154_0454_AHHHKMDRXX/Unaligned/NIPT-PearlPPlasma-03-PPx_S3downSample_R1_001.fastq.gz /nexusb/Novaseq/200311_A00154_0454_AHHHKMDRXX/Unaligned/NIPT-PearlPPlasma-03-PPx_S3downSample_R2_001.fastq.gz
        (one of the commands exited with non-zero exit code; note that snakemake uses bash strict mode!)
    cluster_jobid: Your job 381369 ("snakejob.fastQC.1.sh") has been submitted

Error executing rule fastQC on cluster (jobid: 1, external: Your job 381369 ("snakejob.fastQC.1.sh") has been submitted, jobscript: /nexusb/nipt/200311_A00154_0454_AHHHKMDRXX/testMetrics/outSnakeMake_test/.snakemake/tmp.bnhr7qck/snakejob.fastQC.1.sh). For error details see the cluster log and the log files of the involved rule(s).
Shutting down, this might take some time.
Exiting because a job execution failed. Look above for error message
在第一次执行工作流时,我注意到环境是在
.snakemake/conda
处创建的(相对于Snakefile)。当我第二次调用脚本时,在不更改
conda
指令的情况下,snakemake使用相同的
conda env

“我的环境”的描述如下所示:

channels:
  - bioconda
  - conda-forge
dependencies:
  - bwa=0.7.17
  - samtools=1.9
  - picard=2.22.1
  - mosdepth=0.2.6
  - python=3.7.6
  - pandas=1.0.3
  - fastqc=0.11.9
它保存在
envs/NIPTlibPrep.yaml
(相对于蛇文件)

工作流在本地完成,但无法在集群上运行,这一事实让我感到非常困惑,特别是考虑到具有正确依赖关系的环境已成功创建。

请看:

您必须为规则
sort\u bam
创建一个make a conda环境yaml,如下所示:

channels:
  - bioconda
dependencies:
  - samtools
然后在规则中,您需要在
conda
属性下引用此文件:

rule sort_bam:
    input:
        "aligned/{sample}.bam"
    output:
        protected("aligned/{sample}.sorted.bam")
    params:
        THREADS = config['sort_threads']
    conda:
        "samtools.yaml"
    shell:
        "samtools sort -T aligned/{wildcards.sample} "
        "-O bam {input} > {output}"
然后您可以调用
snakemake-np-s Snakefile\u v4\u ngs\u bngs05b--cluster qsub-j5--use conda
,snakemake会处理剩下的部分。

看一下:

您必须为规则
sort\u bam
创建一个make a conda环境yaml,如下所示:

channels:
  - bioconda
dependencies:
  - samtools
然后在规则中,您需要在
conda
属性下引用此文件:

rule sort_bam:
    input:
        "aligned/{sample}.bam"
    output:
        protected("aligned/{sample}.sorted.bam")
    params:
        THREADS = config['sort_threads']
    conda:
        "samtools.yaml"
    shell:
        "samtools sort -T aligned/{wildcards.sample} "
        "-O bam {input} > {output}"

然后你可以调用
snakemake-np-s Snakefile\u v4\u ngs\u bngs05b-集群qsub-j5-使用conda
,snakemake会处理其余的问题。

我已经做了你建议的编辑,尽管我仍然有错误,请查看我编辑的问题我已经做了你建议的编辑,尽管我仍然有错误,请查看我编辑的问题输出/错误消息是什么?我得到的唯一错误消息显示在问题上。规则中的
log
指令正在生成空日志文件,不幸的是,我们怎么知道这是一个conda问题?如果你触摸输出会怎么样。这行得通吗?我强烈怀疑这与使用
qsub
提交创建环境有关,因为当我在没有
--cluster
标志的情况下运行时,整个工作流完成时没有错误。我已经用
touch{output}
替换了
bwa_map
中的
shell
指令,而fastQC的指令只是
mkdir-p fastQC/{wildcards.sample}
,我得到了一条相同的错误消息,没有安装conda的地方。我指定了
-q
参数,以将作业提交到一台机器(安装了conda)上,它工作了输出/错误消息是什么?我得到的唯一错误消息显示在问题上。规则中的
log
指令正在生成空日志文件,不幸的是,我们怎么知道这是一个conda问题?如果你触摸输出会怎么样。这行得通吗?我强烈怀疑这与使用
qsub
提交创建环境有关,因为当我在没有
--cluster
标志的情况下运行时,整个工作流完成时没有错误。我已经用
touch{output}
替换了
bwa_map
中的
shell
指令,而fastQC的指令只是
mkdir-p fastQC/{wildcards.sample}
,我得到了一条相同的错误消息,没有安装conda的地方。我指定了
-q
参数,以将作业提交给一台机器(安装了conda的机器)并使其工作