senid.extrinsic

Functions

senchat(adata, sender_label[, receiver_label, ...])

Calculate all interaction scores with respect to a specified lbel.

calculate_interaction_scores_for_lr_pair(adata, ...[, ...])

Calculate all interaction scores for a specified ligand-receptor pair

constrain_senchat_interactions(adata, senchat_output_key)

subset_for_communication(adata, senchat_output_key[, ...])

run_cnmf(output_dir, adata_fname, output_name, n_modules)

infer_consensus_modules(adata_cnmf, output_dir, ...[, ...])

calculate_ligand_enrichment(adata[, spectra_tpm_key])

Package Contents

senid.extrinsic.senchat(adata, sender_label, receiver_label=None, sender_groups=None, receiver_groups=None, output_key='SenChat_output', model='human', use_highly_variable=False, highly_variable_key=None, stringency='neither', min_signal_proportion=0.1, filter_small_groups=False, min_cell_proportion=0.001, test_permutation=False, n_perms=100, return_df=False, n_jobs=1, score_method='v1', perm_method='v1')[source]

Calculate all interaction scores with respect to a specified lbel.

Parameters:
  • adata (AnnData) – Annotated data matrix containing expression data.

  • group_label (str) – Key in adata.obs containing the group label.

  • model (str) – The model organism. Options are ‘mouse’ or ‘human’.

  • use_highly_variable (bool) – Whether to use highly variable genes. If True, then you need to have previously determined which genes are highly variable, i.e., the information shoudl be contained in adata.var[highly_variable_key].

  • highly_variable_key (Optional[str]) – Key in adata.var containing the highly variable genes. If None, then the highly variable genes are not used.

  • min_proportion (float) – Minimum proportion of cells expressing the ligand or receptor to be considered as a potential sender or receiver.

  • test_permutation (bool) – Whether to calculate an associated p-value for the interaction scores using permutation testing.

  • n_perms (int) – Number of permutations to use for permutation testing

  • sender_label (str)

  • receiver_label (Optional[str])

  • sender_groups (Optional[List[str]])

  • receiver_groups (Optional[List[str]])

  • output_key (str)

  • stringency (Optional[str])

  • min_signal_proportion (float)

  • filter_small_groups (bool)

  • min_cell_proportion (float)

  • return_df (bool)

  • n_jobs (int)

  • score_method (Literal['v1', 'v2'])

  • perm_method (Literal['v1', 'v2'])

Returns:

DataFrame containing the interaction scores across all ligand-receptor interaction pairs and potentially interacting groups

Return type:

pd.DataFrame

senid.extrinsic.calculate_interaction_scores_for_lr_pair(adata, ligand, receptor, sender_label, receiver_label=None, sender_groups=None, receiver_groups=None, downstream_tf=None, pathway=None, pathway_type=None, is_neurotransmitter=None, min_signal_proportion=0.1, filter_small_groups=False, min_cell_proportion=0.001, test_permutation=False, n_perms=100, score_method='v1', perm_method='v1')[source]

Calculate all interaction scores for a specified ligand-receptor pair

Parameters:
  • adata (AnnData) – Annotated data matrix containing expression data.

  • sender_label (str) – Key in adata.obs containing the group label.

  • group1 (str) – Name of the first group.

  • group2 (str) – Name of the second group.

  • ligand_receptor_pairs (pd.DataFrame) – DataFrame containing ligand-receptor pairs.

  • interaction_score_method (str) – Method to calculate the interaction score. Options are “geometric_mean” or “arithmetic_mean”.

  • tf_expression (Optional[Union[str, np.ndarray]]) – Key in adata.obs containing the expression of a downstream transcription factor. If None, the interaction score is calculated without considering the downstream transcription factor.

  • ligand (Optional[Union[str, List[str]]])

  • receptor (Optional[Union[str, List[str]]])

  • receiver_label (Optional[str])

  • sender_groups (Optional[List[str]])

  • receiver_groups (Optional[List[str]])

  • downstream_tf (Optional[Union[str, List[str]]])

  • pathway (Optional[str])

  • pathway_type (Optional[str])

  • is_neurotransmitter (Optional[bool])

  • min_signal_proportion (float)

  • filter_small_groups (bool)

  • min_cell_proportion (float)

  • test_permutation (bool)

  • n_perms (int)

  • score_method (Literal['v1', 'v2'])

  • perm_method (Literal['v1', 'v2'])

Returns:

DataFrame containing the interaction scores for a specified ligand-receptor pair between all potentially interacting groups.

Return type:

pd.DataFrame

senid.extrinsic.constrain_senchat_interactions(adata, senchat_output_key, implausible_interactions=None, pathway_types=None)[source]
Parameters:
Return type:

None

senid.extrinsic.subset_for_communication(adata, senchat_output_key, pval_threshold=None, subset_sasp=True, layer='counts', model='human')[source]
Parameters:
Return type:

anndata.AnnData

senid.extrinsic.run_cnmf(output_dir, adata_fname, output_name, n_modules, combine_only=False, worker_i=0, total_workers=1, **kwargs)[source]
Parameters:
  • output_dir (str)

  • adata_fname (str)

  • output_name (str)

  • n_modules (Sequence[int] | int)

  • combine_only (bool)

  • worker_i (int)

  • total_workers (int)

Return type:

None

senid.extrinsic.infer_consensus_modules(adata_cnmf, output_dir, output_name, optimal_k, density_threshold=0.1)[source]
Parameters:
Return type:

None

senid.extrinsic.calculate_ligand_enrichment(adata, spectra_tpm_key='cNMF_spectra_tpm')[source]
Parameters:
Return type:

pandas.DataFrame