regvelo.preprocessing.set_prior_grn

regvelo.preprocessing.set_prior_grn(adata, gt_net, keep_dim=False, cor_filter=True)[source]

Add a prior gene regulatory network (GRN) to an AnnData object.

This function aligns a provided gene regulatory network (gt_net) with the gene expression data in the AnnData object.

Parameters:
  • adata (AnnData) – Annotated data matrix.

  • gt_net (DataFrame) – Prior GRN (rows = targets, columns = regulators).

  • keep_dim (bool) – If True, output AnnData retains its original dimensions. Default is False. If False, prune genes without incoming or outgoing regulatory edges.

  • cor_filter (bool) – If True, filter regulatory edges by correlation with expression data before storing in the AnnData object. Default is True.

Return type:

AnnData

Returns:

: Updates adata with the following fields:

  • adata.uns["skeleton"]: binary adjacency matrix for the GRN.

  • adata.uns["network"]: same as skeleton, may be updated later in pipeline.

  • adata.uns["regulators"] and adata.uns["targets"]: gene names after alignment.