calour.amplicon_experiment.AmpliconExperiment.sort_centroid

AmpliconExperiment.sort_centroid(transform=<function log_n>, inplace=False, **kwargs)[source]

Sort the features based on the center of mass

Assuming that samples are already sorted by some continuous field (eg pH), this function will sort features based on their center of mass along this field. Specifically, it calculates the center of mass for each feature and sort features by their center of mass.

Parameters:
  • transform (callable, optional) – a callable transform on a 2-d matrix. Input and output of transform are Experiment. The transform function modifies Experiment.data (it is a copy) but not change the dimension of Experiment.data.
  • inplace (bool, optional) – False (default) to create a copy True to Replace data in exp
  • kwargs (dict) – additional keyword parameters passed to transform.
Keyword Arguments:
 
  • steps (list of callable) – each callable is a transformer that takes Experiment object as its 1st argument and has a boolean parameter of inplace. Each callable should return an Experiment object.
  • inplace (bool) – transformation occuring in the original data or a copy
  • kwargs (dict) – keyword arguments to pass to each transformers. The key should be in the form of “<transformer_name>__<param_name>”. For example, “transform(exp: Experiment, steps=[log_n], log_n__n=3)” will set “n” of function “log_n” to 3
Returns:

features sorted by center of mass

Return type:

Experiment

See also

transform()