コード例 #1
0
ファイル: cp_importer.py プロジェクト: bennihepp/yaca
        object_file_postfix = '_' + os.path.splitext(os.path.basename(object_file))[0].split('_')[-1]
        object_file_postfixes.append(object_file_postfix)

    pdc = import_cp2_csv_results(cp2_csv_path, image_file_postfix, object_file_postfixes, csv_delimiter, csv_extension)

    Importer().set_pdc(pdc)

    utils.update_state(importer.__name__, 'imported')

    print 'Finished importing data from CellProfiler'
    return 'Finished importing data from CellProfiler'


__dict__ = sys.modules[__name__].__dict__

utils.register_module(__name__, 'CellProfiler import', __dict__, utils.DEFAULT_STATE)

utils.register_parameter(__name__, 'image_cp2_file', utils.PARAM_INPUT_FILE, 'Image CSV file from CellProfiler 2', optional=True)
utils.set_parameter_hook(__name__, 'image_cp2_file', importer.filename_hook)

utils.register_parameter(__name__, 'object_cp2_csv_files', utils.PARAM_INPUT_FILES, 'Object CSV files from CellProfiler 2', optional=True)
utils.set_parameter_hook(__name__, 'object_cp2_csv_files', importer.filename_hook)

utils.register_parameter(__name__, 'cp2_csv_path', utils.PARAM_PATH, 'Path to CellProfiler 2 CSV files', optional=True)
utils.set_parameter_hook(__name__, 'cp2_csv_path', importer.filename_hook)

utils.register_parameter(__name__, 'csv_delimiter', utils.PARAM_STR, 'Delimiter for the CSV files', ',')

utils.register_parameter(__name__, 'csv_extension', utils.PARAM_STR, 'Extension for the CSV files', '.csv')

utils.register_action(__name__, 'import_cp', 'Import data from CellProfiler CSV files', import_data_from_cp)
コード例 #2
0
               repl_mask = pdc.objFeatures[:,pdc.objReplicateFeatureId][mask] == repl.index
               tr_repl_mask = numpy.logical_and(tr_mask, repl_mask)
               repl_name = '%d' % repl.index
               #name = '%s,[%d]' % (tr.name, repl.index)
               subnames.append(repl_name)
               submasks.append(tr_repl_mask)
       subgroups = zip(subnames, submasks)
       groups.append([tr.name, subgroups])
