.is_proteodata

proteopy.utils.is_proteodata(adata, *, raise_error=False, layers=None)[source]

Check whether the AnnData object stores peptide- or protein-level proteomics data.

Parameters:
  • adata (AnnData) – AnnData object whose .var annotations will be inspected.

  • raise_error (bool) – If True, raise a ValueError for proteomics-specific validation failures instead of returning False.

  • layers (str | list[str] | None) – Optional layer key or list of layer keys in adata.layers to validate. Each specified layer matrix is checked for infinite values, the same way .X is checked.

Returns:

(True, "peptide") if the data satisfy the peptide-level assumptions, (True, "protein") if they satisfy the protein-level assumptions, otherwise (False, None) when raise_error is False.

Return type:

tuple[bool, str | None]

Notes

Peptide-level data must provide both .var["peptide_id"] and .var["protein_id"]. Every peptide_id value must be unique, and the column must match adata.var_names (and the .var index) exactly. Each peptide must map to exactly one protein_id. Neither column may contain missing values.

Protein-level data must provide .var["protein_id"], must not contain a peptide_id column, and the protein_id values must match adata.var_names (and the .var index) exactly while also being unique. The column must not contain missing values.

Set raise_error=True to raise a ValueError instead of returning False when the proteomics-specific validation fails.