【问题标题】:What is the format for a Snakemake JSON config file?Snakemake JSON 配置文件的格式是什么?
【发布时间】:2022-08-24 00:59:25
【问题描述】:

我可以找到 yaml 配置文件的示例,但是我找不到任何 json 配置文件,而且我的猜测失败了

如何在 JSON 配置文件中执行此操作,以便 config[\"samples\"] 返回正确的值?

Yaml:
samples:
    A: data/samples/A.fastq
    B: data/samples/B.fastq

    标签: python json python-3.x yaml snakemake


    【解决方案1】:

    如果你有config.yaml,看起来像这样:

    samples:
        A: data/samples/A.fastq
        B: data/samples/B.fastq
    

    那么等效的config.json 将如下所示:

    {
        "samples":
        {
            "A": "data/samples/A.fastq",
            "B": "data/samples/B.fastq"
        }
    }
    

    所以下面的Snakefile 将与yamljson 配置文件具有相同的行为:

    # uncomment the option of interest
    # configfile: 'config.json'
    # configfile: 'config.yaml'
    
    rule all:
        input:
           A=config['samples']["A"],
           B=config['samples']["B"]
    

    请注意,上面的 Snakefile 失败是有意的,它将表明配置文件的内容被正确解析。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-10-23
      • 1970-01-01
      • 2017-11-18
      • 2014-11-24
      • 1970-01-01
      • 2013-07-14
      相关资源
      最近更新 更多