rna-seq for de analysis: detecting differential expression - part 5

41
Detecting differentially expressed genes RNA-seq for DE analysis training Joachim Jacob 20 and 27 January 2014 This presentation is available under the Creative Commons Attribution-ShareAlike 3.0 Unported License. Please refer to http://www.bits.vib.be/ if you use this presentation or parts hereof.

Upload: bits

Post on 05-Dec-2014

986 views

Category:

Education


6 download

DESCRIPTION

Part 5 of the training sesson 'RNA-seq for differential expression analysis' considers the algorithm used for detecting differential expression between conditions. See http://www.bits.vib.be

TRANSCRIPT

Page 1: RNA-seq for DE analysis: detecting differential expression - part 5

Detecting differentially expressed genes

RNA-seq for DE analysis trainingJoachim Jacob20 and 27 January 2014

This presentation is available under the Creative Commons Attribution-ShareAlike 3.0 Unported License. Please refer to http://www.bits.vib.be/ if you use this presentation or parts hereof.

Page 2: RNA-seq for DE analysis: detecting differential expression - part 5

Goal

Based on a count table, we want to detect differentially expressed genes between conditions of interest.

We will assign to each gene a p-value (0-1), which shows us 'how surprised we should be' to see this difference, when we assume there is no difference.

0 1

Very big chance there is a difference

p-value

Very small chance there is a real difference

Page 3: RNA-seq for DE analysis: detecting differential expression - part 5

Goal

Every single decision we have taken in previous analysis steps was done to improve this outcome of detecting DE expressed genes.

Page 4: RNA-seq for DE analysis: detecting differential expression - part 5

Goal

Page 5: RNA-seq for DE analysis: detecting differential expression - part 5

Algorithms under active development

http://wiki.bits.vib.be/index.php/RNAseq_toolbox#Detecting_differential_expression_by_count_analysis

Page 6: RNA-seq for DE analysis: detecting differential expression - part 5

Algorithms under active development

http://genomebiology.com/2010/11/10/r106

Page 7: RNA-seq for DE analysis: detecting differential expression - part 5

Intuition

gene_id CAF0006876

sample1 sample2 sample3 sample4 sample5 sample6 sample7 sample823171 22903 29227 24072 23151 26336 25252 24122

Sample9 sample10 sample11 sample12 sample13 sample14 sample15 sample1619527 26898 18880 24237 26640 22315 20952 25629

Variability X

Variability YCompare and conclude given aMean level: similar or not?

Condition A

Condition B

Page 8: RNA-seq for DE analysis: detecting differential expression - part 5

Intuition

gene_id CAF0006876

sample1 sample2 sample3 sample4 sample5 sample6 sample7 sample823171 22903 29227 24072 23151 26336 25252 24122

Sample9 sample10 sample11 sample12 sample13 sample14 sample15 sample1619527 26898 18880 24237 26640 22315 20952 25629

Condition A

Condition B

Page 9: RNA-seq for DE analysis: detecting differential expression - part 5

Intuition – model is fitted

gene_id CAF0006876

sample1 sample2 sample3 sample4 sample5 sample6 sample7 sample823171 22903 29227 24072 23151 26336 25252 24122

Sample9 sample10 sample11 sample12 sample13 sample14 sample15 sample1619527 26898 18880 24237 26640 22315 20952 25629

Condition A

Condition B

NB model is estimated:2 parameters: mean and

dispersion needed.

Page 10: RNA-seq for DE analysis: detecting differential expression - part 5

Intuition – difference is quantified

gene_id CAF0006876

sample1 sample2 sample3 sample4 sample5 sample6 sample7 sample823171 22903 29227 24072 23151 26336 25252 24122

Sample9 sample10 sample11 sample12 sample13 sample14 sample15 sample1619527 26898 18880 24237 26640 22315 20952 25629

Condition A

Condition B

NB model is estimated:2 parameters: mean and

dispersion needed.

Difference is put into p-value

Page 11: RNA-seq for DE analysis: detecting differential expression - part 5

BUT counts are dependent on

The read counts of a gene between different conditions, is dependent on (see first part): 1. Chance (NB model)2. Expression level3. Library size (number of reads in that library)4. Length of transcript5. GC content of the genes

Page 12: RNA-seq for DE analysis: detecting differential expression - part 5

Normalize for library size

Assumption: most genes are not DE between samples. DESeq calculates for every sample the 'effective library size' by a scale factor.

http://www.ncbi.nlm.nih.gov/pmc/articles/PMC3426807/

