微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Snakemake-如何通过子目录获取目录中的所有文件

如何解决Snakemake-如何通过子目录获取目录中的所有文件

我有一个包含多个目录的目录:

Uncaught TypeError: Error resolving module specifier “emailjs-com”. Relative module specifiers must start with “./”,“../” or “/”.

所有子目录都有几个不同的文件

https://github.com/mrbilal4972/farmhouse-project

我正在使用snakemake运行命令,我需要用cond将所有文件分隔为空白

我试图这样做:

/test/cond1/
/test/cond2/
/test/cond3/
/test/cond4/

这是我的规则snakemake

cond1 : a1.txt,a2.txt
cond2 : b1.txt,b2.txt,b3.txt
cond3 : c1.txt,c2.txt,c4.txt
cond4 : d1.txt,c4.txt,d2.txt

在--more-bed {params.trs}

我希望得到:

def get_motifs_tf(wildcards):
    file_list = sorted(glob.glob("tf_final/{wildcards.cond}/*.bed"))
    return " ".join(file_list)

然后

rule compute_combi_enrichment:
    """
    For a given input,compute the enrichment in n-wise TF combinations using OLOGRAM-MODL.
    """
    input:
        query = 'input/core_silencer/{cond}/core_silencer.bed',excl = "input/exclude_region_dhs.bed",genome = "input/mm9.chromsizes"

    params:
        trs = get_motifs_tf,minibatch_number = 16,minibatch_size = 10   # Modulate depending on available RAM
    threads: 8                                       # Do not use 16 threads to not vampirize all the cluster

    output: 'output/ologram_result/{cond}/00_ologram_stats.tsv',shell: """
    set +u; source /gpfs/tagc/home/Apps/anaconda3/bin/activate dev; set -u
    gtftk ologram -z -c {input.genome} -p {input.query} --more-bed {params.trs} \
        -o output/ologram_result/{wildcards.cell_line} --force-chrom-peak --force-chrom-more-bed  \
        -V 3 -k {threads} -mn {params.minibatch_number} -ms {params.minibatch_size} \
        --more-bed-multiple-overlap --bed-excl {input.excl} --no-date \
        --multiple-overlap-max-number-of-combinations 80
    """

依此类推...

解决方法

我解决了:

函数中的通配符必须在stp中转换且不带括号:

def get_motifs_tf(wildcards):
    file_list = sorted(glob.glob("tf_final/"+str(wildcards.cond)+"/*.bed"))
    return " ".join(file_list)

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。