calour.transforming.normalize_by_subset_features

calour.transforming.normalize_by_subset_features(exp: calour.experiment.Experiment, features, total=10000, negate=True, inplace=False)[source]

Normalize each sample by their total sums without a list of features

Normalizes all features (including in the exclude list) by the total sum calculated without the excluded features. This is to alleviate the compositionality in the data set by only keeping the features that you think are not changing across samples.

Note

sum is not identical in all samples after normalization (since also keeps the excluded features)

Note

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

Parameters:
  • exp (Experiment) – Input experiment object.
  • features (list of str) – The feature IDs to exclude (or include if negate=False)
  • total (int, optional) – The total abundance for the non-excluded features per sample
  • negate (bool, optional) – True (default) to calculate normalization factor without features in features list. False to calculate normalization factor only with features in features list.
  • inplace (bool, optional) – False (default) to create a new experiment, True to normalize in place
Returns:

The normalized experiment

Return type:

Experiment