R/get_prop_zero.R
get_prop_zero.Rd
This function calculates the Proportion Zero for each gene in each user defined group. Proportion Zero = number of zero counts for a gene for a group of cells/number of cells in the group.
get_prop_zero(sce, group_col = "cellType")
SummarizedExperiment-class object
name of the column in the
colData() of sce
that defines the group of interest.
A data.frame()
containing proportion of zero counts, genes as rows,
groups as columns.
For more information about calculating Proportion Zero, check equation 1 from the vignette in section "Calculate Proportion Zero and Pick Cutoff".
Other Proportion Zero functions:
filter_prop_zero()
## Basic Proportion counts == 0
rowSums(assays(sce_zero_test)$counts == 0) / ncol(sce_zero_test)
#> g100 g50 g0 gOffOn gVar
#> 1.00 0.50 0.00 0.50 0.47
## Get proportion by the default group "cellType"
get_prop_zero(sce_zero_test)
#> A B
#> g100 1.00 1.00
#> g50 0.48 0.52
#> g0 0.00 0.00
#> gOffOn 0.50 0.50
#> gVar 0.58 0.36
## Get proportion by user defined grouping of the data
get_prop_zero(sce_zero_test, group_col = "group")
#> A_Back A_Front B_Back B_Front
#> g100 1.00 1.00 1.00 1.00
#> g50 0.48 0.48 0.52 0.52
#> g0 0.00 0.00 0.00 0.00
#> gOffOn 0.60 0.40 0.60 0.40
#> gVar 0.48 0.68 0.32 0.40
## Groups with missing levels will be dropped
get_prop_zero(sce_zero_test, group_col = "cellType_na")
#> Warning: Dropping Empty Levels in group_col: cellType_na
#> A B
#> g100 1.00 1.00
#> g50 0.48 0.52
#> g0 0.00 0.00
#> gOffOn 0.50 0.50
#> gVar 0.58 0.36