I am new to Snakemake, using snakemake-minimal 5.4.5. I have a rule that looks something like this:
rule make_grm:
input:
inc_snps: "path/snps_for_test_chr{chromosome}.txt",
inc_samples: "path/samples_for_test_chr{chromosome}.txt"
params:
plink_root="path/data_chr{chromosome}",
output_root="path/snpgrm_chr{chromosome}"
output:
expand("path/snpgrm_chr{chromosome}.grm.{ext}", ext=["gz", "id"])
conda:
"path/environment.yaml"
shell:
"gcta64 --bfile {params.plink_root} --make-grm-gz --keep {input.inc_samples} --extract {input.inc_snps} --out {params.output_root}"
Essentially it takes a number of inputs and runs them through GCTA which produces two output files: an .id file and a .gz file.
If I am explicit about all file names in this rule (i.e. I use a chromosome number in place of the {chromosome} wildcard) it works perfectly. Now I am trying to make it so that I can specify which chromosome to look at from the command line but snakemake complains about my use of wildcards:
Wildcard error in line 40 of Snakefile
Wildcards in input files cannot be determined from output files: chromosome
Any ideas why if I run something like this in my shell:
snakemake --use-conda path/snpgrm_chr18.grm.gz
Snakemake cannot infer that {chromosome}=18 as it would do for my other rules?
(I do also run this on a SGE cluster but I've left these details out as I don't think they are involved in this behaviour and add a lot of clutter)