<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.bwhpc.de/wiki/index.php?action=history&amp;feed=atom&amp;title=BinAC2%2FSoftware%2FBowtie2</id>
	<title>BinAC2/Software/Bowtie2 - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.bwhpc.de/wiki/index.php?action=history&amp;feed=atom&amp;title=BinAC2%2FSoftware%2FBowtie2"/>
	<link rel="alternate" type="text/html" href="https://wiki.bwhpc.de/wiki/index.php?title=BinAC2/Software/Bowtie2&amp;action=history"/>
	<updated>2026-10-30T11:05:05Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.17</generator>
	<entry>
		<id>https://wiki.bwhpc.de/wiki/index.php?title=BinAC2/Software/Bowtie2&amp;diff=16561&amp;oldid=prev</id>
		<title>F Bartusch at 15:58, 29 October 2026</title>
		<link rel="alternate" type="text/html" href="https://wiki.bwhpc.de/wiki/index.php?title=BinAC2/Software/Bowtie2&amp;diff=16561&amp;oldid=prev"/>
		<updated>2026-10-29T15:58:55Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 17:58, 29 October 2026&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 267:&lt;/td&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 267:&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* The module no longer loads &amp;lt;code&amp;gt;compiler/gnu/14.2&amp;lt;/code&amp;gt;. Job scripts that relied on it being loaded must now load it themselves.&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* The module no longer loads &amp;lt;code&amp;gt;compiler/gnu/14.2&amp;lt;/code&amp;gt;. Job scripts that relied on it being loaded must now load it themselves.&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* References above 2 GiB now always get a large index (&amp;lt;code&amp;gt;.bt2l&amp;lt;/code&amp;gt;)&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;.&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* References above 2 GiB now always get a large index (&amp;lt;code&amp;gt;.bt2l&amp;lt;/code&amp;gt;)&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-empty diff-side-deleted&quot;&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-empty diff-side-deleted&quot;&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;= Support =&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-empty diff-side-deleted&quot;&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-empty diff-side-deleted&quot;&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;If you have questions or problems, contact hpcmaster [at] uni-tuebingen.de..&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>F Bartusch</name></author>
	</entry>
	<entry>
		<id>https://wiki.bwhpc.de/wiki/index.php?title=BinAC2/Software/Bowtie2&amp;diff=16560&amp;oldid=prev</id>
		<title>F Bartusch: Created page with &quot;{{Softwarepage|bio/bowtie2/2.5.5}}  {| width=600px class=&quot;wikitable&quot; |- ! Description !! Content |- | module load | bio/bowtie2/2.5.5 |- | License | GPL-3.0, see [https://github.com/BenLangmead/bowtie2/blob/master/LICENSE] |- | Citing | Langmead B, Salzberg SL. Fast gapped-read alignment with Bowtie 2. Nature Methods 9, 357 to 359 (2012), [https://doi.org/10.1038/nmeth.1923] |- | Links | Bowtie 2 Website: [https://bowtie-bio.sourceforge.net/bowtie2/] &lt;br&gt; Bowtie 2 Manual...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.bwhpc.de/wiki/index.php?title=BinAC2/Software/Bowtie2&amp;diff=16560&amp;oldid=prev"/>
		<updated>2026-10-29T15:58:19Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;{{Softwarepage|bio/bowtie2/2.5.5}}  {| width=600px class=&amp;quot;wikitable&amp;quot; |- ! Description !! Content |- | module load | bio/bowtie2/2.5.5 |- | License | GPL-3.0, see [https://github.com/BenLangmead/bowtie2/blob/master/LICENSE] |- | Citing | Langmead B, Salzberg SL. Fast gapped-read alignment with Bowtie 2. Nature Methods 9, 357 to 359 (2012), [https://doi.org/10.1038/nmeth.1923] |- | Links | Bowtie 2 Website: [https://bowtie-bio.sourceforge.net/bowtie2/] &amp;lt;br&amp;gt; Bowtie 2 Manual...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Softwarepage|bio/bowtie2/2.5.5}}&lt;br /&gt;
&lt;br /&gt;
{| width=600px class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Description !! Content&lt;br /&gt;
|-&lt;br /&gt;
| module load&lt;br /&gt;
| bio/bowtie2/2.5.5&lt;br /&gt;
|-&lt;br /&gt;
| License&lt;br /&gt;
| GPL-3.0, see [https://github.com/BenLangmead/bowtie2/blob/master/LICENSE]&lt;br /&gt;
|-&lt;br /&gt;
| Citing&lt;br /&gt;
| Langmead B, Salzberg SL. Fast gapped-read alignment with Bowtie 2. Nature Methods 9, 357 to 359 (2012), [https://doi.org/10.1038/nmeth.1923]&lt;br /&gt;
|-&lt;br /&gt;
| Links&lt;br /&gt;
| Bowtie 2 Website: [https://bowtie-bio.sourceforge.net/bowtie2/] &amp;lt;br&amp;gt;&lt;br /&gt;
Bowtie 2 Manual: [https://bowtie-bio.sourceforge.net/bowtie2/manual.shtml] &amp;lt;br&amp;gt;&lt;br /&gt;
Bowtie 2 Repository: [https://github.com/BenLangmead/bowtie2]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= Description =&lt;br /&gt;
&lt;br /&gt;
Bowtie 2 is a fast and memory-efficient aligner for short sequencing reads against a reference genome.&lt;br /&gt;
&lt;br /&gt;
This page describes the module &amp;lt;code&amp;gt;bio/bowtie2/2.5.5&amp;lt;/code&amp;gt;. All options, recommendations and run times on this page were measured with this version. The older module &amp;lt;code&amp;gt;bio/bowtie2/2.5.4&amp;lt;/code&amp;gt; is also installed, but not covered here.&lt;br /&gt;
&lt;br /&gt;
The module is built from source for BinAC 2:&lt;br /&gt;
&lt;br /&gt;
* Built with GCC 14.2 and &amp;lt;code&amp;gt;-march=x86-64-v3&amp;lt;/code&amp;gt;; it runs on all BinAC 2 compute nodes.&lt;br /&gt;
* Index building uses libsais, which is much faster than the classic algorithm.&lt;br /&gt;
* Compressed reads (&amp;lt;code&amp;gt;.fastq.gz&amp;lt;/code&amp;gt;) are read with zlib-ng.&lt;br /&gt;
* No compiler module is needed: the C++ and OpenMP runtimes are part of the binaries.&lt;br /&gt;
&lt;br /&gt;
= Usage =&lt;br /&gt;
&lt;br /&gt;
== Loading the module ==&lt;br /&gt;
&lt;br /&gt;
Load the module in your job script; &amp;lt;code&amp;gt;lib/zlib-ng-compat/2.3.3&amp;lt;/code&amp;gt; is loaded with it automatically.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
module load bio/bowtie2/2.5.5&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Only one bowtie2 module can be loaded at a time.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Command !! Purpose&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;bowtie2&amp;lt;/code&amp;gt; || align reads to an index&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;bowtie2-build&amp;lt;/code&amp;gt; || build an index from a reference FASTA&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;bowtie2-inspect&amp;lt;/code&amp;gt; || show the contents of an index&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Variable !! Content&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;BOWTIE2_VERSION&amp;lt;/code&amp;gt; || version, &amp;lt;code&amp;gt;2.5.5&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;BOWTIE2_HOME&amp;lt;/code&amp;gt; || installation directory&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;BOWTIE2_BIN_DIR&amp;lt;/code&amp;gt; || directory of the commands&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Building an index ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;bowtie2-build&amp;lt;/code&amp;gt; chooses the index type itself: references up to about 2 GiB of uncompressed FASTA get a small index (&amp;lt;code&amp;gt;.bt2&amp;lt;/code&amp;gt;), larger ones a large index (&amp;lt;code&amp;gt;.bt2l&amp;lt;/code&amp;gt;). Human and most mammalian genomes therefore get a large index; you do not need &amp;lt;code&amp;gt;--large-index&amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt;bowtie2&amp;lt;/code&amp;gt; finds either type by the index name.&lt;br /&gt;
&lt;br /&gt;
For Zstandard-compressed references (&amp;lt;code&amp;gt;.fa.zst&amp;lt;/code&amp;gt;), &amp;lt;code&amp;gt;bowtie2-build&amp;lt;/code&amp;gt; cannot check the size. For such references above 2 GiB, pass &amp;lt;code&amp;gt;--large-index&amp;lt;/code&amp;gt;; otherwise the build stops with an error message.&lt;br /&gt;
&lt;br /&gt;
Measured index builds, 32 CPUs on a Zen 3 node of the &amp;lt;code&amp;gt;compute&amp;lt;/code&amp;gt; partition (EPYC 7543):&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Reference !! Size (FASTA, uncompressed) !! Index type !! Wall time !! Peak memory !! Recommended &amp;lt;code&amp;gt;--mem&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| GRCh38, no-alt analysis set || about 3.2 GB || large (&amp;lt;code&amp;gt;.bt2l&amp;lt;/code&amp;gt;) || 9.6 min || 24.6 GiB || &amp;lt;code&amp;gt;32G&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Most of the build uses only a few CPUs (4.2 on average), but one phase uses all 32.&lt;br /&gt;
&lt;br /&gt;
Your reference genome is not in the table? Send us the genome (e.g. an NCBI or Ensembl accession) via hpcmaster [at] uni-tuebingen.de. We measure the index build on BinAC 2 and add it to this table.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH --job-name=bt2-index&lt;br /&gt;
#SBATCH --nodes=1&lt;br /&gt;
#SBATCH --ntasks=1&lt;br /&gt;
#SBATCH --cpus-per-task=32&lt;br /&gt;
#SBATCH --mem=32G&lt;br /&gt;
#SBATCH --time=01:00:00&lt;br /&gt;
&lt;br /&gt;
module load bio/bowtie2/2.5.5&lt;br /&gt;
bowtie2-build --threads ${SLURM_CPUS_PER_TASK} GRCh38.fa GRCh38&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This writes &amp;lt;code&amp;gt;GRCh38.1.bt2l&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;GRCh38.rev.2.bt2l&amp;lt;/code&amp;gt;; use &amp;lt;code&amp;gt;-x GRCh38&amp;lt;/code&amp;gt; when aligning.&lt;br /&gt;
&lt;br /&gt;
== Aligning reads ==&lt;br /&gt;
&lt;br /&gt;
This job aligns one paired-end sample in two steps and writes a sorted BAM file to a workspace on the fast work storage:&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;code&amp;gt;bowtie2&amp;lt;/code&amp;gt; aligns with all CPUs and pipes its output into &amp;lt;code&amp;gt;samtools view&amp;lt;/code&amp;gt;, which writes an unsorted BAM file. No SAM file is written.&lt;br /&gt;
# &amp;lt;code&amp;gt;samtools sort&amp;lt;/code&amp;gt; sorts the unsorted BAM with all CPUs into the final BAM file.&lt;br /&gt;
&lt;br /&gt;
The job writes into one of your existing workspaces; replace &amp;lt;code&amp;gt;&amp;amp;lt;workspace&amp;amp;gt;&amp;lt;/code&amp;gt; in the job script with its name. &amp;lt;code&amp;gt;ws_list&amp;lt;/code&amp;gt; shows your workspaces. If you do not have one yet, allocate it with &amp;lt;code&amp;gt;ws_allocate &amp;amp;lt;workspace&amp;amp;gt; &amp;amp;lt;days&amp;amp;gt;&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH --job-name=bt2-align&lt;br /&gt;
#SBATCH --nodes=1&lt;br /&gt;
#SBATCH --ntasks=1&lt;br /&gt;
#SBATCH --cpus-per-task=32&lt;br /&gt;
#SBATCH --mem=40G&lt;br /&gt;
#SBATCH --time=10:00:00&lt;br /&gt;
set -euo pipefail&lt;br /&gt;
&lt;br /&gt;
module load bio/bowtie2/2.5.5 bio/samtools/1.24&lt;br /&gt;
&lt;br /&gt;
WORKSPACE=&amp;lt;workspace&amp;gt;&lt;br /&gt;
OUTDIR=$(ws_find ${WORKSPACE})&lt;br /&gt;
[ -n &amp;quot;${OUTDIR}&amp;quot; ] || { echo &amp;quot;workspace ${WORKSPACE} not found, check with ws_list&amp;quot; &amp;gt;&amp;amp;2; exit 1; }&lt;br /&gt;
&lt;br /&gt;
# Intermediate files (unsorted BAM, sort temporary files):&lt;br /&gt;
# small samples: node-local $TMPDIR; large samples: use TMP=${OUTDIR} instead&lt;br /&gt;
TMP=${TMPDIR}&lt;br /&gt;
&lt;br /&gt;
# 1. align with all CPUs, write an unsorted BAM&lt;br /&gt;
bowtie2 -p ${SLURM_CPUS_PER_TASK} -x /path/to/GRCh38 \&lt;br /&gt;
        -1 sample_R1.fastq.gz -2 sample_R2.fastq.gz \&lt;br /&gt;
  | samtools view -@ 4 -b -o ${TMP}/sample.unsorted.bam -&lt;br /&gt;
&lt;br /&gt;
# 2. sort with all CPUs into the workspace&lt;br /&gt;
samtools sort -@ ${SLURM_CPUS_PER_TASK} -T ${TMP}/sample.tmp -o ${OUTDIR}/sample.bam ${TMP}/sample.unsorted.bam&lt;br /&gt;
rm -f ${TMP}/sample.unsorted.bam&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Small or large sample:&amp;#039;&amp;#039;&amp;#039; &amp;lt;code&amp;gt;$TMPDIR&amp;lt;/code&amp;gt; is the node-local disk. It holds about 450 GB and is shared by all jobs on the node, and Slurm does not reserve space per job. For small samples, keep the intermediate files there; it is the fastest choice. For large samples we cannot guarantee that &amp;lt;code&amp;gt;$TMPDIR&amp;lt;/code&amp;gt; has enough space; set &amp;lt;code&amp;gt;TMP=${OUTDIR}&amp;lt;/code&amp;gt; to keep them in the workspace. As a guideline (estimate): use &amp;lt;code&amp;gt;$TMPDIR&amp;lt;/code&amp;gt; if the compressed FASTQ files of one sample are below about 50 GB in total, roughly a human genome at 25x.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Space needed:&amp;#039;&amp;#039;&amp;#039; a human genome at about 50x coverage (787M read pairs, 2 x 101 bp) gives an unsorted BAM of 115 GB and a sorted BAM of 106 GB. The sort temporary files come on top during step 2.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Run time:&amp;#039;&amp;#039;&amp;#039; 50x took 4.1 hours on a node with EPYC 75F3 not shared with other jobs: 3.8 hours for step 1, 13 to 16 minutes for step 2. On nodes with EPYC 7543 or on a node shared with other jobs it takes longer, about 4.5 to 5 hours (estimate). A 30x genome takes about 2.5 to 3 hours (estimate).&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Memory:&amp;#039;&amp;#039;&amp;#039; step 1 needs about 5 GiB, step 2 with 32 sort threads 28 GiB. The job ran with &amp;lt;code&amp;gt;--mem=40G&amp;lt;/code&amp;gt;.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;CPUs:&amp;#039;&amp;#039;&amp;#039; &amp;lt;code&amp;gt;samtools view -@ 4&amp;lt;/code&amp;gt; runs on top of the 32 bowtie2 threads. It needs very little CPU, and taking CPUs away from bowtie2 for it was slower in our tests.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;After the analysis:&amp;#039;&amp;#039;&amp;#039; keep the BAM in the workspace while you work with it. When you no longer need it there, move it to your project directory, since workspaces expire.&lt;br /&gt;
&lt;br /&gt;
== Why two steps? ==&lt;br /&gt;
&lt;br /&gt;
We compared the two-step job above with a single pipe into &amp;lt;code&amp;gt;samtools sort&amp;lt;/code&amp;gt; and with writing a SAM file first. Full 50x genome, output in a workspace on work, nodes not shared with other jobs:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Variant !! Run time !! Node !! Intermediate file&lt;br /&gt;
|-&lt;br /&gt;
| Two steps, intermediate files in &amp;lt;code&amp;gt;$TMPDIR&amp;lt;/code&amp;gt; (example job) || 4.05 h || EPYC 75F3 || unsorted BAM, 115 GB&lt;br /&gt;
|-&lt;br /&gt;
| Two steps, intermediate files in the workspace || 4.09 h || EPYC 75F3 || unsorted BAM, 115 GB&lt;br /&gt;
|-&lt;br /&gt;
| One pipe: &amp;lt;code&amp;gt;bowtie2 -p 26 &amp;amp;#124; samtools sort -@ 6&amp;lt;/code&amp;gt; || 4.73 h || EPYC 75F3 || none&lt;br /&gt;
|-&lt;br /&gt;
| SAM file, then &amp;lt;code&amp;gt;samtools sort&amp;lt;/code&amp;gt; || 4.66 h || EPYC 7543 || SAM file, 525 GB&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Two steps are about 14 % faster than the single pipe.&amp;#039;&amp;#039;&amp;#039; In the pipe, &amp;lt;code&amp;gt;samtools sort&amp;lt;/code&amp;gt; slows &amp;lt;code&amp;gt;bowtie2&amp;lt;/code&amp;gt; down, even when bowtie2 keeps all 32 CPUs. &amp;lt;code&amp;gt;samtools view&amp;lt;/code&amp;gt; does not.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;The unsorted BAM is only slightly larger than the sorted one&amp;#039;&amp;#039;&amp;#039; (115 GB vs 106 GB), while a SAM file is about five times as large (525 GB). Do not write SAM files.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;The sort step is faster with its temporary files in &amp;lt;code&amp;gt;$TMPDIR&amp;lt;/code&amp;gt;&amp;#039;&amp;#039;&amp;#039; (13 vs 16 minutes); where the unsorted BAM is read from made no difference.&lt;br /&gt;
&lt;br /&gt;
= Resources and Efficiency =&lt;br /&gt;
&lt;br /&gt;
Request 16 to 32 CPUs per sample and give bowtie2 all of them with &amp;lt;code&amp;gt;-p&amp;lt;/code&amp;gt;; for many samples, use a job array with one sample per job.&lt;br /&gt;
&lt;br /&gt;
Measured with bowtie2 2.5.5 and 20M read pairs (NA12878, 2 x 101 bp) against GRCh38 on a Zen 3 node of the &amp;lt;code&amp;gt;compute&amp;lt;/code&amp;gt; partition with AMD EPYC 7543 (nodes with EPYC 75F3 were about 8 % faster in one comparison):&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:right&amp;quot;&lt;br /&gt;
! &amp;lt;code&amp;gt;--cpus-per-task&amp;lt;/code&amp;gt; !! Physical cores !! Wall time (min) !! Core time relative to 16 CPUs !! Peak memory (GiB)&lt;br /&gt;
|-&lt;br /&gt;
| 16 || 8 || 12.9 || 1.00 || 4.4&lt;br /&gt;
|-&lt;br /&gt;
| 32 || 16 || 6.9 || 1.07 || 4.7&lt;br /&gt;
|-&lt;br /&gt;
| 64 || 32 || 4.2 || 1.30 || 5.5&lt;br /&gt;
|-&lt;br /&gt;
| 128 || 64 || 3.1 || 1.92 || 6.9&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Run time grows linearly with the number of reads: a full genome at about 50x took 26.7 s per million read pairs with 32 CPUs, the 20M pair run 24.6 s.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Setting !! Recommendation !! Basis&lt;br /&gt;
|-&lt;br /&gt;
| Threads || &amp;lt;code&amp;gt;bowtie2 -p&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;--cpus-per-task&amp;lt;/code&amp;gt;; &amp;lt;code&amp;gt;samtools view -@ 4&amp;lt;/code&amp;gt; on top; &amp;lt;code&amp;gt;samtools sort -@&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;--cpus-per-task&amp;lt;/code&amp;gt; || measured: as fast as bowtie2 writing a file directly&lt;br /&gt;
|-&lt;br /&gt;
| CPUs per sample || 16 to 32 || measured: 32 CPUs cost 7 % more core time than 16, 64 CPUs 30 % more&lt;br /&gt;
|-&lt;br /&gt;
| Memory, alignment against a human index || &amp;lt;code&amp;gt;--mem=8G&amp;lt;/code&amp;gt; for bowtie2 alone, &amp;lt;code&amp;gt;--mem=40G&amp;lt;/code&amp;gt; for the two-step example job || measured: bowtie2 4.4 to 6.9 GiB for 16 to 128 CPUs; &amp;lt;code&amp;gt;samtools sort -@ 32&amp;lt;/code&amp;gt; 28 GiB on a full genome, tested at &amp;lt;code&amp;gt;--mem=40G&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Memory, building a human index || &amp;lt;code&amp;gt;--mem=32G&amp;lt;/code&amp;gt; || measured: peak 24.6 GiB, tested at &amp;lt;code&amp;gt;--mem=32G&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Run time || &amp;lt;code&amp;gt;--time=10:00:00&amp;lt;/code&amp;gt; for one genome at up to 50x with 32 CPUs || measured: 4.1 hours at 50x on EPYC 75F3, longer on EPYC 7543 or shared nodes&lt;br /&gt;
|-&lt;br /&gt;
| Disk space || unsorted BAM 115 GB plus sort temporary files (in &amp;lt;code&amp;gt;$TMPDIR&amp;lt;/code&amp;gt; or the workspace), sorted BAM 106 GB in the workspace, per 50x genome || measured&lt;br /&gt;
|-&lt;br /&gt;
| Many samples || one job per sample, e.g. a job array || measured: core time per sample rises with the CPU count&lt;br /&gt;
|-&lt;br /&gt;
| Several bowtie2 on one node with the same index || add &amp;lt;code&amp;gt;--mm&amp;lt;/code&amp;gt; so they share one copy of the index in memory || bowtie2 manual&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;A Slurm CPU is a hardware thread.&amp;#039;&amp;#039;&amp;#039; On the Zen 3 compute nodes, &amp;lt;code&amp;gt;--cpus-per-task=32&amp;lt;/code&amp;gt; gives 16 physical cores with two threads each. bowtie2 uses the second thread well (27 to 40 % faster on the same cores up to 32 cores), so request CPUs as usual and do not use &amp;lt;code&amp;gt;--hint=nomultithread&amp;lt;/code&amp;gt;.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Compressed reads work directly.&amp;#039;&amp;#039;&amp;#039; Pass &amp;lt;code&amp;gt;.fastq.gz&amp;lt;/code&amp;gt; files directly; bowtie2 decompresses them while aligning, so there is no need to unpack the reads first.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Avoid &amp;lt;code&amp;gt;--reorder&amp;lt;/code&amp;gt; unless you need the input order.&amp;#039;&amp;#039;&amp;#039; It makes bowtie2 hold back finished reads until all earlier ones are written, which can cost time and memory.&lt;br /&gt;
&lt;br /&gt;
= Where to Keep Your Data =&lt;br /&gt;
&lt;br /&gt;
Reads and index can stay on project storage; there is no need to copy them to &amp;lt;code&amp;gt;$TMPDIR&amp;lt;/code&amp;gt; first. bowtie2 reads its input at well under 10 MB/s, which every storage on BinAC 2 delivers.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Reads and index !! Sort temporary files and BAM !! Wall time (s)&lt;br /&gt;
|-&lt;br /&gt;
| project || &amp;lt;code&amp;gt;$TMPDIR&amp;lt;/code&amp;gt; || 452&lt;br /&gt;
|-&lt;br /&gt;
| copied to &amp;lt;code&amp;gt;$TMPDIR&amp;lt;/code&amp;gt; first || &amp;lt;code&amp;gt;$TMPDIR&amp;lt;/code&amp;gt; || 453, plus 10 for the copy&lt;br /&gt;
|-&lt;br /&gt;
| work || work || 456&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Earlier single pipe (&amp;lt;code&amp;gt;bowtie2 -p 28 &amp;amp;#124; samtools sort -@ 4&amp;lt;/code&amp;gt;), 20M read pairs, one Zen 3 node of the &amp;lt;code&amp;gt;compute&amp;lt;/code&amp;gt; partition (EPYC 75F3), one run each. The full 50x genome, read directly from project, took 26.7 s per million read pairs, close to the 24.6 s of the 20M pair run.&lt;br /&gt;
&lt;br /&gt;
Where the sort temporary files and the BAM are written does matter. Measured with the earlier single pipe (&amp;lt;code&amp;gt;bowtie2 -p 28 &amp;amp;#124; samtools sort -@ 4&amp;lt;/code&amp;gt;), full 50x genome (787M read pairs, reads from project), one exclusive Zen 3 node of the &amp;lt;code&amp;gt;compute&amp;lt;/code&amp;gt; partition (EPYC 75F3), one run each:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Sort temporary files and BAM !! Wall time !! Compared to &amp;lt;code&amp;gt;$TMPDIR&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;$TMPDIR&amp;lt;/code&amp;gt; (local NVMe) || 4 h 39 min || &lt;br /&gt;
|-&lt;br /&gt;
| work (NVMe) || 4 h 48 min || +3 %&lt;br /&gt;
|-&lt;br /&gt;
| project (HDD) || 4 h 59 min || +7 %&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Copying the finished 106 GB BAM from &amp;lt;code&amp;gt;$TMPDIR&amp;lt;/code&amp;gt; takes about 1 to 2 minutes:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Destination !! Default layout (1 stripe) !! &amp;lt;code&amp;gt;lfs setstripe -c 4&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| project (HDD) || 78 to 120 s (0.9 to 1.4 GB/s) || 55 to 57 s (1.9 GB/s)&lt;br /&gt;
|-&lt;br /&gt;
| work (NVMe) || 59 s (1.8 GB/s) || 53 s (2.0 GB/s)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Reads and index:&amp;#039;&amp;#039;&amp;#039; read them directly from project.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Intermediate files (unsorted BAM, sort temporary files):&amp;#039;&amp;#039;&amp;#039; for small samples in &amp;lt;code&amp;gt;$TMPDIR&amp;lt;/code&amp;gt;, the fastest choice. For large samples in the workspace: the node-local disk holds about 450 GB and is shared by all jobs on the node, up to four jobs with 32 CPUs each, and Slurm does not reserve space per job. If several large jobs land on one node, they can fill the disk and fail hours into the run.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Final BAM:&amp;#039;&amp;#039;&amp;#039; in the workspace, as in the example job.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;When the analysis is done:&amp;#039;&amp;#039;&amp;#039; move the BAM files from the workspace to your project directory. Workspaces expire, and data in an expired workspace is deleted.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Why not project for the BAM and the intermediate files:&amp;#039;&amp;#039;&amp;#039; writing them directly to project costs about 7 % (20 minutes for a 50x genome).&lt;br /&gt;
&lt;br /&gt;
= Benchmark Data =&lt;br /&gt;
&lt;br /&gt;
The reference genome and the read files used for the measurements on this page are in &amp;lt;code&amp;gt;/pfs/10/project/benchmark_data&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data !! Path&lt;br /&gt;
|-&lt;br /&gt;
| Reference, GRCh38 no-alt analysis set || &amp;lt;code&amp;gt;/pfs/10/project/benchmark_data/reference_genomes/GRCh38_GIAB_references/GCA_000001405.15_GRCh38_no_alt_analysis_set.fasta.gz&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Reads, NA12878 full genome, about 50x (787M read pairs, 2 x 101 bp) || &amp;lt;code&amp;gt;/pfs/10/project/benchmark_data/wgs/giab_NA12878_truseq_30x/ERR194147/ERR194147_1.fastq.gz&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&amp;lt;code&amp;gt;/pfs/10/project/benchmark_data/wgs/giab_NA12878_truseq_30x/ERR194147/ERR194147_2.fastq.gz&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= Changes Compared to Earlier Builds =&lt;br /&gt;
&lt;br /&gt;
* The module no longer loads &amp;lt;code&amp;gt;compiler/gnu/14.2&amp;lt;/code&amp;gt;. Job scripts that relied on it being loaded must now load it themselves.&lt;br /&gt;
* References above 2 GiB now always get a large index (&amp;lt;code&amp;gt;.bt2l&amp;lt;/code&amp;gt;).&lt;/div&gt;</summary>
		<author><name>F Bartusch</name></author>
	</entry>
</feed>