R/SingleCellClasses.R

#' The SingCellaR Class
#' The SingCellaR object stores all of information required for the analyses.
#' The followings are the description of slots.
#' 
#' @slot dir_path_10x_matrix is the path to the directory that contains 'barcodes.tsv','genes.tsv', and 'matrix.mtx' matrices generated by the 10x Genomics Cell Ranger software.
#' @slot sample_uniq_id is the unique name of the sample.
#' @slot genes.info contains the dataframe of gene information.
#' @slot meta.data contains the dataframe of cells information.
#' @slot regressout_matrix contain the normalised expression matrix (in log1p scale) that was regressed out the confounders.
#' @slot pca.result contains the PCA analysis result from the IRLBA package
#' @slot nnmf.result contains the NNMF analysis result.
#' @slot tsne.result contains the TSNE analysis result.
#' @slot diffusionmap.result contains the diffusionmap analysis result.
#' @slot umap.result contains the UMAP analysis result.
#' @slot lsi.result contans the LSI analysis result.
#' @slot knn_graph.graph contains the igraph object.
#' @slot knn_graph.layout contains the graph layout.
#' @slot knn_graph.kmeans.cluster contains the k-means clustering results derived from the 3D KNN graph layout.
#' @slot igraph.graph contains the igraph object.
#' @slot fa2_graph.layout contains the graph layout generated by the ForceAtlas2 software.
#' @slot sc.clusters contains the cluster information.
#' @slot marker.genes contains the list of identified marker genes per each cluster.
#' @slot GenesExpressionMatrixFile contains the file name of gene expression
#' @slot CellsMetaDataFile contains the dataframe of TARGET-seq cell information.
#' @slot dir_path_SingCellR_object_files contains the directory name that contains SingCellaR objects from multiple individual sample.
#' @slot SingCellR_object_files contains the vector of individual object names.
#' @slot Variable.genes contains the list of identified variable genes.
#' @slot SingCellaR.individual.clusters contains the list of identified clusters information per individual sample.
#' @slot GSEA.aligned.clusters contains the list of GSEA results per indentified clusters in individual sample.
#' @slot Scanorama.integrative.matrix contains Scannorama integrative matrix.
#' @slot Harmony.embeddings contains Harmony integrative embeddings.
#' @slot SupervisedHarmony.embeddings contains SupervisedHarmony integrative embeddings.
#' @slot Liger.embeddings contains Liger integrative embeddings.
#' @slot Seurat.embeddings contains Seurat integrative embeddings.
#' @slot Combat.embeddings contains Combat integrative embeddings.
#'

####Below is critical to make Rcpp functions work!. The Makevars description is also critical to add "PKG_CXXFLAGS += -DARMA_64BIT_WORD".
#' @name SingCellaR
#' @rdname SingCellaR
#' @aliases SingCellaR-class
#' @exportClass SingCellaR
#' @importFrom Rcpp sourceCpp
#' @importFrom RcppParallel RcppParallelLibs
#' @useDynLib SingCellaR, .registration=TRUE

setClass("SingCellaR",
    contains="SingleCellExperiment",
    slots = c(
    dir_path_10x_matrix = "character",
    sample_uniq_id="character",
    genes.info = "data.frame",
    meta.data  = "data.frame",
    regressout_matrix = "ANY",
    pca.result = "ANY",
    nnmf.result= "ANY",
    tsne.result = "ANY",
	  diffusionmap.result="ANY",
    umap.result ="ANY",
	  lsi.result="ANY",
    knn_graph.graph = "ANY",
    knn_graph.layout = "ANY",
    knn_graph.kmeans.cluster = "ANY",
    igraph.graph="ANY",
    fa2_graph.layout = "ANY",
    sc.clusters="ANY",
    marker.genes="ANY",
    GenesExpressionMatrixFile="character",
    CellsMetaDataFile="character",
    dir_path_SingCellR_object_files="character",
    SingCellR_object_files="character",
    Variable.genes="ANY",
    SingCellaR.individual.clusters="ANY",
    GSEA.aligned.clusters="ANY",
    Scanorama.integrative.matrix="ANY",
    Harmony.embeddings="ANY",
    SupervisedHarmony.embeddings="ANY",
    Liger.embeddings="ANY",
    Seurat.embeddings="ANY",
    Combat.embeddings="ANY"
    
  )
)

#' show method for SingCellaR
#' @param object A SingCellaR object
#' @name show
#' @aliases show,SingCellaR-method
#' @aliases show,SingCellaR_Int-method
#' @docType methods
#' @rdname show-methods
#' 
setMethod(
		f ="show",
		signature ="SingCellaR",
		definition = function(object) {
			cat(
					"An object of class",
					class(object),
					"with a matrix of :",
					dim(object)[1],
					"genes across",
					dim(object)[2],
					"samples.\n"
			)
			invisible(x = NULL)
		}
)
supatt-lab/SingCellaR documentation built on Aug. 24, 2023, 5:49 p.m.