Kevin’s Snakemake Helpers

To use these, pip install this package in the same python environment as snakemake, then use from kdmsnakemake import * in the top of your Snakefile.

Helper functions

kdmsnakemake.make_regions(rdict, window=1000000.0)[source]

Splits a reference into window sized windows.

Makes a list of regions for each reference in a dict of {refname:
refpath: entries.
Parameters:
  • rdict – dict of {refname: refpath, …}
  • window – Size of windows
Returns:

dict of {refname: {region: coordinates, …}, …}

kdmsnakemake.make_chromosomes(rdict, chrom_regex='^chr')[source]

Splits a reference into chromosome chunks

Makes a list of regions for each reference in a dict of {refname: refpath} entries. Sequences matching chrom_regex appear as their own entires, all other sequences appear under a “scaffols” pseudo-chromosome.

Parameters:
  • rdict – dict of {refname: refpath, …}
  • chrom_regex – Regular expression that (case-insensitively) matches proper chromosomes.
Returns:

dict of {refname: {chromosome_set: [refseq_name, …]}, …}

Indices and tables