cytonormpy._dataset.DataHandlerFCS#
- class cytonormpy._dataset.DataHandlerFCS(metadata, input_directory=None, channels='markers', reference_column='reference', reference_value='ref', batch_column='batch', sample_identifier_column='file_name', n_cells_reference=None, transformer=None, truncate_max_range=True, output_directory=None, prefix='Norm')#
Class to intermediately represent the data, read and write outputs and handle intermediate steps.
- Parameters:
metadata (
Union[DataFrame,PathLike]) – A table containing the file names, the batch and the reference information. Expects the columns file_name, batch and reference where reference must contain ref for reference samples and other for non-reference samples. Can be provided as aDataFrameor a path.input_directory (
Optional[PathLike]) – Path specifying the input directory in which the .fcs files are stored. If left None, the current working directory is assumed.channels (
Union[list[str],str,Literal['all','markers']]) – Can be a list of detectors (e.g. BV421-A), a single channel or ‘all’ or ‘markers’. If markers, channels containing ‘FSC’, ‘SSC’, ‘Time’, ‘AF’ and CyTOF technicals will be excluded.reference_column (
str) – The column in the metadata that specifies whether a sample is used for reference and is therefore present in all batches. Defaults to ‘reference’.reference_value (
str) – Specifies the value that is considered a reference. Defaults to ‘ref’.batch_column (
str) – The column in the metadata that specifies the batch. Defaults to ‘batch’.sample_identifier_column (
str) – Specifies the column in the metadata that is unique to the samples. Defaults to ‘file_name’.output_directory (
Optional[PathLike]) – Path specifying the output directory in which the .fcs files are saved to. If left None, the current input directory is assumed.prefix (
str) – The prefix that are prepended to the file names of the normalized fcs files.
- Return type:
None
Attributes
Methods
add_file(file_name, batch)append_cytof_technicals(value)append_flow_technicals(value)get_corresponding_ref_dataframe(file_name)Returns the data of the corresponding reference for the indicated file name.
get_dataframe(file_name)Returns a dataframe for the indicated file name.
get_ref_data_df([markers])Returns the reference data frame.
get_ref_data_df_subsampled(n[, markers])Returns the reference data frame, subsampled to n events.
write(file_name, data[, output_dir])Writes the data to the hard drive as an .fcs file.