pyXenium.perturb#

pyXenium.perturb is the lightweight SpatialPerturb Bridge surface. It writes handoff specs and stable external CLI commands for running Perturb-seq reference projection with the separately installed SpatialPerturb package.

class SpatialPerturbBridgeConfig(xenium_path, output_dir, prepared_h5ad=None, cache_dir='.spatialperturb-cache', cell_group_path=None, roi_geojson_path=None, sample_name=None, reference_datasets=('gse241115_breast_cropseq',), install_requirement='SpatialPerturb>=0.3')#

Bases: object

Configuration for a pyXenium-to-SpatialPerturb handoff specification.

Parameters:
xenium_path: str | Path#
output_dir: str | Path#
prepared_h5ad: str | Path | None = None#
cache_dir: str | Path = '.spatialperturb-cache'#
cell_group_path: str | Path | None = None#
roi_geojson_path: str | Path | None = None#
sample_name: str | None = None#
reference_datasets: Sequence[str] | str = ('gse241115_breast_cropseq',)#
install_requirement: str = 'SpatialPerturb>=0.3'#
spatialperturb_status()#

Return environment status for the optional external SpatialPerturb package.

Return type:

dict[str, Any]

build_spatialperturb_handoff(config)#

Build a JSON-serializable handoff spec for the external SpatialPerturb CLI.

Parameters:

config (SpatialPerturbBridgeConfig | Mapping[str, Any])

Return type:

dict[str, Any]

write_spatialperturb_handoff(config, output_path)#

Write a SpatialPerturb Bridge handoff spec as JSON and return the spec.

Parameters:
Return type:

dict[str, Any]