scviva.tools.vision.split_signed_signatures#

scviva.tools.vision.split_signed_signatures(adata, varm_key='signatures', sig_names=None, use_raw=False)[source]#

Auto-split bidirectional signatures into _UP / _DOWN sub-signatures.

For each column in adata.varm[varm_key] that contains both +1 and -1 weights, two additional columns are appended:

  • {name}_UP: +1 for up-regulated genes, 0 elsewhere.

  • {name}_DOWN: -1 for down-regulated genes (preserving R’s _DN weight convention), 0 elsewhere.

The original bidirectional column is preserved so the combined score remains available alongside the split sub-signatures.

Parameters:
adata AnnData

AnnData object.

varm_key str

Key in adata.varm (or adata.raw.varm when use_raw=True) holding the (n_genes x n_sigs) signature weight matrix to split.

sig_names list | None

Column names to use if the signature matrix is not already a pandas.DataFrame (i.e. a bare array). Ignored otherwise.

use_raw bool

Read/write the signature matrix in adata.raw.varm instead of adata.varm, matching where load_signatures() stored it when called with use_raw=True.

Return type:

None

Returns:

None Modifies the signature matrix in-place.