Is it possible to pass custom command line arguments to snakemake scripts? I have tried, but executing Snakefile with argparse results in error snakemake: error: unrecognized arguments: -zz. Below is an example script.import argparsedef get_args(): parser = argparse.ArgumentParser(description='Compares Illumina and 10x VCFs using RTG vcfeval') # required main arguments parser.add_argument('-zz', metavar='--filename', dest='fn', help='Filename', required=True) # parse arguments args = parser.parse_args() fn = args.fn return fnfn = get_args()rule test_1: input: fn + "/example.txt" shell: "echo Using file {input}" 解决方案 Passing arguments from command line is possible using --config. For example:snakemake --config zz="filename"In snakefile script, this can be used in this way:rule test_1: input: fn + config['zz'] shell: "echo Using file {input}"See the doc for more info. 这篇关于在Snakemake脚本中使用argparse的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
09-05 18:26