scembed.methods.LIGERMethod#

class scembed.methods.LIGERMethod(adata, k=20, value_lambda=None, thresh=None, max_iters=None, nrep=None, rand_seed=None, print_obj=None, quantiles=None, ref_dataset=None, min_cells=None, dims_use=None, do_center=None, max_sample=None, num_trees=None, refine_knn=None, knn_k=None, use_ann=None, **kwargs)#

LIGER integration method.

Wrapper around the LIGER method [WKF+19] for single-cell multi-omic integration.

Methods table#

fit()

Fit LIGER - no explicit fitting needed.

fit_transform()

Fit the method and transform the data.

get_model_info()

Get information about the fitted model.

load_artifact(source[, artifact_type, ...])

Load a pre-trained model or embedding from various sources.

save_embedding([format_type, filename, ...])

Save embedding to file with preserved cell names as index.

save_model(path)

Save the trained model (for deep learning methods).

setup([force_recompute])

Setup LIGER-specific preprocessing.

transform()

Apply LIGER integration.

validate_adata(adata)

Validate the AnnData object has required keys and structure.

validate_spatial_adata(adata)

Validate spatial-specific data requirements.

Methods#

LIGERMethod.fit()#

Fit LIGER - no explicit fitting needed.

LIGERMethod.fit_transform()#

Fit the method and transform the data.

Modifies self.adata in place.

Return type:

None

LIGERMethod.get_model_info()#

Get information about the fitted model.

Return type:

dict[str, Any]

Returns:

Dict[str, Any] Dictionary with model information.

LIGERMethod.load_artifact(source, artifact_type='model', embedding_key=None, **kwargs)#

Load a pre-trained model or embedding from various sources.

Parameters:
  • source (str | Path | dict) – Source of the artifact. Can be: - str/Path: Local path to model directory or embedding file - dict: WandB parameters with keys ‘run_id’, ‘entity’, ‘project’

  • artifact_type (Literal['model', 'embedding'] (default: 'model')) – Type of artifact to load: ‘model’ or ‘embedding’.

  • embedding_key (str | None (default: None)) – Key to store embedding in adata.obsm. If None, uses self.embedding_key. Only used when artifact_type=’embedding’.

  • **kwargs – Additional arguments passed to loading functions.

Return type:

None

LIGERMethod.save_embedding(format_type='parquet', filename=None, compression=True)#

Save embedding to file with preserved cell names as index.

Parameters:
  • format_type (Literal['parquet', 'pickle', 'h5'] (default: 'parquet')) – Format to save embedding in. Options: ‘parquet’, ‘pickle’, or ‘h5’.

  • filename (str | None (default: None)) – Custom filename (without extension). If None, uses “embedding”.

  • compression (bool (default: True)) – Whether to use compression (gzip for all formats).

Return type:

Path

Returns:

Path Path to the saved embedding file.

Raises:

ValueError – If method is not fitted or embedding key not found in adata.obsm.

LIGERMethod.save_model(path)#

Save the trained model (for deep learning methods).

Parameters:

path (Path) – Directory to save the model.

Return type:

Path | None

Returns:

Optional[Path] Path to saved model file, None if method doesn’t support saving.

LIGERMethod.setup(force_recompute=False)#

Setup LIGER-specific preprocessing.

Return type:

None

LIGERMethod.transform()#

Apply LIGER integration.

LIGERMethod.validate_adata(adata)#

Validate the AnnData object has required keys and structure.

Parameters:

adata (AnnData) – Annotated data object to validate.

Raises:

ValueError – If required keys are missing or data is malformed.

Return type:

AnnData

LIGERMethod.validate_spatial_adata(adata)#

Validate spatial-specific data requirements.

Parameters:

adata (AnnData) – Annotated data object to validate.

Raises:

ValueError – If required spatial keys are missing or data is malformed.

Return type:

None