register_context¶
- register_context(context_class)[source]¶
Register new context to the collection.
Example:
import perturb_lib as plib import scanpy as sc import numpy as np @plib.register_context class CoolPerturbationScreen(AnnData): def __init__(self): super().__init__( X=np.zeros((3, 5), dtype=np.float32), obs={"perturbation": ["P1", "P2", "P3"]}, var={"readout": ["R1", "R2", "R3", "R4", "R5"]}, )
- Parameters:
context_class (
type
[AnnData
]) – context class to register- Raises:
ValueError – If a context class with the same name exists already.