API

Fitting

Fitting Dirichlet-Multinomial(DMN) models and logNormal distributions of single-cell UMI counts.

tomas.fit.dmn(adata, groupby[, groups, tol, ...])

Fit Dirichlet-Multinomial distribution with UMI counts of homo-droplet populations.

Inference

Inferring heterotypic doublets and the total-mRNA ratios between two cell types.

tomas.infer.get_dbl_mg(adata, groupby[, ...])

Extract metagenes from raw UMI counts of heterotypic doublets.

tomas.infer.get_dbl_mg_bc(adata, groupby, ...)

Extract metagenes from raw UMI counts of a certain type of heterotypic doublets. :param adata: The (annotated) UMI count matrix of shape n_obs × n_vars. Rows correspond to droplets and columns to genes. :type adata: AnnData :param groupby: The key of the droplet categories stored in adata.obs. :type groupby: str :param groups: Specify two droplet categories, e.g. ['Homo-ct1', 'Homo-ct2'] annotated in adata.obs[groupby], which form the hetero-dbl of interest. :type groups: list of strings :param output: Path to save the results. :type output: path :param num_mg: Number of exclusive meta-genes. The default is 100. :type num_mg: int, optional :param kl_cutoff: DESCRIPTION. The default is 1. :type kl_cutoff: float, optional :param merging_threshold: Stop merging when alpha sum of metagenes exceeds the threshold in conterpart celltype. The default is 5. :type merging_threshold: float, optional :param skip_threshold: If adding a gene into current metegene leads to 'skip_threshold'-fold change of the std of alpha values, this gene is skipped. The default is 2. :type skip_threshold: float, optional :param alphaMin: Individual genes with alpha greater than the threshold are skipped in mergging step and considerted as a specifial metagene with one member gene. The default is 1. :type alphaMin: float, optional.

tomas.infer.ratios_bc(adata_mg, dblgroup[, ...])

Infer the total-mRNA ratio between two cell types given the heterotypic doublets composed by the two cell types.

tomas.infer.heteroDbl(adata, d_groupby, ...)

Identification and refinement of heterotypic doublets

tomas.infer.heteroDbl_bc(adata, dbl, ...[, ...])

Identification and refinement of a certain type of heterotypic doublets specified by "dbl".

Total-mRNA-ratio-aware analyses

Performing total-mRNA-ratio-aware analyses including differential expression (DE) analysis and gene set enrichment (GSEA) analysis (under construction).

tomas.lrt.total_mRNA_aware_DE(adata_rc, groupby)

Total-mRNA-aware differential expression analysis. :param adata_rc: The ratio-based corrected UMI counts. Rows correspond to droplets and columns to genes. :type adata_rc: AnnData :param groupby: The key of the droplet categories stored in adata.obs. :type groupby: str :param reference: One droplet category annotated in adata.obs[groupby]. Compare with respect to the specified group. :type reference: str :param groups: Droplet categories annotated in adata.obs[groupby] to which DE analysis shoudl be performed with. The default is None. :type groups: list, optional :param minCells: Minimum number of cells in one of the group. The default is 5. :type minCells: int, optional :param n_cores: Number of cpu cores be used. If not given, generally 80% cpu cores woueld be used. :type n_cores: int, optional :param pval_cutoff: Significance level. The default is 0.05. :type pval_cutoff: float, optional :param logFC_cutoff: Cutoff of log2-foldchange to tell the DE significance. The default is 0. :type logFC_cutoff: float, optional :param method: The method to perform DE analysis, such as 'wilcoxon' or 'lrt'. The default is 'wilcoxon'. :type method: str, optional.

tomas.lrt.extract_DE(adata[, pval_cutoff, ...])

Extract DE results from Anndata into a table.

tomas.lrt.summarize2DE(gs_df, lrt_df, group)

Compare and summarize two DE results.

Visualization

tomas.vis.UMI_hist(adata[, groupby, groups, ...])

Visualize the log-UMI-amount distribution.

tomas.vis.dmn_convergence(group, output[, ...])

Visualize the convergence of DMN optimation process.

tomas.vis.corrected_UMI_hist(adata, groupby, ...)

Compare raw log-UMI-amount distributions versus ratio-based corrected log-UMI-amount distributions.

tomas.vis.volcano_2DE(de_df[, marker_list, ...])

Plot the volcano plot of 2 DE results stored in 'de_df'.

tomas.vis.violin_2DE(adata_1, adata_2, genes)

Violin plot of gene expressions in global-scaling values and ratio-corrected values.

Auxiliary functions

tomas.auxi.correctUMI(adata, groupby[, ...])

Correct UMI to meet the estimated total-mRNA-ratio.

tomas.auxi.extract_specific_genes(...[, ...])

Extract specifically highly expressed genes of each cell type based on DE results.