Snakemake规则的日志部分中定义的文件与输出部分中定义的文件有很大不同吗? [英] Are files defined in the log section of a snakemake rule much different from the ones defined in the output section?

查看:229
本文介绍了Snakemake规则的日志部分中定义的文件与输出部分中定义的文件有很大不同吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

据我了解, log部分的文档一种蛇形制作规则,必须手动"将内容发送到日志文件.在我看来,使用output部分中定义的文件可以达到相同的结果.

As I understand the documentation for the log section of a snakemake rule, one has to "manually" send things to the log files. It seems to me that one could achieve the same results using files defined in the output section.

这两种可能的方法之间有哪些重要区别?

log部分的真正用途是什么?

What is the real usefulness of the log section?

推荐答案

对我来说,最好的日志记录是Snakemake就像这样:

For me the best pratice for log is Snakemake is like that :

rule example1:
  input:
    file = <input>

  log: 
    out = '_stdout.log',
    err = '_stderr.err'

  output:
    <output>

  shell: 
    'Script/Tool {input.file} 2> {log.err} 1> {log.out}'

我认为log section非常有用.大多数程序或工具都会在standard outstandard error上生成一些日志.这对于用户了解该工具或程序在哪一步失败很有用.

The log section is very useful I think. Most programs or tools produce some logs on standard out and standard error.This is useful for the user to know at which step of the tool or program it fails.

当然,您可以在输出部分执行此操作,如以下代码所示:

Of course you can do it on the output section like the following code :

rule example2:
  input:
    file = <input>

  output:
    file = <output>
    out = '_stdout.log',
    err = '_stderr.err'

  shell: 
    'Script/Tool {input.file} 2> {output.err} 1> {output.out}'

这将产生与example1规则相同的结果.但是output section的目的是使dependencies具有其他规则,或者只是提供所需的结果文件.在大多数情况下,日志不是这些文件,除非有规则检查某些参数或文件.

This will produce the same results as the example1 rule. But the purpose of output section is to make dependencies with other rules or just provide the results files you needed. In most cases, logs aren't these files, unless in a rule to check some parameters or files.

放置日志输出有一个很大的缺点.当Snakemake中的规则失败时,Snakemake会删除所有可能因失败而损坏的输出.因此,您的日志也将被删除,并且您可能无法查看程序在哪一步失败或失败的原因.

雨果

这篇关于Snakemake规则的日志部分中定义的文件与输出部分中定义的文件有很大不同吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