View source: R/nUniqueNeighDons.R
nUniqueNeighDons | R Documentation |
This function constructs a variable that for each event shows the number of donors in its nearest neighbor surroundings. It builds on the same idea as has been put forward in the Sconify package: -Burns TJ (2019). Sconify: A toolkit for performing KNN-based statistics for flow and mass cytometry data. R package version 1.4.0 and -Hart GT, Tran TM, Theorell J, Schlums H, Arora G, Rajagopalan S, et al. Adaptive NK cells in people exposed to Plasmodium falciparum correlate with protection from malaria. J Exp Med. 2019 Jun 3;216(6):1280–90. First, the k nearest neighbors are defined for cell x. Then, the number of donors in the k nearest neighbor cloud is returned.
nUniqueNeighDons(
donorData,
euclidSpaceData,
neighRows = seq_len(nrow(as.matrix(donorData))),
ctrlRows,
kNeighK = max(100, round(nrow(as.matrix(euclidSpaceData))/10000)),
kMeansK = max(1, round(nrow(as.matrix(euclidSpaceData))/1000))
)
donorData |
The donor information. |
euclidSpaceData |
The data cloud in which the nearest neighbors for the events should be identified. Can be a vector, matrix or dataframe. |
neighRows |
The rows in the dataset that correspond to the neighbors of the donorData points. This can be all the donorData points, or a subset, depending on the setup. |
ctrlRows |
Optionally, a set of control rows that are used to remove background signal from the neighRows data before sending the data back. |
kNeighK |
The number of nearest neighbors. |
kMeansK |
The number of clusters in the initial step of the algorithm. A higher number leads to shorter runtime, but potentially lower accuracy. |
An object of the same dimensions as donorData that has been smoothed.
data(testData)
data(testDataSNE)
euclidSpaceData <-
testData[, c(
"SYK", "CD16", "CD57", "EAT.2",
"CD8", "NKG2C", "CD2", "CD56"
)]
## Not run:
nDonorsVector <- nUniqueNeighDons(
donorData = as.numeric(testData$label),
euclidSpaceData
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.