python/cell_cycle_gating/run_cell_cycle_gating.py
def merge_metadata(dfm, obj, nuclei_population_name):
    """Merges metadata with object level file and
    sorts files by cell line, drug and concetration.

    Parameters
    ----------
    dfm : pandas dataframe
        metadata file with wells mapped to treatment conditions
    obj : str
        path to folder containing object level data
    nuclei_population_name : str
        Name of the nuclei "population" in the Harmony analysis protocol.

    Returns
    -------
    dfmc : pandas dataframe
        mapping between wells, treatment, and filename
        containing object level data.
        Sorted by cell line, drug and concentration
    """
    # Merge agent and concentration columns in the case of
    # combination experiments.
    dfm = process_metadata_file(dfm)

    barcode = obj.split('[')[0]
    dfm = dfm[dfm.barcode == barcode].copy()
    dfm.index = dfm.well.tolist()
    wells = []
    object_level_files = [s for s in os.listdir(obj)
                          if f'{nuclei_population_name}[0].txt' in s]
    for file in object_level_files:
        well = re.search('result.(.*?)\[', file).group(1)
        well = "%s%s" % (well[0], well[1:].zfill(2))
        wells.append(well)
    dfmap = pd.DataFrame(list(zip(wells, object_level_files)),
                         columns=['well', 'object_level_file'])
    dfmap.index = dfmap.well.tolist()
    dfmc = pd.concat([dfm, dfmap], axis=1)
    dfmc = dfmc.loc[:, ~dfmc.columns.duplicated()]
    dfmc = dfmc.dropna(subset=['object_level_file'])
    dfmc = dfmc.sort_values(['cell_line', 'agent', 'concentration'])
    return dfmc
Merges metadata with object level file and
    sorts files by cell line, drug and concetration.

    Parameters
    ----------
    dfm : pandas dataframe
        metadata file with wells mapped to treatment conditions
    obj : str
        path to folder containing object level data
    nuclei_population_name : str
        Name of the nuclei "population" in the Harmony analysis protocol.

    Returns
    -------
    dfmc : pandas dataframe
        mapping between wells, treatment, and filename
        containing object level data.
        Sorted by cell line, drug and concentration
    
Merges metadata with object level file and
sorts files by cell line, drug and concetration.

Parameters

dfm : pandas dataframe
metadata file with wells mapped to treatment conditions
obj : str
path to folder containing object level data
nuclei_population_name : str
Name of the nuclei "population" in the Harmony analysis protocol.

Returns

dfmc : pandas dataframe
mapping between wells, treatment, and filename
containing object level data.
Sorted by cell line, drug and concentration
Merges metadata with object level file and sorts files by cell line drug and concetration . Parameters dfm : pandas dataframe metadata file with wells mapped to treatment conditions obj : str path to folder containing object level data nuclei_population_name : str Name of the nuclei " population " in the Harmony analysis protocol . Returns dfmc : pandas dataframe mapping between wells treatment and filename containing object level data . Sorted by cell line drug and concentration
def merge_metadata(dfm, obj, nuclei_population_name):
    dfm = process_metadata_file(dfm)
    barcode = obj.split('[')[0]
    dfm = dfm[dfm.barcode == barcode].copy()
    dfm.index = dfm.well.tolist()
    wells = []
    object_level_files = [s for s in os.listdir(obj)
                          if f'{nuclei_population_name}[0].txt' in s]
    for file in object_level_files:
        well = re.search('result.(.*?)\[', file).group(1)
        well = "%s%s" % (well[0], well[1:].zfill(2))
        wells.append(well)
    dfmap = pd.DataFrame(list(zip(wells, object_level_files)),
                         columns=['well', 'object_level_file'])
    dfmap.index = dfmap.well.tolist()
    dfmc = pd.concat([dfm, dfmap], axis=1)
    dfmc = dfmc.loc[:, ~dfmc.columns.duplicated()]
    dfmc = dfmc.dropna(subset=['object_level_file'])
    dfmc = dfmc.sort_values(['cell_line', 'agent', 'concentration'])
    return dfmc
def merge_metadata ( dfm , obj , nuclei_population_name ) : dfm = process_metadata_file ( dfm ) barcode = obj . split ( '[' ) [ 0 ] dfm = dfm [ dfm . barcode == barcode ] . copy ( ) dfm . index = dfm . well . tolist ( ) wells = [ ] object_level_files = [ s for s in os . listdir ( obj ) if f'{nuclei_population_name}[0].txt' in s ] for file in object_level_files : well = re . search ( 'result.(.*?)\[' , file ) . group ( 1 ) well = "%s%s" % ( well [ 0 ] , well [ 1 : ] . zfill ( 2 ) ) wells . append ( well ) dfmap = pd . DataFrame ( list ( zip ( wells , object_level_files ) ) , columns = [ 'well' , 'object_level_file' ] ) dfmap . index = dfmap . well . tolist ( ) dfmc = pd . concat ( [ dfm , dfmap ] , axis = 1 ) dfmc = dfmc . loc [ : , ~ dfmc . columns . duplicated ( ) ] dfmc = dfmc . dropna ( subset = [ 'object_level_file' ] ) dfmc = dfmc . sort_values ( [ 'cell_line' , 'agent' , 'concentration' ] ) return dfmc
Merges metadata with object level file and
sorts files by cell line, drug and concetration.
Merges metadata with object level file and sorts files by cell line drug and concetration .
"""Merges metadata with object level file and
    sorts files by cell line, drug and concetration.

    Parameters
    ----------
    dfm : pandas dataframe
        metadata file with wells mapped to treatment conditions
    obj : str
        path to folder containing object level data
    nuclei_population_name : str
        Name of the nuclei "population" in the Harmony analysis protocol.

    Returns
    -------
    dfmc : pandas dataframe
        mapping between wells, treatment, and filename
        containing object level data.
        Sorted by cell line, drug and concentration
    """ # Merge agent and concentration columns in the case of # combination experiments.
dfm
obj
nuclei_population_name