flowsom.FlowSOM#

class flowsom.FlowSOM(inp, n_clusters, cols_to_use=None, model=<class 'flowsom.models.flowsom_estimator.FlowSOMEstimator'>, xdim=10, ydim=10, rlen=10, mst=1, alpha=(0.05, 0.01), seed=None, mad_allowed=4, **kwargs)#

A class that contains all the FlowSOM data using MuData objects.

Attributes table#

cluster_labels

Get the cluster labels.

metacluster_labels

Get the metacluster labels.

Methods table#

build_MST()

Make a minimum spanning tree.

clean_anndata()

Cleans marker and channel names.

copy()

Returns a copy of the FlowSOM instance, leveraging MuData's built-in copy method.

get_cell_data()

Get the cell data.

get_cluster_data()

Get the cluster data.

metacluster([n_clusters])

Perform a (consensus) hierarchical clustering.

new_data(inp[, mad_allowed])

Map new data to a FlowSOM grid.

read_input([inp, cols_to_use])

Converts input to a FlowSOM AnnData object.

run_model()

Run the model on the input data.

subset(ids)

Take a subset from a FlowSOM object.

test_outliers([mad_allowed, fsom_reference, ...])

Test if any cells are too far from their cluster centers.

Attributes#

FlowSOM.cluster_labels#

Get the cluster labels.

FlowSOM.metacluster_labels#

Get the metacluster labels.

Methods#

FlowSOM.build_MST()#

Make a minimum spanning tree.

FlowSOM.clean_anndata()#

Cleans marker and channel names.

FlowSOM.copy()#

Returns a copy of the FlowSOM instance, leveraging MuData’s built-in copy method.

Returns:

FlowSOM: A new instance of FlowSOM with all data copied.

FlowSOM.get_cell_data()#

Get the cell data.

FlowSOM.get_cluster_data()#

Get the cluster data.

FlowSOM.metacluster(n_clusters=None)#

Perform a (consensus) hierarchical clustering.

Parameters:

n_clusters (int) – The number of metaclusters

FlowSOM.new_data(inp, mad_allowed=4)#

Map new data to a FlowSOM grid.

Parameters:
  • inp (ad.AnnData / str) – An anndata or filepath to an FCS file

  • mad_allowed (default: 4) – A warning is generated if the distance of the new

data points to their closest cluster center is too big. This is computed based on the typical distance of the points from the original dataset assigned to that cluster, the threshold being set to median + madAllowed * MAD. Default is 4. :type mad_allowed: int

FlowSOM.read_input(inp=None, cols_to_use=None)#

Converts input to a FlowSOM AnnData object.

Parameters:

inp (str / ad.AnnData) – A file path to an FCS file or a AnnData FCS file to cluster

FlowSOM.run_model()#

Run the model on the input data.

FlowSOM.subset(ids)#

Take a subset from a FlowSOM object.

Parameters:

ids (np.array) – An array of ids to subset

FlowSOM.test_outliers(mad_allowed=4, fsom_reference=None, plot_file=None, channels=None)#

Test if any cells are too far from their cluster centers.

Parameters:
  • mad_allowed (int) – Number of median absolute deviations allowed. Default = 4.

  • fsom_reference (FlowSOM) – FlowSOM object to use as reference. If NULL (default), the original fsom object is used.

  • plot_file (default: None)

:param channels:If channels are given, the number of outliers in the original space for those channels will be calculated and added to the final results table. :type channels: np.array