grassp.io.read_msnset#
- read_msnset(path, *, set_colors=True, strict_spec=True)[source]#
Read a pRoloc artifact back into grassp.
This is the return leg of the round trip:
write_msnset()out,grasspio’sgrassp_write_msnsetin R, then this. The artifact is already grassp-shaped, so the work is a contract-version check and two sanity warnings – proteins are in.obs, fractions in.var, matrix-valuedfData/pDatacolumns in.obsm/.varmwith their class names inuns["obsm_colnames"]/uns["varm_colnames"], extraassayDataelements in.layers. Nothing is renamed or converted.Everything crosses except
.obsp/.varp:eSethas no pairwise slot. Recompute the graph withgrassp.pp.neighbors(), which is where it came from anyway.- Parameters:
- path
str|Path|AnnData Path to an h5ad written by
grasspio’sgrassp_write_msnset(or bywrite_msnset()). An in-memoryAnnDatais passed through as-is.- set_colors
bool(default:True) Assign compartment colours via
grassp.preprocessing.set_sensible_compartment_colors().- strict_spec
bool(default:True) Whether an artifact written by a newer contract version raises rather than warns.
- path
- Return type:
- Returns:
The artifact as an
AnnData.
See also
read_proloc_resultsGraft an artifact’s annotations onto an object you already have.
list_msnset_resultsInventory an artifact without reading it into a session.
Examples
>>> adata = gr.io.read_msnset("results.h5ad") >>> adata.obs["markers"].isna().sum() # unlabelled proteins doctest: +SKIP