Snakemake:STAR在Snakemake中失败,但不是独立的
编辑,在尝试任何操作之前,请确保安装Snakemake时使用:Snakemake:STAR在Snakemake中失败,但不是独立的,snakemake,Snakemake,编辑,在尝试任何操作之前,请确保安装Snakemake时使用: conda install -c bioconda -c conda-forge snakemake 如广告所示:。不要像这里宣传的那样安装它:,您将得到一个非常旧的版本(c conda forge很重要!) 原创帖子=> 我今天一直在和蛇怪摔跤。我的问题是我的星号规则给了我一个错误: /rst1/2017-0205_illuminaseq/scratch/swo-406/snakemake/etc/conda/activate.
conda install -c bioconda -c conda-forge snakemake
如广告所示:。不要像这里宣传的那样安装它:,您将得到一个非常旧的版本(c conda forge很重要!)
原创帖子=>
我今天一直在和蛇怪摔跤。我的问题是我的星号规则给了我一个错误:
/rst1/2017-0205_illuminaseq/scratch/swo-406/snakemake/etc/conda/activate.d/activate-binutils_linux-64.sh: line 67: HOST: unbound variable
Error in job star_map while creating output file /rst1/2017-0205_illuminaseq/scratch/swo-406/preprocessing/180413_NB501997_0054_AHTFJ3BGX3/0054_P2018SEQE15S4_S14.Aligned.out.bam.
RuleException:
CalledProcessError in line 50 of /home/nlv24077/experiments/experiments/swo-406/scripts/Snakefile.snakefile:
Command '
source activate /rst1/2017-0205_illuminaseq/scratch/swo-406/snakemake
STAR --runThreadN 8 --genomeDir /rst1/2017-0205_illuminaseq/scratch/swo-390/STAR_references/human --readFilesIn /rst1/2017-0205_illuminaseq/scratch/swo-406/fastq/180413_NB501997_0054_AHTFJ3BGX3/0054_P2018SEQE15S4_S14_R1_001.fastq.gz /rst1/2017-0205_illuminaseq/scratch/swo-406/fastq/180413_NB501997_0054_AHTFJ3BGX3/0054_P2018SEQE15S4_S14_R2_001.fastq.gz --outSAMtype BAM Unsorted --readFilesCommand zcat --outFileNamePrefix /rst1/2017-0205_illuminaseq/scratch/swo-406/preprocessing/180413_NB501997_0054_AHTFJ3BGX3/0054_P2018SEQE15S4_S14.
' returned non-zero exit status 1.
File "/home/nlv24077/experiments/experiments/swo-406/scripts/Snakefile.snakefile", line 50, in __rule_star_map
File "/rst1/2017-0205_illuminaseq/scratch/swo-406/snakemake/lib/python3.6/concurrent/futures/thread.py", line 56, in run
Exiting because a job execution failed. Look above for error message
但是,当我只是将该脚本/命令复制到终端时,它就可以工作了
这是我的蛇形档案:
import os
from glob import glob
#from snakemake.utils import validate
configfile: 'config.yaml'
#validate(config, "config.schema.yaml")
# Set the working directory
workdir: config['workdir']
experiment_name = 'swo-406'
scratch_data_base_dir="/rst1/2017-0205_illuminaseq/scratch"
scratch_data_dir = os.path.join(scratch_data_base_dir, experiment_name)
seqrun = '180413_NB501997_0054_AHTFJ3BGX3'
fastq_dir = os.path.join(scratch_data_dir, 'fastq', seqrun)
preprocessing_dir = os.path.join(scratch_data_dir, 'preprocessing', seqrun)
quantification_dir = os.path.join(scratch_data_dir, 'quantification', seqrun)
if not os.path.isdir(preprocessing_dir):
os.makedirs(preprocessing_dir)
#ref_base_dir = config[ref_base_dir]
ref_genome = os.path.join(config['ref_base_dir'], config['ref_genome'])
star_ref_dir = config['star_ref_dir']
## Rsem settings
rsem_ref_dir = os.path.join(scratch_data_base_dir, 'swo-387', 'RSEM_references')
rsem_ref_base = os.path.join(rsem_ref_dir, 'Homo_sapiens.GRCh38')
log = os.path.join(preprocessing_dir, 'log.txt')
SAMPLES = set([os.path.basename(fastq_file.replace('_R1_001.fastq.gz', '').replace('_R2_001.fastq.gz', ''))
for fastq_file in glob(os.path.join(fastq_dir, '*_R*_001.fastq.gz'))
if not 'Undetermined' in fastq_file])
#star_output_prefix = os.path.join(preprocessing_dir, '{sample}.')
# Rule all is a pseudo-rule that tells snakemake what final files to generate.
rule all:
input:
expand(os.path.join(quantification_dir, '{sample}'), sample=SAMPLES)
rule star_map:
input:
os.path.join(fastq_dir, '{sample}_R1_001.fastq.gz'),
os.path.join(fastq_dir, '{sample}_R2_001.fastq.gz'),
output:
os.path.join(preprocessing_dir, '{sample}.Aligned.out.bam')
shell:
"""
source activate /rst1/2017-0205_illuminaseq/scratch/swo-406/snakemake
STAR \
--runThreadN 8 \
--genomeDir {star_ref_dir} \
--readFilesIn {input} \
--outSAMtype BAM Unsorted \
--readFilesCommand zcat \
--outFileNamePrefix {preprocessing_dir}/{wildcards.sample}.
"""
rule samtools_sort:
input:
os.path.join(preprocessing_dir, '{sample}.Aligned.out.bam')
output:
os.path.join(preprocessing_dir, '{sample}.Aligned.out.sorted.bam')
shell:
"""
source activate /rst1/2017-0205_illuminaseq/scratch/swo-406/snakemake
samtools sort -T {wildcards.sample} -O bam {input} > {output}
"""
rule rsem_quantify:
input:
os.path.join(preprocessing_dir, '{sample}.Aligned.out.sorted.bam')
output:
os.path.join(quantification_dir, '{sample}')
shell:
"""
source activate /rst1/2017-0205_illuminaseq/scratch/swo-406/snakemake
rsem-calculate-expression \
--paired-end \
--bam \
--num-threads 8 \
--strandedness reverse \
{rsem_ref_base} \
{output}
"""
有人能发现错误吗?
顺便说一句,我得发表评论
validate(config, "config.schema.yaml")
因为我的snakemake.utils似乎没有“验证”:
(/rst1/2017-0205_illuminaseq/scratch/swo-406/snakemake)16:40nlv24077@kavia/rst1/2017-0205_illuminaseq/scratch/swo-406>蟒蛇3
Python 3.6.7 | Anaconda,Inc.|(默认,2018年10月23日,19:16:44)
linux上的[GCC 7.3.0]
有关详细信息,请键入“帮助”、“版权”、“信用证”或“许可证”。
>>>从snakemake.utils导入验证
回溯(最近一次呼叫最后一次):
文件“”,第1行,在
ImportError:无法导入名称“验证”
>>>
致以崇高的敬意
Freek.能否从Snake文件中不同规则的外壳部分删除所有
源激活/rst1/2017-0205_illuminaseq/scratch/swo-406/snakemake
命令,并激活环境:
source activate/rst1/2017-0205\u illuminaseq/scratch/swo-406/snakemake
(您甚至可以在此环境中添加具有验证
的snakemake版本)。因此,您可以运行source activate/rst1/2017-0205\u illuminaseq/scratch/swo-406/snakemake
,然后运行snakemake
conda:path/to/created/env/file
参数。然后使用--使用conda
标志运行snakemakerule test_activate:
output : "test.txt"
shell: "source activate NGS && conda list > {output}"
我得到了相同的未绑定变量错误,但由于我的环境不同,使用了不同的变量。这是对可能发生的情况的解释:
从某种意义上说,一旦您通过snakemake vs terminal运行它,一些变量就会被解除绑定,并被视为错误。您的snakemake版本是什么<代码>验证可用。哇,看起来我使用的是真正古老的3.13.3版本!我做了一个新的安装,但可能我的集群的康达是旧的?我会深入调查的,谢谢你的提示!嗯,我有一只老蛇,但最近有一只康达,你能解释一下吗:08:36nlv24077@lefkimi/rst1/2017-0205_illuminaseq/scratch/swo-406>snakemake--版本3.13.3(/rst1/2017-0205_illuminaseq/scratch/swo-406/snakemake)08:36nlv24077@lefkimi/rst1/2017-0205_illuminaseq/scratch/swo-406>康达——康达版本4.5.11(/rst1/2017-0205_illuminaseq/scratch/swo-406/snakemake)08:37nlv24077@lefkimi/rst1/2017-0205_illuminaseq/scratch/swo-406>conda update snakemake解决环境:完成#已安装所有请求的软件包。好的,我发现了错误,因此snakemake要获得最新的snakemake,需要使用:conda安装“install-c bioconda-c conda forge snakemake”,而不是“conda install-c bioconda snakemake”。这确实有效!我可能应该提到我使用了qsub,并且我最初得到了“STAR not found errors”,我认为我最初是使用“source activate”方法解决的。现在我在脚本顶部的路径中添加了STAR(导出路径=/rst1/2017-0205_illuminaseq/tools/STAR-2.6.1a/来源:$PATH#顺便说一句,这不是康达的STAR)它是有效的。不知怎的,我本以为激活Snakemake env会很好,因为它有我所有的工具。我发现奇怪的是,它会导致错误,我必须手动将所有工具添加到我的路径。但是,现在,我很高兴。我错误地认为你正在使用conda。如果你提交的大多数作业都需要它的话您可以将
source activate…
添加到$HOME/.bash_profile
中,当提交作业时,它将可用。我通常创建一个作业脚本文件,并使用snakemake--jobscript path/to/jobscript
运行snakemake。在您的情况下,作业脚本可以简单到只需更改\properties={properties}
到导出路径…
并添加任何其他工具。然后,您可以在需要时重用此作业脚本。好的,thanx,我将尝试此方法。但首先,我必须了解如何让我的conda安装Snakemake 5.1而不是3.13…thanx,以获得迄今为止的支持。
rule test_activate:
output : "test.txt"
shell: "source activate NGS && conda list > {output}"