cellrefiner.tl.contact_communication
- cellrefiner.tl.contact_communication(df_ligrec, adata, sem=None, contact_key='contacts', lr_delimiter='-', heteromeric_delimiter='_')[source]
Contact-base communication inference
- Parameters:
df_ligrec (DataFrame) – Dataframe where each row corresponds to a ligand-receptor pair with ligands, receptors, and the associated signaling pathways in the three columns, respectively.
adata (Anndata) – Anndata object, must contain cell-cell contact information in .obsp[contact_key] if sem is None.
sem (SEM, optional) –
Cell shape model object that contains cell-cell contact matrix and associated AnnData.
If provided, contact matrix will be obtained from sem.contact_matrix.
If both sem and adata are provided, adata parameter takes precedence.
contact_key (str, default 'contacts') – Key in adata.obsp containing the cell-cell contact matrix (csr_matrix).
lr_delimiter (str, default '-') – Delimiter used to construct ligand-receptor pair names in output.
heteromeric_delimiter (str, default '_') –
Delimiter used to separate subunits in heteromeric complexes within df_ligrec.
For example, if a receptor complex is ‘TGFBR1_TGFBR2’, this parameter should be ‘_’.
- Returns:
add .obsp[‘{ligand}{lr_delimiter}{receptor}’], contact-base communication matrix via ligand-receptor pairs (rows are sender cells, columns are receiver cells)
add .obsp[‘{pathway}’], pathway-level contact-base communication matrix
add .obsp[‘total’], sum of all pathway communication matrix
add .obsm[‘sender_signal’], dataFrame with sender communication strengths per cell
add .obsm[‘receiver_signal’], dataFrame with receiver communication strengths per cell
- add .uns[‘contact_signal_info’], metadata of the analysis
’lr_pair’: List of L-R pair names
’pathway’: List of pathway names
’total’: [‘total’]
’db’: Filtered ligand-receptor database
- Return type:
Sets the following fields in adata
Examples
>>> db_lr = cr.pp.ligand_receptor_database() >>> db_lr = cr.pp.filter_lr_database(db_lr,adata_cr, min_cell_pct=0.01) >>> cr.tl.contact_communication(db_lr, adata)