我试图将名为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'
所有这些都会为snakefile中的配置字典生成这样的结果(注意最后的samples参数)
{'__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', 'kgmitchell@ucdavis.edu')]), 'samples': (6036,)}
Snakemake将
config
键/值对的值作为输入传递给this list中的每个函数,依次计算该值:在Python[u]nderscores are ignored for determining the numeric value of the literal中计算数字文本时
因此,
60_3_6
作为整数计算,因为int
在str
之前被尝试:(在问题的第一个示例中,
60_3_6,
作为值传递;在本例中,eval
返回一个元组,其中包含6036
作为其唯一元素,如配置值转储中所示要解决这个问题,您需要传递一个值,该值只能由
str
成功处理另一个可能的解决方法是传递
由于snakemake将使用callable instead of the result of processing parsers但是我不知道如何从配置文件或命令行执行此操作,因此我认为您需要直接从python代码调用snakemake的
main
函数(可能创建包装脚本?)这种“双重引用”似乎奏效了:
它也适用于多个示例:
虚拟蛇形文件:
相关问题 更多 >
编程相关推荐