-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.rmd
463 lines (309 loc) · 10.3 KB
/
index.rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
---
title: DNA Sequencing
output:
ioslides_presentation:
incremental: true
transition: faster
css: ../style.css
# beamer_presentation:
# theme: "AnnArbor"
# colortheme: "dolphin"
# fonttheme: "structurebold"
author: James Hawley
date: 2019-10-04
autosize: true
---
```{r setup, include=FALSE}
options(htmltools.dir.version = FALSE)
```
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script>
$(document).ready(function() {
$('slide:not(.backdrop):not(.title-slide)').append('<div class=\"footnotes\">');
$('footnote').each(function(index) {
var text = $(this).html();
var fnNum = (index+1).toString();
$(this).html(fnNum.sup());
var footnote = fnNum + '. ' + text + '<br/>';
var oldContent = $(this).parents('slide').children('div.footnotes').html();
var newContent = oldContent + footnote;
$(this).parents('slide').children('div.footnotes').html(newContent);
});
});
</script>
## MBP Tech Talks | Fall 2019
Fundamentals of Genome Sequencing and Applications
## Motivations
* Lots of research involves genome sequencing or and analysis
* Few resources covering the fundamentals
* Information is often scattered through blog posts, presentations
* Multidisciplinary - difficult for a single person to discuss thoroughly
## Goals for the fall semester
* Understand foundations of genome sequencing
* How DNA is captured and read
* What makes good sequencing data
* Sequence alignment
* Wet and dry sides of sequencing experiments
* How to think about good experiment design when sequencing
## Outline | Part 1: Fundamentals of genome sequencing
* History of reading DNA
* Massively-parallel sequencing
* Standard file formats
* Sequence alignment
* Alignment metrics
## Outline | Part 2: Applications of genome sequencing
* Mutation detection
* Chromatin accessibililty
* Histone modifications and protein binding
* Transcriptome sequencing
* Chromatin organization
* DNA methylation
## Session structure
* HSB 100, Friday 12:00 - 14:00
* No food or drinks
* Each session has 2 parts, break in the middle
# Fundamentals of DNA sequencing
## DNA molecules
<div class="columns-2">

<footnote>Alberts, Molecular biology of the cell, 6ed. pg. 176</footnote>
* DNA is double-stranded polymer
* DNA contains 4 nucleotides: adenine (A), cytosine (C), guanine (G), thymine (T)
* DNA has a sugar-phosphate backbone
* Nucleotides come in complementary pairs: A-T, C-G
</div>
## DNA molecules
<div class="columns-2">

<footnote>Alberts, Molecular biology of the cell, 6ed. pg. 177</footnote>
* DNA has a right-handed orientation
* Strands are oriented in opposite directions
* We measure direction by counting 5' to 3'
</div>
## DNA encodes information for organisms

<footnote>Alberts, Molecular biology of the cell, 6ed. pg. 178</footnote>
* Complementary strands allow for replication
* Sequences themselves code for proteins inside cells
## DNA sequencing
* Genome: set of all DNA inside an organism
* Sequencing: the process of measuring the order of these nucleotides in a set of cells
## Sanger sequencing
<div class="note">
* Just from a high level, since details aren't totally relevant, just the idea
</div>
* Gel electrophoresis
* Small fragments of DNA are loaded into lanes of gel
* Small electric potential pulls DNA through gel
* Larger resistance on longer fragments
* Load polymerase, primers, and ddNTPs to template strand
* Primers to act as substrate for polymerase
* Polymerase to bind ddNTPs to template strand
* Add ddNTPs one at a time to control which nucleotide gets added next
## Sanger sequencing

<footnote>Mardis, 2013</footnote>
<div class="note">
* Separate small portion after adding a particular ddNTP
* Keep all portions after adding a given ddNTP together
* Load these in a lane
* Bright band in the lane gives nucleotide
* Vertical position gives order in sequence
</div>
## Sanger sequencing
Pros
* Sequence DNA fragments
* Can visually see the order of nucleotides
Cons
* Limited by sharpness of bands
* Limited by length of gel
* X-ray gel exposure, image development, one nucleotide at a time (laborious)
## Sequencing by synthesis
* Use ideas of Sanger sequencing:
* Primers, polymerase, nucleotides
* Synthesize complementary strand base-by-base
* Instead of measuring all at once via gel, measure fluorescence
## Sequencing by synthesis

## Sequencing by synthesis

## Sequencing by synthesis

## Sequencing by synthesis

## Sequencing by synthesis

## Sequencing by synthesis

## Massively parallel sequencing

## Massively parallel sequencing

## Massively parallel sequencing

## Massively parallel sequencing

## Massively parallel sequencing

## Massively parallel sequencing

## Massively parallel sequencing

## Massively parallel sequencing

## Massively parallel sequencing

## Massively parallel sequencing

## Massively parallel sequencing

## Massively parallel sequencing

* Complement of captured bases to reveal the original DNA sequence
* Image of the entire slide allows simultaneous capturing of millions of fragments of DNA
# Storing DNA sequences
## FASTA format {.build}
* Sequence name
* Sequence string
```{shell}
>Name
SEQUENCE
```
```{shell}
>reference-seq-name1
ATCTATACTTTATCTTTATCTTTA
>reference-seq-name2
ATTTTATCGCGTAGCTAGCTGGCT
```
<div class="note">
* Pairs of lines are the fundamental units
* Everything encoded in plain text
</div>
## FASTA format Pros
* Simple to understand
* Encodes DNA in plain letters
* Easy to parse, edit, etc
## FASTA format Cons
* Assumes sequences are exact
* Often not true in practice
* Often extremely large files
* Human genome: 3 Gbp
* Tend to be gzipped to compress size
* No computational optimization
* Random access
* ASCII encoding is overkill when you only need 2 bits
## FASTQ format
<div class="note">
* Very similar to FASTA
</div>
* Sequence name
* Sequence string
* Description
* Quality scores (uncertainty in measurement)
<div class="note">
* Analogous to working with sig figs, % err in measurements
</div>
## FASTQ format | Quality scores
<div class="note">
* Consider same set of reads as before
* Fragments spread out on a substrate
* Ideally we'd be able to measure a single strand of DNA
* More robust measurements come from having clones of the same fragment
</div>

## FASTQ format | Quality scores

## FASTQ format | Quality scores

<div class="note">
* Consensus call is blue
* Not unanimous
</div>
$p = \mathbb{P}[\text{incorrect call}] = \frac{1}{9}$
## FASTQ format | Quality scores

$p = \mathbb{P}[\text{incorrect call}] = \frac{3}{9} = \frac{1}{3}$
<div class="note">
* This is a simple model for calculating errors in calls
* More complicated methods can be used to calculate $p$, based on the chemistry, the asymmetric errors, input sample base distribution, etc
</div>
## FASTQ format | Quality scores
* Modern sequencers are very accurate
* Often $p \approx 0$
* Phred quality score $q = -10\log_{10}(p)$
* $q \in [0, \infty)$,
* $q = 10 \implies p = \frac{1}{10}$
* $q = 20 \implies p = \frac{1}{100}$
* $q = 30 \implies p = \frac{1}{1000}$
* $q = 40 \implies p = \frac{1}{10000}$
## FASTQ format | Quality scores {.build}
* Encode $q$ as a single ASCII character
* ASCII(round($q$) + 33)
* $q = 0 \implies$ !
* $q = 40 \implies$ I
```{shell}
@reference-seq-name1
ATCTATACTTTATCTTTATCTTTA
+
GFFFFBBBCBCCBBAAA:::;;;;
@reference-seq-name2
ATTTTATCGCGTAGCTAGCTGGCT
+
FFFEEBBBCBCCBBAAA:::;;;;
```
## DNA sequencing data is full of errors
* Say you have 1000 fragments, each 100 bp long, each base has $q = 40$
* What is the probability you have no errors anywhere in your data?
## DNA sequencing data is full of errors
* $\mathbb{P}[\text{no errors}]$
* $(\mathbb{P}[\text{no errors in read}])^{1000}$
* $((1-\mathbb{P}[\text{incorrect base call}])^{100})^{1000}$
* $(1-p)^{100000} \approx 4.54 \cdot 10^{-5}$
* $\mathbb{E}[\text{incorrect base calls}] \approx np = 100000 \cdot \frac{1}{10000} = 10$
## DNA sequencing data is full of errors

## Sequencing is a random sampling problem
<div class="note">
* Many steps involve complicated chemistry
* DNA doesn't come in these pre-defined chunks that we can measure
* All sequencing is random sample of input space
* Similar to taking polls of demographics to extrapolate to the population
* Prime example of Hidden Markov Model
</div>
* Many steps in sequencing are stochastic
* Composition of input DNA
* Fragmentation
* Adapter ligation
* Annealing to substrate
* Amplification
* Errors in base calls
* Trillions of possible fragments, only millions sequenced
* Single measurements are not deterministic
# Break
# Assessing DNA sequencing data quality with FastQC
## FastQC {.build}
* Tool to assess quality of sequencing data
* Produces HTML report
```{shell}
fastqc {FASTQ}
```
## FastQC Examples
* https://github.com/MBP-Tech-Talks/MBP-Tech-Talks.github.io/tree/master/2019-2020/01-dna-sequencing
* https://www.bioinformatics.babraham.ac.uk/projects/fastqc/RNA-seq_fastqc.html
* https://www.bioinformatics.babraham.ac.uk/projects/fastqc/good_sequence_short_fastqc.html
* https://www.bioinformatics.babraham.ac.uk/projects/fastqc/bad_sequence_short_fastqc.html
## Summary
* A brief history of DNA sequencing and various methods
* Phred quality scores
* Storing DNA sequences (FASTA, FASTQ)
* FASTQ quality control metrics
* Sequencing as a random sampling measurement
## What I didn't cover
* Alternative sequencing technologies (PacBio, Oxford Nanopore)
* Chemistry of these technologies
* What to do with these data
## Next time
* Exact sequencing alignment
* String alignment to a reference
* Naive alignment
* Boyer-Moore algorithm