FlowCytometryTools.FCOrderedCollection

class FlowCytometryTools.FCOrderedCollection(ID, measurements, position_mapper, shape=(8, 12), positions=None, row_labels=None, col_labels=None)[source]

A dict-like class for holding flow cytometry samples that are arranged in a matrix.

__init__(ID, measurements, position_mapper, shape=(8, 12), positions=None, row_labels=None, col_labels=None)

A dictionary-like container for holding multiple Measurements in a 2D array.

Note that the collection keys are not necessarily identical to the Measurements IDs. Additionally, like a dict, measurement keys must be unique.

ID : hashable
Collection ID
measurements : mappable | iterable
values are measurements of appropriate type (type is explicitly checked for).

position_mapper : [None, callable, mapping, ‘name’, ‘row_first_enumerator’, ‘col_first_enumerator’]

Returns the coordinates (row, col) which correspond to the key. (The key is the key extracted from the filename by the parser.)

For example, the key ‘A1’ corresponds to the matrix coordinates (0, 0).

  • None : if None, then uses the same value as the parser
  • callable : gets key and returns position
  • mapping : key:pos
  • ‘name’ : parses things like ‘A1’, ‘G12’
  • ‘row_first_enumerator’, ‘name’ : converts number to positions, going over rows first
  • ‘col_first_enumerator’ : converts number to positions, going over columns first.
shape : 2-tuple
Shape of the 2D array of measurements (rows, cols).
positions : dict | None
Mapping of measurement_key:(row,col) If None is given set positions as specified by the position_mapper arg.
row_labels : iterable of str
If None is given, rows will be labeled ‘A’,’B’,’C’, …
col_labels : iterable of str
If None is given, columns will be labeled 1,2,3, …

Methods

__init__(ID, measurements, position_mapper) A dictionary-like container for holding multiple Measurements in a 2D array.
apply(func[, ids, applyto, output_format, …]) Apply func to each of the specified measurements.
clear()
clear_measurement_data([ids]) Clear the data in all specified measurements (all if None given).
clear_measurement_meta([ids]) Clear the metadata in all specified measurements (all if None given).
copy([deep]) Make a copy of this object
counts([ids, setdata, output_format]) Return the counts in each of the specified measurements.
dropna() Remove rows and cols that have no assigned measurements.
filter(criteria[, applyto, ID]) Filter measurements according to given criteria.
filter_by_IDs(ids[, ID]) Keep only Measurements with given IDs.
filter_by_attr(attr, criteria[, ID])
filter_by_cols(cols[, ID]) Keep only Measurements in corresponding columns.
filter_by_key(keys[, ID]) Keep only Measurements with given keys.
filter_by_meta(criteria[, ID])
filter_by_rows(rows[, ID]) Keep only Measurements in corresponding rows.
from_dir(ID, path[, parser, …]) Create a Collection of measurements from data files contained in a directory.
from_files(ID, datafiles[, parser, …]) Create an OrderedCollection of measurements from a set of data files.
gate(gate[, ID, apply_now]) Applies the gate to each Measurement in the Collection, returning a new Collection with gated data.
get(k[,d])
get_measurement_metadata(fields[, ids, …]) Get the metadata fields of specified measurements (all if None given).
get_positions([copy]) Get a dictionary of measurement positions.
grid_plot(func[, applyto, ids, row_labels, …]) Creates subplots for each well in the plate.
items()
keys()
load(path) Loads object from a pickled file.
plot(channel_names[, kind, gates, …]) Produces a grid plot with each subplot corresponding to the data at the given position.
pop(k[,d]) If key is not found, d is returned if given, otherwise KeyError is raised.
popitem() as a 2-tuple; but raise KeyError if D is empty.
save(path) Saves object to a pickled file.
set_data([ids]) Set the data for all specified measurements (all if None given).
set_labels(labels[, axis]) Set the row/col labels.
set_positions([positions, position_mapper, ids]) checks for position validity & collisions,
setdefault(k[,d])
subsample(key[, order, auto_resize, ID]) Allows arbitrary slicing (subsampling) of the data.
transform(transform[, direction, …]) Apply transform to each Measurement in the Collection.
update([E, ]**F) If E present and has a .keys() method, does: for k in E: D[k] = E[k]
values()

Attributes

layout
shape