factorizeMatrix {celda} | R Documentation

## Generate factorized matrices showing each feature's influence on cell / gene clustering

### Description

Generates factorized matrices showing the contribution of each feature in each cell population or each cell population in each sample.

### Usage

    factorizeMatrix(x, celdaMod, ...)

    ## S4 method for signature 'SingleCellExperiment,ANY'
    factorizeMatrix(
      x,
      useAssay = "counts",
      altExpName = "featureSubset",
      type = c("counts", "proportion", "posterior")
    )

    ## S4 method for signature 'matrix,celda_CG'
    factorizeMatrix(x, celdaMod, type = c("counts", "proportion", "posterior"))

    ## S4 method for signature 'matrix,celda_C'
    factorizeMatrix(x, celdaMod, type = c("counts", "proportion", "posterior"))

    ## S4 method for signature 'matrix,celda_G'
    factorizeMatrix(x, celdaMod, type = c("counts", "proportion", "posterior"))

### Arguments

`x` | Can be one of A SingleCellExperiment object returned by celda_C, celda_G or celda_CG, with the matrix located in the `useAssay` assay slot in `altExp(x, altExpName)`. Rows represent features and columns represent cells. Integer counts matrix. Rows represent features and columns represent cells. This matrix should be the same as the one used to generate `celdaMod`.
`celdaMod` | Celda model object. Only works if `x` is an integer counts matrix.
`...` | Ignored. Placeholder to prevent check warning.
`useAssay` | A string specifying which assay slot to use if `x` is a SingleCellExperiment object. Default "counts".
`altExpName` | The name for the altExp slot to use. Default "featureSubset".
`type` | Character vector. A vector containing one or more of "counts", "proportion", or "posterior". "counts" returns the raw number of counts for each factorized matrix. "proportions" returns the normalized probabilities for each factorized matrix, which are calculated by dividing the raw counts in each factorized matrix by the total counts in each column. "posterior" returns the posterior estimates which include the addition of the Dirichlet concentration parameter (essentially as a pseudocount). Default `"counts"`.

### Value

For celda_CG model, A list with elements for "counts", "proportions", or "posterior" probabilities. Each element will be a list containing factorized matrices for "module", "cellPopulation", and "sample". Additionally, the contribution of each module in each individual cell will be included in the "cell" element of "counts" and "proportions" elements.

For celda_C model, a list with elements for "counts", "proportions", or "posterior" probabilities. Each element will be a list containing factorized matrices for "module" and "sample".

For celda_G model, a list with elements for "counts", "proportions", or "posterior" probabilities. Each element will be a list containing factorized matrices for "module" and "cell".

### Examples

    data(sceCeldaCG)
    factorizedMatrices <- factorizeMatrix(sceCeldaCG, type = "posterior")
    data(celdaCGSim, celdaCGMod)
    factorizedMatrices <- factorizeMatrix(
      celdaCGSim$counts,
      celdaCGMod,
      "posterior")
    data(celdaCSim, celdaCMod)
    factorizedMatrices <- factorizeMatrix(
      celdaCSim$counts,
      celdaCMod, "posterior"
    )
    data(celdaGSim, celdaGMod)
    factorizedMatrices <- factorizeMatrix(
      celdaGSim$counts,
      celdaGMod, "posterior"
    )

[Package celda version 1.6.1 Index]