Learn R Programming

DR.SC (version 3.7)

RunWPCA: Run Weighted Principal Component Analysis

Description

Run a weighted PCA dimensionality reduction

Usage

RunWPCA(object, q=15)
  ### S3 method for class "Seurat"
  ## RunWPCA(object, q=15)
  
  ### S3 method for class "matrix"
  ## RunWPCA(object, q=15)
  
  ### S3 method for class "dgCMatrix"
  ## RunWPCA(object, q=15)

Value

For Seurat object, return a Seurat object. For objcet "matrix" and "dgCMatrix", return a object "matrix" with rownames same as the colnames of X, and colnames "WPCA1" to "WPCAq".

Arguments

object

an object named "Seurat", "maxtrix" or "dgCMatrix". The object of class "Seurat" must include slot "scale.data".

q

an optional positive integer, specify the number of features to be extracted.

Author

Wei Liu

Details

Nothing

References

Bai, J. and Liao, Y. (2017). Inferences in panel data with interactive effects using large covariance matrices. Journal of Econometrics, 200(1):59–78.

See Also

None

Examples

Run this code
if (FALSE) {
  library(Seurat)
  data(seu)
  ## log-normalization
  seu <- NormalizeData(seu)
  ##
  seu <- FindVariableFeatures(seu, nfeatures=80)
  ## Scale
  seu <- ScaleData(seu)
  ## Run WPCA
  seu <- RunWPCA(seu)
  seu
  ## Run tSNE based on wpca
  seu <- RunTSNE(seu, reduction='wpca')
  seu
  ## Find SVGs
  seu <- FindSVGs(seu, nfeatures=80)
  (genes <- topSVGs(seu, ntop=10))
  Idents(seu) <- factor(paste0("cluster", seu$true_clusters), levels=paste0("cluster",1:4))
  RidgePlot(seu, features = genes[1:2], ncol = 2)
  FeaturePlot(seu, features = genes[1:2], reduction = 'tsne' ,ncol=2)
  }

Run the code above in your browser using DataLab