Perform UMAP on the Adjacency Matrix of a Milo Object
miloUmap.Rd
This function uses uwot::umap
to perform UMAP dimensionality
reduction on the adjacency matrix of the KNN graph in a Milo object.
Usage
miloUmap(
milo,
slot_name = "UMAP_knngraph",
n_neighbors = 50L,
metric = "euclidean",
min_dist = 0.3,
...
)
Arguments
- milo
the milo object with knn graph that needed to conduct umap on.
- slot_name
character, with default 'UMAP_knngraph'.
The slot name in reduceDim where the result store
- n_neighbors
integer, with default 50L.
the size of local neighborhood (in terms of number of neighboring sample points) used for manifold approximation.
Here, the goal is to create large enough neighborhoods to capture the local manifold structure to allow for hypersampling.
- metric
character, with default 'euclidean'
the choice of metric used to measure distance to find nearest neighbors. Default is 'euclidean'.
- min_dist
numeric, with default 0.3
the minimum distance between points in the low dimensional space
- ...
other parameters passed to uwot::umap
Examples
data(sce_vdj)
# downsample to just 1000 cells
sce_vdj <- sce_vdj[, 1:1000]
sce_vdj <- setupVdjPseudobulk(sce_vdj,
already.productive = FALSE,
allowed_chain_status = c("Single pair", "Extra pair")
)
#> Checking productivity from productive_abT_VDJ, productive_abT_VJ ...
#> 744 of cells filtered
#> checking allowed chains...
#> 2 of cells filtered
#> VDJ data extraction begin:
#> extract_cols not specified, automatically generate colnames for extraction.
#> Extract main TCR from v_call_abT_VDJ, d_call_abT_VDJ, j_call_abT_VDJ, v_call_abT_VJ, j_call_abT_VJ ...
#> Complete.
#> Filtering cells from v_call_abT_VDJ_main, j_call_abT_VDJ_main, v_call_abT_VJ_main, j_call_abT_VJ_main ...
#> 7 of cells filtered
#> 247 of cells remain.
# Build Milo Object
milo_object <- miloR::Milo(sce_vdj)
milo_object <- miloR::buildGraph(milo_object,
k = 50, d = 20,
reduced.dim = "X_scvi"
)
#> Constructing kNN graph with k:50
milo_object <- miloR::makeNhoods(milo_object,
reduced_dims = "X_scvi", d = 20
)
#> Checking valid object
#> Running refined sampling with reduced_dim
# Construct UMAP on Milo Neighbor Graph
milo_object <- miloUmap(milo_object)