Skip to content

Instantly share code, notes, and snippets.

@jblachly
Last active April 8, 2016 18:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jblachly/e12612831bc0c1fee0a10882946fbf81 to your computer and use it in GitHub Desktop.
Save jblachly/e12612831bc0c1fee0a10882946fbf81 to your computer and use it in GitHub Desktop.
Undocumented Snakemake functionality

Wildcards

wildcards only appears in two cases as far as I can tell

  1. when using a function to define input files
  2. in a lambda function , as in e.g. params: stagger_len = lambda wildcards: stagger(int(wildcards.REVNUM))

Including variables in expand()

Including variables in an expansion doesn't seem to work at first:

demuxed=expand("demux/fwd{FWDNUM}-rev{REVNUM}_R1.fastq", FWDNUM=padded_range()),

does not work - complains about missing variable subsitution REVNUm.

However, putting double braces as in:

demuxed=expand("demux/fwd{FWDNUM}-rev{{REVNUM}}_R1.fastq", FWDNUM=padded_range()),

works just fine.

{ } in input or output filenames

Passing {text} in a parameter or output file name (as in {name} when using cutadapt) does not work when double escaping {{ as recommended by the manual or in the program.

outparm="demux/\{name\}-rev{REVNUM}_R1.fastq"

works just fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment