53
Lecture 5. Sequence Assembly The Chinese University of Hong Kong CSCI3220 Algorithms for Bioinformatics

Lecture 5. Sequence Assembly The Chinese University of Hong Kong CSCI3220 Algorithms for Bioinformatics

Embed Size (px)

Citation preview

Page 1: Lecture 5. Sequence Assembly The Chinese University of Hong Kong CSCI3220 Algorithms for Bioinformatics

Lecture 5. Sequence Assembly

The Chinese University of Hong KongCSCI3220 Algorithms for Bioinformatics

Page 2: Lecture 5. Sequence Assembly The Chinese University of Hong Kong CSCI3220 Algorithms for Bioinformatics

CSCI3220 Algorithms for Bioinformatics | Kevin Yip-cse-cuhk | Fall 2015 2

Lecture outline1. The sequence assembly problem– Several general approaches

2. Related graph problems– Hamiltonian path– Eulerian path

3. Sequence assembly by using de Bruijn graphs

Last update: 26-Sep-2015

Page 3: Lecture 5. Sequence Assembly The Chinese University of Hong Kong CSCI3220 Algorithms for Bioinformatics

THE SEQUENCE ASSEMBLY PROBLEM

Part 1

Page 4: Lecture 5. Sequence Assembly The Chinese University of Hong Kong CSCI3220 Algorithms for Bioinformatics

CSCI3220 Algorithms for Bioinformatics | Kevin Yip-cse-cuhk | Fall 2015 4

Reference sequence• In the last lecture, we studied the problem of

short read alignment• Assumptions behind the short read alignment

problem:– There is a reference genome– The reference is similar to, but not exactly the

same as, the DNA sequence from which the short reads were generated

• Sometimes, no good references are available

Last update: 26-Sep-2015

Page 5: Lecture 5. Sequence Assembly The Chinese University of Hong Kong CSCI3220 Algorithms for Bioinformatics

CSCI3220 Algorithms for Bioinformatics | Kevin Yip-cse-cuhk | Fall 2015 5

Lack of a reference sequence• Some situations in which a good reference

sequence is not available:– Sequencing a new type of bacteria– Sequencing a genomic region previously poorly

annotated• In these situations, we need to reconstruct the

sequence by assembling the short reads.– This process is called sequence assembly, or “de

novo assembly”.

Last update: 26-Sep-2015

Page 6: Lecture 5. Sequence Assembly The Chinese University of Hong Kong CSCI3220 Algorithms for Bioinformatics

CSCI3220 Algorithms for Bioinformatics | Kevin Yip-cse-cuhk | Fall 2015 6

Sequence assembly• Example revisited: Suppose we have got the

following short reads from multiple copies of an unknown sequence s:– ACA, ATA, ATA, ATT, TAG, TAT, TTC– How to get back sequence s from these short reads?

• One possible formulation: Shortest superstring– Find the shortest string s’ such that every observed read

is a substring of s’• There is no guarantee that s’ must be equal to the actual

sequence s• Very difficult problem (NP-hard) – No known polynomial time

algorithm exists

Last update: 26-Sep-2015

Page 7: Lecture 5. Sequence Assembly The Chinese University of Hong Kong CSCI3220 Algorithms for Bioinformatics

CSCI3220 Algorithms for Bioinformatics | Kevin Yip-cse-cuhk | Fall 2015 7

Greedy approach• One heuristic method to solving shortest

superstring: Greedy merge of the two strings with the maximum overlap– For example, ATA may be followed by TAG, since

the last two characters of ATA are the same as the first two characters of TAG

– Similar to playing a jigsaw puzzle

Last update: 26-Sep-2015

Image credit: slideteam.net

Page 8: Lecture 5. Sequence Assembly The Chinese University of Hong Kong CSCI3220 Algorithms for Bioinformatics

CSCI3220 Algorithms for Bioinformatics | Kevin Yip-cse-cuhk | Fall 2015 8

Greedy approach• Detailed steps:

1. First remove any input short read that is a sub-sequence of another. For example,• If both ACAT and ACA are in the input, remove ACA.• If there are multiple copies of ACA in the input, remove all but one of

them.

2. For the remaining list of short reads, find the ordered pair (x, y) with the maximum overlap between x’s suffix and y’s prefix. If y contains l characters and the overlap involves k characters, remove y and replace x with the merged sequence xy[k+1..l].• Tie-breaking rule for our discussion: If there are multiple of them,

merge the first pair according to lexicographic order.• (1, 2) < (1, 3) < (2, 1) < (2, 3) < (3, 1) < (3, 2)

3. Repeat steps 1 and 2 until there is only one sequence left.

Last update: 26-Sep-2015

Page 9: Lecture 5. Sequence Assembly The Chinese University of Hong Kong CSCI3220 Algorithms for Bioinformatics

CSCI3220 Algorithms for Bioinformatics | Kevin Yip-cse-cuhk | Fall 2015 9

Greedy approach example• Input short reads: ACA, ATA, ATA, ATT, TAG, TAT, TTC

→ (Removing reads that are substrings of others)ACA, ATA, ATT, TAG, TAT, TTC

→ACA, ATA, ATT, TAG, TAT, TTC→ACA, ATAG, ATT, TAT, TTC→ACA, ATAG, ATT, TAT, TTC→ACA, ATAG, ATTC, TAT→ACA, ATAG, ATTC, TAT→ACA, ATTC, TATAG→ACA, ATTC, TATAG→ACATTC, TATAG→ACATTCTATAG

• Results:1. Reconstructed string different from actual one (TATACATTAG)2. Also 1 character more (11 vs. 10)

Last update: 26-Sep-2015

Page 10: Lecture 5. Sequence Assembly The Chinese University of Hong Kong CSCI3220 Algorithms for Bioinformatics

CSCI3220 Algorithms for Bioinformatics | Kevin Yip-cse-cuhk | Fall 2015 10

How good is the greedy algorithm?• How long is the reconstructed sequence?– It has been proved that if the shortest superstring

has length m, then the reconstructed string has length 4m. (Note that m is different from n, the length of the actual sequence s.)• Is there an example with a reconstructed string with

length 2m?

– It is possible to have m < n, i.e., the shortest superstring is not the actual sequence s• Is there an example with a reconstructed string with

length << n?

Last update: 26-Sep-2015

Page 11: Lecture 5. Sequence Assembly The Chinese University of Hong Kong CSCI3220 Algorithms for Bioinformatics

CSCI3220 Algorithms for Bioinformatics | Kevin Yip-cse-cuhk | Fall 2015 11

Practical issues• There are many practical issues in sequence

assembly:1. Non-uniqueness due to short read length2. Non-uniqueness due to heterogeneity3. Incomplete coverage4. Sequencing errors5. Ambiguity due to repeats...

Last update: 26-Sep-2015

Page 12: Lecture 5. Sequence Assembly The Chinese University of Hong Kong CSCI3220 Algorithms for Bioinformatics

CSCI3220 Algorithms for Bioinformatics | Kevin Yip-cse-cuhk | Fall 2015 12

Practical difficulties and solutions• Short reads: ACA, ATA, ATA, ATT, TAG, TAT, TTC

• Problems:1. Non-uniqueness due to short read length: TAT

may also be followed by ATT (instead of ATA as in TATACATTAG)

• Solution:– Use longer reads and/or paired reads, and

assemble reads only when they have substantial overlaps• Limited by current technology: <250nt per NGS read

Last update: 26-Sep-2015

Page 13: Lecture 5. Sequence Assembly The Chinese University of Hong Kong CSCI3220 Algorithms for Bioinformatics

CSCI3220 Algorithms for Bioinformatics | Kevin Yip-cse-cuhk | Fall 2015 13

Paired end sequencing• Sequence both ends of a fragment• The two reads are called a mate pair• Insert sizes form a distribution due to

random fragmentation and manual size selection– One read is likely within a certain distance range

from the other– If the location of one read is ambiguous, may

use the location information of the other to help• More difficult in practice due to imprecise

insert size• The idea of paired end sequencing is also

useful in short read alignment

Last update: 26-Sep-2015

Read length

Insert size

Fragment length

Sequencing

Read1 Read2

TAT ATA ATT

...CAT ...ATT ...GGG

(Suppose s=TATACATTAGGG here)

Page 14: Lecture 5. Sequence Assembly The Chinese University of Hong Kong CSCI3220 Algorithms for Bioinformatics

CSCI3220 Algorithms for Bioinformatics | Kevin Yip-cse-cuhk | Fall 2015 14

Practical difficulties and solutions• Short reads: ACA, ATA, ATA, ATT, TAG, TAT, TTC

• Problems:2. Non-uniqueness due to heterogeneity: It is

possible that the DNA sample contains two versions of the sequence, one with TATACATTAG and one with TATACATTCG

• Solution:– Use an assembly method that can consider

multiple possible ways of assembling the reads

Last update: 26-Sep-2015

Page 15: Lecture 5. Sequence Assembly The Chinese University of Hong Kong CSCI3220 Algorithms for Bioinformatics

CSCI3220 Algorithms for Bioinformatics | Kevin Yip-cse-cuhk | Fall 2015 15

Practical difficulties and solutions• Short reads: ACA, ATA, ATA, ATT, TAG, TAT, TTC• Problems:

3. Incomplete coverage: We do not know what is after ACA, since no reads start with CA

• Solution:– Produce more reads• The ratio between the total length of useful reads and the

length of s is called the average read depth. For sequence alignment, it is now common to perform 30x-60x coverage. For sequence assembly, usually we need >100x.– Sometimes we do not know the actual length of s and need to estimate

it

• Costs more starting materials, reagents, money and computation

Last update: 26-Sep-2015

Page 16: Lecture 5. Sequence Assembly The Chinese University of Hong Kong CSCI3220 Algorithms for Bioinformatics

CSCI3220 Algorithms for Bioinformatics | Kevin Yip-cse-cuhk | Fall 2015 16

Practical difficulties and solutions• Short reads: ACA, ATA, ATA, ATT, TAG, TAT, TTC

• Problems:4. Sequencing errors: ATT seems to be followed by

TTC, but actually s does not contain TTC as a subsequence (recall that s=TATACATTAG), due to a sequencing error (TTC should actually be TTA)

• Solutions:– Use longer reads/paired reads so that if a read

contains an error, it has low probability of being assembled

– Use some statistics to estimate error probability

Last update: 26-Sep-2015

Page 17: Lecture 5. Sequence Assembly The Chinese University of Hong Kong CSCI3220 Algorithms for Bioinformatics

CSCI3220 Algorithms for Bioinformatics | Kevin Yip-cse-cuhk | Fall 2015 17

Practical difficulties and solutions• Short reads: ACA, ATA, ATA, ATT, TAG, TAT, TTC

• Problems:5. Ambiguity due to repeats: Should ATA be put

before or after TAT?• This problem is due to the occurrence of two TA’s in

s=TATACATTAG

• Solution:– Use longer reads/paired reads• Still cannot handle the following cases:

– Each unit of a repeat is very long– There are many copies of a repeating unit

Last update: 26-Sep-2015

Page 18: Lecture 5. Sequence Assembly The Chinese University of Hong Kong CSCI3220 Algorithms for Bioinformatics

CSCI3220 Algorithms for Bioinformatics | Kevin Yip-cse-cuhk | Fall 2015 18

Contigs and scaffolds• Key terms:– Contig: A partially assembled sequence from some

reads– Scaffold: An arrangement of the contigs with

specified order and orientations– See this video for an illustration: http://

www.youtube.com/watch?v=vg7Y5EeZsjk

Last update: 26-Sep-2015

Page 19: Lecture 5. Sequence Assembly The Chinese University of Hong Kong CSCI3220 Algorithms for Bioinformatics

CSCI3220 Algorithms for Bioinformatics | Kevin Yip-cse-cuhk | Fall 2015 19

Quality of an assembly• Usually the final output does not contain a single

sequence, but just some contigs/scaffolds• Some descriptive statistics of assembly outputs:– Length of longest contig– Average length of contigs– Total length of contigs– N50: Length of the contig such that shorter contigs

amount to 50% or more of the total length of all contigs• If the lengths are (in an arbitrary unit) 10, 8, 6, 5, 3, 3, 2, 1, 1,

1, then the N50 value would be 6, since (10+8+6) = 24, which is larger than 50% of the sum (10+8+6+5+3+3+2+1+1+1) = 40

Last update: 26-Sep-2015

Page 20: Lecture 5. Sequence Assembly The Chinese University of Hong Kong CSCI3220 Algorithms for Bioinformatics

CSCI3220 Algorithms for Bioinformatics | Kevin Yip-cse-cuhk | Fall 2015 20

General approaches• Some other proposed approaches to sequence

assembly:– Greedy extension: Extend the current contig until there

are no more or multiple extensions• Short reads: ACA, ATA, ATA, ATT, TAG, TAT, TTC• ATT ATTC

– Overlap/layout/consensus: Perform all-against-all read alignments to find overlaps, deduce approximate layout, and refine layout by multiple sequence alignment• The all-against-all part requires tremendous computational

power

– de Bruijn graph (More details later)

Last update: 26-Sep-2015

Page 21: Lecture 5. Sequence Assembly The Chinese University of Hong Kong CSCI3220 Algorithms for Bioinformatics

RELATED GRAPH PROBLEMSPart 2

Page 22: Lecture 5. Sequence Assembly The Chinese University of Hong Kong CSCI3220 Algorithms for Bioinformatics

CSCI3220 Algorithms for Bioinformatics | Kevin Yip-cse-cuhk | Fall 2015 22

Graph formulations• We can use a graph to provide an abstraction of

the short read assembly scenario• Formulation 1:– Each node is a short read– There is an edge from node X to node Y if a suffix of

X substantially overlaps with a prefix of node Y• E.g., overlapping at least |X|/2 characters

– Goal : Find a path that visits every node exactly once• Because you want every short read to appear exactly

once in the resulting sequence• This is a Hamiltonian path problem

Last update: 26-Sep-2015

Page 23: Lecture 5. Sequence Assembly The Chinese University of Hong Kong CSCI3220 Algorithms for Bioinformatics

CSCI3220 Algorithms for Bioinformatics | Kevin Yip-cse-cuhk | Fall 2015 23

Hamiltonian path formulation• Short reads (new example):ACA, ATA, ATT, CAT, TAC, TAG , TAT, TTA

• Suppose a node is connected to another one if the length-2 suffix of the former equals the length-2 prefix of the latter:

• Unfortunately, even the decision version (whether such a path exists) is very difficult (NP-complete)

Last update: 26-Sep-2015

TTA

TAT

ATA

TAC

ACA

CAT

ATT

TAG

Page 24: Lecture 5. Sequence Assembly The Chinese University of Hong Kong CSCI3220 Algorithms for Bioinformatics

CSCI3220 Algorithms for Bioinformatics | Kevin Yip-cse-cuhk | Fall 2015 24

Graph formulations• Formulation 2:– Each edge is a short read– The two nodes that connect an edge are derived

from the prefix and suffix of the corresponding read• Different reads can share nodes

– Goal: Find a path that visits every edge exactly once• The Eulerian path problem

Last update: 26-Sep-2015

Page 25: Lecture 5. Sequence Assembly The Chinese University of Hong Kong CSCI3220 Algorithms for Bioinformatics

CSCI3220 Algorithms for Bioinformatics | Kevin Yip-cse-cuhk | Fall 2015 25

Eulerian path formulation• Short reads:ACA, ATA, ATT, CAT, TAC, TAG , TAT, TTA

• Suppose each read is decomposed into two nodes, one containing the length-2 prefix of it and the other the length-2 suffix of it. There is an edge pointing from the former to the latter.

• Interestingly, it is much easier to find Eulerian pathsLast update: 26-Sep-2015

AC

AG

AT

CATA

TT

ACAATA

ATT

CATTACTAGTAT

TTA

Page 26: Lecture 5. Sequence Assembly The Chinese University of Hong Kong CSCI3220 Algorithms for Bioinformatics

CSCI3220 Algorithms for Bioinformatics | Kevin Yip-cse-cuhk | Fall 2015 26

The Eulerian path problem

• Existence of an Eulerian path:– The in-degree of a node is the number of edges going into it– The out-degree of a node is the number of edges going out of it– If a connected directed graph has an Eulerian path, the followings are true (why?):

• At most one node has (out-degree – in-degree) = 1• At most one node has (out-degree – in-degree) = -1• All other nodes have (out-degree – in-degree) = 0

– Surprisingly, if a connected graph satisfies these conditions, it must have an Eulerian path, i.e., the three form a set of both necessary and sufficient conditions

Last update: 26-Sep-2015

AC

AG

AT

CATA

TT

ACAATA

ATT

CATTACTAGTAT

TTA

Page 27: Lecture 5. Sequence Assembly The Chinese University of Hong Kong CSCI3220 Algorithms for Bioinformatics

CSCI3220 Algorithms for Bioinformatics | Kevin Yip-cse-cuhk | Fall 2015 27

The Eulerian path problem

• Finding an Eulerian path (Hierholzer’s algorithm):– Start with the node with an extra out-degree (or if not exist, any node)– Follow any unused edges to visit other nodes, until getting stuck

• Either back to the starting node and it has no more unused edge, or the node with an extra in-degree (why are there no other possibilities?)

– If any visited node has unused edges, repeat the above with this node as the starting node. The path must end at the same node. Join this new path with the old one.

Last update: 26-Sep-2015

AC

AG

AT

CATA

TT

ACAATA

ATT

CATTACTAGTAT

TTA

Page 28: Lecture 5. Sequence Assembly The Chinese University of Hong Kong CSCI3220 Algorithms for Bioinformatics

CSCI3220 Algorithms for Bioinformatics | Kevin Yip-cse-cuhk | Fall 2015 28

Example

Last update: 26-Sep-2015

AC

AG

AT

CATA

TT

AC

AG

AT

CATA

TT

1

2

3

4

AC

AG

AT

CATA

TT

1

2

3

4

ii

iii

iv

i

AC

AG

AT

CATA

TT

1

2

3

8

5

6

7

4Final answer:TATTACATAG

Page 29: Lecture 5. Sequence Assembly The Chinese University of Hong Kong CSCI3220 Algorithms for Bioinformatics

CSCI3220 Algorithms for Bioinformatics | Kevin Yip-cse-cuhk | Fall 2015 29

Using stacks to find the paths

Last update: 26-Sep-2015

AC

AG

AT

CATA

TT

1

2

3

4

Current path stack Completed path stack

TAATTTTAAG

Page 30: Lecture 5. Sequence Assembly The Chinese University of Hong Kong CSCI3220 Algorithms for Bioinformatics

CSCI3220 Algorithms for Bioinformatics | Kevin Yip-cse-cuhk | Fall 2015 30

Using stacks to find the paths

Last update: 26-Sep-2015

AC

AG

AT

CATA

TT

1

2

3

4

Current path stack Completed path stack

TAATTTTA

AG

Page 31: Lecture 5. Sequence Assembly The Chinese University of Hong Kong CSCI3220 Algorithms for Bioinformatics

CSCI3220 Algorithms for Bioinformatics | Kevin Yip-cse-cuhk | Fall 2015 31

Using stacks to find the paths

Last update: 26-Sep-2015

Current path stack Completed path stack

TAATTTTA

AG

AC

AG

AT

CATA

TT

1

2

3

4

ii

iii

iv

i

ACCAATTA

Page 32: Lecture 5. Sequence Assembly The Chinese University of Hong Kong CSCI3220 Algorithms for Bioinformatics

CSCI3220 Algorithms for Bioinformatics | Kevin Yip-cse-cuhk | Fall 2015 32

Using stacks to find the paths

Last update: 26-Sep-2015

Current path stack Completed path stack

TAATTTTA

AG

AC

AG

AT

CATA

TT

1

2

3

4

ii

iii

iv

i

ACCAATTA

Final answer:TATTACATAG

Page 33: Lecture 5. Sequence Assembly The Chinese University of Hong Kong CSCI3220 Algorithms for Bioinformatics

CSCI3220 Algorithms for Bioinformatics | Kevin Yip-cse-cuhk | Fall 2015 33

Comparing the two formulations

• The Hierholzer’s algorithm runs in linear time– Does it mean we have proved P=NP?– A general Hamiltonian path problem is NP hard, but due to the

equivalence to the Eulerian path formulation, Hamiltonian path problems *for short reads* can be efficiently solved

Last update: 26-Sep-2015

TTA

TAT

ATA

TAC

ACA

CAT

ATT

TAG

Hamiltonian path formulation:

AC

AG

AT

CATA

TT

ACAATA

ATT

CATTACTAGTAT

TTA

Eulerian path formulation:

Actual DNA sequence (which should be unknown): TATACATTAG

Page 34: Lecture 5. Sequence Assembly The Chinese University of Hong Kong CSCI3220 Algorithms for Bioinformatics

CSCI3220 Algorithms for Bioinformatics | Kevin Yip-cse-cuhk | Fall 2015 34

Why the big difference?• Why is the Eulerian path problem much easier

than the general Hamiltonian path problem?– Strict necessary and sufficient conditions for an

Eulerian path to exist– The conditions are simple: They can be checked

very efficiently– For the Eulerian path problem, the solution of a

sub-problem (involving only a subset of the edges) can always contribute towards the solution of the original problem• Another example of reusing results

Last update: 26-Sep-2015

Page 35: Lecture 5. Sequence Assembly The Chinese University of Hong Kong CSCI3220 Algorithms for Bioinformatics

CSCI3220 Algorithms for Bioinformatics | Kevin Yip-cse-cuhk | Fall 2015 35

Back to sequence assembly• While the Eulerian path formulation is elegant,

we need to deal with the many issues when applying it to perform sequence assembly– Non-uniqueness– Errors in data– Repeats– Heterogeneity– ...

• We now study some practical methods for solving these issues

Last update: 26-Sep-2015

Page 36: Lecture 5. Sequence Assembly The Chinese University of Hong Kong CSCI3220 Algorithms for Bioinformatics

DE BRUIJN GRAPHSPart 3

Page 37: Lecture 5. Sequence Assembly The Chinese University of Hong Kong CSCI3220 Algorithms for Bioinformatics

CSCI3220 Algorithms for Bioinformatics | Kevin Yip-cse-cuhk | Fall 2015 37

Problems of the graph formulations• So far we have assumed that each node (in the

Hamiltonian path formulation) or each edge (in the Eulerian path formulation) is a short read.

• It is problematic if “short” reads are not really that short (but 100-250nt) when determining which reads should be connected in the graph:– If the required overlap is too large, a single error/mutation

would make two consecutive reads not connected• TATACATTA, ATAGATTAG

– If the required overlap is too small, there will be too many connections and it is easy to have non-unique solutions

– There can be a tremendous number of nodes/edges, making the graph not fitting into memory

Last update: 26-Sep-2015

Page 38: Lecture 5. Sequence Assembly The Chinese University of Hong Kong CSCI3220 Algorithms for Bioinformatics

CSCI3220 Algorithms for Bioinformatics | Kevin Yip-cse-cuhk | Fall 2015 38

de Bruijn graph• In the original definition proposed by Dutch mathematician

Nicolaas de Bruijn in 1946:– A de Bruijn graph is a graph that contains every k-mer of a certain

alphabet as a node, and there is a directed edge from a node to another one if the length-(k-1) suffix of the former is the same as the length-(k-1) prefix of the latter.

• Example: k=3, alphabet={0, 1}

Last update: 26-Sep-2015

Image source: Wikipedia

Page 39: Lecture 5. Sequence Assembly The Chinese University of Hong Kong CSCI3220 Algorithms for Bioinformatics

CSCI3220 Algorithms for Bioinformatics | Kevin Yip-cse-cuhk | Fall 2015 39

de Bruijn graph for sequence assembly

• To use de Bruijn graph for sequence assembly:– We consider only k-mers that are subsequences of

some observed reads• In practice, only a very small fraction of the 4k possible

k-mers appear in the reads

– Two nodes are connected only if there are reads that contain both at consecutive positions• So, there will not be an edge from ATA to TAG if ATAG

is not observed in any read

– The number of reads that support each edge is also recorded

Last update: 26-Sep-2015

Page 40: Lecture 5. Sequence Assembly The Chinese University of Hong Kong CSCI3220 Algorithms for Bioinformatics

CSCI3220 Algorithms for Bioinformatics | Kevin Yip-cse-cuhk | Fall 2015 40

de Bruijn graph for sequence assembly

• Example:– Sequencing reads: a:ACGGC, b:CGGCG, c:CGTGA,

d:GACGT, e:GCGTG, f:GGCGT, g:GTGAC and h:TGACG– To construct a de Bruijn graph when each edge

corresponds to a 3-mer:

Last update: 26-Sep-2015

First 3-mer in a read Next 3-mer in a read Supporting reads

ACG CGG 1 (a)

ACG CGT 1 (d)

CGG GGC 2 (a, b)

CGT GTG 2 (c, e)

GAC ACG 2 (d, h)

GCG CGT 2 (e, f)

GGC GCG 2 (b, f)

GTG TGA 2 (c, g)

TGA GAC 2 (g, h)

ACG

CGG

GCG

GGC

CGT

GTG

TGA

GAC

1

12

2

22

2

22

Page 41: Lecture 5. Sequence Assembly The Chinese University of Hong Kong CSCI3220 Algorithms for Bioinformatics

CSCI3220 Algorithms for Bioinformatics | Kevin Yip-cse-cuhk | Fall 2015 41

Patterns of various issues• The various issues we discussed before will

form special patterns in a de Bruijn graph:– Non-uniqueness: frayed rope• s=TACCGGACCGC• Observed reads (not necessarily covering all k-mers of

s): TACC, ACCG, CCGG, GACC, CCGC

– Incomplete coverage: possibly disconnected graph• s=TATACATTAG• Observed reads: TATA, ATAC, ACAT, CATT, ATTA

Last update: 26-Sep-2015

TACACC CCG

CGG

GAC GGA

TAT ATA TAC ACA CAT ATT TTA

Image credit: cuttingedgedjs.com

Page 42: Lecture 5. Sequence Assembly The Chinese University of Hong Kong CSCI3220 Algorithms for Bioinformatics

CSCI3220 Algorithms for Bioinformatics | Kevin Yip-cse-cuhk | Fall 2015 42

Patterns of various issues– Tandem repeats: cycle• s=TACCGACCGC• Observed reads: ACCG, CCGA, CGAC, GACC, CCGC

– Errors at read ends: spur• s=TATACATTAG• Observed reads: TATA, TATT, ATAC, TACA, ACAT

Last update: 26-Sep-2015

ACC CCG CGA GAC

CGC

TAT ATA TAC ACA CAT

ATT

Image credit: Wikimedia

Page 43: Lecture 5. Sequence Assembly The Chinese University of Hong Kong CSCI3220 Algorithms for Bioinformatics

CSCI3220 Algorithms for Bioinformatics | Kevin Yip-cse-cuhk | Fall 2015 43

Patterns of various issues– Heterogeneity/errors at read centers: bubble• s=TATACATTAG; s’=TATAGATTAG• Observed reads: TATA, ATAC, TACA, ACAT, CATT, ATAG, TAGA, AGAT, GATT

Last update: 26-Sep-2015

TAT ATATAC ACA CAT

TAGATT

AGA GAT

Page 44: Lecture 5. Sequence Assembly The Chinese University of Hong Kong CSCI3220 Algorithms for Bioinformatics

CSCI3220 Algorithms for Bioinformatics | Kevin Yip-cse-cuhk | Fall 2015 44

Resolving problems• Some methods for resolving the problems

(high-level ideas only):– Handling potential errors:• Pre-filtering k-mers supported by few reads

– Bimodal distribution of k-mer frequencies: one peak corresponds to legitimate k-mers, the other (much lower) peak due to errors

– May also use base quality scores in filtering

• Remove paths supported by few reads• Combine near-identical paths

Last update: 26-Sep-2015

Page 45: Lecture 5. Sequence Assembly The Chinese University of Hong Kong CSCI3220 Algorithms for Bioinformatics

CSCI3220 Algorithms for Bioinformatics | Kevin Yip-cse-cuhk | Fall 2015 45

Resolving problems• Some methods for resolving the problems

(high-level ideas only):– Non-uniqueness, heterogeneity:• Duplicate the shared part in frayed ropes and bubbles

into separate paths, if supported by read counts

– Repeats:• Use read counts to deduce number of copies• Usually not very accurate due to random fluctuations in

read counts

Last update: 26-Sep-2015

Page 46: Lecture 5. Sequence Assembly The Chinese University of Hong Kong CSCI3220 Algorithms for Bioinformatics

