将信息从dict传递到snakemake会导致缺少输入文件错误

2024-04-27 21:32:32 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在使用csv文件读取输入信息。使用所需/选定的输入参数创建dict,并将其传递给shell脚本。我收到丢失的inputfile错误,如下所示:

Building DAG of jobs...
MissingInputException in line 28 of /Users/ravinpoudel/Documents/neoantigen/devs/Snakefile:
Missing input files for rule test_run:
HLA-A02:01

下面是我的蛇形档案


samples = pd.read_csv("acc_filepath_df.csv").set_index("sample", drop=False)
sids=samples['sample']


def info_dict_from_sample(wildcards):
    return {
    "filepath": samples.loc[wildcards.sample, "filepath"], 
    "hla": samples.loc[wildcards.sample, "HLA"]
  }


expected_filenames = "mhctyped/{sample}.txt.gz"

rule all:
    input:
        expand(expected_filenames,
            zip,
            sample=sids)

rule test_run:
    input:
        unpack(info_dict_from_sample)
    output:
        "mhctyped/{sample}.txt.gz"
    shell:
        "cat {input.filepath} {input.hla} > {output}"

Tags: ofcsvsampleruntestinfoinputshell