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

使用Snakemake编写阴影规则的示例

如何解决使用Snakemake编写阴影规则的示例

假设我有一个蛇形规则,如下:

rule ExampleNoShadow:
    input:
        inFile = "{runPath}/{sample}_inFile.txt",otherFile = "/some/other/directory/otherFile.txt"
    output:
        outFile1 = "{runPath}/{sample}_outFile.txt",outFile2 = "{runPath}/{sample}_otherFile.txt"
    shell:
        """
        cd {wildcards.runPath}
        cp {wildcards.sample}_inFile.txt {wildcards.sample}_outFile.txt
        cp {input.otherFile} {wildcards.sample}_otherFile.txt
        cd ..
        """

我将如何用shadow: "shallow"shadow: "minimal"shadow: "full"编写此规则,这将如何改变该规则的执行?根据文档,我还不太清楚(https://snakemake.readthedocs.io/en/stable/snakefiles/rules.html?highlight=shadow#shadow-rules;是的,我已经看过了。)

解决方法

我不确定我是否理解这个问题,但是正如docs所示,您可以将影子关键字放在规则中,如下所示:

# get the count of clusters
# I note it as <cluster_count>
SELECT COUNT(cluster_id)
FROM clusters;

# get the contents whose record number in content_cluster equals to <cluster_count>;
# I note this list as <content_id_list>
SELECT content_id 
FROM content_cluster
GROUP BY content_id
HAVING COUNT(cluster_id)=<cluster_count>;

# update contents table
UPDATE contents
SET contents.status=1
WHERE content_id IN <content_id_list>

它将如何变化:

通过设置阴影:“浅”,顶级文件和目录是符号链接的,因此子目录中的任何相对路径将是文件系统中的真实路径。设置阴影:“ full”完全阴影了当前工作目录的整个子目录结构。设置阴影:“最小”仅将输入符号链接到规则。规则成功执行后,如有必要,输出文件将移至输出指示的实际路径。

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