Sequence Alignment & Search

Similar documents
Lecture Overview. Sequence search & alignment. Searching sequence databases. Sequence Alignment & Search. Goals: Motivations:

Biology 644: Bioinformatics

Dynamic Programming User Manual v1.0 Anton E. Weisstein, Truman State University Aug. 19, 2014

Bioinformatics for Biologists

Sequence analysis Pairwise sequence alignment

An Analysis of Pairwise Sequence Alignment Algorithm Complexities: Needleman-Wunsch, Smith-Waterman, FASTA, BLAST and Gapped BLAST

Brief review from last class

Compares a sequence of protein to another sequence or database of a protein, or a sequence of DNA to another sequence or library of DNA.

FASTA. Besides that, FASTA package provides SSEARCH, an implementation of the optimal Smith- Waterman algorithm.

Computational Molecular Biology

BLAST MCDB 187. Friday, February 8, 13

Computational Genomics and Molecular Biology, Fall

Heuristic methods for pairwise alignment:

EECS730: Introduction to Bioinformatics

Lecture 2 Pairwise sequence alignment. Principles Computational Biology Teresa Przytycka, PhD

24 Grundlagen der Bioinformatik, SS 10, D. Huson, April 26, This lecture is based on the following papers, which are all recommended reading:

As of August 15, 2008, GenBank contained bases from reported sequences. The search procedure should be

Principles of Bioinformatics. BIO540/STA569/CSI660 Fall 2010

BGGN 213 Foundations of Bioinformatics Barry Grant

BLAST: Basic Local Alignment Search Tool Altschul et al. J. Mol Bio CS 466 Saurabh Sinha

Pairwise Sequence Alignment. Zhongming Zhao, PhD

Comparison of Sequence Similarity Measures for Distant Evolutionary Relationships

Alignment of Pairs of Sequences

COS 551: Introduction to Computational Molecular Biology Lecture: Oct 17, 2000 Lecturer: Mona Singh Scribe: Jacob Brenner 1. Database Searching

Introduction to BLAST with Protein Sequences. Utah State University Spring 2014 STAT 5570: Statistical Bioinformatics Notes 6.2

BLAST & Genome assembly

Sequence alignment is an essential concept for bioinformatics, as most of our data analysis and interpretation techniques make use of it.

Similarity Searches on Sequence Databases

.. Fall 2011 CSC 570: Bioinformatics Alexander Dekhtyar..

Sequence alignment theory and applications Session 3: BLAST algorithm

BLAST & Genome assembly

B L A S T! BLAST: Basic local alignment search tool. Copyright notice. February 6, Pairwise alignment: key points. Outline of tonight s lecture

Pairwise Sequence Alignment: Dynamic Programming Algorithms. COMP Spring 2015 Luay Nakhleh, Rice University

Alignment of Long Sequences

From Smith-Waterman to BLAST

Sequence comparison: Local alignment

CS313 Exercise 4 Cover Page Fall 2017

BLAST, Profile, and PSI-BLAST

Lecture 10. Sequence alignments

Sequence alignment algorithms

Bioinformatics. Sequence alignment BLAST Significance. Next time Protein Structure

Bioinformatics explained: BLAST. March 8, 2007

Basic Local Alignment Search Tool (BLAST)

Scoring and heuristic methods for sequence alignment CG 17

Lecture 5 Advanced BLAST

BLAST - Basic Local Alignment Search Tool

Data Mining Technologies for Bioinformatics Sequences

Pairwise Sequence Alignment: Dynamic Programming Algorithms COMP 571 Luay Nakhleh, Rice University

Algorithmic Approaches for Biological Data, Lecture #20

FastA and the chaining problem, Gunnar Klau, December 1, 2005, 10:

CS 284A: Algorithms for Computational Biology Notes on Lecture: BLAST. The statistics of alignment scores.

Sequence Alignment (chapter 6) p The biological problem p Global alignment p Local alignment p Multiple alignment

Today s Lecture. Multiple sequence alignment. Improved scoring of pairwise alignments. Affine gap penalties Profiles

Bioinformatics explained: Smith-Waterman

Database Searching Using BLAST

Introduction to Computational Molecular Biology

Today s Lecture. Edit graph & alignment algorithms. Local vs global Computational complexity of pairwise alignment Multiple sequence alignment

FastA & the chaining problem

A Design of a Hybrid System for DNA Sequence Alignment

CISC 889 Bioinformatics (Spring 2003) Multiple Sequence Alignment

Biochemistry 324 Bioinformatics. Multiple Sequence Alignment (MSA)

Lectures by Volker Heun, Daniel Huson and Knut Reinert, in particular last years lectures

BIOL 7020 Special Topics Cell/Molecular: Molecular Phylogenetics. Spring 2010 Section A

TCCAGGTG-GAT TGCAAGTGCG-T. Local Sequence Alignment & Heuristic Local Aligners. Review: Probabilistic Interpretation. Chance or true homology?

OPEN MP-BASED PARALLEL AND SCALABLE GENETIC SEQUENCE ALIGNMENT

Dynamic Programming & Smith-Waterman algorithm

Sequence Alignment. part 2

Sequence Alignment Heuristics

Distributed Protein Sequence Alignment

PROTEIN MULTIPLE ALIGNMENT MOTIVATION: BACKGROUND: Marina Sirota

BLAST. Basic Local Alignment Search Tool. Used to quickly compare a protein or DNA sequence to a database.

BIOL591: Introduction to Bioinformatics Alignment of pairs of sequences

Searching Sequence Databases

Lecture 3: February Local Alignment: The Smith-Waterman Algorithm

CISC 636 Computational Biology & Bioinformatics (Fall 2016)

Similarity searches in biological sequence databases

Sequence Comparison: Dynamic Programming. Genome 373 Genomic Informatics Elhanan Borenstein

CAP BLAST. BIOINFORMATICS Su-Shing Chen CISE. 8/20/2005 Su-Shing Chen, CISE 1

Notes on Dynamic-Programming Sequence Alignment

Database Similarity Searching

Central Issues in Biological Sequence Comparison

ICB Fall G4120: Introduction to Computational Biology. Oliver Jovanovic, Ph.D. Columbia University Department of Microbiology

Alignments BLAST, BLAT

Special course in Computer Science: Advanced Text Algorithms

Important Example: Gene Sequence Matching. Corrigiendum. Central Dogma of Modern Biology. Genetics. How Nucleotides code for Amino Acids

Chapter 4: Blast. Chaochun Wei Fall 2014

Research Article Aligning Sequences by Minimum Description Length

Lesson 13 Molecular Evolution

Global Alignment Scoring Matrices Local Alignment Alignment with Affine Gap Penalties

Comparative Analysis of Protein Alignment Algorithms in Parallel environment using CUDA

Lecture 9: Core String Edits and Alignments

Computational Molecular Biology

Outline. Sequence Alignment. Types of Sequence Alignment. Genomics & Computational Biology. Section 2. How Computers Store Information

Biological Sequence Matching Using Fuzzy Logic

2) NCBI BLAST tutorial This is a users guide written by the education department at NCBI.

Sequencing Alignment I

Bioinformatics 1: lecture 4. Followup of lecture 3? Molecular evolution Global, semi-global and local Affine gap penalty

Multiple Sequence Alignment: Multidimensional. Biological Motivation

Profiles and Multiple Alignments. COMP 571 Luay Nakhleh, Rice University

C E N T R. Introduction to bioinformatics 2007 E B I O I N F O R M A T I C S V U F O R I N T. Lecture 13 G R A T I V. Iterative homology searching,

Transcription:

Sequence Alignment & Search Karin Verspoor, Ph.D. Faculty, Computational Bioscience Program University of Colorado School of Medicine With credit and thanks to Larry Hunter for creating the first version of these slides. Karin.Verspoor@ucdenver.edu http://compbio.ucdenver.edu/hunter_lab/verspoor

Lecture Overview Goals: Understand pairwise sequence alignment algorithms Be able to utilize tools for sequence search based on alignments Motivations: Basis for retrieval of sequence-indexed database information Similarity among genomic (amino acid) sequences is a core indicator of homology

Part 1: Background

Genomic Databases Gene and gene product (e.g. protein) databases are often organized by sequence Genomic sequence encodes all traits of an organism. Gene products are uniquely described by their sequences. Similar sequences among biomolecules indicates both similar function and an evolutionary relationship A located sequence feature (place on a chromosome) is unambiguous and biologically meaningful Closely related to the molecular concept of a gene. => Biologically meaningful database keys