CSCI3220 Algorithms for Bioinformatics | Kevin Yip-cse-cuhk | Fall 2015 46

Strand issue• In actual sequencing, often we get sequencing reads

from both strands• Example:– +5’CATACATTAG 3’-3’GTATGTAATC 5’

– Suppose each read is 6nt long, we can get the following reads:• From the +ve strand: CATACA, ATACAT, TACATT, ACATTA, CATTAG

• From the -ve strand: CTAATG, TAATGT, AATGTA, ATGTAT, TGTATG

• The corresponding de Bruijn graph is also more complicated

Last update: 26-Sep-2015

Page 47: Lecture 5. Sequence Assembly The Chinese University of Hong Kong CSCI3220 Algorithms for Bioinformatics

CSCI3220 Algorithms for Bioinformatics | Kevin Yip-cse-cuhk | Fall 2015 47

Scaffolding• Two main types of useful information:– Paired-end reads– Reference alignment

Last update: 26-Sep-2015

Image credit: Green, Nature Reviews Genetics 2(8):573-583, (2001)

Page 48: Lecture 5. Sequence Assembly The Chinese University of Hong Kong CSCI3220 Algorithms for Bioinformatics

CASE STUDY, SUMMARY AND FURTHER READINGS

Epilogue

Page 49: Lecture 5. Sequence Assembly The Chinese University of Hong Kong CSCI3220 Algorithms for Bioinformatics

CSCI3220 Algorithms for Bioinformatics | Kevin Yip-cse-cuhk | Fall 2015 49

Case study: “Synthetic cell”• Topic of this lecture so far:

– We have multiple copies of an unknown (biological) DNA sequence

– We cut them down into small fragments– We sequence each of them to get short reads (text strings)– We assemble the short reads to get back the original (text)

sequence• Is it possible to do the opposite?

– We have a long text string s– We cut it down into small strings– We biochemically synthesize each of them– We assemble them to get a DNA molecule with sequence s

Last update: 26-Sep-2015

Page 50: Lecture 5. Sequence Assembly The Chinese University of Hong Kong CSCI3220 Algorithms for Bioinformatics

CSCI3220 Algorithms for Bioinformatics | Kevin Yip-cse-cuhk | Fall 2015 50

Case study: “Synthetic cell”• In 2008, a team reported such an experiment:– They took the DNA sequence (text string) of a

bacterium called Mycoplasma genitalium• Total length: 582,970 base pairs

– They synthesized the DNA molecule in a hierarchical manner, with some changes to the sequence• Cassettes of 5-7kb intermediate assemblies of ~24kb

~72kb ~144kb full sequence

Last update: 26-Sep-2015

Page 51: Lecture 5. Sequence Assembly The Chinese University of Hong Kong CSCI3220 Algorithms for Bioinformatics

CSCI3220 Algorithms for Bioinformatics | Kevin Yip-cse-cuhk | Fall 2015 51

Case study: “Synthetic cell”• In 2010, the team reported something more:

– They synthesized the DNA molecule of a bacterium, Mycoplasma mycoides (1.1Mb)

– They then transplanted it into a cell from a closely related species, Mycoplasma capricolum

– The cell did not divide– Was it “alive”?

• Later they found that there was a frameshift mutation in an important gene– After correcting it, cells receiving the sequence

were able to divide• The study stirred up a lot of heated debates

Last update: 26-Sep-2015

Image credit: Gibson et al., Science 329(5987):52-56, (2010)

Page 52: Lecture 5. Sequence Assembly The Chinese University of Hong Kong CSCI3220 Algorithms for Bioinformatics

CSCI3220 Algorithms for Bioinformatics | Kevin Yip-cse-cuhk | Fall 2015 52

Summary• The sequence assembly problem is to assemble the original

sequence from short sequencing reads without a reference• Two graph formulations:

– Read as nodes: Hamiltonian path problem• Hamiltonian path problems are NP-hard in general

– Read as edges: Eulerian path problem• Eulerian path problems can be solved efficiently

• Current standard is to use k-mer-based de Bruijn graphs– Complications due to various issues:

• Heterogenetity/heterozygosity• Sequence errors• Non-uniqueness of sub-sequence, repeats• Incomplete coverage

Last update: 26-Sep-2015