Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
because Roy told me to. :)
Otherwise I can't push, of course.
  • Loading branch information
Czarnewski committed Dec 3, 2020
2 parents 5a5fa54 + 6337c9d commit 80868e7
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 5 deletions.
Binary file added data/deseq_dispersion.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion lab_dge.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ Overdispersion is the reason why RNA-Seq data is better modelled as negative-bin
The log fold change is computed from the corrected count values as such:

```
FC = (corrected counts group B - corrected counts group A) / corrected counts group A
FC = corrected counts group B / corrected counts group A
logFC = log2(FC)
```

Expand Down
27 changes: 23 additions & 4 deletions slide_dge.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -86,29 +86,48 @@ sizeFactors(d)
```

---
name: dge-dispersion
name: dge-dispersion-1

## Dispersion

- Dispersion is a measure of variability in gene expression for a given mean
- Dispersion is unreliable for low mean counts

```{r,fig.height=4,fig.width=8,echo=FALSE}
cv <- function(x) sd(x)/mean(x)
rowCv <- function(x) apply(x,1,cv)
{
par(mfrow=c(1,2))
plot(x=log10(rowMeans(cf)+1),y=log10(rowVars(as.matrix(cf))),xlab="Log10 Mean counts",ylab="Log10 Mean Variance")
plot(x=log10(rowMeans(cf)+1),y=log10(rowCv(as.matrix(cf))),xlab="Log10 Mean counts",ylab="Log10 Mean CV")
par(mfrow=c(1,1))
}
```


---
name: dge-dispersion-2

## Dispersion

- Genes with similar mean values must have similar dispersion
- Estimate likely (ML) dispersion for each gene based on counts
- Fit a curve through the gene-wise estimates
- Shrink dispersion towards the curve

```{r,fig.height=3,fig.width=3}
d <- DESeq2::estimateDispersions(d)
{par(mar=c(4,4,1,1))
plotDispEsts(d)}
```

![](data/deseq_dispersion.png)

---
name: dge-test

## Testing

- Log2 fold changes changes are computed after GLM fitting
- Log2 fold changes changes are computed after GLM fitting `FC = counts group B / counts group A`

```{r}
dg <- nbinomWaldTest(d)
Expand Down

0 comments on commit 80868e7

Please sign in to comment.