Skip to content

msmu.pp.attach_sdrf

Attach an SDRF table to mdata.uns["sdrf"] as the immutable source of truth.

The SDRF is stored whole because its rows span both axes -- comment[label] maps to the obs axis (channels) and comment[data file] to the var axis (runs/fractions) -- so it is not reducible to obs alone. uns is copied through split_tmt and collapse_obs, making it the durable home for the original table; obs is left untouched here. Use :func:apply_sdrf_to_obs to project selected columns onto obs.

Parameters:

Name Type Description Default
mdata MuData

MuData to annotate.

required
sdrf DataFrame | str | PathLike[str]

An SDRF as a pandas DataFrame, or a path/URL read via :func:read_sdrf.

required
validate bool

Validate the SDRF with sdrf-pipelines (if installed). Default True.

True
skip_ontology bool

Skip ontology term checks during validation. Default True.

True

Returns:

Type Description
MuData

A copy of mdata with the SDRF DataFrame stored at uns["sdrf"].