我正在尝试将名为 samples 的 --config
参数传递给 snakemake 函数。似乎无论我如何通过它,所有下划线都被删除了?有什么建议,还是我做错了什么?snakemake -s snakefile.py all --configfile /share/biocore/keith/dennislab/snakemake/templates/tagseq.json --config samples=60_3_6,
或 snakemake -s snakefile.py all --configfile /share/biocore/keith/dennislab/snakemake/templates/tagseq.json --config samples="60_3_6"
或 snakemake -s snakefile.py all --configfile /share/biocore/keith/dennislab/snakemake/templates/tagseq.json --config samples='60_3_6'
对于蛇文件中的配置字典,所有这些都会产生这样的结果(注意最后的示例参数。{'__default__': OrderedDict([('__comment1', 'running_locally=[True,False] ~ type=[PE,SE,tagseq]'), ('running_locally', 'False'), ('type', 'tagseq'), ('__comment2', 'Path to the file containing a column of sample names'), ('samples_file', '/share/biocore/keith/dennislab/rhesus_tagseq/samples.txt')]), 'project': OrderedDict([('basename', '/share/biocore/keith/dennislab'), ('id', 'PE'), ('fastqs', 'rhesus_tagseq'), ('human_rrna_ref', '/share/biocore/keith/workshop/rnaseq_examples/References/human_rrna.fasta'), ('star_ref', '/share/biocore/keith/dennislab/star.overlap100.gencode')]), 'hts_star': OrderedDict([('__comment', 'This is for running one sample for htspreproc > star'), ('job-name', 'hts_star_'), ('n', 1), ('ntasks', 9), ('partition', 'production'), ('time', '120'), ('mem', '32000'), ('__comment2', 'The name of the sample and analysis type will be inserted before .out and .err'), ('output', 'slurm_out/hts_star_.out'), ('error', 'slurm_out/hts_star_.err'), ('mail-type', 'NONE'), ('mail-user', '[email protected]')]), 'samples': (6036,)}
最佳答案
这种“双引号”似乎有效:
snakemake --config samples='"10_13"'
它也适用于多个样本:
snakemake --config samples='"10_13", "foo", "19_19"'
假蛇文件:
samples= config['samples']
rule all:
input:
expand('{sample}.txt', sample= samples),
rule one:
output:
'{sample}.txt',
shell:
r"""
touch {output}
"""
关于python - Snakemake 删除 --config 值中的下划线?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/58475923/