"""

# define necessary parameters for this module (see parameter_utils.py for details)
#
#
__dict__ = sys.modules[__name__].__dict__
#
utils.register_module(__name__, 'Grouping of cell objects', __dict__)
#
utils.add_required_state(__name__, importer.__name__, 'imported')
#
utils.register_parameter(__name__, 'custom_get_treatment_groups_src', utils.PARAM_LONGSTR, 'Function defining the grouping of cell objects by treatment', param_default=default_get_treatment_groups_src)
#
utils.register_parameter(__name__, 'custom_get_well_groups_src', utils.PARAM_LONGSTR, 'Function defining the grouping of cell objects by well', param_default=default_get_well_groups_src)
#
utils.register_parameter(__name__, 'custom_get_replicate_groups_src', utils.PARAM_LONGSTR, 'Function defining the grouping of cell objects by replicate', param_default=default_get_replicate_groups_src)
#
utils.register_parameter(__name__, 'custom_get_treatment_replicate_groups_src', utils.PARAM_LONGSTR, 'Function defining the grouping of cell objects by treatment and replicate', param_default=default_get_treatment_replicate_groups_src)
#
#utils.register_parameter(__name__, 'custom_get_groups_dict_src', utils.PARAM_DICT, 'Dictionary defining custom groupings of cell objects', param_default={}, hidden=True)
#
utils.register_parameter(__name__, 'reject_treatments', utils.PARAM_TREATMENTS, 'Treatments not to be used', param_default=[])
コード例 #3
0
ファイル: analyse.py プロジェクト: bennihepp/yaca
import numpy
import scipy
import scipy.linalg
import sklearn.decomposition

import distance


# define necessary parameters for this module (see parameter_utils.py for details)
#
import parameter_utils as utils

#
__dict__ = sys.modules[__name__].__dict__
#
utils.register_module(__name__, "Analysis of images", __dict__)
#
import importer

utils.add_required_state(__name__, importer.__name__, "imported")
#
utils.register_parameter(__name__, "control_treatment_names", utils.PARAM_TREATMENTS, "Names of the control treatments")
#
utils.register_parameter(__name__, "run_mahal_dist", utils.PARAM_BOOL, "Run Mahalanobis filter?", False)
#
utils.register_parameter(
    __name__,
    "mahal_dist_cutoff_fraction",
    utils.PARAM_FLOAT,
    "Fraction of control cells to use for mahalanobis distance",
    0.9,
コード例 #4
0
    if type(param_value) == str:
        values = [param_value]
    else:
        values = param_value
    for i, value in enumerate(values):
        if not os.path.isabs(value):
            values[i] = os.path.join(os.path.dirname(yaml_filename), value)
    if type(param_value) == str:
        return values[0]
    else:
        return values


__dict__ = sys.modules[__name__].__dict__

utils.register_module(__name__, 'Data import', __dict__, utils.DEFAULT_STATE)

utils.register_parameter(__name__, 'hdf5_input_file', utils.PARAM_INPUT_FILE, 'YACA HDF5 input file', optional=True)
utils.set_parameter_hook(__name__, 'hdf5_input_file', filename_hook)
utils.register_parameter(__name__, 'optional_hdf5_input_files', utils.PARAM_INPUT_FILES, 'Further YACA HDF5 input files', optional=True)
utils.set_parameter_hook(__name__, 'optional_hdf5_input_files', filename_hook)

utils.register_parameter(__name__, 'hdf5_output_file', utils.PARAM_OUTPUT_FILE, 'YACA HDF5 output file', optional=True)
utils.set_parameter_hook(__name__, 'hdf5_output_file', filename_hook)

utils.register_action(__name__, 'load_hdf5', 'Load data from a YACA HDF5 file', load_hdf5)

utils.register_action(__name__, 'save_hdf5', 'Save data as YACA HDF5 file', save_hdf5)

utils.register_action(__name__, 'normalize_intensities', 'Normalize intensity features to mean control cell intensity', normalize_intensities)
コード例 #5
0
    QUALITY_CONTROL_OUT_OF_PERIPHERY : 'out of image periphery',
    QUALITY_CONTROL_TOO_SMALL_NUCLEUS : 'too small nucleus area',
    QUALITY_CONTROL_TOO_BIG_NUCLEUS : 'too big nucleus area',
    QUALITY_CONTROL_TOO_SMALL_CYTOPLASM : 'too small cytoplasm area',
    QUALITY_CONTROL_TOO_BIG_CYTOPLASM : 'too big cytoplasm area',
    QUALITY_CONTROL_TOO_SMALL_NUCLEUS_SOLIDITY : 'too small nucleus solidity',
    QUALITY_CONTROL_NOT_ENOUGH_VALID_CELLS : 'not enough valid cells',
    QUALITY_CONTROL_TOO_MANY_CELLS : 'too many cells',
    QUALITY_CONTROL_NOT_ENOUGH_BG_PIXELS : 'not enough background pixels'
}

import parameter_utils as utils

__dict__ = sys.modules[__name__].__dict__

utils.register_module(__name__, 'Quality control of cells and images', __dict__)


import importer
utils.add_required_state(__name__, importer.__name__, 'imported')

utils.register_parameter(__name__, 'positionX', utils.PARAM_OBJ_FEATURE, 'Feature ID for the x coordinate of a cell (in pixel)', 'nucleus_Location_Center_X')
utils.register_parameter(__name__, 'positionY', utils.PARAM_OBJ_FEATURE, 'Feature ID for the y coordinate of a cell (in pixel)', 'nucleus_Location_Center_Y')

utils.register_parameter(__name__, 'cellArea', utils.PARAM_OBJ_FEATURE, 'Feature ID for the area of a cell (in pixel)', 'cell_AreaShape_Area')
utils.register_parameter(__name__, 'nucleusArea', utils.PARAM_OBJ_FEATURE, 'Feature ID for the area of a nucleus (in pixel)', 'nucleus_AreaShape_Area')

utils.register_parameter(__name__, 'nucleusSolidity', utils.PARAM_OBJ_FEATURE, 'Feature ID for the solidity of a nucleus', 'nucleus_AreaShape_Solidity')

utils.register_parameter(__name__, 'minAreaBg', utils.PARAM_INT, 'Minimum number of background pixels', 50000, 0, None)
utils.register_parameter(__name__, 'minNucArea', utils.PARAM_INT, 'Minimum area of nuclei in pixels', 1000, 0, None)