Searching sequence databases There are large sequence databases available NCBI Entrez Gene, UniProt Starting from a sequence alone, find information about it Many kinds & sources of input sequences Genomic, expressed, protein (amino acid vs. nucleic acid) Complete or fragmentary sequences Goal is to retrieve a set of similar sequences. Exact matches are rare, and not always interesting Both small differences (mutations) and large (not required for function) within similar sequences can be biologically important.

Sequence search & alignment Database organization is focused on efficiency Sequence search doesn t match the traditional database model perfectly Alternative: Start with dynamic programming (a central idea in computational biology) Then explore approximations to it (BLAST)

Homology Homology is an evolutionary relationship that either exists or does not. It cannot be partial. An ortholog is a homolog with shared function. A paralog is a homolog that arose through a gene duplication event. Paralogs often have divergent function.

Homology

Evolutionary Relationships

Homology vs Similarity Similarity is a measure of the quality of alignment between two sequences. High similarity is evidence for homology. Homology is an inference from similarity. Similar sequences may correspond to orthologs or paralogs*. * Or, possibly, they derived from common selective pressures rather than a common ancestor. Or, the organisms were exposed to a common virus. Or,

Part 2: Sequence Alignment

Pairwise Sequence Alignment Sequence similarity depends on an alignment. What is an alignment, and why might it be significant? An alignment is a mapping from one sequence to another. Biological alignment maps together elements that are likely to have arisen from a common ancestor The existence of an alignment with many matches is an indication of homology

What complicates sequence alignment? Evolutionary changes Genetic variation Mutations (e.g. SNPs) Copy number variation Duplications, inversions, translocations, segment shuffling Insertions, Deletions, Substitutions

What counts as similarity? Similarity can be defined by counting positions that match between two sequences But which positions? Allowing gaps makes a difference in the number of matching positions abcdef abcdef abcdef- abceef acdefg a-cdefg

Not all mismatches are the same Some amino acids are more substitutable for each other than others. Serine and threonine are more alike than tryptophan and alanine. We can introduce "mismatch costs" for handling different substitutions. We don't usually use mismatch costs in aligning nucleotide sequences, since no substitution is per se better than any other.

Many possible alignments to consider Without gaps, there are are N+M-1 possible alignments between sequences of length N and M Once we start allowing gaps, there are many more possible arrangements to consider: abcbcd abcbcd abcbcd abc--d a--bcd ab--cd This becomes a very large number when we allow mismatches, since we then need to look at every possible pairing between elements: there are roughly N M possible alignments. Aligning length 100 sequences this way is impractical

Avoiding random alignments with a score function Not only are there many possible gapped alignments, but introducing too many gaps makes nonsense alignments possible: s--e-----qu---en--ce (sequence) sometimesquipsentice Want to distinguish between alignments that occur due to homology, and those that could be expected to be seen just by chance. Define a score function that accounts for both element mismatches and a gap penalty

Match scores are often calculated on the basis of the frequency of particular mutations in very similar sequences. We can transform substitution frequencies into log odds scores, which can then be added together. Match scores

An alignment score An alignment score is the sum of all the match scores of an alignment, with a penalty subtracted for each gap. Gap penalties are usually "affine" meaning that the penalty for one long gap is smaller than the penalty for many smaller gaps that add up to the same size. Match score Gap start + continuation penalty a b c - - d a c c e f d 9 2 7 6 => 24 - (10 + 2) = 12 Alignment Score

Global & Local alignments A global alignment includes all elements of a sequence, and includes gaps A global alignment may or may not include "end gap" penalties. And.--so,.from.hour.to.hour,.we.ripe.and.ripe And.then,.from.hour.to.hour,.we.rot-.and.rot- A local alignment includes only subsequences, and sometimes is computed without gaps. My.care.is.loss.of.care,.by.old.care.done, Your.care.is.gain.of.care,.by.new.care.won

Local vs. Global alignments Local alignments can find shared domains in divergent proteins and are fast to compute Global alignments are better indicators of homology and take longer to compute.

Finding the optimal alignment Given a pair of sequences and a score function, identify the best scoring (optimal) alignment between the sequences. Remember, exponential number of possible alignments (most with terrible scores). Computer science to the rescue: dynamic programming identifies optimal alignments in time proportional to the sum of the lengths of the sequences

A brief aside on Computational Complexity A key idea in computer science: How much work does it take to solve a class of problems? How do we measure complexity? Relative to problem size How long does it take? Clock time versus operations Order: O(?) notation Worst case / best case Other resources used (particularly space)

Dynamic programming The key idea is to break the larger problem down into smaller sub-problems which are solved, the results stored, and then combined. DP is usually applied to optimization problems. Here, we start aligning the sequences left to right Once a prefix is optimally aligned, nothing about the remainder of the alignment can change the alignment of the prefix. We construct a matrix of possible alignment scores (NxM 2 calculations worst case) and then "traceback" to find the optimal alignment. Called Needleman-Wunsch or Smith-Waterman

Dynamic programming alignment Each cell contains the score for the best aligned sequence prefix up to that position. Start by filling in initial gap and first element to first element match score Use arrow to indicate path to that alignment Align ACD to AACADCD: (match = 5, gap start = -5, gap continue = -2)

Continue filling in optimal path scores For each cell, have three choices for how to get there from the last optimal alignment (match, gap sequence 1, gap sequence 2). Best score(s) are selected, and arrows added indicated route. From -5 align As -5 +5 = 0 From 5, insert gap 5 + -5 = 0 From -7, insert gap -7 + -5 = -12 - A -A AA A A A- AA -- AA --A AA- align As insert gap insert gap

Optimal alignment by traceback We traceback a path that gets us the highest score. If we don't have end gap penalties, then take any path from the last row or column to the first. Otherwise we need to include the top and bottom corners AACADCD AACADCD -AC-D-- ---A-CD

Parameter Selection The optimal alignment between a pair of sequences depends critically on the selection of the score matrix and the gap penalty. These sorts of generic inputs to a program are called parameters. How do we pick the ones that give the most biologically meaningful alignments (and alignment scores?)

How do we pick match scores? For match scores, two main options PAM based on global alignments of closely related sequences. Normalized to changes per 100 sites, then exponentiated for more distant relatives. BLOSUM based on local alignments in much more diverse sequences Each matrix has versions aimed at different evolutionary distances. BLOSUM62 is NCBI s default. BLOSUM45 may work better for more evolutionarily distant sequences.

Picking gap penalties Many different possible forms: Most common is affine (gap open + gap continue penalities) More complex penalties have been proposed. Penalties must be commensurate with match scores. Therefore, the match scoring scheme influences the gap penalty Most alignment programs suggest appropriate penalties for each match score option.

Searching for optimal scores One possibility is to try several different match score and gap penalties, and choose the best In general, this is called parameter space search and it is important in many areas. Problems requires a lot computation we need some principled way to compare the results. Use significance testing to compare...

The significance of an alignment Significance testing is the branch of statistics that is concerned with assessing the probability that a particular result could have occurred by chance. How do we calculate the probability that an alignment occurred by chance? Either with a model of evolution, or Empirically, by scrambling our sequences and calculating scores on many randomized (and by assumption unrelated) sequences. Incorporated into BLAST: E-value

Part 3: Search

Linear search Test query against each target sequentially Worst case, query matches last target and you have as many tests as targets (size of database) Query TTACG Average case, test half the targets. Linear in the size of the database Database ACTGA TTAGG CGTAA AGAGA CGATA CCGGA GCCCT TTACG

Indexed (binary) search Create a sorted set of keys that point to entries Start in the middle, then figure out which half Eliminate half the database each step, so need log 2 steps at worst Need to build the index (takes space and time at each database update) Query TTACG 1 2 Index ACTGA AGAGA CCGGA 3 CGATA CGTAA GCCCT TTACG TTAGG Database ACTGA TTAGG CGTAA AGAGA CGATA CCGGA GCCCT TTACG

Hash tables Map each query to an arbitrary number with a hash function Use those numbers as an index into a table Collisions can happen, but are rare Constant time lookup, no index construction f (TTACG)= 8 Hash table 1. CGATA 2. GCCCT 3. CGTAA, AGAGA 4. 5. ACTGA 6. CCGGA 7. TTAGG 8. TTACG

