grassp.tl.calculate_interfacialness_score#
- calculate_interfacialness_score(data, compartment_annotation_column, neighbors_key=None, obsp=None, exclude_category=None)[source]#
 Quantify interfacialness of proteins across compartment boundaries.
The score is based on a modified Jaccard index computed from each protein’s immediate neighbourhood:
For a given protein count how many of its neighbours belong to each compartment (categories in
compartment_annotation_column).Sort counts and take the two highest:
d1andd2for compartmentsk1andk2.Compute
score = (d1 + d2) / (N_k1 + N_k2 - (d1 + d2))where
N_kis the total number of proteins annotated as compartment k in the dataset. High scores indicate that a protein sits at an interface between two compartments.
New columns are appended to
data.obswith the jaccard_ prefix.- Parameters:
 - data 
AnnData anndata.AnnDatawith a neighbour graph and compartment annotations for each protein.- compartment_annotation_column 
str Observation column containing the ground-truth compartment labels.
- neighbors_key 
str|None(default:None) Specify which neighbour graph to use (mirrors Scanpy conventions).
- obsp 
str|None(default:None) Specify which neighbour graph to use (mirrors Scanpy conventions).
- exclude_category 
Union[str,List[str],None] (default:None) One or multiple category labels (e.g. ‘unknown’) to ignore when counting neighbours.
- data 
 - Return type:
 - Returns:
 - class:’~anndata.AnnData` object with additional columns:
 
jaccard_scoreInterfacialness score.
jaccard_d1,jaccard_d2Counts of the two dominating neighbour compartments.
jaccard_k1,jaccard_k2Corresponding compartment labels.