问题描述
我有两条可能的三位一体之路:无基因组(GF)和基因组指导(GG)。为了决定采用哪种方式,我使用了配置中的变量GUIDED,并根据它给出了GG或GF部分创建的文件的路径。
问题在于,不管Input函数返回什么,snakemake总是尝试运行GG部分。 (除了c之外)
def GenomeDependentinput()->str:
guided = config["GUIDED"]
if guided == "GF":
print(rules.aggregate_GF.output.fasta) #this print is run by snakemake and gives the correct path ...Results/trinityGF/{species}_Trinity_GF.fasta
return rules.aggregate_GF.output.fasta
elif guided == "GG":
print(rules.aggregateTrinity.output.fasta) # this is not (good)
return rules.aggregateTrinity.output.fasta
else:
raise ValueError("Please fill in the GUIDED variable in the config")
rule Transdecoder:
input:
fasta = GenomeDependentinput()
output:
pep = path.join(TRANS_DIR,"{species}",path.basename(GenomeDependentinput()) + ".transdecoder.pep")
envmodules:
config["PERL"],config["python3"]
script:
"scripts/TransDecoder.py"
解决方法
所以我发现,另一条规则仅使用GG部分,我也不得不在其中使用GenomeDependentInput函数。
此外,由于尚未将Transdecoder的输出用作输入,因此Transdecoder规则甚至都没有激活。
也许这会对其他人有帮助,所以我就把它留在这里。