FACSPy.dt.Panel

Contents

FACSPy.dt.Panel#

class FACSPy.dt.Panel(file='', panel=None, from_fcs=False)#

Panel class to represent and unify cytometry panel representations. The structure has to be at least two columns: fcs_colname with the channels (e.g. BV421-A) and antigens with the custom antigen names (e.g. CD3). If the panel is supposed to be read from the FCS files directly, set the flag from_fcs. The will create a completely empty panel file that is later filled by the function fp.create_dataset().

Parameters:
  • file (str) – The path or filename pointing to the table. Can be .txt, .csv.

  • panel (Optional[DataFrame]) – Optional. If the dataframe has been assembled with pandas, supply this panel dataframe.

  • from_fcs (bool) – If True, returns an empty Panel object which will be filled during dataset assembly by fp.create_dataset().

Return type:

The dataset object of Panel

Examples

>>> import FACSPy as fp
>>> import pandas as pd
>>> panel = fp.dt.panel("panel.csv") # creates a panel from the local file `panel.csv`
>>> panel
Panel(12 channels, loaded as provided file)
>>> panel_frame = pd.DataFrame(
...     data = {
...         "fcs_colname": ["FSC-A", "SSC-A", "BV421-A"],
...         "antigens" : ["FSC-A", "SSC-A", "CD3"]
...     },
...     index = list(range(3))
... )
>>> panel = fp.dt.Panel(panel = panel_frame) # creates a panel from a pd.DataFrame
>>> panel
Panel(3 channels, loaded as provided dataframe)
>>> panel = fp.dt.Panel(from_fcs = True) # creates an empty Panel
Panel(0 channels, loaded as read from FCS)

Notes

See further usage examples in the following tutorials: The Panel object

Methods

get_antigens()

returns the antigens from the panel as a list

get_channels()

returns the channel names from the panel as a list

rename_antigen(old_name, new_name)

renames an antigen

rename_channel(old_channel_name, ...)

renames a channel

select_channels(channels)

selects channels and subsets dataframe

to_df()

returns the dataframe of the object

write([output_directory])

writes the underlying table to disk.