diff --git a/R/pgx-cluster.R b/R/pgx-cluster.R index 9a755676..44497f2e 100644 --- a/R/pgx-cluster.R +++ b/R/pgx-cluster.R @@ -272,7 +272,7 @@ pgx.FindClusters <- function(X, ## reduce dimensions ## X <- Matrix::head(X[order(apply(X, 1, stats::sd, na.rm = TRUE)), ], top.sd) - X <- Matrix::head(X[order(matrixStats::rowSds(X, na.rm = TRUE)), ], top.sd) + X <- Matrix::head(X[order(matrixStats::rowSds(X, na.rm = TRUE), decreasing = TRUE), ], top.sd) if (scale) { X <- t(scale(t(X))) ## scale features?? } @@ -282,7 +282,9 @@ pgx.FindClusters <- function(X, suppressMessages(suppressWarnings( out <- irlba::irlba(X, nv = npca) )) - X <- t(out$v) + ## weight by singular values: out$v alone is unit-norm (whitened), which + ## gives noise components the same weight as the dominant ones + X <- t(sweep(out$v, 2, out$d, "*")) } ## km.sizes <- c(2, 3, 4, 5, 7, 10, 15, 20, 25, 50, 100) @@ -293,7 +295,7 @@ pgx.FindClusters <- function(X, ## perform K-means if ("kmeans" %in% method) { message("perform K-means...") - km <- lapply(km.sizes, function(k) stats::kmeans(t(X), k, iter.max = 10)) + km <- lapply(km.sizes, function(k) stats::kmeans(t(X), k, iter.max = 10, nstart = 20)) km.idx <- do.call(cbind, lapply(km, function(r) r$cluster)) colnames(km.idx) <- paste0("kmeans.", km.sizes) index[["kmeans"]] <- km.idx diff --git a/man/getExampleFeatures.Rd b/man/getExampleFeatures.Rd index a8342120..98069d32 100644 --- a/man/getExampleFeatures.Rd +++ b/man/getExampleFeatures.Rd @@ -4,7 +4,7 @@ \alias{getExampleFeatures} \title{Return n example features (symbols) for given organism} \usage{ -getExampleFeatures(organism, n, protein.coding = TRUE, type = "SYMBOL") +getExampleFeatures(organism, n = 20, db = c("gprofiler", "orgdb")) } \description{ Return n example features (symbols) for given organism diff --git a/man/getOrganismGO.Rd b/man/getOrganismGO.Rd index 6a4b3e3e..0ed8804d 100644 --- a/man/getOrganismGO.Rd +++ b/man/getOrganismGO.Rd @@ -10,7 +10,8 @@ getOrganismGO( features = NULL, minsize = 3, batch_size = 2000, - db = c("annothub", "gprofiler") + db = c("annothub", "gprofiler"), + include_iea = TRUE ) } \description{ diff --git a/man/getSpeciesAliases.Rd b/man/getSpeciesAliases.Rd new file mode 100644 index 00000000..dfe3b5f0 --- /dev/null +++ b/man/getSpeciesAliases.Rd @@ -0,0 +1,11 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/pgx-annot-utils.R +\name{getSpeciesAliases} +\alias{getSpeciesAliases} +\title{Show all aliases} +\usage{ +getSpeciesAliases(species) +} +\description{ +Show all aliases +}