spared.gene_features.get_glob_exp_frac

spared.gene_features.get_glob_exp_frac(adata: AnnData) AnnData[source]

Compute the global expression fraction for all genes.

This function computes the global expression fraction for each gene in a dataset.

The global expression fraction of a gene in a dataset is defined as the proportion of spots where that gene is expressed. It is a number between 0.0 and 1.0 where 0.0 means that the gene is not expressed in any spot and 1.0 means that the gene is expressed in all the spots. Its difference with the expression fraction is that the global expression fraction is computed for the whole dataset and not for each slide.

Parameters:

adata (ad.AnnData) – A slide collection where a non-expressed genes have a value of 0 in the adata.X matrix.

Returns:

The updated slide collection with the information added into the adata.var['glob_exp_frac'] column.

Return type:

ad.AnnData