Talapas Tricks - kr-colab/colab_wiki GitHub Wiki

Using Snakemake with Talapas

In addition to your Snakefile, you'll need:

  1. A runner script that launches the long Snakemake command and passes cluster info to Snakemake.
  2. A cluster configuration JSON file.

Below are two examples of these:

snakemake -j 999 --use-conda --config config="./cluster_talapas.json" --cluster-config cluster_talapas.json \
   --cluster 'sbatch --error {cluster.error} --output {cluster.output} -A {cluster.account} -p {cluster.partition} -n {cluster.n} -t {cluster.time} --mem-per-cpu {cluster.mem} -c {cluster.cores}'

Below is cluster_talapas.json, which in this example sets the default configuration, and then has some sections tailored to specific rules. In this case, the rule-specific entries modify the number of threads (which can be specified in the Snakefile with a threads: directive):

{
    "__default__" :
    {
        "time" : "2-00:00:00",
        "n" : 1,
        "account" : "kernlab",
        "partition" : "kern,kerngpu",
        "mem" : "20G",
        "cores" : "1",
        "chdir": "/absolute/path/to/your/project/",
        "name" : "YOURJOBNAME_{rule}_{wildcards}",
        "output" : "logs/out/{rule}_{wildcards}.out",
        "error" : "logs/error/{rule}_{wildcards}.err"
    },
    "minimap_pe" :
    {
        "time" : "10-00:00:00",
        "mem" : "20G",
        "cores" : "4"
    },
    "minimap_se" :
    {
        "time" : "10-00:00:00",
        "mem" : "20G",
        "cores" : "4"
    }
}

Alternative to cluster configuration JSON

Alternatively, you can use a profile specifically configured to work with Talapas and our lab's partitions. The two main advantages to this is that you won't have to use long snakemake calls as above and the profile is better suited to deal with changes in job status (job cancellation, etc.). See this repository with further instructions.