The provided data can be a double matrix of expression data or a data.frame with all non-integer (double) columns being treated as expression data features (and the others ignored), an ExpressionSet, or a SingleCellExperiment.
DiffusionMap(data = stopifnot_distmatrix(distance), sigma = "local", k = find_dm_k(dataset_n_observations(data, distance) - 1L), n_eigs = min(20L, dataset_n_observations(data, distance) - 2L), density_norm = TRUE, ..., distance = c("euclidean", "cosine", "rankcor"), n_local = seq(to = min(k, 7L), length.out = min(k, 3L)), rotate = FALSE, censor_val = NULL, censor_range = NULL, missing_range = NULL, vars = NULL, verbose = !is.null(censor_range), suppress_dpt = FALSE)
data | Expression data to be analyzed and covariates. Provide |
---|---|
sigma | Diffusion scale parameter of the Gaussian kernel. One of |
k | Number of nearest neighbors to consider (default: a guess betweeen 100 and \(n - 1\). See |
n_eigs | Number of eigenvectors/values to return (default: 20) |
density_norm | logical. If TRUE, use density normalisation |
... | Unused. All parameters to the right of the |
distance | Distance measurement method applied to |
n_local | If |
rotate | logical. If TRUE, rotate the eigenvalues to get a slimmer diffusion map |
censor_val | Value regarded as uncertain. Either a single value or one for every dimension (Optional, default: censor_val) |
censor_range | Uncertainity range for censoring (Optional, default: none). A length-2-vector of certainty range start and end. TODO: also allow \(2\times G\) matrix |
missing_range | Whole data range for missing value model. Has to be specified if NAs are in the data |
vars | Variables (columns) of the data to use. Specifying NULL will select all columns (default: All floating point value columns) |
verbose | Show a progressbar and other progress information (default: do it if censoring is enabled) |
suppress_dpt | Specify TRUE to skip calculation of necessary (but spacious) information for |
A DiffusionMap object:
eigenvalues
Eigenvalues ranking the eigenvectors
eigenvectors
Eigenvectors mapping the datapoints to n_eigs
dimensions
sigmas
Sigmas object with either information about the find_sigmas heuristic run or just local or optimal_sigma.
data_env
Environment referencing the data used to create the diffusion map
eigenvec0
First (constant) eigenvector not included as diffusion component.
transitions
Transition probabilities. Can be NULL
d
Density vector of transition probability matrix
d_norm
Density vector of normalized transition probability matrix
k
The k parameter for kNN
n_local
The n_local
th nearest neighbor(s) is/are used to determine local kernel density
density_norm
Was density normalization used?
rotate
Were the eigenvectors rotated?
distance
Distance measurement method used
censor_val
Censoring value
censor_range
Censoring range
missing_range
Whole data range for missing value model
vars
Vars parameter used to extract the part of the data used for diffusion map creation
DiffusionMap-methods to get and set the slots. find_sigmas
to pre-calculate a fitting global sigma
parameter
#> DiffusionMap (20 Diffusion components and 428 observations) #> eigenvalues: Named num [1:20] 0.953 0.837 0.77 0.753 0.679 ... #> - attr(*, "names")= chr [1:20] "DC1" "DC2" "DC3" "DC4" ... #> eigenvectors: num [1:428, 1:20] 0.0506 0.0503 0.0427 0.0468 0.0497 ... #> ..colnames: chr [1:20] "DC1" "DC2" "DC3" "DC4" ... #> optimal_sigma: Named num [1:428] 7.69 7.63 9.19 6.76 6.35 ... #> - attr(*, "names")= chr [1:428] "10" "11" "12" "13" ... #> distance: chr "euclidean"#> finding knns......done. Time: 0.46s #> Calculating transition probabilities... | | | 0% | |======================================================================| 100%...done. Time: 0.11s #> #> performing eigen decomposition......done. Time: 0.05s#> DiffusionMap (20 Diffusion components and 428 observations) #> eigenvalues: Named num [1:20] 0.586 0.303 0.261 0.201 0.191 ... #> - attr(*, "names")= chr [1:20] "DC1" "DC2" "DC3" "DC4" ... #> eigenvectors: num [1:428, 1:20] -0.0491 -0.0512 -0.0422 -0.0403 -0.0462 ... #> ..colnames: chr [1:20] "DC1" "DC2" "DC3" "DC4" ... #> optimal_sigma: num 13 #> distance: chr "euclidean"covars <- data.frame(covar1 = letters[1:100]) dists <- dist(matrix(rnorm(100*10), 100)) DiffusionMap(covars, distance = dists)#> Error in `dimnames<-.dist`(`*tmp*`, value = dn): dimension of 'x' and length of 'value' do not conform