How to define a hash function Basic: must map keys to a number that is within the size of the table Desired: minimize collisions So: similar keys should lead to different hashes Good general method: map key to a number, and then take the remainder when divided by a prime number. Specialized hash functions can be better. Hash tables are the basis of most database lookups.

Approximate searches Recall the needs of sequence searches: Not looking for exact match, but similar sequences Database search methods only help us find exact matches. Hash tables particularly bad at similar because we need similar keys to map to different hashes First, need to define what is similar, then find efficient ways to search for similar sequences.

Part 4: BLAST Basic Local Alignment Search Tool http://blast.ncbi.nlm.nih.gov/blast.cgi

Why BLAST? Dynamic programming solutions to alignment problems are relatively slow, and don't lend themselves to efficient database search. Time complexity proportional to the size of the database. Need some way to search a large database to find sequences that have an inexact match to a query sequence BLAST: an imperfect approximation to DP. DP finds some distantly related sequences the approximations don't

Sequence search basics BLAST is 50-100x faster than DP Proper use is similar to DP: Use appropriate substitution and gap scores BLOSUM62 is good for weak protein similarities Use PAM30, PAM70 or BLOSUM45 for better results on more similar sequences, BLOSUM80 for most distant Use low-complexity (repetitive seq) filters and filter out human repeats (ALUs, etc) If searching for coding regions, always translate nucleotide to amino acid sequence.

How BLAST works Break sequence into overlapping words, by default of length 3. Sequence of length n makes n-m+1 m-size words ABCDE ABC, BCD, CDE For each word, define ~50 other words that are similar (use substitution matrix + threshold T) Repeat for each of the n-m+1 words, giving about 50*n words (out of 20 3 =8000 possible) Use a hash table to find all places in DB with an exact match to any of those words.

Extending HSPs Identify database sequences that contain several matching words on the same diagonal (think DP alignments) and within a short distance. Extend these short, ungapped alignments in both directions along the sequence so long as score of alignment increases. BLAST alignments scored simply with a log-odds matrix; no gap penalties at this point. Call these extended alignments HSPs for high scoring pairs

Is an HSP Significant? What is the probability of scoring at least as large as x by chance? Extreme value (not Normal!) distribution: Where m is size of the database, n is length of query, and l is average length of alignment between two random sequences of those lengths using this scoring scheme. Called E value for expectation (analogous to p value) High BLAST score = low E value (low probability of chance)

K and λ Parameters of the extreme value distribution Depend on the particular substitution matrix Estimated by aligning a lot of random sequences drawn on a particular distribution of amino acids, and fitting the extreme value distribution to those alignments These empirical estimates may not be correct (error in the assumed distribution of AAs used to create the random sequences) but seem to be reasonably close.

BLAST2: add gaps Multiple HSPs in one target sequence possibility of gapped alignment. Combine HSP scores to score whole sequence: Add HSP scores Adjust K and λ for this scoring method Set modest e-value threshold to identify reasonable target set Use DP to produce final gapped alignments Run DP on the (relatively) small number of database sequences that were above the threshold with multiple HSPs

Practical Gapped BLAST Default on NCBI web site BLAST versus DP on whole databases Still might miss some alignments DP would find as database search tool DP on fractions of the database (e.g. all human sequences) can be done with parallel hardware, but computational complexity scales with database size. BLAST allows users to set certain gap penalties, word sizes and thresholds in Advanced settings but not all (since K & λ have to be calculated in advance)

Part 5: Closing comments

Motivating scenarios "I have just sequenced a DNA fragment Run a BLAST search Once you have candidates, run a more careful alignment among them. "I've located a gene using a gene-finding algorithm Run BLAST to locate similar genes. Run a global alignment to see differences. "I'm confirming a sequencing experiment do a global alignment From: http://www.seas.gwu.edu/~simhaweb/cs151/lectures/module12/align.html

Study guide... Dynamic programming alignments are a key technology in bioinformatics, and you should understand how they work. The method is perhaps counterintuitive Work some examples by hand. All of the textbooks describe D-P, and there is more detail and supplementary material on the course web site.