Site Map
News and updates
New releases and related tools will be announced through the Bowtie mailing list. |
Getting Help
Please email Daehwan Kim for questions. |
Releases
version 0.1.6-beta | 4/17/2015 |
Source code | |
Linux x86_64 binary | |
Mac OS X x86_64 binary |
Indexes
H. sapiens, UCSC hg19 | 7.0 GB |
M. musculus, UCSC mm10 | 6.4 GB |
The current version of HISAT does not use some of the files in the index, so the actual memory requirement is much lower than the index size. For example, the memory footprint of HISAT for the human genome is about 4.3GB.
Related Tools
Publications
Kim D, Langmead B and Salzberg SL. HISAT: a fast spliced aligner with low memory requirements. Nature Methods 2015
Contributors
- Daehwan Kim
- Ben Langmead
- Geo Pertea
- Steven Salzberg
Links
Table of Contents
Introduction
What is HISAT?
HISAT is a fast and sensitive spliced alignment program. As part of HISAT, we have developed a new indexing scheme based on the Burrows-Wheeler transform (BWT) and the FM index, called hierarchical indexing, that employs two types of indexes: (1) one global FM index representing the whole genome, and (2) many separate local FM indexes for small regions collectively covering the genome. Our hierarchical index for the human genome (about 3 billion bp) includes ~48,000 local FM indexes, each representing a genomic region of ~64,000bp. As the basis for non-gapped alignment, the FM index is extremely fast with a low memory footprint, as demonstrated by Bowtie. In addition, HISAT provides several alignment strategies specifically designed for mapping different types of RNA-seq reads. All these together, HISAT enables extremely fast and sensitive alignment of reads, in particular those spanning two exons or more. As a result, HISAT is much faster >50 times than TopHat2 with better alignment quality. Although it uses a large number of indexes, the memory requirement of HISAT is still modest, approximately 4.3 GB for human. HISAT uses the Bowtie2 implementation to handle most of the operations on the FM index. In addition to spliced alignment, HISAT handles reads involving indels and supports a paired-end alignment mode. Multiple processors can be used simultaneously to achieve greater alignment speed. HISAT outputs alignments in SAM format, enabling interoperation with a large number of other tools (e.g. SAMtools, GATK) that use SAM. HISAT is distributed under the GPLv3 license, and it runs on the command line under Linux, Mac OS X and Windows.
Obtaining HISAT
Download HISAT sources and binaries from the Releases sections on the right side. Binaries are available for Intel architectures (x86_64
) running Linux, and Mac OS X.
Building from source
Building HISAT from source requires a GNU-like environment with GCC, GNU Make and other basics. It should be possible to build HISAT on most vanilla Linux installations or on a Mac installation with Xcode installed. HISAT can also be built on Windows using Cygwin or MinGW (MinGW recommended). For a MinGW build the choice of what compiler is to be used is important since this will determine if a 32 or 64 bit code can be successfully compiled using it. If there is a need to generate both 32 and 64 bit on the same machine then a multilib MinGW has to be properly installed. MSYS, the zlib library, and depending on architecture pthreads library are also required. We are recommending a 64 bit build since it has some clear advantages in real life research problems. In order to simplify the MinGW setup it might be worth investigating popular MinGW personal builds since these are coming already prepared with most of the toolchains needed.
First, download the source package from the Releases secion on the right side. Unzip the file, change to the unzipped directory, and build the HISAT tools by running GNU make
(usually with the command make
, but sometimes with gmake
) with no arguments. If building with MinGW, run make
from the MSYS environment.
HISAT is using the multithreading software model in order to speed up execution times on SMP architectures where this is possible. On POSIX platforms (like linux, Mac OS, etc) it needs the pthread library. Although it is possible to use pthread library on non-POSIX platform like Windows, due to performance reasons HISAT will try to use Windows native multithreading if possible.
For the support of SRA data access in HISAT, please download and install the NCBI-NGS toolkit. When running make
, specify additional variables as follow. make USE_SRA=1 NCBI_NGS_DIR=/path/to/NCBI-NGS-directory NCBI_VDB_DIR=/path/to/NCBI-NGS-directory
, where NCBI_NGS_DIR
and NCBI_VDB_DIR
will be used in Makefile for -I and -L compilation options. For example, $(NCBI_NGS_DIR)/include and $(NCBI_NGS_DIR)/lib64 will be used.
Running HISAT
Adding to PATH
By adding your new HISAT directory to your PATH environment variable, you ensure that whenever you run hisat
, hisat-build
or hisat-inspect
from the command line, you will get the version you just installed without having to specify the entire path. This is recommended for most users. To do this, follow your operating system's instructions for adding the directory to your PATH.
If you would like to install HISAT by copying the HISAT executable files to an existing directory in your PATH, make sure that you copy all the executables, including hisat
, hisat-align-s
, hisat-align-l
, hisat-build
, hisat-build-s
, hisat-build-l
, hisat-inspect
, hisat-inspect-s
and hisat-inspect-l
.
Reporting
The reporting mode governs how many alignments HISAT looks for, and how to report them.
In general, when we say that a read has an alignment, we mean that it has a valid alignment. When we say that a read has multiple alignments, we mean that it has multiple alignments that are valid and distinct from one another.
Distinct alignments map a read to different places
Two alignments for the same individual read are "distinct" if they map the same read to different places. Specifically, we say that two alignments are distinct if there are no alignment positions where a particular read offset is aligned opposite a particular reference offset in both alignments with the same orientation. E.g. if the first alignment is in the forward orientation and aligns the read character at read offset 10 to the reference character at chromosome 3, offset 3,445,245, and the second alignment is also in the forward orientation and also aligns the read character at read offset 10 to the reference character at chromosome 3, offset 3,445,245, they are not distinct alignments.
Two alignments for the same pair are distinct if either the mate 1s in the two paired-end alignments are distinct or the mate 2s in the two alignments are distinct or both.
Default mode: search for one or more alignments, report each
HISAT searches for up to N distinct, primary alignments for each read, where N equals the integer specified with the -k
parameter. Primary alignments mean alignments whose alignment score is equal or higher than any other alignments. It is possible that multiple distinct alignments whave the same score. That is, if -k 2
is specified, HISAT will search for at most 2 distinct alignments. The alignment score for a paired-end alignment equals the sum of the alignment scores of the individual mates. Each reported read or pair alignment beyond the first has the SAM 'secondary' bit (which equals 256) set in its FLAGS field. See the SAM specification for details.
HISAT does not "find" alignments in any specific order, so for reads that have more than N distinct, valid alignments, HISAT does not gaurantee that the N alignments reported are the best possible in terms of alignment score. Still, this mode can be effective and fast in situations where the user cares more about whether a read aligns (or aligns a certain number of times) than where exactly it originated.
Alignment summmary
When HISAT finishes running, it prints messages summarizing what happened. These messages are printed to the "standard error" ("stderr") filehandle. For datasets consisting of unpaired reads, the summary might look like this:
20000 reads; of these:
20000 (100.00%) were unpaired; of these:
1247 (6.24%) aligned 0 times
18739 (93.69%) aligned exactly 1 time
14 (0.07%) aligned >1 times
93.77% overall alignment rate
For datasets consisting of pairs, the summary might look like this:
10000 reads; of these:
10000 (100.00%) were paired; of these:
650 (6.50%) aligned concordantly 0 times
8823 (88.23%) aligned concordantly exactly 1 time
527 (5.27%) aligned concordantly >1 times
----
650 pairs aligned concordantly 0 times; of these:
34 (5.23%) aligned discordantly 1 time
----
616 pairs aligned 0 times concordantly or discordantly; of these:
1232 mates make up the pairs; of these:
660 (53.57%) aligned 0 times
571 (46.35%) aligned exactly 1 time
1 (0.08%) aligned >1 times
96.70% overall alignment rate
The indentation indicates how subtotals relate to totals.
Wrapper
The hisat
, hisat-build
and hisat-inspect
executables are actually wrapper scripts that call binary programs as appropriate. The wrappers shield users from having to distinguish between "small" and "large" index formats, discussed briefly in the following section. Also, the hisat
wrapper provides some key functionality, like the ability to handle compressed inputs, and the fucntionality for --un
, --al
and related options.
It is recommended that you always run the hisat wrappers and not run the binaries directly.
Small and large indexes
hisat-build
can index reference genomes of any size. For genomes less than about 4 billion nucleotides in length, hisat-build
builds a "small" index using 32-bit numbers in various parts of the index. When the genome is longer, hisat-build
builds a "large" index using 64-bit numbers. Small indexes are stored in files with the .bt2
extension, and large indexes are stored in files with the .bt2l
extension. The user need not worry about whether a particular index is small or large; the wrapper scripts will automatically build and use the appropriate index.
Performance tuning
If your computer has multiple processors/cores, use
-p
The
-p
option causes HISAT to launch a specified number of parallel search threads. Each thread runs on a different processor/core and all threads find alignments in parallel, increasing alignment throughput by approximately a multiple of the number of threads (though in practice, speedup is somewhat worse than linear).
Command Line
Setting function options
Some HISAT options specify a function rather than an individual number or setting. In these cases the user specifies three parameters: (a) a function type F
, (b) a constant term B
, and (c) a coefficient A
. The available function types are constant (C
), linear (L
), square-root (S
), and natural log (G
). The parameters are specified as F,B,A
- that is, the function type, the constant term, and the coefficient are separated by commas with no whitespace. The constant term and coefficient may be negative and/or floating-point numbers.
For example, if the function specification is L,-0.4,-0.6
, then the function defined is:
f(x) = -0.4 + -0.6 * x
If the function specification is G,1,5.4
, then the function defined is:
f(x) = 1.0 + 5.4 * ln(x)
See the documentation for the option in question to learn what the parameter x
is for. For example, in the case if the --score-min
option, the function f(x)
sets the minimum alignment score necessary for an alignment to be considered valid, and x
is the read length.
Usage
hisat [options]* -x <hisat-idx> {-1 <m1> -2 <m2> | -U <r> | --sra-acc <SRA accession number>} [-S <hit>]
Main arguments
|
The basename of the index for the reference genome. The basename is the name of any of the index files up to but not including the final |
|
Comma-separated list of files containing mate 1s (filename usually includes |
|
Comma-separated list of files containing mate 2s (filename usually includes |
|
Comma-separated list of files containing unpaired reads to be aligned, e.g. |
|
Comma-separated list of SRA accession numbers, e.g. |
|
File to write SAM alignments to. By default, alignments are written to the "standard out" or "stdout" filehandle (i.e. the console). |
Options
Input options
|
Reads (specified with |
|
Reads (specified with |
|
Reads (specified with |
|
Reads (specified with |
|
The read sequences are given on command line. I.e. |
|
Skip (i.e. do not align) the first |
|
Align the first |
|
Trim |
|
Trim |
|
Input qualities are ASCII chars equal to the Phred quality plus 33. This is also called the "Phred+33" encoding, which is used by the very latest Illumina pipelines. |
|
Input qualities are ASCII chars equal to the Phred quality plus 64. This is also called the "Phred+64" encoding. |
|
Convert input qualities from Solexa (which can be negative) to Phred (which can't). This scheme was used in older Illumina GA Pipeline versions (prior to 1.3). Default: off. |
|
Quality values are represented in the read input file as space-separated ASCII integers, e.g., |
Alignment options
|
Sets a function governing the maximum number of ambiguous characters (usually |
|
When calculating a mismatch penalty, always consider the quality value at the mismatched position to be the highest possible, regardless of the actual value. I.e. input is treated as though all quality values are high. This is also the default behavior when the input doesn't specify quality values (e.g. in |
|
If |
Scoring options
|
Sets the match bonus. In [ |
|
Sets the maximum ( |
|
Sets penalty for positions where the read, reference, or both, contain an ambiguous character such as |
|
Sets the read gap open ( |
|
Sets the reference gap open ( |
|
Sets a function governing the minimum alignment score needed for an alignment to be considered "valid" (i.e. good enough to report). This is a function of read length. For instance, specifying |
Spliced alignment options
|
Sets the penalty for each pair of canonical splice sites (e.g. GT/AG). Default: 0. |
|
Sets the penalty for each pair of non-canonical splice sites (e.g. non-GT/AG). Default: 3. |
|
Sets the penalty for long introns so that alignments with shorter introns are preferred to those with longer ones. Default: G,-8,1 |
|
Sets minimum intron length. Default: 20 |
|
Sets maximum intron length. Default: 500000 |
|
With this mode, you can provide a list of known splice sites, which HISAT makes use of to align reads with small anchors. |
|
In this mode, HISAT reports a list of splice sites in the file |
|
With this mode, you can provide a list of novel splice sites that were generated from the above option "--novel-splicesite-outfile". |
|
HISAT, by default, makes use of splice sites found by earlier reads to align later reads in the same run, in particular, reads with small anchors (<= 15 bp). |
|
Disable spliced alignment. |
|
Specify strand-specific information: the default is unstranded. (TopHat has a similar option, --library-type option, where fr-firststrand corresponds to R and RF; fr-secondstrand corresponds to F and FR.) |
Reporting options
|
It searches for at most Note: HISAT is not designed with large values for |
Paired-end options
|
The minimum fragment length for valid paired-end alignments. E.g. if The larger the difference between Default: 0 (essentially imposing no minimum) |
|
The maximum fragment length for valid paired-end alignments. E.g. if The larger the difference between Default: 500. |
|
The upstream/downstream mate orientations for a valid paired-end alignment against the forward reference strand. E.g., if |
|
By default, when |
|
By default, |
|
If the mates "dovetail", that is if one mate alignment extends past the beginning of the other such that the wrong mate begins upstream, consider that to be concordant. See also: Mates can overlap, contain or dovetail each other. Default: mates cannot dovetail in a concordant alignment. |
|
If one mate alignment contains the other, consider that to be non-concordant. See also: Mates can overlap, contain or dovetail each other. Default: a mate can contain the other in a concordant alignment. |
|
If one mate alignment overlaps the other at all, consider that to be non-concordant. See also: Mates can overlap, contain or dovetail each other. Default: mates can overlap in a concordant alignment. |
Output options
|
Print the wall-clock time required to load the index files and align the reads. This is printed to the "standard error" ("stderr") filehandle. Default: off. |
|
Write unpaired reads that fail to align to file at |
|
Write unpaired reads that align at least once to file at |
|
Write paired-end reads that fail to align concordantly to file(s) at |
|
Write paired-end reads that align concordantly at least once to file(s) at |
|
Print nothing besides alignments and serious errors. |
|
Write |
|
Write |
|
Write a new |
SAM options
|
Suppress SAM records for reads that failed to align. |
|
Suppress SAM header lines (starting with |
|
Suppress |
|
Set the read group ID to |
|
Add |
|
When printing secondary alignments, HISAT by default will write out the |
Performance options
|
Override the offrate of the index with |
|
Launch |
|
Guarantees that output SAM records are printed in an order corresponding to the order of the reads in the original input file, even when |
|
Use memory-mapped I/O to load the index, rather than typical file I/O. Memory-mapping allows many concurrent |
Other options
|
Filter out reads for which the QSEQ filter field is non-zero. Only has an effect when read format is |
|
Use |
|
Normally, HISAT re-initializes its pseudo-random generator for each read. It seeds the generator with a number derived from (a) the read name, (b) the nucleotide sequence, (c) the quality sequence, (d) the value of the |
|
Print version information and quit. |
|
Print usage information and quit. |
SAM output
Following is a brief description of the SAM format as output by hisat
. For more details, see the SAM format specification.
By default, hisat
prints a SAM header with @HD
, @SQ
and @PG
lines. When one or more --rg
arguments are specified, hisat
will also print an @RG
line that includes all user-specified --rg
tokens separated by tabs.
Each subsequnt line describes an alignment or, if the read failed to align, a read. Each line is a collection of at least 12 fields separated by tabs; from left to right, the fields are:
Name of read that aligned.
Note that the SAM specification disallows whitespace in the read name. If the read name contains any whitespace characters, HISAT will truncate the name at the first whitespace character. This is similar to the behavior of other tools.
Sum of all applicable flags. Flags relevant to HISAT are:
1
The read is one of a pair
2
The alignment is one end of a proper paired-end alignment
4
The read has no reported alignments
8
The read is one of a pair and has no reported alignments
16
The alignment is to the reverse reference strand
32
The other mate in the paired-end alignment is aligned to the reverse reference strand
64
The read is mate 1 in a pair
128
The read is mate 2 in a pair
Thus, an unpaired read that aligns to the reverse reference strand will have flag 16. A paired-end read that aligns and is the first mate in the pair will have flag 83 (= 64 + 16 + 2 + 1).
Name of reference sequence where alignment occurs
1-based offset into the forward reference strand where leftmost character of the alignment occurs
Mapping quality
CIGAR string representation of alignment
Name of reference sequence where mate's alignment occurs. Set to
=
if the mate's reference sequence is the same as this alignment's, or*
if there is no mate.1-based offset into the forward reference strand where leftmost character of the mate's alignment occurs. Offset is 0 if there is no mate.
Inferred fragment length. Size is negative if the mate's alignment occurs upstream of this alignment. Size is 0 if the mates did not align concordantly. However, size is non-0 if the mates aligned discordantly to the same chromosome.
Read sequence (reverse-complemented if aligned to the reverse strand)
ASCII-encoded read qualities (reverse-complemented if the read aligned to the reverse strand). The encoded quality values are on the Phred quality scale and the encoding is ASCII-offset by 33 (ASCII char
!
), similarly to a FASTQ file.Optional fields. Fields are tab-separated.
hisat
outputs zero or more of these optional fields for each alignment, depending on the type of the alignment:AS:i:<N>
Alignment score. Can be negative. Can be greater than 0 in [
--local
] mode (but not in [--end-to-end
] mode). Only present if SAM record is for an aligned read.YS:i:<N>
Alignment score for opposite mate in the paired-end alignment. Only present if the SAM record is for a read that aligned as part of a paired-end alignment.
XN:i:<N>
The number of ambiguous bases in the reference covering this alignment. Only present if SAM record is for an aligned read.
XM:i:<N>
The number of mismatches in the alignment. Only present if SAM record is for an aligned read.
XO:i:<N>
The number of gap opens, for both read and reference gaps, in the alignment. Only present if SAM record is for an aligned read.
XG:i:<N>
The number of gap extensions, for both read and reference gaps, in the alignment. Only present if SAM record is for an aligned read.
NM:i:<N>
The edit distance; that is, the minimal number of one-nucleotide edits (substitutions, insertions and deletions) needed to transform the read string into the reference string. Only present if SAM record is for an aligned read.
YF:Z:<S>
String indicating reason why the read was filtered out. See also: [Filtering]. Only appears for reads that were filtered out.
YT:Z:<S>
Value of
UU
indicates the read was not part of a pair. Value ofCP
indicates the read was part of a pair and the pair aligned concordantly. Value ofDP
indicates the read was part of a pair and the pair aligned discordantly. Value ofUP
indicates the read was part of a pair but the pair failed to aligned either concordantly or discordantly.MD:Z:<S>
A string representation of the mismatched reference bases in the alignment. See SAM format specification for details. Only present if SAM record is for an aligned read.
XS:A:<A>
Values of
+
and-
indicate the read is mapped to transcripts on sense and anti-sense strands, respectively. Spliced alignments need to have this field, which is required in Cufflinks and StringTie.
We can report this field for the canonical-splice site (GT/AG), but not for non-canonical splice sites. You can direct HISAT not to output such alignments (involving non-canonical splice sites) using "--pen-noncansplice 1000000".NH:i:<N>
The number of mapped locations for the read or the pair.
The hisat-build
indexer
hisat-build
builds a HISAT index from a set of DNA sequences. hisat-build
outputs a set of 6 files with suffixes .1.bt2
, .2.bt2
, .3.bt2
, .4.bt2
, .rev.1.bt2
, and .rev.2.bt2
. In the case of a large index these suffixes will have a bt2l
termination. These files together constitute the index: they are all that is needed to align reads to that reference. The original sequence FASTA files are no longer used by HISAT once the index is built.
Use of Karkkainen's blockwise algorithm allows hisat-build
to trade off between running time and memory usage. hisat-build
has three options governing how it makes this trade: -p
/--packed
, --bmax
/--bmaxdivn
, and --dcv
. By default, hisat-build
will automatically search for the settings that yield the best running time without exhausting memory. This behavior can be disabled using the -a
/--noauto
option.
The indexer provides options pertaining to the "shape" of the index, e.g. --offrate
governs the fraction of Burrows-Wheeler rows that are "marked" (i.e., the density of the suffix-array sample; see the original FM Index paper for details). All of these options are potentially profitable trade-offs depending on the application. They have been set to defaults that are reasonable for most cases according to our experiments. See Performance tuning for details.
hisat-build
can generate either small or large indexes. The wrapper will decide which based on the length of the input genome. If the reference does not exceed 4 billion characters but a large index is preferred, the user can specify --large-index
to force hisat-build
to build a large index instead.
The HISAT index is based on the FM Index of Ferragina and Manzini, which in turn is based on the Burrows-Wheeler transform. The algorithm used to build the index is based on the blockwise algorithm of Karkkainen.
Command Line
Usage:
hisat-build [options]* <reference_in> <bt2_base>
Main arguments
|
A comma-separated list of FASTA files containing the reference sequences to be aligned to, or, if |
|
The basename of the index files to write. By default, |
Options
|
The reference input files (specified as |
|
The reference sequences are given on the command line. I.e. |
|
Force |
|
Disable the default behavior whereby |
|
Use a packed (2-bits-per-nucleotide) representation for DNA strings. This saves memory but makes indexing 2-3 times slower. Default: off. This is configured automatically by default; use |
|
The maximum number of suffixes allowed in a block. Allowing more suffixes per block makes indexing faster, but increases peak memory usage. Setting this option overrides any previous setting for |
|
The maximum number of suffixes allowed in a block, expressed as a fraction of the length of the reference. Setting this option overrides any previous setting for |
|
Use |
|
Disable use of the difference-cover sample. Suffix sorting becomes quadratic-time in the worst case (where the worst case is an extremely repetitive reference). Default: off. |
|
Do not build the |
|
Build only the |
|
To map alignments back to positions on the reference sequences, it's necessary to annotate ("mark") some or all of the Burrows-Wheeler rows with their corresponding location on the genome. |
|
The ftab is the lookup table used to calculate an initial Burrows-Wheeler range with respect to the first |
|
This option governs how many rows get marked in a local index: the indexer will mark every 2^ |
|
The local ftab is the lookup table in a local index. The default setting is 6 (ftab is 8KB per local index). |
|
Use |
|
Index only the first |
|
|
|
Print usage information and quit. |
|
Print version information and quit. |
The hisat-inspect
index inspector
hisat-inspect
extracts information from a HISAT index about what kind of index it is and what reference sequences were used to build it. When run without any options, the tool will output a FASTA file containing the sequences of the original references (with all non-A
/C
/G
/T
characters converted to N
s). It can also be used to extract just the reference sequence names using the -n
/--names
option or a more verbose summary using the -s
/--summary
option.
Command Line
Usage:
hisat-inspect [options]* <bt2_base>
Main arguments
|
The basename of the index to be inspected. The basename is name of any of the index files but with the |
Options
|
When printing FASTA output, output a newline character every |
|
Print reference sequence names, one per line, and quit. |
|
Print a summary that includes information about index settings, as well as the names and lengths of the input sequences. The summary has this format:
Fields are separated by tabs. Colorspace is always set to 0 for HISAT. |
|
Print verbose output (for debugging). |
|
Print version information and quit. |
|
Print usage information and quit. |
Getting started with HISAT
HISAT comes with some example files to get you started. The example files are not scientifically significant; these files will simply let you start running HISAT and downstream tools right away.
First follow the manual instructions to obtain HISAT. Set the HISAT_HOME
environment variable to point to the new HISAT directory containing the hisat
, hisat-build
and hisat-inspect
binaries. This is important, as the HISAT_HOME
variable is used in the commands below to refer to that directory.
Indexing a reference genome
To create an index for the genomic region (1 million bps from the human chromosome 22 between 20,000,000 and 20,999,999) included with HISAT, create a new temporary directory (it doesn't matter where), change into that directory, and run:
$HISAT_HOME/hisat-build $HISAT_HOME/example/reference/22_20-21M.fa 22_20-21M_hisat
The command should print many lines of output then quit. When the command completes, the current directory will contain ten new files that all start with 22_20-21M_hisat
and end with .1.bt2
, .2.bt2
, .3.bt2
, .4.bt2
, .5.bt2
, .6.bt2
, .rev.1.bt2
, .rev.2.bt2
, .rev.5.bt2
, and .rev.6.bt2
. These files constitute the index - you're done!
You can use hisat-build
to create an index for a set of FASTA files obtained from any source, including sites such as UCSC, NCBI, and Ensembl. When indexing multiple FASTA files, specify all the files using commas to separate file names. For more details on how to create an index with hisat-build
, see the manual section on index building. You may also want to bypass this process by obtaining a pre-built index.
Aligning example reads
Stay in the directory created in the previous step, which now contains the 22_20-21M_hisat
index files. Next, run:
$HISAT_HOME/hisat -x 22_20-21M_hisat -U $HISAT_HOME/example/reads/reads_1.fq -S eg1.sam
This runs the HISAT aligner, which aligns a set of unpaired reads to the the genome region using the index generated in the previous step. The alignment results in SAM format are written to the file eg1.sam
, and a short alignment summary is written to the console. (Actually, the summary is written to the "standard error" or "stderr" filehandle, which is typically printed to the console.)
To see the first few lines of the SAM output, run:
head eg1.sam
You will see something like this:
@HD VN:1.0 SO:unsorted
@SQ SN:22:20000000-20999999 LN:1000000
@PG ID:hisat PN:hisat VN:0.1.0
1 0 22:20000000-20999999 4115 255 100M * 0 0 GGAGCGCAGCGTGGGCGGCCCCGCAGCGCGGCCTCGGACCCCAGAAGGGCTTCCCCGGGTCCGTTGGCGCGCGGGGAGCGGCGTTCCCAGGGCGCGGCGC IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII AS:i:0 XN:i:0 XM:i:0 XO:i:0 XG:i:0 NM:i:0 MD:Z:100 YT:Z:UU
2 16 22:20000000-20999999 4197 255 100M * 0 0 GTTCCCAGGGCGCGGCGCGGTGCGGCGCGGCGCGGGTCGCAGTCCACGCGGCCGCAACTCGGACCGGTGCGGGGGCCGCCCCCTCCCTCCAGGCCCAGCG IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII AS:i:0 XN:i:0 XM:i:0 XO:i:0 XG:i:0 NM:i:0 MD:Z:100 YT:Z:UU
3 0 22:20000000-20999999 4113 255 100M * 0 0 CTGGAGCGCAGCGTGGGCGGCCCCGCAGCGCGGCCTCGGACCCCAGAAGGGCTTCCCCGGGTCCGTTGGCGCGCGGGGAGCGGCGTTCCCAGGGCGCGGC IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII AS:i:0 XN:i:0 XM:i:0 XO:i:0 XG:i:0 NM:i:0 MD:Z:100 YT:Z:UU
4 0 22:20000000-20999999 52358 255 100M * 0 0 TTCAGGGTCTGCCTTTATGCCAGTGAGGAGCAGCAGAGTCTGATACTAGGTCTAGGACCGGCCGAGGTATACCATGAACATGTGGATACACCTGAGCCCA IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII AS:i:0 XN:i:0 XM:i:0 XO:i:0 XG:i:0 NM:i:0 MD:Z:100 YT:Z:UU
5 16 22:20000000-20999999 52680 255 100M * 0 0 CTTCTGGCCAGTAGGTCTTTGTTCTGGTCCAACGACAGGAGTAGGCTTGTATTTAAAAGCGGCCCCTCCTCTCCTGTGGCCACAGAACACAGGCGTGCTT IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII AS:i:0 XN:i:0 XM:i:0 XO:i:0 XG:i:0 NM:i:0 MD:Z:100 YT:Z:UU
6 16 22:20000000-20999999 52664 255 100M * 0 0 TCTCACCTCTCATGTGCTTCTGGCCAGTAGGTCTTTGTTCTGGTCCAACGACAGGAGTAGGCTTGTATTTAAAAGCGGCCCCTCCTCTCCTGTGGCCACA IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII AS:i:0 XN:i:0 XM:i:0 XO:i:0 XG:i:0 NM:i:0 MD:Z:100 YT:Z:UU
7 0 22:20000000-20999999 52468 255 100M * 0 0 TGTACACAGGCACTCACATGGCACACACATACACTCCTGCGTGTGCACAAGCACACACATGCAAGCCATATACATGGACACCGACACAGGCACATGTACG IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII AS:i:0 XN:i:0 XM:i:0 XO:i:0 XG:i:0 NM:i:0 MD:Z:100 YT:Z:UU
8 0 22:20000000-20999999 4538 255 100M * 0 0 CGGCCCCGCACCTGCCCGAACCTCTGCGGCGGCGGTGGCAGGGTACGCGGGACCGCTCCCTCCCAGCCGACTTACGAGAACATCCCCCGACCATCCAGCC IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII AS:i:0 XN:i:0 XM:i:0 XO:i:0 XG:i:0 NM:i:0 MD:Z:100 YT:Z:UU
9 16 22:20000000-20999999 4667 255 50M19567N50M * 0 0 CTTCCCCGGACTCTGGCCGCGTAGCCTCCGCCACCACTCCCAGTTCACAGACCTCGCGACCTGTGTCAGCAGAGCCGCCCTGCACCACCATGTGCATCAT IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII AS:i:-1 XN:i:0 XM:i:0 XO:i:0 XG:i:0 NM:i:0 MD:Z:100 YT:Z:UU XS:A:+
10 0 22:20000000-20999999 30948 255 20M9021N80M * 0 0 CAACAACGAGATCCTCAGTGGGCTGGACATGGAGGAAGGCAAGGAAGGAGGCACATGGCTGGGCATCAGCACACGTGGCAAGCTGGCAGCACTCACCAAC IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII AS:i:-1 XN:i:0 XM:i:0 XO:i:0 XG:i:0 NM:i:0 MD:Z:100 YT:Z:UU XS:A:+
11 16 22:20000000-20999999 40044 255 65M8945N35M * 0 0 TGGCAAGCTGGCAGCACTCACCAACTACCTGCAGCCGCAGCTGGACTGGCAGGCCCGAGGGCGAGGCACCTACGGGCTGAGCAACGCGCTGCTGGAGACT IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII AS:i:-1 XN:i:0 XM:i:0 XO:i:0 XG:i:0 NM:i:0 MD:Z:100 YT:Z:UU XS:A:+
The first few lines (beginning with @
) are SAM header lines, and the rest of the lines are SAM alignments, one line per read or mate. See the HISAT manual section on SAM output and the SAM specification for details about how to interpret the SAM file format.
Paired-end example
To align paired-end reads included with HISAT, stay in the same directory and run:
$HISAT_HOME/hisat -x 22_20-21M_hisat -1 $HISAT_HOME/example/reads/reads_1.fq -2 $HISAT_HOME/example/reads/reads_2.fq -S eg2.sam
This aligns a set of paired-end reads to the reference genome, with results written to the file eg2.sam
.
Using SAMtools/BCFtools downstream
SAMtools is a collection of tools for manipulating and analyzing SAM and BAM alignment files. BCFtools is a collection of tools for calling variants and manipulating VCF and BCF files, and it is typically distributed with SAMtools. Using these tools together allows you to get from alignments in SAM format to variant calls in VCF format. This example assumes that samtools
and bcftools
are installed and that the directories containing these binaries are in your PATH environment variable.
Run the paired-end example:
$HISAT_HOME/hisat -x $HISAT_HOME/example/index/22_20-21M_hisat -1 $HISAT_HOME/example/reads/reads_1.fq -2 $HISAT_HOME/example/reads/reads_2.fq -S eg2.sam
Use samtools view
to convert the SAM file into a BAM file. BAM is a the binary format corresponding to the SAM text format. Run:
samtools view -bS eg2.sam > eg2.bam
Use samtools sort
to convert the BAM file to a sorted BAM file.
samtools sort eg2.bam eg2.sorted
We now have a sorted BAM file called eg2.sorted.bam
. Sorted BAM is a useful format because the alignments are (a) compressed, which is convenient for long-term storage, and (b) sorted, which is conveneint for variant discovery. To generate variant calls in VCF format, run:
samtools mpileup -uf $HISAT_HOME/example/reference/22_20-21M.fa eg2.sorted.bam | bcftools view -bvcg - > eg2.raw.bcf
Then to view the variants, run:
bcftools view eg2.raw.bcf
See the official SAMtools guide to Calling SNPs/INDELs with SAMtools/BCFtools for more details and variations on this process.