Quickstart#

import pytometry as pm
import readfcs
import anndata

Read fcs file example from the readfcs package. The fcs file was part of the following reference and originally deposited on the FlowRepository.

path_data = readfcs.datasets.Oetjen18_t1()
adata = pm.io.read_fcs(path_data)
assert isinstance(adata, anndata._core.anndata.AnnData)

Next, we split the data matrix into the marker intensity part and the FSC/SSC part. Moreover, we move all height related features to the .obs part of the anndata file. Notably. the function split_signal checks if a feature name is either FSC/SSC or whether a name endswith -A for area related features and -H for height related features.

pm.pp.split_signal(adata, var_key="channel")

We can plot the fluorescent marker intensity distribution with the plotdata function.

pm.pl.plotdata(adata)
https://d33wubrfki0l68.cloudfront.net/1c6d13d67a66166a5584b486ab2454ed83811608/f0bbd/_images/1d8ea0447e1c1998ed3d4fcf305a5e69fd5c24ccb70d4ef709aa0d768021c794.png

For 2D distribution plots, we use the scatter_density function.

pm.pl.scatter_density(adata, x_lim=[-1, 2.7e5])
https://d33wubrfki0l68.cloudfront.net/2fb07814b81b537dc6494f936a0b233d68a49a07/f867a/_images/3540cfa70a142c199262f2823a879eba898fe7cf597242852399345abaeb19d2.png
pm.pp.compensate(adata)
adata_arcsinh = pm.tl.normalize_arcsinh(adata, cofactor=150, inplace=False)
adata_biexp = pm.tl.normalize_biExp(adata, inplace=False)
adata_logicle = pm.tl.normalize_logicle(adata, inplace=False)

Save data to HDF5 file format.

adata.write("example.h5ad")