calour.sorting.cluster_data

calour.sorting.cluster_data(exp: calour.experiment.Experiment, transform=None, axis=1, metric='euclidean', inplace=False, **kwargs)[source]

Cluster the samples/features.

Reorder the features/samples so that ones with similar behavior (pattern across samples/features) are close to each other

Note

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

Parameters:
  • exp (Experiment) – Input experiment object.
  • aixs (0, 1, 's', or 'f', optional) – ‘f’ or 1 (default) means clustering features; ‘s’ or 0 means clustering samples
  • transform (Callable) – a callable transform on a 2-d matrix. Input and output of transform are Experiment. The transform function can modify Experiment.data (it is a copy). It should not change the dimension of Experiment.data.
  • metric (str or callable) – the clustering metric to use. It should be able to be passed to scipy.spatial.distance.pdist.
  • inplace (bool, optional) – False (default) to create a copy. True to Replace data in exp.
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:

With samples/features clustered (reordered)

Return type:

Experiment

See also

transform()