View source: R/CellSimilarityToGenotypes.R
CellSimilarityToGenotypes | R Documentation |
Computes the fraction of matching variants between single cells in a Seurat object and the reference genotypes in a genotype object. Store this similarity measure in a new assay within the Seurat object.
CellSimilarityToGenotypes(
seurat,
genotype,
assay.name = "similarity",
prefix = "Similarity-",
features.use = "all",
assays = c("VAR", "REF", "ALT"),
layers = c("data", "data", "data")
)
seurat |
A seurat object |
genotype |
A genotype object |
assay.name |
character(1). The name under which the similarities are stored in the seurat object (Default: "similarity"). |
prefix |
character(1). A prefix appended to the genotype names to generate the feature names in the similarity assay (Default: "Similarity-"). |
features.use |
character(n). The features (i.e. variants) to be used for the similarity calculations. Can be a vector of variants by name, or NA to use informative variants if available, or "all" (Default: "all"). |
assays |
character(3). The name of the assays within the Seurat object that contain the variant calls (sparse matrix with values 1,2,3 in vartrix conventions), and counts of reference and alt alleles (Default: c("VAR","REF","ALT")). |
layers |
The layers to use within the assays above (Default: c("data","data","data")). |
The similarity is defined as the fraction of variants which have an identical call (i.e. ref/ref, alt/alt, or ref/alt) in individual cells compared to the reference genotype. Variants which are not covered by any read at the single cell level are ignored and do not contribute to the similarity value. Variants which are covered by only one read are always considered a match with a heterozygous reference genotype.
Returns the Seurat object
MySeuratObject <- CellSimilarityToGenotypes(MySeuratObject,MyGenotypes)
DefaultAssay(MySeuratObject) <- "similarity"
FeaturePlot(MySeuratObject,"Similarity-MyGenotypeName1")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.