writeSCMM: Read and write single cell sparse matrix

View source: R/ngsio.R

writeSCMMR Documentation

Read and write single cell sparse matrix

Description

Read and write gene cell sparse matrix for single cell experiment.

Usage

  writeSCMM(x, file)
  readSCMM(file)

Arguments

x

matrix with rownames as gene ids and colnames as cells

file

character(1): the filename of output matrix with ‘.mtx’ as extension.

Details

The corresponding colnames and rownames of the matrix are saved in ‘.colNames’ and ‘.rowNames’ files within the same folder of ‘.mtx’ folder.

Value

Invisible file for writeSCMM.

dgCMatrix of the gene cell count matrix for readSCMM.

Author(s)

Ge Tan

Examples

  x <- matrix(c(2,0,0,0,0,1,0,0), ncol=2,
              dimnames=list(c("gene1", "gene2", "gene3", "gene4"),
                            c("cell1", "cell2")))
  file <- tempfile(pattern = "countMatrix", fileext = ".mtx")
  writeSCMM(x, file)
  x2 <- readSCMM(file)

uzh/ezRun documentation built on Dec. 26, 2024, 9:53 a.m.