scviva.tools.harreman.HarremanToolsAccessor#
- class scviva.tools.harreman.HarremanToolsAccessor(ha)[source]#
Tool methods accessible as
ha.tl.<method>.Created automatically by
HarremanAnalysis; users do not instantiate it directly.- Parameters:
- ha
HarremanAnalysis The analysis object whose AnnData is used when
adatais not passed.
- ha
Methods table
Compute correlations between interacting cell scores and module scores. |
|
|
Computes the spatial proximity graph. |
|
Select significant gene pairs or metabolite-mediated interactions. |
Methods
- HarremanToolsAccessor.compute_interaction_module_correlation(adata=None, *, cor_method='pearson', test=None, interaction_type='metabolite', only_sig_values=False, normalize_values=False, use_FDR=True, use_super_modules=False, ct_aware=None)[source]#
Compute correlations between interacting cell scores and module scores.
Forwards to
compute_interaction_module_correlation().adatadefaults to the AnnData held by the analysis object.- Parameters:
- adata AnnData | None
Must contain: -
uns['interacting_cell_results']with parametric or non-parametric scores -obsm['module_scores']orobsm['super_module_scores']-uns['metabolites']oruns['gene_pairs_sig_names']- cor_method
Union[Literal['pearson'],Literal['spearman'],None] Statistical method used to compute correlations.
- test
Union[Literal['parametric'],Literal['non-parametric'],None] Which interacting-cell score set to use. -
"parametric"usesuns['interacting_cell_results']['p']-"non-parametric"usesuns['interacting_cell_results']['np']- interaction_type
Union[Literal['metabolite'],Literal['gene_pair'],None] Select whether to correlate: - metabolite scores, or - gene pair scores.
- only_sig_values
bool|None If True, use only significant interacting cell score values (
cs_sig_pvalorcs_sig_FDR).- normalize_values
bool|None Apply min-max normalization to interacting cell score values per interaction.
- use_FDR
bool|None If
only_sig_values=True, determines whether to filter by FDR or raw p-values.- use_super_modules
bool|None Whether to use super-module scores instead of module scores.
- ct_aware
bool|None Whether to use cell-type-aware interacting cell scores. If
None, cell-type-aware scores are used only when standard scores are absent and matching cell-type-aware scores are present.
- Return type:
- HarremanToolsAccessor.compute_knn_graph(adata=None, *, compute_neighbors_on_key=None, distances_obsp_key=None, weighted_graph=False, neighborhood_radius=None, n_neighbors=None, neighborhood_factor=3, sample_key=None, tree=None, use_gpu=None, verbose=False, random_state=0)[source]#
Computes the spatial proximity graph.
Forwards to
compute_knn_graph().adatadefaults to the AnnData held by the analysis object.- Parameters:
- adata AnnData | None
AnnData object.
- compute_neighbors_on_key
str|None Key in
adata.obsmto use for computing neighbors. IfNone, use neighbors stored inadata. If no neighbors have been previously computed an error will be raised.- distances_obsp_key
str|None Distances encoding cell-cell similarities directly. Shape is (cells x cells). Input is key in
adata.obsp.- weighted_graph
bool|None Whether or not to create a weighted graph.
- neighborhood_radius
int|None Neighborhood radius.
- n_neighbors
int|None Neighborhood size.
- neighborhood_factor
int|None Used when creating a weighted graph. Sets how quickly weights decay relative to distances within the neighborhood. The weight for a cell with distance d decays as exp(-d^2/D), where D is the distance to the
n_neighbors/neighborhood_factor-th neighbor.- sample_key
str|None Sample information in case the data contains different samples or samples from different conditions. Input is key in
adata.obs.- tree
Root tree node. Can be created using ete3.Tree
- use_gpu
bool|None Whether to use GPU acceleration via rapids_singlecell/cuML.
None(default) tries GPU and falls back to CPU automatically;Falseforces CPU;Trueraises if GPU fails.- verbose
bool|None Whether to print progress and status messages.
- random_state
int|Generator|None Seed (or generator) for the random tie-breaking in the tree-based KNN path (used only when
treeis given), for reproducible neighbor selection. Defaults to0.
- HarremanToolsAccessor.select_significant_interactions(adata=None, *, ct_aware=False, test='parametric', use_FDR=True, threshold=0.05)[source]#
Select significant gene pairs or metabolite-mediated interactions.
Forwards to
select_significant_interactions().adatadefaults to the AnnData held by the analysis object.Selection is based on FDR/p-value thresholds and optional cell-type-aware tests.
- Parameters:
- adata AnnData | None
AnnData object containing:
uns['ccc_results']oruns['ct_ccc_results'], each of which includes:cell_com_df_gp: DataFrame with statistics for gene pairscell_com_df_m: DataFrame with statistics for metabolites
- ct_aware
bool|None If True, use cell-type–aware CCC results (
uns['ct_ccc_results']). If False, use cell-type-agnostic CCC results (uns['ccc_results']).- test
Union[Literal['parametric'],Literal['non-parametric'],None] Determines which statistical columns to use: - Parametric:
Z_FDR/Z_pval,C_p- Non-parametric:FDR_np/pval_np,C_np- use_FDR
bool|None If True, threshold significance using FDR values. If False, use raw p-values.
- threshold
float|None Significance cutoff applied to the selected statistic (FDR or p-value).
- Return type: