calour.sorting.sort_ids

calour.sorting.sort_ids(exp: calour.experiment.Experiment, ids, axis=1, inplace=False)[source]

Sort the features or samples by the given ids.

If ids are not cover the all the features (samples), the rest will be unsorted and appended.

Note

This function is also available as a class method Experiment.sort_ids()

Parameters:
  • exp (Experiment) – Input experiment object.
  • ids (list of str) – The ids to put first in the new experiment
  • axis (0, 1, 's', or 'f') – sort by samples (0 or ‘s’) or by features (1 or ‘f’), i.e. the field is a column in sample_metadata (0 or ‘s’) or feature_metadata (1 or ‘f’)
  • inplace (bool, optional) – False (default) to create a copy of the experiment, True to filter inplace
Returns:

with features/samples first according to the ids list and then the rest

Return type:

Experiment