Skip to content

Commit

Permalink
configurable paths #12
Browse files Browse the repository at this point in the history
  • Loading branch information
cmeesters committed Dec 6, 2023
1 parent da84a01 commit f471dd9
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 12 deletions.
7 changes: 4 additions & 3 deletions slides/common/preamble.tex
Original file line number Diff line number Diff line change
Expand Up @@ -340,9 +340,10 @@
\MyDat[\arabic{datacount},3]}%
}

\newcommand{\pathtosetup}[1]{\path{/lustre/project/hpckurs/workflows/#1}}
\newcommand{\pathtoclozure}[1]{\path{/lustre/project/hpckurs/workflows/tutoturial/#1}}
\newcommand{\pathtosolutions}[1]{\path{/lustre/project/hpckurs/workflows/solutions/#1}}
%\newcommand{\pathtosetup}[1]{\path{/lustre/project/hpckurs/workflows/#1}}
\newcommand{\pathtosetup}[1]{\texttt{\configparam{pathtosetup}/#1}}
\newcommand{\pathtoclozure}[1]{\texttt{\configparam{pathtoclozure}/#1}}
\newcommand{\pathtosolutions}[1]{\texttt{\configparam{pathtosolutions}/#1}}

\setcounter{tocdepth}{1}

Expand Down
35 changes: 26 additions & 9 deletions slides/creators/A_First_Workflow.tex
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,23 @@ \section{A first Workflow}
\end{exampleblock}
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[fragile]
\frametitle{Specifiying \texttt{Snakefile}s (Details)}
\begin{docs}[\texttt{Snakemake}s Default \texttt{Snakefile}]
The workflow definition in form of a snakefile. Usually, you should not need to specify this. By default, \texttt{Snakemake} will search for "\altverb{Snakefile}", "\altverb{snakefile}", "\altverb{workflow/Snakefile}", "\altverb{workflow/snakefile}" beneath the current working directory, in this order.\newline
When using a different layout, you can use
\begin{lstlisting}[language=Bash, style=Shell]
$ snakemake <other arguments> \
> --snakefile <path to snakefile>
\end{lstlisting}
\end{docs}
\pause
\begin{hint}
On clusters we recommend working from \altverb{HOME} and configuring workflows such that they point to data on project file systems. How and the reasons why will be covered.
\end{hint}
\end{frame}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{A first Step or ``Rule''}
Expand Down Expand Up @@ -168,7 +185,7 @@ \subsection{A first Step or ``Rule''}
" | samtools view -Sb - >"
" mapped_reads/A.bam"
\end{lstlisting}
You will find the working content in \altverb{01_Snakefile}, too.
You will find the working content in \pathtoclozure{01\_Snakefile}, too.
\end{onlyenv}
\end{frame}

Expand Down Expand Up @@ -300,7 +317,7 @@ \subsection{A first Step or ``Rule''}
Your task is simple to introduce the \altverb{\{input\}} and \altverb{\{output\}} wildcards in our current \altverb{bwa_map} rule. Replace the input and output within the \altverb{shell} directive using these wildcards.
\end{task}
\begin{hint}
Remember, \texttt{Snakemake} will concatenate multiline in- or output. Refer to \altverb{02_Snakefile} in your tutorial folder for the task setting.
Remember, \texttt{Snakemake} will concatenate multiline in- or output. Refer to \altverb{02\_Snakefile} in your tutorial folder for the task setting.
\end{hint}
\end{frame}

Expand All @@ -321,7 +338,7 @@ \subsection{A first Step or ``Rule''}
" {output}"
\end{lstlisting}
As we have multiline input \texttt{Snakemake} will replace \altverb{\{input\}} with \altverb{data/genome.fa data/samples/A.fastq} before executing the command.\newline
A working solution can be found in \pathtosolutions{02_Snakefile}.
A working solution can be found in \pathtosolutions{02\_Snakefile}.
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Expand All @@ -330,7 +347,7 @@ \subsection{A first Step or ``Rule''}
(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.
You may refer to the \pathtoclozure{03\_Snakefile} template.
\end{task}
\end{frame}

Expand All @@ -354,19 +371,19 @@ \subsection{A first Step or ``Rule''}
\begin{frame}[fragile]
\frametitle{\HandsOn{Mini-Task: add the \texttt{sample} Wildcard}}
\begin{task}
Simply refer to your current \texttt{Snakefile} or to the cloze text in \pathtoclozure{03_Snakefile}. Replace the \altverb{A} in the second input file and in the output file with the wildcard \altverb{\{sample\}}.\newline
Simply refer to your current \texttt{Snakefile} or to the cloze text in \pathtoclozure{03\_Snakefile}. Replace the \altverb{A} in the second input file and in the output file with the wildcard \altverb{\{sample\}}.\newline
Then run:
\begin{lstlisting}[language=Bash, style=Shell]
$ snakemake -np mapped_reads/B.bam
\end{lstlisting}
\texttt{Snakemake} will determine that the rule \altverb{bwa_map} can be applied to generate the target file by replacing the wildcard \altverb{\{sample\}} with the value \altverb{B}.
\begin{hint}
If your workflow does not work, find the solution in \pathtosolutions{03_Snakefile}.
If your workflow does not work, find the solution in \pathtosolutions{03\_Snakefile}.
\end{hint}
\end{task}
\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
\pathtosolutions{03_Snakefile}
\pathtosolutions{03\_Snakefile}
\end{docs}
\end{frame}

Expand Down Expand Up @@ -423,7 +440,7 @@ \subsection{A first Step or ``Rule''}
"-O bam {input} > {output}"
\end{lstlisting}
\begin{task}
Please refer to your template \altverb{04_Snakefile}.
Please refer to your template \altverb{04\_Snakefile}.
\end{task}
\end{frame}

Expand Down Expand Up @@ -536,7 +553,7 @@ \subsection{A first Step or ``Rule''}
"bcftools mpileup -f {input.fa} {input.bam} | "
"bcftools call -mv - > {output}"
\end{lstlisting}
This is part of \altverb{05_Snakefile}.
This is part of \altverb{05\_Snakefile}.
\end{frame}


Expand Down

0 comments on commit f471dd9

Please sign in to comment.