mechanochat.preprocessing.filter_lr_database#
- mechanochat.preprocessing.filter_lr_database(df_ligrec: DataFrame, adata: AnnData, heteromeric: bool = True, heteromeric_delimiter: str = '_', heteromeric_rule: Literal['min', 'ave'] = 'min', filter_criteria: Literal['min_cell_pct', 'min_cell'] = 'min_cell_pct', min_cell: int = 100, min_cell_pct: float = 0.05) DataFrame[source]#
Filter ligand-receptor pairs.
- Parameters:
df_ligrec (
pandas.DataFrame) – The pandas dataframe of ligand-receptor database with three columns being ligand, receptor, and pathway name respectively.adata (
Anndata) – The AnnData object of gene expression. Unscaled data (minimum being zero) is expected.heteromeric (
bool) – Whether the ligands and receptors are described as heteromeric.heteromeric_delimiter (
str) – If heteromeric notations are used for ligands and receptors, the character separating the heteromeric units.heteromeric_rule (
str) – When heteromeric is True, the rule to quantify the level of a heteromeric ligand or receptor. Choose from minimum (‘min’) and average (‘ave’).filter_criteria (
str) – Use either cell percentage (‘min_cell_pct’) or cell numbers (min_cell) to filter genes.min_cell (
int) – If filter_criteria is ‘min_cell’, the LR-pairs with both ligand and receptor detected in greater than or equal to min_cell cells are kept.min_cell_pct (
float) – If filter_criteria is ‘min_cell_pct’, the LR-pairs with both ligand and receptor detected in greater than or equal to min_cell_pct percentage of cells are kepts.
- Returns:
df_ligrec_filtered (
pandas.DataFrame) – A pandas DataFrame of the filtered ligand-receptor pairs. Columns: ‘Ligands’, ‘Receptor’, ‘Pathway’, ‘Type’