-
Notifications
You must be signed in to change notification settings - Fork 0
/
RNAseq_lecture.html
2104 lines (1319 loc) · 50.8 KB
/
RNAseq_lecture.html
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
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="" xml:lang="">
<head>
<title>Transcriptome Data Analysis</title>
<meta charset="utf-8" />
<script src="libs/header-attrs/header-attrs.js"></script>
<link href="libs/remark-css/default.css" rel="stylesheet" />
<link href="libs/remark-css/default-fonts.css" rel="stylesheet" />
<link rel="stylesheet" href="css/FMstyles.css" type="text/css" />
<link rel="stylesheet" href="css/animate.css" type="text/css" />
</head>
<body>
<textarea id="source">
class: center, middle, title-slide
.title[
# Transcriptome Data Analysis
]
.subtitle[
## Bulk RNA-seq Workshop - IMBEI, University Medical Center Mainz
]
.author[
### <p>Instructors: Annekathrin Nedwed, Alicia Schulze, Federico Marini</br></p>
]
.date[
### 2023/06/23</br></br>
<p align="center">
<a href="https://imbeimainz.github.io/GTIPI2022"><img src="images/gtipi_logo.png" alt="" height="100"/></a></br> <code>Material adapted from the GTIPI lecture by Charlotte Soneson and Federico Marini</code>
</p>
]
---
layout: true
---
# An introduction round
---
# What do you expect to learn today?
Enter your expectations "as questions" into
https://sli.do, with code `0030044`
---
### Questions
--
What are the steps to process RNA-Seq data?
- How to convert RNA-seq reads into counts?
- How to perform quality control (QC) of RNA-seq reads?
--
How to identify differentially expressed genes across multiple experimental conditions?
- How to properly analyze RNA count data using DESeq2?
- How to perform quality control (QC) and exploratory data analysis (EDA) of RNA-seq count data?
--
What are the biological functions impacted by the differential expression of genes?
- How can I perform a gene ontology enrichment analysis?
--
How can I create neat visualizations of the data?
- How can I visualize the results for my enrichment analysis?
--
How can I generate interactive reports to summarise my analyses?
---
### Questions
**What are the steps to process RNA-Seq data?**
- How to convert RNA-seq reads into counts?
- How to perform quality control (QC) of RNA-seq reads?
**How to identify differentially expressed genes across multiple experimental conditions?**
- How to properly analyze RNA count data using DESeq2?
- How to perform quality control (QC) and exploratory data analysis (EDA) of RNA-seq count data?
What are the biological functions impacted by the differential expression of genes?
- How can I perform a gene ontology enrichment analysis?
How can I create neat visualizations of the data?
- How can I visualize the results for my enrichment analysis?
**How can I generate interactive reports to summarise my analyses?**
---
# What you will learn
- the basics of RNA-seq data
--
- the basics of RNA-seq data analysis
--
- to get familiar with the concepts of gene expression, high-dimensional data, expression quantification, differential expression analysis
--
- the importance to pose the right question, in order to get the right answer :)
---
# Setup for practical sessions
Got R/RStudio?
Latest versions highly recommended!
See https://imbeimainz.github.io/GTIPI2022/material.html for details!
---
# Decomposing the title
### RNA
--
### Sequencing
--
### Bioinformatics
--
### Transcriptome
--
### Analysis
---
# (messenger) RNA
<p align="center">
<img src="images/gene_structure.png" alt="" height="400"/>
</p>
---
# (messenger) RNA
<p align="center">
<img src="images/DNA_alternative_splicing.gif" alt="" height="400"/>
</p>
Exons, introns, transcripts, isoforms
---
# Sequencing
<p align="center">
<img src="https://upload.wikimedia.org/wikipedia/commons/3/3d/Radioactive_Fluorescent_Seq.jpg" alt="" height="400"/>
</p>
4 base pairs, 21 aminoacids
Excellent review on next-generation sequencing: [`https://www.nature.com/articles/nrg.2016.49`](https://www.nature.com/articles/nrg.2016.49)
---
# RNA-sequencing
<p align="center">
<img src="images/rnaseq_schema.png" alt="" height="400"/>
</p>
- RNA quantification at single base resolution
- Cost efficient analysis of the whole transcriptome in a high-throughput manner
---
# Challenges in RNA-seq
- Different origin for the sample RNA and the reference genome
- Presence of incompletely processed RNAs or transcriptional background noise
- Sequencing biases (e.g. PCR library preparation)
--
Benefits
- sensitive
- specific
- high-throughput
- cost-efficient
- basepair resolution
You can see: transcripts, splicing, lncRNA, circRNA, gene fusions
---
# Bioinformatics
> "an interdisciplinary field that develops methods and software tools for understanding biological data, in particular when the data sets are large and complex."
--
A combination of
- biology
- computer science
- information engineering
- mathematics
- statistics
... to analyze and interpret the biological data
---
# Transcriptome
Gene expression is a fundamental level at which the results of various genetic and regulatory programs are observable.
--
RNA sequencing (RNA-seq) provides a quantitative and open system for profiling transcriptional outcomes on a large scale
--
Much has been learned about the characteristics of the RNA-seq data sets, as well as the performance of the myriad of methods developed
.footnote[
"RNA Sequencing Data: Hitchhiker's Guide to Expression Analysis" ->
[`https://www.annualreviews.org/doi/abs/10.1146/annurev-biodatasci-072018-021255`](https://www.annualreviews.org/doi/abs/10.1146/annurev-biodatasci-072018-021255)
]
---
# Analysis
There's data involved!
--
and these datasets have particular properties (how they are generated, ...)
--
How to make sense out of it?
--
There is a large diversity of applications to deal with
--
Among the most widely adopted workflows:
<!-- identify the molecular players of an observed phenotype, a.k.a. differential expression analysis -->
- Transcript discovery
> *Which RNA molecules are in my sample?*
> Novel isoforms and alternative splicing, Non-coding RNAs, Single nucleotide variations, Fusion genes
- RNA quantification
> *What is the concentration of RNAs?*
> Absolute gene expression (within sample), Differential expression (between biological samples)
---
# Analysis - a bird's eye view
<p align="center">
<img src="images/conesa_roadmap.png" alt="" height="500"/>
</p>
---
# The essential
--
- Expression quantification
--
- Data exploration: PCA, gene plots
--
- Differential analysis: DE modeling, design, effect size, variability, significance
--
- Functional interpretation: gene sets, pathways, biological themes
--
We will revisit this at the end of the practical session!
---
# Differential analysis types for RNA-seq
No single available standardized workflow
Multiple possible best practices for every dataset
--
To get the right answer, you have to pose the right question.
--
- Does the total output of a gene change between conditions? Differential Gene Expression (DGE)
--
- Does the expression of individual transcripts change? Differential Transcript Expression (DTE)
--
- Does any isoform of a given gene change? DTE+G
--
- Does the isoform composition for a given gene change? Differential Transcript Usage/Differential Exon Usage (DTU/DEU)
--
Each needs different computational approaches (quantifications + tests)
---
## Overview of the processing workflow
<p align="center">
<img src="images/ss_RNAseq_workflow.png" alt="" height="400"/>
</p>
Ingredients + operations
---
# The raw data: sequencing reads
FASTQ files: sequence + base quality (phred score)
--
First lines of a FASTQ file
```
@SRR1055095.1 HWI-ST156:397:D09NJACXX:5:1101:1222:1915/1
NGCTGCTGGACTCCGAAGATGGGCGGTATATCATCCCACTGCTGACTCTN
+
#1=DDFFFHFHHHJJHIIGHIJJGIJAFDDHGGGIJJGJIJJJIJJIIH#
@SRR1055095.2 HWI-ST156:397:D09NJACXX:5:1101:1245:1920/1
NCTTTTCTTTGTTCTCATCATCTTCAGGAGGAGGAGGGTCATCCTTGTGN
+
#1=BDB:?FFDFFDF?EF<FFF>B>?C@CF<1??CFB:09;09BFE9DB#
```
--
Repeat this tens of millions of times, and you'll have _one_ sample
---
# The raw data: sequencing reads
Different quality encodings exist
<p align="center">
<img src="images/ss_fastq.png" alt="" height="300"/>
</p>
---
# The raw data
Demo: quality control report, from FastQC
http://www.bioinformatics.babraham.ac.uk/projects/fastqc/good_sequence_short_fastqc.html
--
Your next best friend: MultiQC
--
Common sequence artefacts in NGS data:
* read errors
* base calling errors
* small insertions and deletions
* poor quality reads
* primer/adapter contamination
Solutions:
Quality trimming & filtering (wide range of QC tools available)
---
# Reference files
Reference genome sequences (in `fasta` format), required for genome alignment.
--
Think of the alignment as the address of each read in a 3-billion houses street, where the elements along the street can also end up repeating themselves.
--
#### What's out there?
Ensembl: http://www.ensembl.org/info/data/ftp/index.html
Gencode (human & mouse): https://www.gencodegenes.org/
UCSC: http://hgdownload.cse.ucsc.edu/downloads.html
iGenome: http://support.illumina.com/sequencing/sequencing_software/igenome.html
---
# Reference files
Some critical points:
--
Be consistent!
--
Different chromosome identifiers!
--
Reference genomes and annotations are continuously refined, extended and improved
--
Keep track of version and be consistent!
--
Naming of genes can vary across versions, in some databases!
---
# Reference files
An example:
[`http://ftp.ensembl.org/pub/release-106/fasta/homo_sapiens/dna/`](http://ftp.ensembl.org/pub/release-106/fasta/homo_sapiens/dna/)
... and one level up...
[`http://ftp.ensembl.org/pub/release-106/fasta/homo_sapiens/`](http://ftp.ensembl.org/pub/release-106/fasta/homo_sapiens/)
--
```
>1 dna:chromosome chromosome:GRCh38:1:1:248956422:1 REF
NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
...
TTGGTGCCAGTTCCTCCAAGTCGATGGCACCTCCCTCCCTCTCAACCACTTGAGCAAACT
CCAAGACATCTTCTACCCCAACACCAGCAATTGTGCCAAGGGCCATTAGGCTCTCAGCAT
GACTATTTTTAGAGACCCCGTGTCTGTCACTGAAACCTTTTTTGTGGGAGACTATTCCTC
CCATCTGCAACAGCTGCCCCTGCTGACTGCCCTTCTCTCCTCCCTCTCATCCCAGAGAAA
CAGGTCAGCTGGGAGCTTCTGCCCCCACTGCCTAGGGACCAACAGGGGCAGGAGGCAGTC
```
---
# Reference files
The GTF format
```
chr1 unknown exon 11874 12227 . + . gene_id "DDX11L1"; gene_name "DDX11L1";
transcript_id "NR_046018"; tss_id "TSS16107";
chr1 unknown CDS 3427347 3427466 . - 2 gene_id "MEGF6"; gene_name "MEGF6";
p_id "P34437"; transcript_id "NM_001409"; tss_id "TSS31177";
```
* One line per "feature" (exon, transcript, gene, CDS, 3'UTR, 5'UTR, ...)
* One feature = 9 columns of data, plus optional track definition lines
* Essential for releasing annotation information
--
Fields:
seqname - name of chromosome/scaffold
source - data/program source
feature - feature type name
start - positions of the feature
end
score - floating point value
strand - forward or reverse
frame - 0|1|2
attribute - semicolon-separated list of tag-value pairs, providing
additional information
---
# Bioconductor
<p align="center">
<img src="images/ss_bioc.png" alt="" height="500"/>
</p>
---
# Bioconductor - soon your best friend
- an open source project
- a repository of packages, focused on bioinformatics/computational biology
- a open development platform and community
--
Currently (June 2023)
- 2230 software packages
- 912 annotation packages
- 419 experiment packages
- 27 workflows
- 3 books
**Aim**: interdisciplinary research, collaboration and rapid development of scientific software
--
### Documentation
- function manual pages, most of them with runnable examples
- package vignettes - mandatory here!
- workflows, documenting full analyses spanning multiple tools
- a very active support site
---
# The real deal: Bioconductor's community
<p align="center">
<img src="images/ss_biocsupport.png" alt="" height="500"/>
</p>
---
# Data processing
<p align="center">
<img src="images/raw_to_proc.jpg" alt="A nice example of going from raw data to some form of processed data - fastq-to-bam" height="500"/>
</p>
---
# Data processing
Turning millions of text lines into properly structured abundance tables
--
Our aim: we often want to compare abundance (expression) of genes or other features between conditions
Splice-aware genome alignment vs "direct" transcript mapping and quantification
---
# Alignment: not just simple mapping
<p align="center">
<img src="images/rnaseq_alignment.png" alt="" height="300"/>
</p>
--
For RNA-seq data, we need a splice-aware aligner
Common choices:
- STAR
- HISAT2
---
# Alignment
File-format: `sam` (compressed into `bam`)
```
SRR1055095.6079377 353 chr1 11167 0 50M = 11751 634 CGCCCCTTGCTTGCAGCCGGGCAC
TACAGGACCCGCTTGCTCACGGTGAA CCCFFFFFHHHHHJJJJJJJJJJJJIGJJJIJJJJJJJJJJJDHJJCEHH
AS:i:-10 XN:i:0 XM:i:2 XO:i:0 XG:i:0 NM:i:2 MD:Z:48C0T0 YT:Z:UU NH:i:20
CC:Z:chrY CP:i:59361513 HI:i:0
```
Again: repeat this, one read at a time!
Entries:
QNAME - Query NAME of the read or the read pair
FLAG - Bitwise FLAG (pairing, strand, mate strand, etc.)
RNAME - Reference sequence NAME
POS - 1-Based leftmost POSition of clipped alignment
MAPQ - MAPping Quality (Phred-scaled)
CIGAR - Extended CIGAR string (operations: MIDNSHP)
MRNM - Mate Reference NaMe (‘=’ if same as RNAME)
MPOS - 1-Based leftmost Mate POSition
ISIZE - Inferred Insert SIZE
SEQ - Query SEQuence on the same strand as the reference
QUAL - Query QUALity (ASCII-33=Phred base quality)
Tags: used to store info about alignment
---
# Before quantification
... and actually, always: Do visualize your data!
Options: UCSC Genome Browser, IGV, IGB - [`http://software.broadinstitute.org/software/igv/`](http://software.broadinstitute.org/software/igv/)
--
<p align="center">
<img src="images/ss_igv.png" alt="" height="400"/>
</p>
---
# Quantification
Ingredients: BAM data + GTF annotation file
Output: number of reads overlapping known features (discrete, positive, skewed)
Gene-level counts, often obtained by genome alignment + overlap counting
<p align="center">
<img src="images/ss_igv.png" alt="" height="400"/>
</p>
---
# The role of annotation
<p align="center">
<img src="images/genemodel_gviz.png" alt="" height="500"/>
</p>
---
# The annotation matters!
<p align="center">
<img src="images/overlap_annos.png" alt="" height="400"/>
</p>
---
# The annotation matters!
<p align="center">
<img src="images/count_modes.png" alt="" height="500"/>
</p>
---
# Alignment-free quantifications
Some recently developed methods:
- salmon (Patro et al, Nat Methods 2017)
- kallisto (Bray et al, Nat Biotechnol 2016)
--
return...
* Transcript-level counts and TPM (transcripts-per-million) estimates, which can be summed up to get
* Gene-level counts and TPM estimates
--
Pros & cons
- considerably faster than traditional alignment+counting -> allow bootstrapping
- more highly resolved estimates (transcripts rather than gene) + can be aggregated
- can use a slightly larger fraction of the reads since multi-mapping reads are not excluded
- don't return precise alignments (bam files, for e.g. visualization in genome browser)
---
# Which way to go?
--
Based on genome alignment - mainly gene-level quantification: combine exons, "ignoring" splice variants
- Simple, powerful, yet in some cases inaccurate
- Tools:
- `htseq-count`, `featureCounts` for estimating expression levels (counts)
- `edgeR`, `DESeq2`, `voom+limma` for statistical modeling
--
Based on transcriptome mapping - transcript- and gene-level quantification: 'assign' reads (or rather, estimate most likely expression level) based on probabilistic modeling
- Potentially cleaner, but high degree of uncertainty on the transcript level!
- Tools:
- `bitSeq`, `RSEM`, `salmon`, `kallisto` for (pseudo)alignment/quantification
- `DESeq2`, `edgeR`, `voom+limma`, `swish`, `DRIMseq`, `DEXSeq`, `sleuth` for modeling (depending on the question of interest)
---
# What it would look like - STAR + featureCounts:
... due to time constraints
Index the genome
```
$ STAR --runThreadN 24 \
--runMode genomeGenerate \
--genomeDir my_genome \
--genomeFastaFiles my_genome.fa \
--sjdbGTFfile my_genes.gtf \
--sjdbOverhang 99
```
---
# What it would look like - STAR + featureCounts:
... due to time constraints
Map each file
```
$ STAR --runThreadN 24 \
--runMode alignReads \
--genomeDir my_genome \
--readFilesIn my_sample_read1.fastq.gz \
my_sample_read2.fastq.gz \
--readFilesCommand zcat \
--outFileNamePrefix output/S1/ \
--outSAMtype BAM SortedByCoordinate \
--quantMode GeneCounts
```
---
# What it would look like - STAR + featureCounts:
<p align="center">
<img src="images/ss_star_folder.png" alt="" height="250"/>
</p>
---
# What it would look like - STAR + featureCounts:
... due to time constraints
Quantify
```
featureCounts(files = bamfiles,
annot.ext = "my_genes.gtf",
isGTFAnnotationFile = TRUE,
GTF.featureType = "exon",
GTF.attrType = "gene_id",
useMetaFeatures = TRUE,
isPairedEnd = TRUE,
strandSpecific = 0)
```
Directly generates a count matrix in your R session.
---
# What it would look like - salmon
... due to time constraints
Create an index of the transcriptome
```
$ salmon index -i my_transcripts.idx \
-t <(cat my_transcripts.fasta my_genome.fasta) \
-d chromosome_names.txt
```
The genome acts as a 'decoy' sequence, to collect reads truly arising from
intronic or intergenic locations.
---
# What it would look like - salmon
... due to time constraints
Quantify a sample at the transcript level
```
$ salmon quant -i my_transcripts.idx -l A \
-1 my_sample_read1.fastq.gz -2 my_sample_read2.fastq.gz \
-p 10 -o results/sample1 --validateMappings \
--numBootstraps 30 --seqBias --gcBias
```
---
# What it would look like - salmon
... due to time constraints
<p align="center">
<img src="images/ss_salmon_folder.png" alt="" height="300"/>
</p>
---
# What it would look like - salmon
... due to time constraints
<p align="center">
<img src="images/ss_salmon_quant.png" alt="" height="400"/>
</p>
---
# Importing salmon quantifications into R
You can follow (offline) the instructions of the `tximport` package - https://bioconductor.org/packages/tximport/
--
`tximeta`: another precious assistant on the way to be consistent and to keep track of provenance identification (we'll see it in action during the exercises)
---
# What does our data look like now?
<p align="center">
<img src="images/ss_countstable.png" alt="" height="400"/>
</p>
---
# Some challenges in RNA-seq data analysis
1 - Choosing an appropriate statistical distribution
2 - Normalization between samples
3 - Few samples available make it difficult to estimate parameters (e.g., variance)
4 - Many genes, many tests - high dimensionality
---
## Some challenges in RNA-seq data analysis - 1
**Choosing an appropriate statistical distribution**
Variance depends on the mean count
Counts are non-negative and often highly skewed
This means you can't just use t-tests, ANOVA - no prob, `glm`s to the rescue!
Poisson -> negative binomial, better captures variability across biological replicates
---
# "Why do we not just take the ratios?"
Fold changes, relative abundances
.pull-left[
<img src="images/ratios_ss.png" alt="" height = 250/>
]
.pull-right[
Ex: ratio between two Poisson distributed variables
Low: mean = 20 vs mean = 10
High: mean = 2000 vs mean = 1000
]
--
Which one would you trust more? Why?
--
This goes back to having appropriate statistical frameworks that nicely model your datasets (and how these get generated)
---
## Some challenges in RNA-seq data analysis - 2
**Normalization between samples**
Observed counts depend on:
- abundance level
- gene/transcript length
- sequencing depth
- sequencing biases
--
"As-is" estimates not directly comparable across samples
--
Normalization aims to ensure our expression estimates are
* comparable across features (genes, isoforms, etc)
* comparable across libraries (different samples)
* on a human-friendly scale (interpretable magnitude)
--
<!--Necessary for valid inference about DE
* between transcripts within samples
* between samples belonging to different biological conditions-->
Most RNA-seq methods (e.g., edgeR, DESeq2, voom) need raw counts (or equivalent) as input
Don’t provide these methods with (e.g.) RPKMs, FPKMs, TPMs, CPMs, log-transformed counts, normalized counts, ...
Read documentation carefully!
---
# Digression: Normalization expression units
--
* RPKM/FPKM (Reads/Fragments per kilobase of transcript per million reads of library)
- Corrects for total library coverage
- Corrects for gene length
- Comparable between different genes within the same dataset
--
* TPM (transcripts per million)
- normalizes to transcript copies instead of reads - gives an idea of the proportion of transcripts
- Corrects for cases where the total RNA output differs between samples
- More appropriate for between sample comparisons (the sum of all TPMs in each sample are the same)
--
For DE analysis you have to work with discrete counts...
... and for comparisons you can use normalized counts (median ratio/TMM methods are robust across all genes!)
---
## Some challenges in RNA-seq data analysis - 3
**Few samples available make it difficult to estimate parameters (e.g., variance)**
You can take advantage of the large number of genes
<p align="center">
<img src="images/ss_dispests.png" alt="" height="250"/>
</p>