Skip to content

Commit

Permalink
fix: use R-squared instead of Pearson correlation coefficient (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
mcanouil authored Dec 26, 2023
1 parent 10f58fb commit b1aa4b2
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 10 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Type: Package
Package: NACHO
Title: NanoString Quality Control Dashboard
Version: 2.0.5
Version: 2.0.6
Authors@R:
c(person(given = "Mickaël",
family = "Canouil",
Expand Down
7 changes: 7 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# NACHO 2.0.6

## Fixes

- In `R/qc_positive_control.R`,
- fix: use R-squared instead of Pearson correlation coefficient. ([#48](https://github.com/mcanouil/NACHO/issues/48))

# NACHO 2.0.5

## Fixes
Expand Down
12 changes: 5 additions & 7 deletions R/autoplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -316,14 +316,13 @@ plot_metrics <- function(
list(
ggplot2::geom_point(
data = ~ .x[!(is_outlier)],
size = size, width = 0.25, na.rm = TRUE,
size = size, na.rm = TRUE,
position = ggplot2::position_jitter(width = 0.25, height = 0)
),
ggplot2::geom_point(
data = ~ .x[(is_outlier)],
size = size * outliers_factor,
colour = "#b22222",
width = 0.25,
na.rm = TRUE,
position = ggplot2::position_jitter(width = 0.25, height = 0)
),
Expand All @@ -338,7 +337,7 @@ plot_metrics <- function(
)
} else {
ggplot2::geom_point(
size = size, width = 0.25, na.rm = TRUE,
size = size, na.rm = TRUE,
position = ggplot2::position_jitter(width = 0.25, height = 0)
)
}
Expand Down Expand Up @@ -449,14 +448,13 @@ plot_cg <- function(
list(
ggplot2::geom_point(
data = ~ .x[!(is_outlier)],
size = size, width = 0.25, na.rm = TRUE,
size = size, na.rm = TRUE,
position = ggplot2::position_jitter(width = 0.25, height = 0)
),
ggplot2::geom_point(
data = ~ .x[(is_outlier)],
size = size * outliers_factor,
colour = "#b22222",
width = 0.25,
na.rm = TRUE,
position = ggplot2::position_jitter(width = 0.25, height = 0)
),
Expand All @@ -471,7 +469,7 @@ plot_cg <- function(
)
} else {
ggplot2::geom_point(
size = size, width = 0.25, na.rm = TRUE,
size = size, na.rm = TRUE,
position = ggplot2::position_jitter(width = 0.25, height = 0)
)
}
Expand Down Expand Up @@ -1131,7 +1129,7 @@ plot_norm <- function(
) +
ggplot2::geom_line(
mapping = ggplot2::aes(colour = .data[["Name"]], group = .data[["Name"]]),
size = size,
linewidth = size,
na.rm = TRUE
) +
ggplot2::facet_grid(cols = ggplot2::vars(.data[["Status"]])) +
Expand Down
8 changes: 6 additions & 2 deletions R/qc_positive_control.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@
#'
#' @return [[numeric]]
qc_positive_control <- function(counts) {
measured <- log2(counts[["Count"]])
if (any(counts[["Count"]] %in% 0)) {
measured <- log2(counts[["Count"]] + 1)
} else {
measured <- log2(counts[["Count"]])
}
known <- log2(as.numeric(sub("^[^(]*\\((.*)\\)$", "\\1", counts[["Name"]]))) # plexset value: "32"
correlation <- stats::cor.test(known, measured)$estimate
correlation <- summary(stats::lm(measured ~ known))$r.squared
unname(round(correlation, 5))
}
Binary file modified data/GSE74821.rda
Binary file not shown.

0 comments on commit b1aa4b2

Please sign in to comment.