Snakemake: How to save and access sample details in config.yml file?

后端 未结 2 1356
忘掉有多难
忘掉有多难 2021-01-06 16:34

Can anybody help me understand if it is possible to access sample details from a config.yml file when the sample names are not written in the snakemake workflow? This is so

2条回答
  •  我在风中等你
    2021-01-06 17:02

    I would suggest using a tab-delimited file in order to store samples information.

    sample.tab:

    Sample     Tag      
    1          S1   
    2          S2
    

    You could store the path to this file in the config file, and read it in your Snakefile.

    config.yaml:

    sample_file: "sample.tab"
    

    Snakefile:

    configfile: "config.yaml"
    
    sample_file = config["sample_file"]
    
    samples = read_table(sample_file)['Sample']
    tags    = read_table(sample_file)['Tag']
    

    This way your can re-use your workflow for any number of samples, with any number of columns.

    Apart from that, in Snakemake usually you can escape curly brackets by doubling them, maybe you could try that.

    Good luck!

提交回复
热议问题