netmap.masking.internal.add_neighbourhood_expression_mask¶
- netmap.masking.internal.add_neighbourhood_expression_mask(adata, grn_adata, strict=False, layer='X', mask_data=True)[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, and whosevarmust contain unambiguoussource/targetgene columns (as produced bynetmap.grn.inferrence.inferrence()) — edge genes are read from these columns rather than parsed fromvar_names, since gene names may themselves contain underscores.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: