netmap.masking.internal.add_neighbourhood_expression_mask¶
- netmap.masking.internal.add_neighbourhood_expression_mask(adata, grn_adata, strict=False, layer='X')[source]¶
Create a binary cell×edge co-expression mask and add it to the GRN AnnData.
The mask indicates whether both the source and target genes of each edge are expressed in the kNN neighbourhood of each cell.
- Parameters:
adata (anndata.AnnData) – Expression AnnData; must have
obsm['X_pca'].grn_adata (anndata.AnnData) – GRN AnnData whose
var_namesareSourceGene_TargetGeneedge identifiers.strict (bool) – If
True, use direct binarization ofadata.Xinstead of neighbourhood expression. Defaults toFalse.layer (str) – Layer to use for expression values. Defaults to
'X'.
- Returns:
grn_adatawithlayers['mask'](int8) andvar['count_nonzero']added.
- Return type: