Generate a sample-level count matrix based on landmark assay and its weighted.nn object
Source:R/scslide_sample_level.R
GenerateSampleObject.RdReturns summed counts of weighted.nn for each landmark cell within each sample.
Usage
GenerateSampleObject(
object,
nn.name = NULL,
k.nn = 5,
sketch.assay = "LANDMARK",
return.seurat = TRUE,
new_assay_name = "LMC",
group.by = "ident",
normalization.method = "ChiSquared",
scale.factor = 10000,
rename.group.by = NULL,
add.meta.data = TRUE,
cells.use = NULL,
verbose = TRUE,
...
)Arguments
- object
Seurat object
- nn.name
Name of the Neighbor object to use for the calculation (e.g.
"weighted.nn"as produced byFindmmNN/PrepareSampleObject, or"single.nn"as produced byFindsmNN). IfNULL(default), the function auto-detects a Neighbor object named"weighted.nn"or"single.nn"; if both are present it errors and asks you to specify this parameter.- k.nn
the number of nearest neighbors to perform the summing
- sketch.assay
the name of the sketch.assay you used to perform the FindmmNN()
- return.seurat
Whether to return the data as a Seurat object. Default is TRUE
- new_assay_name
Name for the new assay containing landmark counts
- group.by
A single meta-data column to group cells by (e.g. Donor ID); 'ident' by default. To group on a combination of columns, add a merged column to the object beforehand and pass that, e.g.
object$batch_rep <- paste(object$batch, object$replicate, sep = "_").- normalization.method
Method for normalization. Supports LogNormalize and ChiSquared. see details at
NormalizeDataandNormalizeChiSquared- scale.factor
Scale factor for Log-Normalization, see
NormalizeData- rename.group.by
if rename.group.by is NULL, the rownames of the landmark matrix will used the original cell IDs. But, user can indicate which meta-data column to use to rename the rows. A suffix of "_LM" + order number will be added automatically.
- add.meta.data
if TRUE, the function will automatically detect sample-level meta-data (based on 'group.by') and append it to the sample-level object; if FALSE, it will not do so.
- cells.use
An optional character vector of cell names to subset before building the sample-level matrix. When non-NULL, only cells in this vector (that are also present in the NN object) are retained. Default is NULL (use all cells).
- verbose
Print progress and diagnostic messages
- ...
Arguments to be passed to methods such as
CreateSeuratObject