| 1 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> |
| 2 |
<html xmlns="http://www.w3.org/1999/xhtml"> |
| 3 |
<head> |
| 4 |
<title>Bowtie: Tutorial</title> |
| 5 |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
| 6 |
<link rel="stylesheet" type="text/css" href="css/style.css" media="screen" /> |
| 7 |
<meta name="verify-v1" content="YJT1CfXN3kzE9cr+jvNB+Q73lTfHrv8eivoY+xjblc0=" /> |
| 8 |
</head> |
| 9 |
<body> |
| 10 |
<div id="wrap"> |
| 11 |
<!--#include virtual="top.ssi" --> |
| 12 |
<div id="main"> |
| 13 |
<!--#include virtual="rhsidebar.ssi" --> |
| 14 |
<div id="leftside"> |
| 15 |
<table><tr><td cellpadding=7> |
| 16 |
<h1> Getting started</h1><br/> |
| 17 |
<div id="toc"> |
| 18 |
<ul> |
| 19 |
<li><a href="#algn">Performing alignments</a></li> |
| 20 |
<li><a href="#preb">Installing a pre-built index</a></li> |
| 21 |
<li><a href="#newi">Building a new index</a></li> |
| 22 |
<li><a href="#sam">Finding variations with SAMtools</a></li> |
| 23 |
</ul><br/> |
| 24 |
</div> |
| 25 |
<p>Download and extract the appropriate |
| 26 |
<a href="https://sourceforge.net/project/showfiles.php?group_id=236897&package_id=288231"> |
| 27 |
Bowtie binary release</a> into a fresh directory. |
| 28 |
Change to that directory.</p> |
| 29 |
<br/> |
| 30 |
<h2 id="algn">Performing alignments</h2><br/> |
| 31 |
<p>The Bowtie source and binary packages come with a pre-built index |
| 32 |
of the <i>E. coli</i> genome, |
| 33 |
and a set of 1,000 35-bp reads simulated from that genome. To use |
| 34 |
Bowtie to align those reads, issue the following command. If you |
| 35 |
get an error message "command not found", try adding a <tt>./</tt> |
| 36 |
before the <tt>bowtie</tt>.</p> |
| 37 |
<br/> |
| 38 |
<blockquote>bowtie e_coli reads/e_coli_1000.fq</blockquote> |
| 39 |
<br/> |
| 40 |
<p> |
| 41 |
The first argument to <tt>bowtie</tt> is the basename of the index for the |
| 42 |
genome to be searched. The second argument is the name of a FASTQ file |
| 43 |
containing the reads. |
| 44 |
</p> |
| 45 |
<p> |
| 46 |
Depending on your computer, the run might take a few seconds up to |
| 47 |
about a minute. You will see bowtie print many lines of output. Each |
| 48 |
line is an alignment for a read. The name of the aligned read appears |
| 49 |
in the leftmost column. The final line should say <tt>Reported 699 |
| 50 |
alignments to 1 output stream(s)</tt> or something similar. |
| 51 |
</p> |
| 52 |
<p>Next, issue this command:</p> |
| 53 |
<br/> |
| 54 |
<blockquote>bowtie -t e_coli reads/e_coli_1000.fq e_coli.map</blockquote> |
| 55 |
<br/> |
| 56 |
<p>This run calculates the same alignments as the previous run, but the |
| 57 |
alignments are written to <tt>e_coli.map</tt> (the final argument) |
| 58 |
rather than to the screen. |
| 59 |
Also, the <tt>-t</tt> option |
| 60 |
instructs Bowtie to print timing statistics. The output should look something like this: |
| 61 |
</p> |
| 62 |
<br/> |
| 63 |
<blockquote> |
| 64 |
Time loading forward index: 00:00:00<br/> |
| 65 |
Time loading mirror index: 00:00:00<br/> |
| 66 |
Seeded quality full-index search: 00:00:00<br/> |
| 67 |
# reads processed: 1000<br/> |
| 68 |
# reads with at least one reported alignment: 699 (69.90%)<br/> |
| 69 |
# reads that failed to align: 301 (30.10%)<br/> |
| 70 |
Reported 699 alignments to 1 output stream(s)<br/> |
| 71 |
Time searching: 00:00:00<br/> |
| 72 |
Overall time: 00:00:00<br/> |
| 73 |
</blockquote> |
| 74 |
</p><br/> |
| 75 |
<h2 id="preb">Installing a pre-built index</h2><br/> |
| 76 |
<p>Download the pre-built <i>S. cerevisiae</i> genome package by |
| 77 |
right-clicking the "<i>S. cerevisiae</i>, CYGD" link in the |
| 78 |
"Pre-built indexes" section of the right-hand sidebar and |
| 79 |
selecting "Save Link As..." or "Save Target As...". All |
| 80 |
pre-built indexes are packaged as <tt>.zip</tt> archives, and |
| 81 |
the <i>S. cerevisiae</i> archive is named |
| 82 |
<tt>s_cerevisiae.ebwt.zip</tt>. When it has finished |
| 83 |
downloading, extract the archive into the Bowtie |
| 84 |
<tt>indexes</tt> subdirectory using your preferred unzip tool. |
| 85 |
The index is now installed.</p> |
| 86 |
<p>To test that the index is properly installed, issue this |
| 87 |
command from the Bowtie install directory:</p> |
| 88 |
<br/> |
| 89 |
<blockquote>bowtie -c s_cerevisiae ATTGTAGTTCGAGTAAGTAATGTGGGTTTG</blockquote> |
| 90 |
<br/> |
| 91 |
<p>This command searches the <i>S. cerevisiae</i> index with a |
| 92 |
single read. The <tt>-c</tt> argument instructs Bowtie to |
| 93 |
obtain read sequences directly from the command line rather |
| 94 |
than from a file. If the index is installed properly, this |
| 95 |
command should print a single alignment and then exit.</p> |
| 96 |
<p>If you would rather install pre-built indexes somewhere other |
| 97 |
than the <tt>indexes</tt> subdirectory of the Bowtie install |
| 98 |
directory, simply set the <tt>BOWTIE_INDEXES</tt> environment |
| 99 |
variable to point to your preferred directory and extract |
| 100 |
indexes there instead.</p> |
| 101 |
<br/> |
| 102 |
<h2 id="newi">Building a new index</h2><br/> |
| 103 |
<p>The pre-built <i>E. coli</i> index included with Bowtie is built |
| 104 |
from the sequence |
| 105 |
for strain 536, known to cause urinary tract infections. We will |
| 106 |
create a new index from the sequence |
| 107 |
of <i>E. coli</i> strain O157:H7, a strain known to cause food poisoning. |
| 108 |
Download the |
| 109 |
<a href="ftp://ftp.ncbi.nlm.nih.gov/genomes/Bacteria/Escherichia_coli_O157_H7_Sakai_uid57781/NC_002127.fna">sequence file by right-clicking this link</a> |
| 110 |
and selecting "Save Link As..." or "Save Target As...". The |
| 111 |
sequence file is named <tt>NC_002127.fna</tt>. When the |
| 112 |
sequence file is finished downloading, move it to the Bowtie |
| 113 |
install directory and issue this command:</p> |
| 114 |
<br/> |
| 115 |
<blockquote>bowtie-build NC_002127.fna e_coli_O157_H7</blockquote> |
| 116 |
<br/> |
| 117 |
<p>The command should finish quickly, and print several lines of status messages. |
| 118 |
When the command has completed, note that the current directory |
| 119 |
contains four new files named <tt>e_coli_O157_H7.1.ebwt</tt>, |
| 120 |
<tt>e_coli_O157_H7.2.ebwt</tt>, |
| 121 |
<tt>e_coli_O157_H7.rev.1.ebwt</tt>, and |
| 122 |
<tt>e_coli_O157_H7.rev.2.ebwt</tt>. These files constitute |
| 123 |
the index. Move these files to the <tt>indexes</tt> |
| 124 |
subdirectory to install it. |
| 125 |
<p>To test that the index is properly installed, issue this |
| 126 |
command:</p> |
| 127 |
<br/> |
| 128 |
<blockquote>bowtie -c e_coli_O157_H7 GCGTGAGCTATGAGAAAGCGCCACGCTTCC</blockquote> |
| 129 |
<br/> |
| 130 |
<p>If the index is installed properly, this |
| 131 |
command should print a single alignment and then exit.</p> |
| 132 |
<br/> |
| 133 |
|
| 134 |
<h2 id="sam">Finding variations with SAMtools</h2><br/> |
| 135 |
<p><a href="http://samtools.sf.net">SAMtools</a> is a suite of tools for storing, |
| 136 |
manipulating, and analyzing alignments such as those output by Bowtie. |
| 137 |
SAMtools understands alignments in either of two complementary |
| 138 |
formats: the human-readable SAM format, or the binary BAM format. |
| 139 |
Because Bowtie can output SAM (using the <tt>-S/--sam</tt> option), and SAM can |
| 140 |
can be converted to BAM using SAMtools, Bowtie users can make full use |
| 141 |
of the analyses implemented in SAMtools, or in any other tools |
| 142 |
supporting SAM or BAM. |
| 143 |
</p> |
| 144 |
<p> |
| 145 |
We will use SAMtools to find SNPs in a set of simulated reads included |
| 146 |
with Bowtie. The reads cover the first 10,000 bases of the pre-built |
| 147 |
E. coli genome and contain 10 SNPs throughout. First, we run <tt>bowtie</tt> |
| 148 |
to align the reads, being sure to specify the <tt>-S</tt> option. We also |
| 149 |
specify an output file that we will use as input for the next step |
| 150 |
(though pipes can be used to accomplish the same thing without the |
| 151 |
intermediate file): |
| 152 |
</p> |
| 153 |
<br/> |
| 154 |
<blockquote> |
| 155 |
bowtie -S e_coli reads/e_coli_10000snp.fq ec_snp.sam |
| 156 |
</blockquote> |
| 157 |
<br/> |
| 158 |
<p> |
| 159 |
Next, we convert the SAM file to BAM in preparation for sorting. We |
| 160 |
assume that SAMtools is installed and that the samtools binary is |
| 161 |
accessible in the PATH. |
| 162 |
</p> |
| 163 |
<br/> |
| 164 |
<blockquote> |
| 165 |
samtools view -bS -o ec_snp.bam ec_snp.sam |
| 166 |
</blockquote> |
| 167 |
<br/> |
| 168 |
<p> |
| 169 |
Next, we sort the BAM file, in preparation for SNP calling: |
| 170 |
</p> |
| 171 |
<br/> |
| 172 |
<blockquote> |
| 173 |
samtools sort ec_snp.bam ec_snp.sorted |
| 174 |
</blockquote> |
| 175 |
<br/> |
| 176 |
<p> |
| 177 |
We now have a sorted BAM file called <tt>ec_snp.sorted.bam</tt>. Sorted BAM is |
| 178 |
a useful format because the alignments are both compressed, which is |
| 179 |
convenient for long-term storage, and sorted, which is conveneint for |
| 180 |
variant discovery. Finally, we call variants from the Sorted BAM: |
| 181 |
</p> |
| 182 |
<br/> |
| 183 |
<blockquote> |
| 184 |
samtools pileup -cv -f genomes/NC_008253.fna ec_snp.sorted.bam |
| 185 |
</blockquote> |
| 186 |
<br/> |
| 187 |
<p> |
| 188 |
For this sample data, the <tt>samtools pileup</tt> command should print |
| 189 |
records for 10 distinct SNPs, the first being at position 541 in the |
| 190 |
reference. |
| 191 |
</p> |
| 192 |
<p> |
| 193 |
See the <a href="http://samtools.sf.net/">SAMtools web site</a> for details |
| 194 |
on how to use these and other |
| 195 |
tools in the SAMtools suite. |
| 196 |
</p> |
| 197 |
</td></tr></table> |
| 198 |
</div> |
| 199 |
</div> |
| 200 |
<!--#include virtual="foot.ssi" --> |
| 201 |
</div> |
| 202 |
|
| 203 |
<!-- Google analytics code --> |
| 204 |
<script type="text/javascript"> |
| 205 |
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); |
| 206 |
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); |
| 207 |
</script> |
| 208 |
<script type="text/javascript"> |
| 209 |
var pageTracker = _gat._getTracker("UA-5334290-1"); |
| 210 |
pageTracker._trackPageview(); |
| 211 |
</script> |
| 212 |
<!-- End google analytics code --> |
| 213 |
|
| 214 |
</body> |
| 215 |
</html> |