Coverage for /home/kale/research/projects/201511_sgrna_sensor/scripts/facs/fcm_helper/fcm_helper/experiments.py : 75%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
#!/usr/bin/env python3
# Find the *.fcs data files relevant to this experiment. If there is a # document with a mapping called "plates:", treat the values as paths to # data directories and the keys as names that can refer to the directories # in the rest of the file. If there is a document with an assignment # called "plate:", treat it as the path to the only data directory that # will be used in the rest of the file. If no data directory is specified # by either of these two mechanisms, try to infer a path from the name of # the YAML file itself.
raise UsageError("Too many fields in 'plates' document.")
plates = {k: Path(v) for k,v in documents[0]['plates'].items()} clean_up_plate_document() elif inferred_path.is_dir(): plates = {None: inferred_path} else: raise UsageError("No plates specified.")
# Construct and fill in an experiment data structure. Cache parsed data in # the 'wells' directory. Parsing a well is expensive because there is a # lot of data associated with each one. Furthermore, experiments can use # some wells over and over while not using others at all. All of this # makes on-the-fly caching worth the effort.
return wells[name]
# Find the *.fcs file referenced by the given name.
raise UsageError("Can't parse well name: '{}'".format(name))
raise UsageError( "Plate '{}' not defined.".format(plate) if plate is not None else "No default plate defined.")
if len(well_paths) > 1: raise UsageError("Multiple *.fcs files found for well '{}'".format(name)) well_path = well_paths[0]
# Load the cell data for the given well.
logging.info('Loading {}'.format(well_path.name)) meta, wells[name] = fcsparser.parse(str(well_path)) return wells[name]
# Set the label for the comparison.
# Set the channel for the comparison.
# Set the well data for the comparison. This requires converting the # well names we were given into paths and parsing those files.
return experiment
'red': 'PE-Texas Red-A', 'green': 'FITC-A', } 'PE-Texas Red-A': 'FITC-A', 'FITC-A': 'PE-Texas Red-A', }
return 'Comparison(label="{0.label}", channel="{0.channel}")'.format(self)
def channel(self): return channel_abbreviations.get(self._channel, self._channel)
def channel(self, value):
def control_channel(self): return default_control_channels.get( self._control_channel, self._control_channel)
def control_channel(self, value): self._control_channel = value
|