mantispy.pp.find_perturbation_key

mantispy.pp.find_perturbation_key#

mantispy.pp.find_perturbation_key(adata, perturbation_key=None)#

Resolve which obs column holds the perturbation identity.

Parameters:
  • adata (AnnData) – Object whose obs columns are searched.

  • perturbation_key (str | None (default: None)) – Column to use, returned unchanged once it is known to be present. None takes the first column of PERTURBATION_KEYS that is there.

Return type:

str

Returns:

The name of the obs column that identifies the perturbation.

Raises:

KeyError – If perturbation_key is not an obs column, or no column was named and none of PERTURBATION_KEYS is present.