calour.filtering.filter_sample_categories

calour.filtering.filter_sample_categories(exp: calour.experiment.Experiment, field, min_samples=5, inplace=False)[source]

Filter sample categories that have too few samples.

This is useful to get rid of categories with few samples for supervised classification training. It also drops the samples that don’t have any value in the field.

Examples

Note

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

Parameters:
  • exp (Experiment) – Input experiment object.
  • field (str) – The name of the column in samples metadata table. This column should has categorical values
  • min_samples (int, optional) – Filter away the samples with a value in the given column if its sample count is less than min_samples.
  • inplace (bool, optional) – False (default) to create a copy of the experiment, True to filter inplace
Returns:

Return type:

Experiment

See also

downsample()