Skip to content

Commit

Permalink
Add solutions to QC exercises we discussed
Browse files Browse the repository at this point in the history
  • Loading branch information
lcolladotor committed Mar 26, 2020
1 parent 2740c7f commit 8824df4
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions R/03-quality-control.R
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,44 @@ plot(
abline(h = attr(discard.mito, "thresholds")["higher"], col = "red")


## Exercise answers

### Why does emptyDrops() return NA values?

## Below lower & test.ambient = FALSE
## 0 "total" (even with test.ambient = TRUE)
with(all.out, table(
'NA pvalue' = is.na(PValue),
'Total is 0?' = Total == 0
))

### Are the p-values the same for e.out and all.out?
## Answers from the group: Yes: 4, No: 6
identical(e.out$PValue, all.out$PValue)

## What if you subset to the non-NA entries?
identical(
e.out$PValue[!is.na(all.out$FDR)],
all.out$PValue[!is.na(all.out$FDR)]
)
## false
identical(
e.out$PValue[!is.na(e.out$FDR)],
all.out$PValue[!is.na(e.out$FDR)]
)
## true
with(e.out, table(
'NA pvalue' = is.na(PValue),
'Total is <= 100' = Total <= 100
))

## We talked about the importance of setting the random seed
## using set.seed() before running any function that has
## a random component. Otherwise your results will not be
## reproducible and you'll never know if they didn't
## reproduce because of the random seed or because some
## other code changed in the function you are running.

## ----marking, cache=TRUE, dependson='use_case'-----------------------------------------------------------------------
# Removing low-quality cells
# Keeping the columns we DON'T want to discard
Expand Down

0 comments on commit 8824df4

Please sign in to comment.