Skip to content
This repository has been archived by the owner on Jun 12, 2022. It is now read-only.

Commit

Permalink
fix cell composition cluster and pca components higher than sample size
Browse files Browse the repository at this point in the history
  • Loading branch information
mcanouil committed May 3, 2019
1 parent 0c7b68a commit ae03004
Show file tree
Hide file tree
Showing 11 changed files with 8 additions and 7 deletions.
Empty file modified CARoT.Rproj
100644 → 100755
Empty file.
Empty file modified DESCRIPTION
100644 → 100755
Empty file.
Empty file modified LICENSE
100644 → 100755
Empty file.
Empty file modified NAMESPACE
100644 → 100755
Empty file.
Empty file modified NEWS.md
100644 → 100755
Empty file.
15 changes: 8 additions & 7 deletions R/qc_idats.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ ggplot2::ggplot(
linetype = 2,
na.rm = TRUE
) +
ggplot2::labs(x = "CpGs", y = "Call Rate", caption = "Only CPGs with a call aate stricly below 100 % are shown") +
ggplot2::labs(x = "CpGs", y = "Call Rate", caption = "Only CpGs with a call rate strictly below 100 % are shown") +
ggplot2::scale_y_continuous(label = scales::percent) +
ggplot2::scale_x_continuous(label = scales::comma)
```
Expand Down Expand Up @@ -431,7 +431,7 @@ cell_comp <- switch(
cat("No method defined yet")
},
{
estimate_k_cluster <- function(Rmat, max_k = 10, n_cores = 1) {
estimate_k_cluster <- function(Rmat, max_k = 25, n_cores = 1) {
svdRmat <- RefFreeEWAS::svdSafe(Rmat)
tmp <- do.call("rbind", parallel::mclapply(
X = 0:max_k,
Expand Down Expand Up @@ -470,10 +470,11 @@ cell_comp <- switch(
)
}
beta_matrix <- minfi::getBeta(data_mset)
max_k <- min(ncol(beta_matrix), 25)
k_estimated <- min(estimate_k_cluster(
Rmat = beta_matrix,
max_k = 25,
n_cores = min(params[["n_cores"]], 25)
max_k = max_k,
n_cores = min(params[["n_cores"]], max_k)
)$best)
mu0 <- RefFreeEWAS::RefFreeCellMixInitialize(
Y = minfi::getBeta(data_mset),
Expand Down Expand Up @@ -712,7 +713,7 @@ data_mset@metadata <- list(cnbeta = norm_beta)
```

```{r export}
readr::write_rds(x = data_mset, path = paste0(output_directory, "/", script_name, "_mset.rds"))
readr::write_rds(x = data_mset, path = paste0(output_directory, "/", params[["array"]], "_mset.rds"))
```

```{r pca}
Expand All @@ -734,8 +735,8 @@ for (ibeta in seq_along(list_beta)) {
design = minfi::pData(data_mset),
id_var = "Sample_ID",
technical_vars = pca_vars,
n_comp = 10,
fig_n_comp = 3,
n_comp = min(10, ncol(data_batch[[names(list_beta)[ibeta]]])),
fig_n_comp = min(3, ncol(data_batch[[names(list_beta)[ibeta]]])),
title_level = 4
)
cat("\n")
Expand Down
Empty file modified README.Rmd
100644 → 100755
Empty file.
Empty file modified README.md
100644 → 100755
Empty file.
Empty file modified _pkgdown.yml
100644 → 100755
Empty file.
Empty file modified appveyor.yml
100644 → 100755
Empty file.
Empty file modified codecov.yml
100644 → 100755
Empty file.

0 comments on commit ae03004

Please sign in to comment.