问题
I use Snakemake to execute some rules, and I've a problem with one:
rule filt_SJ_out:
input:
"pass1/{sample}SJ.out.tab"
output:
"pass1/SJ.db"
shell:'''
gawk '$6==1 || ($6==0 && $7>2)' {input} >> {output};
'''
Here, I just want to merge some files into a general file, but by searching on google I've see that wildcards use in inputs must be also use in output.
But I can't find a solution to work around this problem ..
Thank's by advance
回答1:
If you know the values of sample
prior to running the script, you could do the following:
SAMPLES = [... define the possible values of `sample` ...]
rule filt_SJ_out:
input:
expand("pass1/{sample}SJ.out.tab", sample=SAMPLES)
output:
"pass1/SJ.db"
shell:
"""
gawk '$6==1 || ($6==0 && $7>2)' {input} >> {output};
"""
In the input
step, this will generate a list of files, each of the form pass1/<XYZ>SJ.out.tab
.
来源:https://stackoverflow.com/questions/55300845/snakemake-wildcards-in-input-files-cannot-be-determined-from-output-files