forked from fbartusch/snakemake_tutorial
/
snakemake_tutorial.scif
102 lines (95 loc) · 3.27 KB
/
snakemake_tutorial.scif
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
%appfiles setup
/Snakefile
/config.yaml
%apprun setup
if [ ! -e "${SCIF_DATA}/Snakefile" ]; then
echo "Copying Snakefile to $SCIF_DATA"
cp ${SCIF_APPROOT}/Snakefile ${SCIF_DATA}/Snakefile
fi
if [ ! -e "${SCIF_DATA}/config.yaml" ]; then
echo "Copying config.yaml to $SCIF_DATA"
cp ${SCIF_APPROOT}/config.yaml ${SCIF_DATA}/config.yaml
fi
%apprun valgrind
/bin/bash ${SCIF_APPRUN_setup}
cd ${SCIF_DATA}
exec valgrind --tool=massif /opt/conda/bin/snakemake all
%apprun timeit
/bin/bash ${SCIF_APPRUN_setup}
cd ${SCIF_DATA}
exec /usr/bin/time -a -o $TIME_LOG /opt/conda/bin/snakemake all
%appenv timeit
TIME='%C\t%E\t%K\t%I\t%M\t%O\t%P\t%U\t%W\t%X\t%e\t%k\t%p\t%r\t%s\t%t\t%w\n'
TIME_LOG=/scif/data/snakemake-times.log
export TIME TIME_LOG
%apphelp timeit
Run the snakemake pipeline and save a log of timing and metrics.
Usage: scif run timeit
Log will be written to the main data folder as "snakemake-times.log"
%appinstall bwa
apt-get -y install wget libbz2-dev zlib1g-dev
wget https://sourceforge.net/projects/bio-bwa/files/bwa-0.7.17.tar.bz2
tar xvjf bwa-0.7.17.tar.bz2
cp -r bwa-0.7.17/* lib
rm -r bwa-0.7.17
rm bwa-0.7.17.tar.bz2
cd lib
make
mv bwa ../bin
%apphelp bwa
Burrows-Wheeler Aligner
%apprun bwa
cd $SCIF_DATA
exec bwa "$@"
%applabels bwa
VERSION 0.7.17
%apptest bwa
bwa "$@"
%appinstall samtools
apt-get -y install wget libbz2-dev zlib1g-dev xz-utils liblzma-dev
apt-get -y install libncurses5-dev
wget https://github.com/samtools/samtools/releases/download/1.6/samtools-1.6.tar.bz2
tar xvjf samtools-1.6.tar.bz2
cd samtools-1.6
./configure --without-curses --prefix=$SCIF_APPROOT
make
make install
cd ..
rm -r samtools-1.6
rm samtools-1.6.tar.bz2
wget https://github.com/samtools/bcftools/releases/download/1.6/bcftools-1.6.tar.bz2
tar xvjf bcftools-1.6.tar.bz2
cd bcftools-1.6
./configure --without-curses --prefix=$SCIF_APPROOT
make
make install
cd ..
rm -r bcftools-1.6
rm bcftools-1.6.tar.bz2
%apphelp samtools
This app provides Samtools suite, consisting of Samtools and BCFtools
%apprun samtools
cd $SCIF_DATA
exec samtools "$@"
%applabels samtools
VERSION 1.6
URL http://www.htslib.org/
%apptest samtools
exec samtools
%apphelp snakemake
Run snakemake. The workflow is defined by a Snakefile that should be located in the $SCIF_DATA folder.
This app does not provide snakemake itself, because it is already installed in the Singularity/Docker container.
But it would be easy to install snakemake also in the app context. The Snakefile should be present in the folder.
If not, we copy the one provided by the snakemake application.
%apprun snakemake
/bin/bash ${SCIF_APPRUN_setup}
cd ${SCIF_DATA}
/opt/conda/bin/snakemake "$@"
%appinstall graphviz_create_dag
apt-get -y install graphviz
%apphelp graphviz_create_dag
This app creates a directed acyclic graph representation of a Snakemake workflow execution.
The app takes three arguments: The directory of the Snakefile, the target file and the output filename.
%apprun graphviz_create_dag
cd $1
/opt/conda/bin/snakemake --dag $2 | dot -Tsvg > $SCIF_DATA/$3