diff --git a/NAMESPACE b/NAMESPACE index bd162cd..c2071a9 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,8 +1,6 @@ # Generated by roxygen2: do not edit by hand export(get_num_cell_per_spot) -export(makeSeurat) -export(process_data) export(remove_mito_ribo) export(run_CCI) export(run_L_function) @@ -26,7 +24,6 @@ export(scFeatures) import(DelayedArray) import(EnsDb.Hsapiens.v79) import(EnsDb.Mmusculus.v79) -import(Seurat) import(SingleCellSignalR) import(dplyr) import(rmarkdown) @@ -41,8 +38,6 @@ importFrom(DelayedMatrixStats,rowMeans2) importFrom(DelayedMatrixStats,rowVars) importFrom(GSVA,gsva) importFrom(MatrixGenerics,colSums2) -importFrom(SpatialExperiment,spatialCoords) -importFrom(SummarizedExperiment,colData) importFrom(ape,Moran.I) importFrom(cli,cli_abort) importFrom(cli,cli_warn) diff --git a/man/get_num_cell_per_spot.Rd b/man/get_num_cell_per_spot.Rd index aed7c48..a97c308 100644 --- a/man/get_num_cell_per_spot.Rd +++ b/man/get_num_cell_per_spot.Rd @@ -5,17 +5,16 @@ \title{Estimate a relative number of cells per spot for spatial transcriptomics data} \usage{ -get_num_cell_per_spot(data) +get_num_cell_per_spot(alldata) } \arguments{ -\item{data}{spatial transcriptomics data in Seurat object.} +\item{alldata}{A list object containing spatial transcriptomics} } \value{ -the object with the relative number of cells/spot stored -in the \code{number_cells} attribute. +a vector with the relative number of cells in each spot. } \description{ -This function takes a spatial transcriptomics data as input +This function takes a list object containing spatial transcriptomics matrix as input and estimates the relative number of cells per spot in the data. The number of cells is estimated as the library size scaled to the range from 1 to 100. @@ -27,7 +26,7 @@ data("example_scrnaseq" , package = "scFeatures") data <- example_scrnaseq data$celltype <- NULL -data <- get_num_cell_per_spot(data) +number_of_cells <- get_num_cell_per_spot(data) } diff --git a/man/makeSeurat.Rd b/man/makeSeurat.Rd deleted file mode 100644 index 8cc5d5a..0000000 --- a/man/makeSeurat.Rd +++ /dev/null @@ -1,69 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/wrapper_run_scfeatures.R -\name{makeSeurat} -\alias{makeSeurat} -\title{Format data into Seurat object structured for scFeatures functions} -\usage{ -makeSeurat( - data, - sample = NULL, - celltype = NULL, - assay = NULL, - spatialCoords = NULL, - spotProbability = NULL -) -} -\arguments{ -\item{data}{input data, either a SingleCellExperiment or SpatialExperiment -object. -The object needs to contain a column named "sample" and a column named -"celltype". -Alternatively, user can provide the name of the column containing sample -and celltype into the \code{sample} and \code{celltype} argument. -When passing as SingleCellExperiment or SpatialExperiment, by default we -use the assay stored in "logcount". -Alternatively, user can specify the assay to use in the \code{assay} argument. -If users want to construct features from the spatial category, by default -we need columns called "x_cord" and "y_cord". -Alternatively, please specify the relevant column in the \code{spatialCoords} -argument. -For spot-based spatial transcriptomics, we also requires a matrix -containing cell type prediction probability of each spot, in the format of -celltype x spot} - -\item{sample}{a vector providing sample identifier for each cell. If not -provided, we assume the data contain a metadata column "sample" for running -scFeatures.} - -\item{celltype}{a vector providing celltype identifier. If not -provided, we assume the data contain a metadata column "celltype" for -running scFeatures.} - -\item{assay}{the assay identifier if using a SingleCellExperiment or -SpatialExperiment object.} - -\item{spatialCoords}{the spatialCoords identifiers provided in a list of -two vectors, if users want to construct features from the spatial category. -If not provided, we assume the data contain the metadata columns "x_cord" and -"y_cord" for constructing spatial features.} - -\item{spotProbability}{a matrix in the format of celltype x spot, where each -entry is the prediction probability of that cell type for each spot. This is -needed by spatial transcriptomics data.} -} -\value{ -A \code{Seurat} dataset containing required metadata for running scFeatures. -} -\description{ -This function is used to convert a SingleCellExperiment, SpatialExperiment or a -Seurat object into Seurat object containing all required fields and structured -for scFeatures functions. -} -\examples{ - - data("example_scrnaseq" , package = "scFeatures") - data <- example_scrnaseq - coordinate <- list(x = rep(1, ncol(data)), y = rep(1, ncol(data))) - data <- makeSeurat(data, spatialCoords = coordinate) - -} diff --git a/man/process_data.Rd b/man/process_data.Rd deleted file mode 100644 index 1c89fdc..0000000 --- a/man/process_data.Rd +++ /dev/null @@ -1,31 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/utils.R -\name{process_data} -\alias{process_data} -\title{data pre-processing} -\usage{ -process_data(data, normalise = TRUE) -} -\arguments{ -\item{data}{input data, a Seurat object.} - -\item{normalise}{a logical value indicating whether to normalize the data -or not. Default value is \code{TRUE}.} -} -\value{ -a Seurat object -} -\description{ -This function takes a Seurat object as input and does data -cleaning and pre-processing. For example, it replaces the "+" and "-" -signs in the \code{celltype} column with "plus" and "minus", respectively. -It also removes patients that have less than 10 cells across all cell types. -If the \code{normalise} argument is set to \code{TRUE}, the function will normalize -the data using the \code{Seurat::NormalizeData} function. -} -\examples{ -data("example_scrnaseq" , package = "scFeatures") -data <- example_scrnaseq -data <- process_data(data, normalise = FALSE) - -} diff --git a/man/remove_mito_ribo.Rd b/man/remove_mito_ribo.Rd index 88b07ab..5e379ab 100644 --- a/man/remove_mito_ribo.Rd +++ b/man/remove_mito_ribo.Rd @@ -4,13 +4,13 @@ \alias{remove_mito_ribo} \title{Remove mitochondrial and ribosomal genes, and other highly correlated genes} \usage{ -remove_mito_ribo(data) +remove_mito_ribo(alldata) } \arguments{ -\item{data}{A Seurat object containing expression data} +\item{data}{A list object containing expression data} } \value{ -The Seurat object with the mitochrondrial and ribosomal genes and other highly +The list object with the mitochrondrial and ribosomal genes and other highly correlated genes removed } \description{ diff --git a/man/run_CCI.Rd b/man/run_CCI.Rd index 37f5a3d..ec5c3e0 100644 --- a/man/run_CCI.Rd +++ b/man/run_CCI.Rd @@ -7,7 +7,7 @@ run_CCI(data, type = "scrna", ncores = 1) } \arguments{ -\item{data}{input data, a Seurat object containing \code{celltype} and \code{sample} label} +\item{data}{A list object containing \code{data} matrix and \code{celltype} and \code{sample} vector.} \item{type}{input data type, either scrna, spatial_p, or spatial_t} @@ -29,7 +29,11 @@ It supports scRNA-seq. data("example_scrnaseq" , package = "scFeatures") data <- example_scrnaseq[1:50, 1:20] +celltype <- data$celltype +sample <- data$sample +data <- data@assays$RNA@data -feature_CCI <- run_CCI(data, type = "scrna" , ncores = 1 ) +alldata <- list(data = data, celltype = celltype, sample = sample ) +feature_CCI <- run_CCI(alldata, type = "scrna" , ncores = 1 ) } diff --git a/man/run_L_function.Rd b/man/run_L_function.Rd index a268cc5..b180d26 100644 --- a/man/run_L_function.Rd +++ b/man/run_L_function.Rd @@ -7,7 +7,7 @@ run_L_function(data, type = "spatial_p", ncores = 1) } \arguments{ -\item{data}{A Seurat object containing \code{celltype} and \code{sample} label} +\item{data}{A list object containing \code{data} matrix and \code{celltype} and \code{sample} vector.} \item{type}{The type of dataset, either "scrna", "spatial_t", or "spatial_p".} @@ -27,13 +27,15 @@ The function supports spatial proteomics and spatial transcriptomics. \examples{ data("example_scrnaseq" , package = "scFeatures") -data <- example_scrnaseq - +celltype <- example_scrnaseq$celltype +data <- example_scrnaseq@assays$RNA@data +sample <- sample( c("patient1", "patient2", "patient3"), ncol(data) , replace= TRUE ) x <- sample(1:100, ncol(data) , replace = TRUE) y <- sample(1:100, ncol(data) , replace = TRUE) -data <- makeSeurat(data, spatialCoords = list(x,y)) -data$sample <- sample( c("patient1", "patient2", "patient3"), ncol(data) , replace= TRUE ) +spatialCoords <- list( x , y) +alldata <- list(data = data, sample = sample, celltype = celltype, +spatialCoords = spatialCoords ) -feature_L_function <- run_L_function(data, type = "spatial_p", ncores = 1) +feature_L_function <- run_L_function(alldata, type = "spatial_p", ncores = 1) } diff --git a/man/run_Morans_I.Rd b/man/run_Morans_I.Rd index d90d2ff..1a613da 100644 --- a/man/run_Morans_I.Rd +++ b/man/run_Morans_I.Rd @@ -7,7 +7,7 @@ run_Morans_I(data, type = "spatial_p", ncores = 1) } \arguments{ -\item{data}{A Seurat object containing \code{celltype} and \code{sample} label} +\item{data}{A list object containing \code{data} matrix and \code{celltype} and \code{sample} vector.} \item{type}{The type of dataset, either "scrna", "spatial_t", or "spatial_p".} @@ -31,17 +31,15 @@ The function supports spatial proteomics and spatial transcriptomics. data("example_scrnaseq" , package = "scFeatures") data <- example_scrnaseq[1:50, 1:20] - +celltype <- data$celltype +data <- data@assays$RNA@data +sample <- sample( c("patient1", "patient2", "patient3"), ncol(data) , replace= TRUE ) x <- sample(1:100, ncol(data) , replace = TRUE) y <- sample(1:100, ncol(data) , replace = TRUE) -data <- makeSeurat(data, spatialCoords = list(x,y)) -data$sample <- sample( c("patient1", "patient2", "patient3"), ncol(data) , replace= TRUE ) - -feature_celltype_interaction <- run_celltype_interaction( - data, - type = "spatial_p", ncores = 1 -) +spatialCoords <- list( x , y) +alldata <- list(data = data, sample = sample, celltype = celltype, +spatialCoords = spatialCoords ) -feature_Morans_I <- run_Morans_I(data, type = "spatial_p", ncores = 1) +feature_Morans_I <- run_Morans_I(alldata, type = "spatial_p", ncores = 1) } diff --git a/man/run_celltype_interaction.Rd b/man/run_celltype_interaction.Rd index e74c8cb..953e0ed 100644 --- a/man/run_celltype_interaction.Rd +++ b/man/run_celltype_interaction.Rd @@ -7,7 +7,7 @@ run_celltype_interaction(data, type = "spatial_p", ncores = 1) } \arguments{ -\item{data}{A Seurat object containing \code{celltype} and \code{sample} label} +\item{data}{A list object containing \code{data} matrix and \code{celltype} and \code{sample} vector.} \item{type}{The type of dataset, either "scrna", "spatial_t", or "spatial_p".} @@ -31,15 +31,17 @@ The function supports spatial proteomics and spatial transcriptomics. data("example_scrnaseq" , package = "scFeatures") data <- example_scrnaseq[1:50, 1:20] - +celltype <- data$celltype +data <- data@assays$RNA@data +sample <- sample( c("patient1", "patient2", "patient3"), ncol(data) , replace= TRUE ) x <- sample(1:100, ncol(data) , replace = TRUE) y <- sample(1:100, ncol(data) , replace = TRUE) -data <- makeSeurat(data, spatialCoords = list(x,y)) -data$sample <- sample( c("patient1", "patient2", "patient3"), ncol(data) , replace= TRUE ) +spatialCoords <- list( x , y) +alldata <- list(data = data, sample = sample, celltype = celltype, +spatialCoords = spatialCoords ) feature_celltype_interaction <- run_celltype_interaction( - data, - type = "spatial_p", ncores = 1 + alldata, type = "spatial_p", ncores = 1 ) } diff --git a/man/run_gene_cor.Rd b/man/run_gene_cor.Rd index 5152c39..b174569 100644 --- a/man/run_gene_cor.Rd +++ b/man/run_gene_cor.Rd @@ -13,7 +13,7 @@ run_gene_cor( ) } \arguments{ -\item{data}{A Seurat object containing \code{celltype} and \code{sample} label} +\item{data}{A list object containing \code{data} matrix and \code{celltype} and \code{sample} vector.} \item{type}{The type of dataset, either "scrna", "spatial_t", or "spatial_p".} @@ -41,9 +41,13 @@ and spatial transcriptomics. data("example_scrnaseq" , package = "scFeatures") data <- example_scrnaseq[1:50, 1:20] +celltype <- data$celltype +sample <- data$sample +data <- data@assays$RNA@data +alldata <- list(data = data, celltype = celltype, sample = sample ) feature_gene_cor <- run_gene_cor( - data, type = "scrna", num_top_gene = 5, ncores = 1 + alldata, type = "scrna", num_top_gene = 5, ncores = 1 ) } diff --git a/man/run_gene_cor_celltype.Rd b/man/run_gene_cor_celltype.Rd index 87885a3..2a7fb8d 100644 --- a/man/run_gene_cor_celltype.Rd +++ b/man/run_gene_cor_celltype.Rd @@ -13,7 +13,7 @@ run_gene_cor_celltype( ) } \arguments{ -\item{data}{A Seurat object containing \code{celltype} and \code{sample} label} +\item{data}{A list object containing \code{data} matrix and \code{celltype} and \code{sample} vector.} \item{type}{The type of dataset, either "scrna", "spatial_t", or "spatial_p".} @@ -46,9 +46,14 @@ num_top_gene parameter (defaults to 100). data("example_scrnaseq" , package = "scFeatures") data <- example_scrnaseq[1:50, 1:20] +celltype <- data$celltype +sample <- data$sample +data <- data@assays$RNA@data - feature_gene_cor_celltype <- run_gene_cor_celltype( - data, +alldata <- list(data = data, celltype = celltype, sample = sample ) + +feature_gene_cor_celltype <- run_gene_cor_celltype( + alldata, type = "scrna", num_top_gene = 5, ncores = 1 ) diff --git a/man/run_gene_mean.Rd b/man/run_gene_mean.Rd index 37369c9..7f7b5dd 100644 --- a/man/run_gene_mean.Rd +++ b/man/run_gene_mean.Rd @@ -13,7 +13,7 @@ run_gene_mean( ) } \arguments{ -\item{data}{A Seurat object containing \code{celltype} and \code{sample} label} +\item{data}{A list object containing \code{data} matrix and \code{celltype} and \code{sample} vector.} \item{type}{The type of dataset, either "scrna", "spatial_t", or "spatial_p".} @@ -41,9 +41,13 @@ and spatial transcriptomics. data("example_scrnaseq" , package = "scFeatures") data <- example_scrnaseq +celltype <- data$celltype +sample <- data$sample +data <- data@assays$RNA@data +alldata <- list(data = data, celltype = celltype, sample = sample ) feature_gene_mean <- run_gene_mean( - data, + alldata, type = "scrna", num_top_gene = 150, ncores = 1 ) diff --git a/man/run_gene_mean_celltype.Rd b/man/run_gene_mean_celltype.Rd index 02609a3..902b56d 100644 --- a/man/run_gene_mean_celltype.Rd +++ b/man/run_gene_mean_celltype.Rd @@ -13,7 +13,7 @@ run_gene_mean_celltype( ) } \arguments{ -\item{data}{A Seurat object containing \code{celltype} and \code{sample} label} +\item{data}{A list object containing \code{data} matrix and \code{celltype} and \code{sample} vector.} \item{type}{The type of dataset, either "scrna", "spatial_t", or "spatial_p".} @@ -46,9 +46,14 @@ the num_top_gene parameter (defaults to 100). data("example_scrnaseq" , package = "scFeatures") data <- example_scrnaseq[, 1:20] +celltype <- data$celltype +sample <- data$sample +data <- data@assays$RNA@data - feature_gene_mean_celltype <- run_gene_mean_celltype( - data, +alldata <- list(data = data, celltype = celltype, sample = sample ) + +feature_gene_mean_celltype <- run_gene_mean_celltype( + alldata, type = "scrna", num_top_gene = 100, ncores = 1 ) diff --git a/man/run_gene_prop.Rd b/man/run_gene_prop.Rd index 8bd2016..35c3726 100644 --- a/man/run_gene_prop.Rd +++ b/man/run_gene_prop.Rd @@ -13,7 +13,7 @@ run_gene_prop( ) } \arguments{ -\item{data}{A Seurat object containing \code{celltype} and \code{sample} label} +\item{data}{A list object containing \code{data} matrix and \code{celltype} and \code{sample} vector.} \item{type}{The type of dataset, either "scrna", "spatial_t", or "spatial_p".} @@ -41,7 +41,11 @@ and spatial transcriptomics. data("example_scrnaseq" , package = "scFeatures") data <- example_scrnaseq[1:50, 1:20] +celltype <- data$celltype +sample <- data$sample +data <- data@assays$RNA@data -feature_gene_prop <- run_gene_prop(data, type = "scrna", num_top_gene = 1500, ncores = 1) +alldata <- list(data = data, celltype = celltype, sample = sample ) +feature_gene_prop <- run_gene_prop(alldata, type = "scrna", num_top_gene = 1500, ncores = 1) } diff --git a/man/run_gene_prop_celltype.Rd b/man/run_gene_prop_celltype.Rd index 3c85bf9..516b863 100644 --- a/man/run_gene_prop_celltype.Rd +++ b/man/run_gene_prop_celltype.Rd @@ -13,7 +13,7 @@ run_gene_prop_celltype( ) } \arguments{ -\item{data}{A Seurat object containing \code{celltype} and \code{sample} label} +\item{data}{A list object containing \code{data} matrix and \code{celltype} and \code{sample} vector.} \item{type}{The type of dataset, either "scrna", "spatial_t", or "spatial_p".} @@ -46,9 +46,14 @@ num_top_gene parameter (defaults to 100). data("example_scrnaseq" , package = "scFeatures") data <- example_scrnaseq[, 1:20] +celltype <- data$celltype +sample <- data$sample +data <- data@assays$RNA@data - feature_gene_prop_celltype <- run_gene_prop_celltype( - data, +alldata <- list(data = data, celltype = celltype, sample = sample ) + +feature_gene_prop_celltype <- run_gene_prop_celltype( + alldata, type = "scrna", num_top_gene = 100, ncores = 1 ) diff --git a/man/run_nn_correlation.Rd b/man/run_nn_correlation.Rd index 6ef9697..077ac57 100644 --- a/man/run_nn_correlation.Rd +++ b/man/run_nn_correlation.Rd @@ -7,7 +7,7 @@ run_nn_correlation(data, type = "spatial_p", num_top_gene = NULL, ncores = 1) } \arguments{ -\item{data}{A Seurat object containing \code{celltype} and \code{sample} label} +\item{data}{A list object containing \code{data} matrix and \code{celltype} and \code{sample} vector.} \item{type}{The type of dataset, either "scrna", "spatial_t", or "spatial_p".} @@ -31,14 +31,16 @@ This function supports spatial proteomics, and spatial transcriptomics. data("example_scrnaseq" , package = "scFeatures") data <- example_scrnaseq[1:50, 1:20] +celltype <- data$celltype +data <- data@assays$RNA@data +sample <- sample( c("patient1", "patient2", "patient3"), ncol(data) , replace= TRUE ) x <- sample(1:100, ncol(data) , replace = TRUE) y <- sample(1:100, ncol(data) , replace = TRUE) -data <- makeSeurat(data, spatialCoords = list(x,y)) -data$sample <- sample( c("patient1", "patient2", "patient3"), ncol(data) , replace= TRUE ) - +spatialCoords <- list( x , y) +alldata <- list(data = data, sample = sample, celltype = celltype, +spatialCoords = spatialCoords ) feature_nn_correlation <- run_nn_correlation( - data, - type = "spatial_p", ncores = 1 + alldata, type = "spatial_p", ncores = 1 ) } diff --git a/man/run_pathway_gsva.Rd b/man/run_pathway_gsva.Rd index f7a3a1b..cdb2985 100644 --- a/man/run_pathway_gsva.Rd +++ b/man/run_pathway_gsva.Rd @@ -15,7 +15,7 @@ run_pathway_gsva( ) } \arguments{ -\item{data}{A Seurat object containing \code{celltype} and \code{sample} label} +\item{data}{A list object containing \code{data} matrix and \code{celltype} and \code{sample} vector.} \item{method}{Type of pathway analysis method, currently support \code{ssgsea} and \code{aucell}} @@ -56,9 +56,14 @@ in a list format. data("example_scrnaseq" , package = "scFeatures") data <- example_scrnaseq[, 1:20] +celltype <- data$celltype +sample <- data$sample +data <- data@assays$RNA@data - feature_pathway_gsva <- run_pathway_gsva( - data, +alldata <- list(data = data, celltype = celltype, sample = sample ) + +feature_pathway_gsva <- run_pathway_gsva( + alldata, geneset = NULL, species = "Homo sapiens", type = "scrna", subsample = FALSE, ncores = 1 ) diff --git a/man/run_pathway_mean.Rd b/man/run_pathway_mean.Rd index d7a5f72..1e68889 100644 --- a/man/run_pathway_mean.Rd +++ b/man/run_pathway_mean.Rd @@ -13,7 +13,7 @@ run_pathway_mean( ) } \arguments{ -\item{data}{A Seurat object containing \code{celltype} and \code{sample} label} +\item{data}{A list object containing \code{data} matrix and \code{celltype} and \code{sample} vector.} \item{geneset}{By default (when the \code{geneset} argument is not specified), we use the 50 hallmark gene set from msigdb. @@ -45,7 +45,11 @@ Alternatively, users can provide their own gene sets of interest in a list forma data("example_scrnaseq" , package = "scFeatures") data <- example_scrnaseq[1:50, 1:20] +celltype <- data$celltype +sample <- data$sample +data <- data@assays$RNA@data +alldata <- list(data = data, celltype = celltype, sample = sample ) feature_pathway_mean <- run_pathway_mean( data, geneset = NULL, species = "Homo sapiens", diff --git a/man/run_pathway_prop.Rd b/man/run_pathway_prop.Rd index b7265c2..d91c30a 100644 --- a/man/run_pathway_prop.Rd +++ b/man/run_pathway_prop.Rd @@ -13,7 +13,7 @@ run_pathway_prop( ) } \arguments{ -\item{data}{A Seurat object containing \code{celltype} and \code{sample} label} +\item{data}{A list object containing \code{data} matrix and \code{celltype} and \code{sample} vector.} \item{geneset}{By default (when the \code{geneset} argument is not specified), we use the 50 hallmark gene set from msigdb. @@ -45,9 +45,14 @@ Alternatively, users can provide their own gene sets of interest in a list forma data("example_scrnaseq" , package = "scFeatures") data <- example_scrnaseq[1:20, 1:20] +celltype <- data$celltype +sample <- data$sample +data <- data@assays$RNA@data - feature_pathway_prop <- run_pathway_prop( - data, +alldata <- list(data = data, celltype = celltype, sample = sample ) + +feature_pathway_prop <- run_pathway_prop( + alldata, geneset = NULL, species = "Homo sapiens", type = "scrna", ncores = 1 ) diff --git a/man/run_proportion_logit.Rd b/man/run_proportion_logit.Rd index b84025c..5198a84 100644 --- a/man/run_proportion_logit.Rd +++ b/man/run_proportion_logit.Rd @@ -7,7 +7,7 @@ run_proportion_logit(data, type = "scrna", ncores = 1) } \arguments{ -\item{data}{A Seurat object containing \code{celltype} and \code{sample} label} +\item{data}{A list object containing \code{data} matrix and \code{celltype} and \code{sample} vector.} \item{type}{The type of dataset, either "scrna", "spatial_t", or "spatial_p".} @@ -28,9 +28,14 @@ The function returns a dataframe with samples as rows and cell types as columns. \examples{ data("example_scrnaseq" , package = "scFeatures") data <- example_scrnaseq[1:50, 1:20] +celltype <- data$celltype +sample <- data$sample +data <- data@assays$RNA@data + +alldata <- list(data = data, celltype = celltype, sample = sample ) feature_proportion_logit <- run_proportion_logit( - data, + alldata, type = "scrna", ncores = 1 ) diff --git a/man/run_proportion_ratio.Rd b/man/run_proportion_ratio.Rd index a202be0..c2cf7d1 100644 --- a/man/run_proportion_ratio.Rd +++ b/man/run_proportion_ratio.Rd @@ -7,7 +7,7 @@ run_proportion_ratio(data, type = "scrna", ncores = 1) } \arguments{ -\item{data}{A Seurat object containing \code{celltype} and \code{sample} label} +\item{data}{A list object containing \code{data} matrix and \code{celltype} and \code{sample} vector.} \item{type}{The type of dataset, either "scrna", "spatial_t", or "spatial_p".} @@ -30,8 +30,14 @@ The function returns a dataframe with samples as rows and cell types as columns. data("example_scrnaseq" , package = "scFeatures") data <- example_scrnaseq[1:50, 1:20] +celltype <- data$celltype +sample <- data$sample +data <- data@assays$RNA@data + +alldata <- list(data = data, celltype = celltype, sample = sample ) + feature_proportion_ratio <- run_proportion_ratio( - data, + alldata, type = "scrna", ncores = 1 ) diff --git a/man/run_proportion_raw.Rd b/man/run_proportion_raw.Rd index 5403e9a..bb6b89f 100644 --- a/man/run_proportion_raw.Rd +++ b/man/run_proportion_raw.Rd @@ -7,7 +7,7 @@ run_proportion_raw(data, type = "scrna", ncores = 1) } \arguments{ -\item{data}{A Seurat object containing \code{celltype} and \code{sample} label} +\item{data}{A list object containing \code{data} matrix and \code{celltype} and \code{sample} vector.} \item{type}{The type of dataset, either "scrna", "spatial_t", or "spatial_p".} @@ -28,8 +28,14 @@ The function returns a dataframe with samples as rows and cell types as columns. data("example_scrnaseq" , package = "scFeatures") data <- example_scrnaseq[1:50, 1:20] +celltype <- data$celltype +sample <- data$sample +data <- data@assays$RNA@data + +alldata <- list(data = data, celltype = celltype, sample = sample ) + feature_proportion_raw <- run_proportion_raw( - data, + alldata, type = "scrna", ncores = 1 ) diff --git a/man/scFeatures.Rd b/man/scFeatures.Rd index 35ffd0c..b43efd4 100644 --- a/man/scFeatures.Rd +++ b/man/scFeatures.Rd @@ -5,24 +5,30 @@ \title{Wrapper function to run all feature types in scFeatures} \usage{ scFeatures( - data, + data = NULL, + sample = NULL, + celltype = NULL, + spatialCoords = NULL, + spotProbability = NULL, feature_types = NULL, type = "scrna", ncores = 1, species = "Homo sapiens", celltype_genes = NULL, aggregated_genes = NULL, - geneset = NULL, - sample = NULL, - celltype = NULL, - assay = NULL, - spatialCoords = NULL + geneset = NULL ) } \arguments{ \item{data}{input data, a Seurat object containing "sample" and "celltype" column. "x_cord" and "y_cord" is also required for constructing the features in the spatial metrics category.} +\item{sample}{the sample identifier if using a SingleCellExperiment} + +\item{celltype}{the celltype identifier if using a SingleCellExperiment} + +\item{spatialCoords}{the spatialCoords identifiers if using a SingleCellExperiment} + \item{feature_types}{vector containing the name of the feature types to generate, options are "proportion_raw", "proportion_logit" , "proportion_ratio", "gene_mean_celltype", "gene_prop_celltype", "gene_cor_celltype", @@ -48,13 +54,7 @@ If no value is provided, the top variable genes will be used} \item{geneset}{the geneset of interest for celltype specific pathway feature category If no value is provided, the 50 hallmark pathways will be used} -\item{sample}{the sample identifier if using a SingleCellExperiment} - -\item{celltype}{the celltype identifier if using a SingleCellExperiment} - \item{assay}{the assay identifier if using a SingleCellExperiment} - -\item{spatialCoords}{the spatialCoords identifiers if using a SingleCellExperiment} } \value{ a list of dataframes containing the generated feature matrix in the form of sample x features