Rest of the genes

Rest of the genes

100%

100%

Page 13: RNA-seq for DE analysis: detecting differential expression - part 5

Normalize for library size

DESeq computes a scaling factor for a given sample by computing the median of the ratio, for each gene, of its read count over its geometric mean across all samples. It then uses the assumption that most genes are not DE and uses this median of ratios to obtain the scaling factor associated with this sample.

http://www.ncbi.nlm.nih.gov/pmc/articles/PMC3426807/

Original library size * scale factor = effective library size

DESeq will multiply original counts by the sample scaling factor.

DESeq: This normalization method [14] is included in the DESeq Bioconductor package (ver-sion 1.6.0) [14] and is based on the hypothesis that most genes are not DE. A DESeq scaling factor for a given lane is computed as the median of the ratio, for each gene, of its read count over its geometric mean across all lanes. The underlying idea is that non-DE genes should have similar read counts across samples, leading to a ratio of 1. Assuming most genes are not DE, the median of this ratio for the lane provides an estimate of the correction factor that should be applied to all read counts of this lane to fulfill the hypothesis

Page 14: RNA-seq for DE analysis: detecting differential expression - part 5

Normalize for library size

Geom Mean

24595……...……

1,1 1,2 0,9 1,0 1,2 0,8 0,85 1,00,9 1,0 1,2 0,8 0,85 1,0 1,1 1,21,1 1,2 0,9 1,0 1,2 0,8 0,85 1,01,0 1,2 0,8 0,85 1,0 1,2 1,1 0,81,1 1,0 1,2 0,8 0,85 1,0 0,85 1,00,8 0,85 1,01,1 1,2 0,9 1,0 1,2 1,2… … … … … … … …1,2 0,8 1,1 0,9 0,85 1,1 1,1 1,0

Divide eachcount bygeomean

Take medianper column

Page 15: RNA-seq for DE analysis: detecting differential expression - part 5

Other normalisations

● EdgeR: TMM, trimmed mean of M-values

Page 16: RNA-seq for DE analysis: detecting differential expression - part 5

Dispersion estimation

● For every gene, an NB is fitted based on the counts. The most important factor in that model to be estimated is the dispersion.

● DESeq2 applies three steps● Estimates dispersion parameter for each gene● Plots and fits a curve● Adjusts the dispersion parameter towards the

curve ('shrinking')

Page 17: RNA-seq for DE analysis: detecting differential expression - part 5

Dispersion estimation

1. Black dots: estimatedfrom normalized data.

2. Red line: curve fitted

3. blue dots: final assigned dispersion parameter for

that gene

Model is fit!

Page 18: RNA-seq for DE analysis: detecting differential expression - part 5

Test is run between conditions

If 2 conditions are compared, for each gene 2 NB models (one for each condition) are made, and a test (Wald test) decides whether the difference is significant (red in plot).

Significant (p-value < 0,01)Not significant

MA-plot: mean of countsversus the log2 fold change

between 2 conditions.

Page 19: RNA-seq for DE analysis: detecting differential expression - part 5

Test is run between conditions

If 2 conditions are compared, for each gene 2 NB models (one for each condition) are made, and a test (Wald test) decides whether the difference is significant (red in plot).

This means that we are going to perform 1000's

of tests.

If we set a cut-off on the p-value of 0,01 and we have performed

20000 tests (= genes), 1000 geneswill appear significant by chance.

Page 20: RNA-seq for DE analysis: detecting differential expression - part 5

Check the distribution of p-values

An enrichment (smaller or

Bigger) should be seen at low

P-values.

Other p-values should notshow a trend.

If the histogram of the p-values does not match a profile as shown below, the test is not reliable. Perhaps the NB fitting step did not succeed, or confounding variables are present.

Page 21: RNA-seq for DE analysis: detecting differential expression - part 5

Confounded distribution of p-values

Page 22: RNA-seq for DE analysis: detecting differential expression - part 5

Improve test results

A fraction isfalse positive

You set a cut-off of 0,05.

A fraction iscorrectly identified

as DE

Page 23: RNA-seq for DE analysis: detecting differential expression - part 5

Improve test results

We can improve testing by 2 measures:

● avoid testing: apply a filtering before testing, an independent filtering.

● apply a multiple testing correction

Page 24: RNA-seq for DE analysis: detecting differential expression - part 5

Independent filtering

Some scientists just remove genes with mean counts in the samples <10. But there is a more formal method to remove genes, in order to reduce the testing.

http://www.bioconductor.org/help/course-materials/2012/Bressanone2012/From this collection, read 2012-07-04-Huber-Multiple-testing-independent-filtering.pdf

Page 25: RNA-seq for DE analysis: detecting differential expression - part 5

Independent filtering

http://www.bioconductor.org/help/course-materials/2012/Bressanone2012/From this collection, read 2012-07-04-Huber-Multiple-testing-independent-filtering.pdf

Left a scatter plot of mean counts versus transformed p-values. The red line depicts a cut-off of 0,1. Note that genes with lower counts do not reach the p-value threshold. Some of them are save to exclude from testing.

Page 26: RNA-seq for DE analysis: detecting differential expression - part 5

Independent filtering

If we filter out increasingly bigger portions of genes based on theirmean counts, the number of significant genes increase.

Page 27: RNA-seq for DE analysis: detecting differential expression - part 5

Independent filtering

http://www.bioconductor.org/help/course-materials/2012/Bressanone2012/From this collection, read 2012-07-04-Huber-Multiple-testing-independent-filtering.pdf

See later (slide 30)

Choose the variable of interest.You can run it once on all to check the outcome.

Page 28: RNA-seq for DE analysis: detecting differential expression - part 5

Independent filtering

Page 29: RNA-seq for DE analysis: detecting differential expression - part 5

Multiple testing correction

Automatically in results: Benjamini/Hochberg correction, to control false discovery rate (FDR).

FDR is the fraction of false positives in the genes that are classified as DE.

If we set a threshold α of 0,05, 20% of the DE genes will be false positives.

Page 30: RNA-seq for DE analysis: detecting differential expression - part 5

Including different factors

Always remember your experimental setup and the goal. Summarize the setup in the sample descriptions file.

Yeast (=WT)

GDA (=G)

Yeast mutant (=UPC)

GDA + vit C (=AG)

Additional metadata (batchfactor)

Day 1 Day 1Day 2 Day 2

Page 31: RNA-seq for DE analysis: detecting differential expression - part 5

Including different factors

We provide a combination of factors(the model, GLM) which influence the counts. Every factor should match the

column name in the sample descriptions

The levels of the factors correspondingTo the 'base' or 'no perturbation'.

The fraction filtered out, determinedby the independent filter tool.

Adjusted p-value cut-off

Page 32: RNA-seq for DE analysis: detecting differential expression - part 5

Including different factors

The 'detect differential expression' tool gives you four results: the first is the report including graphs.

Only lower than cut-off and with indep filtering.

All genes, with indep filtering applied.

Complete DESeq results, without indep filtering applied.

Page 33: RNA-seq for DE analysis: detecting differential expression - part 5

Including different factors

Log2(FC) Log2(FC)Stan

dar

d E

rro

r (S

E) o

f Lo

gFC

Stan

dar

d E

rro

r (S

E) o

f Lo

gFC

Page 34: RNA-seq for DE analysis: detecting differential expression - part 5

Including different factors

Volcano plot: shows the DE genes with our given cut-off.

Page 35: RNA-seq for DE analysis: detecting differential expression - part 5

Comparing different conditions

Yeast (=WT)

GDA (=G)

Yeast mutant (=UPC)

GDA + vit C (=AG)

Day 1 Day 1Day 2 Day 2

Which genes are DE between UPC and WT?Which genes are DE between G and AG?Which genes are DE in WT between G and AG?

Page 36: RNA-seq for DE analysis: detecting differential expression - part 5

Comparing different conditions

Adjust the sample descriptions file and the model:

Remove these

Remove these

1. Which genes are DE between UPC and WT? 2. Which genes are DE between G and AG?3. Which genes are DE in WT between G and AG?

1. 2. 3.

Page 37: RNA-seq for DE analysis: detecting differential expression - part 5

Congratulations!

We have reached our goal!

Page 38: RNA-seq for DE analysis: detecting differential expression - part 5

Overview

http://www.nature.com/nprot/journal/v8/n9/full/nprot.2013.099.html

Page 39: RNA-seq for DE analysis: detecting differential expression - part 5

Reads

Page 40: RNA-seq for DE analysis: detecting differential expression - part 5

KeywordsEffective library size

dispersion

shrinking

Significantly differentially expressed

MA-plot

Alpha cut-off

Independent filtering

FDR

p-value

Write in your own words what the terms mean

Page 41: RNA-seq for DE analysis: detecting differential expression - part 5

Break