-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* format the indentations and also get rid of the seed * more styling to be consistent
- Loading branch information
Showing
22 changed files
with
758 additions
and
669 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,26 @@ | ||
#' .determine.multiscale.space | ||
#' | ||
#' | ||
#' @param diffusionmap DiffusionMap object | ||
#' @param n_eigs integer, default is NULL. Number of eigen vectors to use. | ||
#' - If is not specified, the number of eigen vectors will be determined using the eigen gap. | ||
#' - If is not specified, the number of eigen vectors will be determined using the eigen gap. | ||
#' @returns dataframe | ||
.determine.multiscale.space <- function(diffusionmap, n_eigs = NULL) { | ||
.class.check(diffusionmap, "DiffusionMap") | ||
requireNamespace("destiny") | ||
eigenvect <- destiny::eigenvectors(diffusionmap) | ||
eigenval <- destiny::eigenvalues(diffusionmap) | ||
# determine n_eigs | ||
if (is.null(n_eigs)) { | ||
val_gaps <- eigenval[2:length(eigenval) - 1] - eigenval[2:length(eigenval)] | ||
n_eigs <- order(val_gaps)[length(val_gaps)] | ||
if (n_eigs < 3) { | ||
n_eigs <- order(val_gaps)[length(val_gaps) - 1] | ||
.class.check(diffusionmap, "DiffusionMap") | ||
requireNamespace("destiny") | ||
eigenvect <- destiny::eigenvectors(diffusionmap) | ||
eigenval <- destiny::eigenvalues(diffusionmap) | ||
# determine n_eigs | ||
if (is.null(n_eigs)) { | ||
val_gaps <- eigenval[2:length(eigenval) - 1] - eigenval[2:length(eigenval)] | ||
n_eigs <- order(val_gaps)[length(val_gaps)] | ||
if (n_eigs < 3) { | ||
n_eigs <- order(val_gaps)[length(val_gaps) - 1] | ||
} | ||
} | ||
} | ||
# Scale the data | ||
use_eigs <- seq(1, n_eigs) | ||
eigenvect <- eigenvect[, use_eigs] | ||
eigenval <- eigenval[use_eigs] | ||
multis <- apply(eigenvect, 1, `*`, (eigenval/(1 - eigenval))) | ||
return(data.frame(t(multis))) | ||
} | ||
# Scale the data | ||
use_eigs <- seq(1, n_eigs) | ||
eigenvect <- eigenvect[, use_eigs] | ||
eigenval <- eigenval[use_eigs] | ||
multis <- apply(eigenvect, 1, `*`, (eigenval / (1 - eigenval))) | ||
return(data.frame(t(multis))) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.