I am new to Snakemake and planning to use Snakemake for qsub in my cluster environment. In order to avoid critical mistakes that may disturb the cluster, I would like to check qsub job scripts and a qsub command that will be generated by Snakemake before actually submitting the jobs to the que.
Is it possible to see qsub job script files etc. in the dry run mode or in some other ways? I searched for relevant questions but could not find the answer. Thank you for your kind help.
Best,
Schuma
Using
--printshellcmdsor short version-pwith--dry-runwill allow you to see the commands snakemake will feed toqsub, but you won't seeqsuboptions.I don't know any option showing which parameters are given to
qsub, butsnakemakefollows a simple set of rules, which you can find detailed information here and here. As you'll see, you can feed arguments to qsub in multiple ways.--default-resources resource_name1=<value1> resource_name2=<value2>when invoking snakemake.resourcesin rules (prioritized over default values).--set-resources resource_name1=<value1>or for a specific rule using--set-resources rule_name:resource_name1=<value1>(prioritized over default and per-rule values)Suppose you have the following pipeline:
If you call qsub using the
--clusterdirective, you can access all keywords of your rules. Your command could then look like this:snakemake all --cluster "qsub --runtime {resources.runtime} -l mem={resources.mem_mb}mb"This means
snakemakewill submit the following script to the cluster just as if you did directly in your command line:qsub --runtime 240 -l mem=2000mb some_command input.txt output.txtIt is up to you to see which parameters you define where. You might want to check your cluster's documentation or with its administrator what parameters are required and what to avoid.
Also note that for cluster use, Snakemake documentation recommends setting up a profile which you can then use with
snakemake --profile myprofileinstead of having to specify arguments and default values each time.Such a profile can be written in a
~/.config/snakemake/profile_name/config.yamlfile. Here is an example of such a profile:Invoking
snakemake all --profile profile_namecorresponds to invokingYou may also want to define test rules, like a minimal example of your pipeline for instance, and try these first to verify all goes well before running your full pipeline.