API#

Import FlowSOM using the alias fs for convenience. Functions and classes can then be accessed as fs.FlowSOM or fs.io.read_FCS:

import flowsom as fs

The functionality is organised in subpackages:

  • io for reading and writing FCS files

  • pp for preprocessing

  • models for models

  • tl for tools

  • pl for plotting

The central class is FlowSOM, which can be used to read in data and directly perform the FlowSOM algorithm [VGCVH+15]. There is also a convenience function flowsom_clustering which performs the same steps but directly on an existing AnnData object. For more low-level control, the FlowSOMEstimator class with a scikit-learn Estimator API can be used.

For more background information, see the paper for this software package [CRSVG24] and the Nature Protocols paper [QCE+21] on applying FlowSOM in practice.

FlowSOM(inp, n_clusters[, cols_to_use, ...])

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

flowsom_clustering(inp[, cols_to_use, ...])

Perform FlowSOM clustering on an anndata object and returns the anndata object.

Reading#

io.read_FCS(filepath)

Reads in an FCS file.

io.read_csv(filepath[, spillover])

Reads in a CSV file.

Preprocessing#

pp.aggregate_flowframes(filenames, c_total)

Aggregate multiple FCS files together.

Models#

models.FlowSOMEstimator([cluster_model, ...])

A class that implements the FlowSOM model.

models.BatchFlowSOMEstimator([...])

A class that implements the FlowSOM model.

models.SOMEstimator([xdim, ydim, rlen, mst, ...])

Estimate a Self-Organizing Map (SOM) clustering model.

models.ConsensusCluster(n_clusters[, K, H, ...])

Implementation of Consensus clustering.

models.BaseClusterEstimator()

Base class for all cluster estimators in FlowSOM.

models.BaseFlowSOMEstimator(cluster_model, ...)

Base class for all FlowSOM estimators in FlowSOM.

models.SOM(data, codes, nhbrdist, alphas, ...)

models.map_data_to_codes(data, codes[, distf])

Tools#

tl.get_channels(obj, markers[, exact])

Gets the channels of the provided markers based on a FlowSOM object or an FCS file.

tl.get_cluster_percentages_positive(fsom, ...)

Get percentage-positive values for all clusters.

tl.get_counts(fsom[, level])

Get counts of number of cells in clusters or metaclusters.

tl.get_features(fsom, files[, level, type, ...])

Map FCS files on an existing FlowSOM object.

tl.get_markers(obj, channels[, exact])

Gets the markers of the provided channels based on a FlowSOM object or an FCS file.

tl.get_metacluster_percentages_positive(...)

Get percentage-positive values for all metaclusters.

tl.get_percentages(fsom[, level])

Get percentages of number of cells in clusters or metaclusters.

Plotting#

pl.FlowSOMmary(fsom[, plot_file])

Makes a visual FlowSOMmary of a FlowSOM object.

pl.plot_2D_scatters(fsom, channelpairs[, ...])

Function to draw 2D scatter plots of FlowSOM (meta)clusters.

pl.plot_labels(fsom, labels[, ...])

Plot labels for each cluster.

pl.plot_numbers(fsom[, level, max_node_size])

Plot cluster ids for each cluster.

pl.plot_variable(fsom, variable[, cmap, ...])

Plot FlowSOM grid or tree, colored by node values given in variable.

pl.plot_marker(fsom, marker[, ref_markers, ...])

Plot FlowSOM grid or tree, colored by node values for a specific marker.

pl.plot_stars(fsom[, markers, cmap, title])

Plot star charts.

pl.plot_pies(fsom, cell_types[, cmap, title])

Plot FlowSOM grid or tree, with pies indicating another clustering or manual gating result.