FlowCytometryTools.FCPlate.from_dir

classmethod FCPlate.from_dir(ID, path, parser='name', position_mapper=None, pattern='*.fcs', recursive=False, readdata_kwargs={}, readmeta_kwargs={}, ID_kwargs={}, **kwargs)

Create a Collection of measurements from data files contained in a directory.

ID : hashable
Collection ID
datadir : str
Path of directory containing the data files.
pattern : str
Only files matching the pattern will be used to create measurements.
recursive : bool
Recursively look for files matching pattern in subdirectories.

parser : [‘name’ | ‘number’ | ‘read’ | mapping | callable]

Extracts a key from a filename.

Later, this key is used by the position mapper to determine the location of the measurement in the measurement collection.

  • ‘name’ : Use the measurement name given in the file name.
    For example, ‘[whatever]_Well_C9_[blah].fcs’ will get key ‘C9’. The filename must look exactly like the template above.
  • ‘number’ : Use the number given in the file name.
    For example, ‘[some name].001.fcs’ will get key 001. The filename must look exactly like the template above.
  • ‘read’ : Use the measurement ID specified in the metadata.
  • mapping : mapping (dict-like) from datafiles to keys.
  • callable : takes datafile name and returns key.

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.
ID_kwargs: dict
Additional parameters to be used when assigning IDs. Passed to ‘_assign_IDS_to_datafiles’ method.
kwargs : dict
Additional key word arguments to be passed to constructor.