campbio / celda

Bayesian Hierarchical Modeling for Clustering Single Cell Genomic Data
http://bioconductor.org/packages/celda
MIT License
148 stars 27 forks source link

Does decontX() gives out a correct count matrix? #269

Closed piyushjo15 closed 4 years ago

piyushjo15 commented 4 years ago

Hi. I was trying to use decontX on my data and compare it to uncorrected data. While I see that each cell has been assigned a contamination score, in my analysis, I don't see any change in the UMI count of the cells. If there was some correction going on, shouldn't the count matrix change after running the function?

zhewa commented 4 years ago

Hi @piyushjo15

The following commands should give you what you want.

If x is a matrix object:

dec <- decontX(x)
decontaminatedCounts <- dec$decontXcounts

if x is a SingleCellExperiment object:

dec <- decontX(x)
decontaminatedCounts <- decontXcounts(dec)

You can check the details in the documentation of decontX function by typing ?decontX in R. I'll paste some of the documentation here for your reference.

If x is a matrix-like object, a list will be returned with the following items:

decontXcounts: The decontaminated matrix. Values obtained from the variational inference procedure may be non-integer. However, integer counts can be obtained by rounding, e.g. round(decontXcounts).

contamination: Percentage of contamination in each cell.

estimates: List of estimated parameters for each batch. If z was not supplied, then the UMAP coordinates used to generated cell cluster labels will also be stored here.

z: Cell population/cluster labels used for analysis.

runParams: List of arguments used in the function call.

If x is a SingleCellExperiment, then the decontaminated counts will be stored as an assay and can be accessed with decontXcounts(x). The contamination values and cluster labels will be stored in colData(x). estimates and runParams will be stored in metadata(x)$decontX. If z was not supplied, then the UMAPs used to generated cell cluster labels will be stored in reducedDims slot in x

piyushjo15 commented 4 years ago

Thanks!