By Franktonius Watch. Oc bigbutt blackhair butt egyptiangoddess lamia naga snakegirl egyptianqueen bobcut darkskinnedgirl franktonius. Redraw of an old pencil sketch. Thinking of a good name for her. 1000x1518px 823.74 KB. Company History. We have been keeping and breeding reptiles since 1985. Since that time, our operation has expanded from a husband and wife team operating out of their home basement to one of the Worlds largest breeding facilities with a youthful, energetic, dedicated management team and a full time staff of animal care technicians.
Here we provide a short tutorial that guides you through the main features of Snakemake.Note that this is not suited to learn Snakemake from scratch, rather to give a first impression.To really learn Snakemake (starting from something simple, and extending towards advanced features), use the main Snakemake Tutorial.
This document shows all steps performed in the official Snakemake live demo,such that it becomes possible to follow them at your own pace.Solutions to each step can be found at the bottom of this document.
The examples presented in this tutorial come from Bioinformatics.However, Snakemake is a general-purpose workflow management system for any discipline.For an explanation of the steps you will perform here, have a look at Background.More thorough explanations are provided in the full Snakemake Tutorial.
First, install Snakemake via Conda, as outlined in Installation via Conda/Mamba.The minimal version of Snakemake is sufficient for this demo.
Second, download and unpack the test data needed for this example fromhere,e.g., via
First, create an empty workflow in the current directory with:
Once a Snakefile is present, you can perform a dry run of Snakemakewith:
Since the Snakefile is empty, it will report that nothing has to bedone. In the next steps, we will gradually fill the Snakefile with anexample analysis workflow.
The data folder in your working directory looks as follows:
You will create a workflow that maps the sequencing samples in thedata/samples
folder to the reference genome data/genome.fa
.Then, you will call genomic variants over the mapped samples, and createan example plot.
First, create a rule called bwa
, with input files
data/genome.fa
data/samples/A.fastq
and output file
mapped/A.bam
To generate output from input, use the shell command
Providing a shell command is not enough to run your workflow on anunprepared system. For reproducibility, you also have to provide therequired software stack and define the desired version. This can be donewith the Conda package manager, which is directlyintegrated with Snakemake: add a directiveconda:'envs/mapping.yaml'
that points to a Conda environmentdefinition,with the following content
Upon execution, Snakemake will automatically create that environment,and execute the shell command within.
Now, test your workflow by simulating the creation of the filemapped/A.bam
via
to perform a dry-run and
to perform the actual execution.
Now, generalize the rule bwa
by replacing the concrete sample nameA
with a wildcard {sample}
in input and output file the rulebwa
. This way, Snakemake can apply the rule to map any of the threeavailable samples to the reference genome.
Test this by creating the file mapped/B.bam
.
Next, create a rule sort
that sorts the obtained .bam
file bygenomic coordinate. The rule should have the input file
mapped/{sample}.bam
and the output file
mapped/{sample}.sorted.bam
and uses the shell command
to perform the sorting. Moreover, use the same conda:
directive asfor the previous rule.
Test your workflow with
and
Now, we aggregate over all samples to perform a joint calling of genomicvariants. First, we define a variable
at the top of the Snakefile
. This serves as a definition of thesamples over which we would want to aggregate. In real life, you wouldwant to use an external sample sheet or a configfilefor things like this.
For aggregation over many files, Snakemake provides the helper functionexpand
(see thedocs).Create a rule call
with input files
fa='data/genome.fa'
bam=expand('mapped/{sample}.sorted.bam',sample=samples)
output file
'calls/all.vcf'
and shell command
Further, define a new conda environment file with the following content:
Finally, we strive to calculate some exemplary statistics. This time, wedon’t use a shell command, but rather employ Snakemake’s ability tointegrate with scripting languages like R and Python.
First, we create a rule stats
with input file
'calls/all.vcf'
and output file
'plots/quals.svg'
.Instead of a shell command, we write
and create the corresponding script and its containing folder in ourworking directory with
We open the script in the editor and add the following content
As you can see, instead of writing a command line parser for passingparameters like input and output files, you have direct access to theproperties of the rule via a magic snakemake
object, that Snakemakeautomatically inserts into the script before executing the rule.
Finally, we have to define a conda environment for the rule, sayenvs/stats.yaml
, that provides the required Python packages toexecute the script:
Make sure to test your workflow with
So far, we have always specified a target file at the command line wheninvoking Snakemake. When no target file is specified, Snakemake tries toexecute the first rule in the Snakefile
. We can use this property todefine default target files.
At the top of your Snakefile
define a rule all
, with input files
'calls/all.vcf'
'plots/quals.svg'
and neither a shell command nor output files. This rule simply serves asan indicator of what shall be collected as results.
As a last step, we strive to annotate our workflow with some additionalinformation.
Snakemake can automatically create HTML reports with
Such a report contains runtime statistics, a visualization of theworkflow topology, used software and data provenance information.
In addition, you can mark any output file generated in your workflow forinclusion into the report. It will be encoded directly into the report,such that it can be, e.g., emailed as a self-contained document. Thereader (e.g., a collaborator of yours) can at any time download theenclosed results from the report for further use, e.g., in a manuscriptyou write together. In this example, please mark the output file'plots/quals.svg'
for inclusion by replacing it withreport('plots/quals.svg',caption='report/calling.rst')
and adding afile report/calling.rst
, containing some description of the outputfile. This description will be presented as caption in the resultingreport.
The first rule bwa
can in theory use multiple threads. You can makeSnakemake aware of this, such that the information can be used forscheduling. Add a directive threads:8
to the rule and alter theshell command to
This passes the threads defined in the rule as a command line argumentto the bwa
process.
The output of the bwa
rule becomes superfluous once the sortedversion of the .bam
file is generated by the rule sort
.Snakemake can automatically delete the superfluous output once it is notneeded anymore. For this, mark the output as temporary by replacing'mapped/{sample}.bam'
in the rule bwa
withtemp('mapped/{sample}.bam')
.
Only read this if you have a problem with one of the steps.
The rule should look like this:
The rule should look like this:
The rule should look like this:
The rule should look like this:
The rule should look like this:
The rule should look like this:
It has to appear as first rule in the Snakefile
.
The complete workflow should look like this:
'A snake's butt is his conscience and his only companion.' --Descartes
You play as a snake's butt. You head has a nose, so it can find its way to food, so you can follow the head to get fed, but you can also choose to not follow the head, if it's heading into danger. Sometimes, it's best not to follow mindlessly, but to take control and avoid disaster.
Status | Released |
Platforms | Windows, macOS, Linux |
Author | spill |
Genre | Puzzle |
Tags | Arcade, snake |
The game runs on the LÖVE game engine, which can be downloaded at https://love2d.org/
Log in with itch.io to leave a comment.
Love the idea. The head is so stupid though :D (0:30)