View source: R/navigate_space.R
navigate_space | R Documentation |
Prioritize spatial locations involved in a complex biological process by training a machine-learning model to predict sample labels (e.g., disease vs. control, treated vs. untreated, or time post-stimulus), and evaluate the performance of the model in cross-validation.
navigate_space( input, meta = NULL, coords = NULL, k = 50, label_col = "label", coord_cols = c("coord_x", "coord_y"), n_subsamples = 50, subsample_size = 20, folds = 3, var_quantile = 0.5, feature_perc = 0.5, n_threads = 32, show_progress = T, augur_mode = c("default", "velocity"), classifier = c("rf", "lr"), rf_params = list(trees = 100, mtry = 2, min_n = NULL, importance = "accuracy"), lr_params = list(mixture = 1, penalty = "auto") )
input |
a matrix, data frame, or |
meta |
optionally, a data frame containing metadata about the
|
coords |
optionally, a data frame containing the spatial coordinates
for each barcode in the |
k |
the number of spatial nearest-neighbors to use in the AUC
calculation; defaults to |
label_col |
the column of the |
coord_cols |
the names of the columns in the |
n_subsamples |
the number of times to repeat the cross-validation
procedure for each barcode; defaults to |
subsample_size |
the number of barcodes to randomly sample from among
the nearest neighbors in each iteration of the cross-validation procedure;
cannot be greater than |
folds |
the number of folds of cross-validation to run; defaults to
|
var_quantile |
the quantile of highly variable genes to retain using
the variable gene filter (select_variance);
defaults to |
feature_perc |
the proportion of genes that are randomly selected as
features for input to the classifier in each subsample using the
random gene filter (select_random); defaults to |
n_threads |
the number of threads to use for parallelization;
defaults to |
show_progress |
if |
augur_mode |
one of |
classifier |
the classifier to use in calculating area under the curve,
one of |
rf_params |
for
|
lr_params |
for
|
If a Seurat
object is provided as input, Magellan will use the default
assay (i.e., whatever GetAssayData returns) as input. To
use a different assay, provide the expression matrix and metadata as input
separately, using the input
and meta
arguments.
Additionally, Magellan will assume the coordinates of the spatial barcodes
can be found in input@images$slice1@coordinates
. To override this,
specify the count matrix, metadata, and coordinates separately.
a list of class "Magellan"
, containing the following items:
parameters
: the parameters provided to this function as input
results
: the area under the curve for each barcode, in each
fold, in each subsample, in the comparison of interest, as well as a
series of other classification metrics
AUC
: a summary of the mean AUC for each barcode (for
continuous experimental conditions, this is replaced by a CCC
item that records the mean concordance correlation coefficient for each
barcode)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.