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#
Get the cluster labels. |
|
Get the metacluster labels. |
Methods table#
Make a minimum spanning tree. |
|
Cleans marker and channel names. |
|
|
Returns a copy of the FlowSOM instance, leveraging MuData's built-in copy method. |
Get the cell data. |
|
Get the cluster data. |
|
|
Perform a (consensus) hierarchical clustering. |
|
Map new data to a FlowSOM grid. |
|
Converts input to a FlowSOM AnnData object. |
Run the model on the input data. |
|
|
Take a subset from a FlowSOM object. |
|
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:
: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