当我在snakemake中使用run指令(使用python代码)时,它不会产生任何用于故障排除的错误消息.

这里是一个使用snakemake 7.8.3和python 3.9.13的简单示例.

蛇形文件:

def useless_function():
    return[thisVariableAlsoDoesntExist]

rule all:
    input: "final.txt"

rule test:
    output: "final.txt"
    run:
        print(thisVariableDoesNotExist)
        useless_function()

标准:

Building DAG of jobs...
Using shell: /usr/bin/bash
Provided cores: 1 (use --cores to define parallelism)
Rules claiming more threads will be scaled down.
Job stats:
job      count    min threads    max threads
-----  -------  -------------  -------------
all          1              1              1
test         1              1              1
total        2              1              1

Select jobs to execute...

[Mon Jul 25 18:59:13 2022]
rule test:
    output: final.txt
    jobid: 1
    reason: Missing output files: final.txt
    resources: tmpdir=/tmp

Shutting down, this might take some time.
Exiting because a job execution failed. Look above for error message
Complete log: .snakemake/log/2022-07-25T185913.188760.snakemake.log

预期的错误消息(当函数和打印命令直接在python控制台上执行时):

>>> print(thisVariableDoesNotExist)
Traceback (most recent call last):                       
  File "<stdin>", line 1, in <module>                    
NameError: name 'thisVariableDoesNotExist' is not defined


>>> useless_function()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<stdin>", line 2, in useless_function
NameError: name 'thisVariableAlsoDoesntExist' is not defined

推荐答案

我怀疑您最近遇到了bug https://github.com/snakemake/snakemake/issues/1698.

如果是这种情况,您可以降级到v7.6.2或解决它,即忍受它或将代码封装在run中,通过shell执行一个自包含的脚本.无论如何,后者不是一个坏的解决方案,因为它可以很好地隔离代码.

Python-3.x相关问答推荐

根据收件箱内部的值以行降序的特定顺序重新排序列

Python网页抓取:代码输出:汤未定义

删除浮点型数据集中每列重复值比例超过一定阈值的列

从 LeetCode 的 Python 解决方案类中理解关键字 self

Python base64.b32hexencode 未创建预期结果

隐藏Cartopy中高纬度非矩形投影的右侧轴(纬度)标签

单击图形时 plotly graph_objects 持久性数据

过滤阈值大小数据以使用 Pyspark 或 Python 读取

matplotlib.pyplot 多边形,具有相同的纵横比和紧凑的布局

Python BeautifulSoup:在 Select 语句中排除其他标签

使用 from re findall 组合连续匹配并分离非连续匹配

从日志(log)文件中查找延迟最低的用户

二进制文件的 Python 3 和 base64 编码

如何从字典中打印特定键值?

Visual Studio Code 中的 Python 3.x 类型提示

为什么`multiprocessing.Queue.get`这么慢?

在 Python 3 中获取所有超类

Pruning in Keras

是否可以在每个路由的基础上限制 Flask POST 数据大小?

在 macbook pro M1 上安装 Tensorflow 时出现zsh:非法硬件指令 python