Skip to content

scdef.tl.set_factor_signatures

set_factor_signatures(model: scDEF, signatures: Optional[Dict[str, List[str]]] = None, top_genes: int = 10) -> Dict[str, List[str]]

Store a signature per factor in adata.uns['factor_signatures'].

With signatures=None the confident signatures of every layer are pooled into one {factor_name: genes} mapping and stored, truncated to top_genes; pass a mapping instead to store curated lists.

Note that set_confident_signatures already writes this key, so the signatures=None path only re-writes it at a different length. Nothing inside scdef reads uns['factor_signatures'] — the plots take their gene lists from uns['confident_signatures'] instead — so this is for downstream use and for overriding the stored lists by hand.

Parameters:

Name Type Description Default
model scDEF

scDEF model instance. With signatures=None, requires set_confident_signatures to have been run.

required
signatures Optional[Dict[str, List[str]]]

mapping of factor name to gene list. None builds it from the cached confident signatures.

None
top_genes int

genes per factor when building from the cache.

10

Returns:

Type Description
Dict[str, List[str]]

The stored mapping.