Skip to content
Snippets Groups Projects
Commit 9a6e3df9 authored by Luke Zappia's avatar Luke Zappia
Browse files

Fix errors in splatEstLib normality test

Fixes #48
parent 9d454224
No related branches found
No related tags found
No related merge requests found
Package: splatter
Type: Package
Title: Simple Simulation of Single-cell RNA Sequencing Data
Version: 1.5.0
Date: 2018-05-02
Version: 1.5.1
Date: 2018-06-12
Author: Luke Zappia
Authors@R:
c(person("Luke", "Zappia", role = c("aut", "cre"),
......
## Version 1.5.0 (2018-01-02)
## Version 1.5.1 (2018-06-12)
* Fix normality testing error in splatEstLib
* Correct p-value cutoff in normality test
* Sample library sizes for normality testing if > 5000 cells
## Version 1.5.0 (2018-05-02)
* Bioconductor 3.7 devel
# Version 1.4.0 (2018-01-02)
# Version 1.4.0 (2018-05-02)
* Bioconductor 3.7 release
......
......@@ -101,7 +101,7 @@ splatEstMean <- function(norm.counts, params) {
#' Estimate Splat library size parameters
#'
#' The Shapiro-Wilk test is used to determine if the library sizes are
#' The Shapiro-Wilks test is used to determine if the library sizes are
#' normally distributed. If so a normal distribution is fitted to the library
#' sizes, if not (most cases) a log-normal distribution is fitted and the
#' estimated parameters are added to the params object. See
......@@ -116,8 +116,17 @@ splatEstMean <- function(norm.counts, params) {
splatEstLib <- function(counts, params) {
lib.sizes <- colSums(counts)
norm.test <- shapiro.test(lib.sizes)
lib.norm <- norm.test$p.value < 0.05
if (length(lib.sizes) > 5000) {
message("NOTE: More than 5000 cells provided. ",
"5000 sampled library sizes will be used to test normality.")
lib.sizes.sampled <- sample(lib.sizes, 5000, replace = FALSE)
} else {
lib.sizes.sampled <- lib.sizes
}
norm.test <- shapiro.test(lib.sizes.sampled)
lib.norm <- norm.test$p.value > 0.2
if (lib.norm) {
fit <- fitdistrplus::fitdist(lib.sizes, "norm")
......
......@@ -15,7 +15,7 @@ splatEstLib(counts, params)
splatParams object with estimated values.
}
\description{
The Shapiro-Wilk test is used to determine if the library sizes are
The Shapiro-Wilks test is used to determine if the library sizes are
normally distributed. If so a normal distribution is fitted to the library
sizes, if not (most cases) a log-normal distribution is fitted and the
estimated parameters are added to the params object. See
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment