diff --git a/slides/creators/A_First_Workflow.tex b/slides/creators/A_First_Workflow.tex index 70d63c2..0cea471 100644 --- a/slides/creators/A_First_Workflow.tex +++ b/slides/creators/A_First_Workflow.tex @@ -326,8 +326,17 @@ \subsection{A first Step or ``Rule''} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame}[fragile] - \frametitle{Further Workflow Decoration}\footnotesize - \texttt{Snakemake} allows generalizing rules by using named wildcards. Simply replace the \altverb{A} in the second input file and in the output file with the wildcard \altverb{\{sample\}}, to yield: + \frametitle{\HandsOn{Further Workflow Decoration}} + (Usually), experiments consists of more than one input, e.\,g. several replicas might be present.\newline + \begin{task}{Introducing the \altverb{sample} Wildcard} + \texttt{Snakemake} allows generalizing rules by using named wildcards, too. Simply replace the \altverb{A} in the second input file and in the output file with the wildcard \altverb{\{sample\}}.\newline + You may refer to the \pathtoclozure{03_Snakefile} template. + \end{task} +\end{frame} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\begin{frame}[fragile] + \frametitle{Further Workflow Decoration -- Solution} \begin{lstlisting}[language=Python,style=Python,basicstyle=\footnotesize] rule bwa_map: input: @@ -338,15 +347,10 @@ \subsection{A first Step or ``Rule''} shell: "bwa mem {input} | samtools view -Sb - > {output}" \end{lstlisting} - When \texttt{Snakemake} determines that this rule can be applied to generate a target file by replacing the wildcard \altverb{\{sample\}} in the output file with an appropriate value, it will propagate that value to all occurrences of \altverb{\{sample\}} in the input files and thereby determine the necessary input for the resulting job. -\end{frame} - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\begin{frame} - \frametitle{One Caveat!} - \begin{alertblock}{Multiple Wildcards} - You can have multiple wildcards in your file paths, however, to avoid conflicts with other jobs of the same rule, \emph{all output files} of a rule \emph{have to contain exactly the same wildcards}. - \end{alertblock} + \begin{docs}{Background} + When \texttt{Snakemake} determines that this rule can be applied to generate a target file by replacing the wildcard \altverb{\{sample\}} in the output file with an appropriate value, it will propagate that value to all occurrences of \altverb{\{sample\}} in the input files and thereby determine the necessary input for the resulting job.\newline + \pathtosolution{03_Snakefile} + \end{docs} \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -367,6 +371,14 @@ \subsection{A first Step or ``Rule''} \end{lstlisting} \end{frame} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\begin{frame} + \frametitle{One Caveat!} + \begin{alertblock}{Multiple Wildcards} + You can have multiple wildcards in your file paths, however, to avoid conflicts with other jobs of the same rule, \emph{all output files} of a rule \emph{have to contain exactly the same wildcards}. + \end{alertblock} +\end{frame} + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame}[fragile] \frametitle{Sorting Alignments} @@ -374,19 +386,33 @@ \subsection{A first Step or ``Rule''} \begin{lstlisting}[language=Python,style=Python] rule samtools_sort: input: - "mapped_reads/{sample}.bam" + ... output: - "sorted_reads/{sample}.bam" + ... shell: "samtools sort -T sorted_reads/{wildcards.sample} " "-O bam {input} > {output}" \end{lstlisting} - %TODO check cloze text correct? \begin{task} - Please refer to your template \altverb{03_Snakefile}. + Please refer to your template \altverb{04_Snakefile}. \end{task} \end{frame} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\begin{frame}[fragile] + \frametitle{Using Wildcards} + \begin{lstlisting}[language=Python,style=Python] +rule samtools_sort: + input: + "mapped_reads/{sample}.bam" + output: + "sorted_reads/{sample}.bam" + shell: + "samtools sort -T sorted_reads/{wildcards.sample} " + "-O bam {input} > {output}" + \end{lstlisting} +\end{frame} + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame}[fragile] \frametitle{Using Wildcards}