Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
309 views
in Technique[技术] by (71.8m points)

snakemake list rules to execute in cluster and local

I know there is way to declare rules that need to be executed on the local machine using localrules as:

localrules: all, foo

Is there a similar option to declare rules that need to be executed on the cluster? Perhaps a clusterrules option?

I have a bunch of rules in my pipeline that don't need to be executed on the cluster and while I can list them all with localrules, it will be easier to just enter the one or two rules that need to be executed on the cluster.

An alternative option is the use of rule groups that will execute all rules from a group on a single node instead of using multiple nodes in the cluster.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I do not think this is supported unfortunately. I checked the snakemake source code, and one way to hack this is do to something like this:

all_rules = [rule for rule in dir(rules) if not rule.startswith("__")]
cluster_rules = ["my_cluster_rule1", "my_cluster_rule2"]

workflow._localrules = set(rule for rule in all_rules if rule not in cluster_rules)

I haven't tested it but I think this should work. This way we just overwrite what Snakemake parsed from the document. The problem with doing something like this is that it might not be stable between different snakemake versions.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...