scvelo.utils.clean_obs_names(data, base='[AGTCBDHKMNRSVWY]', ID_length=12, copy=False)

Clean up the obs_names.

For example an obs_name ‘sample1_AGTCdate’ is changed to ‘AGTC’ of the sample ‘sample1_date’. The sample name is then saved in obs[‘sample_batch’]. The genetic codes are identified according to according to

adata : AnnData

Annotated data matrix.

base : str (default: [AGTCBDHKMNRSVWY])

Genetic code letters to be identified.

ID_length : int (default: 12)

Length of the Genetic Codes in the samples.

copy : bool (default: False)

Return a copy instead of writing to adata.


  • Returns or updates adata with the attributes
  • obs_names (list) – updated names of the observations
  • sample_batch (.obs) – names of the identified sample batches