grassp.tl.calculate_interfacialness_score#
- calculate_interfacialness_score(data, compartment_annotation_column, neighbors_key=None, obsp=None, exclude_category=None)[source]#
Calculate interfacialness scores for proteins based on their neighborhood annotations.
For each protein, examines its nearest neighbors and calculates a modified Jaccard coefficient between the two most frequent compartment annotations in the neighborhood. This provides a measure of how “interfacial” a protein is between different cellular compartments.
- Parameters:
- data
AnnData
Annotated data matrix with proteins as observations (rows)
- compartment_annotation_column
str
Column in data.obs containing compartment annotations
- neighbors_key
Optional
[str
] (default:None
) Key for neighbors in data.uns. If not specified, will look for neighbors in obsp
- obsp
Optional
[str
] (default:None
) Key for neighbors in data.obsp. Only used if neighbors_key not specified
- exclude_category
Union
[str
,List
[str
],None
] (default:None
) Category or list of categories to exclude from the analysis
- data
- Return type:
AnnData
- Returns:
data Original AnnData object with added columns in .obs: - jaccard_score: Modified Jaccard coefficient measuring interfacialness - jaccard_d1: Number of neighbors with most frequent annotation - jaccard_d2: Number of neighbors with second most frequent annotation - jaccard_k1: Most frequent compartment annotation - jaccard_k2: Second most frequent compartment annotation