Skip to content

Commit

Permalink
now normalizeSparaseEset returnes eset with dgCMatrix
Browse files Browse the repository at this point in the history
  • Loading branch information
QingfeiPan committed Aug 14, 2024
1 parent 0685034 commit 3a77678
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
21 changes: 16 additions & 5 deletions R/manipulate_sparseEset.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#' @title SparseExpressionSet
#' @exportClass SparseExpressionSet
#' @import Biobase
#'
methods::setClass(Class = "SparseExpressionSet",
contains = "ExpressionSet",
prototype = methods::prototype(methods::new("VersionedBiobase", versions = c(Biobase::classVersion("ExpressionSet"), SparseExpressionSet = "1.0.0" )))
Expand Down Expand Up @@ -35,9 +36,20 @@ methods::setClass(Class = "SparseExpressionSet",
#'
#' @examples
#' data("pbmc14k_rawCount")
#' ## 1. Create SparseEset object solely from raw count matrix
#' pbmc14k_raw.eset <- createSparseEset(input_matrix = pbmc14k_rawCount,
#' projectID = "PBMC14k",
#' addMetaData = TRUE)
#'
#' ## 2. Create SparseEset with customized meta data
#' true_label <- read.table(system.file("extdata/demo_pbmc14k/PBMC14k_trueLabel.txt.gz", package = "scMINER"),
#' header = T, row.names = 1, sep = "\t", quote = "", stringsAsFactors = FALSE)
#' pbmc14k_raw.eset <- createSparseEset(input_matrix = pbmc14k_rawCount,
#' cellData = true_label,
#' featureData = NULL,
#' projectID = "PBMC14k",
#' addMetaData = TRUE)
#'
createSparseEset <- function(input_matrix,
do.sparseConversion = TRUE,
cellData = NULL,
Expand Down Expand Up @@ -155,6 +167,7 @@ createSparseEset <- function(input_matrix,
#' addSurfix = NULL,
#' addMetaData = TRUE,
#' imputeNA = TRUE)
#'
combineSparseEset <- function(eset_list,
projectID = NULL,
addPrefix = NULL,
Expand Down Expand Up @@ -285,13 +298,11 @@ combineSparseEset <- function(eset_list,
#' @export
#'
#' @examples
#' true_label <- read.table(system.file("extdata/demo_pbmc14k/PBMC14k_trueLabel.txt.gz", package = "scMINER"),
#' header = T, row.names = 1, sep = "\t", quote = "", stringsAsFactors = FALSE)
#' pbmc14k_raw.eset <- createSparseEset(input_matrix = pbmc14k_rawCount,
#' cellData = true_label,
#' featureData = NULL,
#' data("pbmc14k_expression.eset")
#' pbmc14k_raw.eset <- updateSparseEset(input_eset = pbmc14k_expression.eset,
#' projectID = "PBMC14k",
#' addMetaData = TRUE)
#'
updateSparseEset <- function(input_eset,
dataMatrix = NULL,
cellData = NULL,
Expand Down
7 changes: 7 additions & 0 deletions R/read_input.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#' featureType = "gene_symbol",
#' removeSuffix = TRUE,
#' addPrefix = "demoSample")
#'
readInput_10x.dir <- function(input_dir,
featureType = "gene_symbol",
removeSuffix = TRUE, addPrefix = NULL)
Expand Down Expand Up @@ -145,6 +146,7 @@ readInput_10x.dir <- function(input_dir,
#' featureType = "gene_symbol",
#' removeSuffix = TRUE,
#' addPrefix = "demoSample")
#'
readInput_10x.h5 <- function(h5_file,
featureType = "gene_symbol",
removeSuffix = TRUE,
Expand Down Expand Up @@ -252,6 +254,7 @@ readInput_10x.h5 <- function(h5_file,
#' sparseMatrix <- readInput_h5ad(h5ad_file,
#' removeSuffix = FALSE,
#' addPrefix = "demoSample")
#'
readInput_h5ad <- function(h5ad_file,
removeSuffix = FALSE, addPrefix = NULL)
{
Expand Down Expand Up @@ -322,6 +325,7 @@ readInput_h5ad <- function(h5ad_file,
#' is.geneBYcell = TRUE,
#' removeSuffix = FALSE,
#' addPrefix = "demoSample")
#'
readInput_table <- function(table_file, sep = "\t", is.geneBYcell = TRUE,
removeSuffix = FALSE, addPrefix = NULL)
{
Expand Down Expand Up @@ -378,8 +382,11 @@ readInput_table <- function(table_file, sep = "\t", is.geneBYcell = TRUE,
#' @export
#'
#' @examples
#' \dontrun{
#' scminer_dir <- createProjectSpace(project_dir = "path-to-a-folder",
#' project_name = "PBMC14k")
#' }
#'
createProjectSpace <- function(project_dir,
project_name,
do.unlink = FALSE)
Expand Down

0 comments on commit 3a77678

Please sign in to comment.