def parameters(cls): cls._dyes_lots_param = ParameterFactory.dyes_lots() cls._ndyes_param = ParameterFactory.integer( NDYES, 'Number of dyes to use for design.') cls._nbarcodes_param = ParameterFactory.integer( NBARCODES, 'Integer specifying the number of barcodes to generate', required=True) cls._mix_volume_param = ParameterFactory.float( MIX_VOL, 'Float specifying the mix volume in ul', default=0.0, required=False) cls._total_volume_param = ParameterFactory.float( TOTAL_VOL, 'Float specifying total volume in ul', default=0.0, required=False) cls._pico1_dye_param = ParameterFactory.cs_string( PICO1_DYE, 'Picoinjection 1 dye', required=False) parameters = [ cls._dyes_lots_param, cls._ndyes_param, cls._nbarcodes_param, cls._mix_volume_param, cls._total_volume_param, cls._pico1_dye_param, ] return parameters
def parameters(cls): cls._dyes_metrics = ParameterFactory.dye_metrics() cls._drop_ave_diameter = ParameterFactory.float( DROP_AVE_DIAMETER, 'Float specifying average drop diameter', required=True) cls._drop_std_diameter = ParameterFactory.float( DROP_STD_DIAMETER, 'Float specifying drop diameter standard deviation', required=True) parameters = [ cls._drop_ave_diameter, cls._dyes_metrics, cls._drop_std_diameter ] return parameters
def parameters(cls): cls._design_param = ParameterFactory.design('Library design data.', required=True) cls._mix_volume_param = ParameterFactory.float(MIX_VOL, 'Float specifying the mix volume in ul', default=0.0, required=False) cls._total_volume_param = ParameterFactory.float(TOTAL_VOL, 'Float specifying total volume in ul', default=0.0, required=False) cls._nbarcodes_param = ParameterFactory.integer(NBARCODES, 'Integer specifying the number of barcodes to generate', required=True) parameters = [ cls._design_param, cls._mix_volume_param, cls._total_volume_param, cls._nbarcodes_param, ] return parameters
def parameters(cls): cls.job_uuid_param = ParameterFactory.job_uuid(SA_IDENTITY_COLLECTION) cls.job_name_param = ParameterFactory.lc_string(JOB_NAME, 'Unique '\ 'name to give this ' 'job.') cls.exp_defs_param = ParameterFactory.experiment_definition() cls.training_param = ParameterFactory.integer( TRAINING_FACTOR, TRAINING_FACTOR_DESCRIPTION, default=AC_TRAINING_FACTOR, minimum=1, required=True) cls.ctrl_thresh = ParameterFactory.float(CTRL_THRESH, CTRL_THRESH_DESCRIPTION, default=AC_CTRL_THRESHOLD, minimum=0.0, maximum=100.0) cls.ctrl_filter = ParameterFactory.boolean(CTRL_FILTER, CTRL_FILTER_DESCRIPTION, default_value=False, required=True) cls.ac_method = ParameterFactory.ac_method(AC_METHOD, AC_METHOD_DESCRIPTION) cls.ac_model = ParameterFactory.cs_string( AC_MODEL, AC_MODEL_DESCRIPTION, required=False, enum=[ m for model_dict in MODEL_FILES.values() for m in model_dict ]) parameters = [ cls.job_uuid_param, cls.job_name_param, cls.exp_defs_param, cls.training_param, cls.ctrl_thresh, cls.ctrl_filter, cls.ac_method, cls.ac_model, ] return parameters
def parameters(cls): cls.job_uuid_param = ParameterFactory.job_uuid(PA_PROCESS_COLLECTION) cls.job_name_param = ParameterFactory.lc_string(JOB_NAME, "Unique "\ "name to give this " "job.") cls.pico1_dye_param = ParameterFactory.dye(PICO1_DYE, "Picoinjection 1 dye.") cls.pico2_dye_param = ParameterFactory.dye(PICO2_DYE, "Picoinjection 2 dye.") cls.assay_dye_param = ParameterFactory.dye(ASSAY_DYE, "Assay dye.") cls.n_probes_param = ParameterFactory.integer(NUM_PROBES, NUM_PROBES_DESCRIPTION, default=0, minimum=0) cls.training_param = ParameterFactory.integer(TRAINING_FACTOR, TRAINING_FACTOR_DESCRIPTION, default=DEFAULT_ID_TRAINING_FACTOR, minimum=1) cls.dye_levels_param = ParameterFactory.dye_levels() cls.ignored_dyes_param = ParameterFactory.dyes(name=IGNORED_DYES, required=False) cls.filtered_dyes_param = ParameterFactory.dyes(name=FILTERED_DYES, required=False) cls.ui_threshold_param = ParameterFactory.float(UI_THRESHOLD, UI_THRESHOLD_DESCRIPTION, default=UNINJECTED_THRESHOLD, minimum=0.0) cls.continuous_phase_param = ParameterFactory.boolean(CONTINUOUS_PHASE, CONTINUOUS_PHASE_DESCRIPTION, default_value=False, required=False) cls.dev_mode_param = ParameterFactory.boolean(DEV_MODE, 'Use development mode (more forgiving of mistakes).', default_value=DEFAULT_DEV_MODE, required=False) cls.drift_compensate_param = ParameterFactory.boolean(DRIFT_COMPENSATE, 'Compensate for data drift.', default_value=DEFAULT_DRIFT_COMPENSATE, required=False) cls.max_ui_ratio_param = ParameterFactory.float(MAX_UNINJECTED_RATIO, MAX_UI_RATIO_DESCRIPTION, default=UNINJECTED_RATIO, minimum=0.0) cls.ignore_lowest_barcode = ParameterFactory.boolean(IGNORE_LOWEST_BARCODE, IGNORE_LOWEST_BARCODE_DESCRIPTION, default_value=DEFAULT_IGNORE_LOWEST_BARCODE, required=False) parameters = [ cls.job_uuid_param, cls.job_name_param, cls.pico1_dye_param, cls.pico2_dye_param, cls.assay_dye_param, cls.n_probes_param, cls.training_param, cls.dye_levels_param, cls.ignored_dyes_param, cls.filtered_dyes_param, cls.ui_threshold_param, cls.continuous_phase_param, cls.max_ui_ratio_param, cls.ignore_lowest_barcode, cls.dev_mode_param, cls.drift_compensate_param, ] return parameters
def parameters(cls): # required parameters cls.job_name_param = ParameterFactory.lc_string( JOB_NAME, 'Unique name for this job.', required=True) cls.exp_def_param = ParameterFactory.experiment_definition() cls.mask_param = ParameterFactory.cs_string( VARIANT_MASK, 'Mask code for variant selection.', required=False) # primary analysis parameters cls.pa_data_src_param = ParameterFactory.cs_string( PA_DATA_SOURCE, "Primary analysis data source (HDF5 or image stack).", required=True) cls.dyes_param = ParameterFactory.dyes(required=False) cls.device_param = ParameterFactory.device(required=False, default='katahdin') cls.major_param = ParameterFactory.integer(MAJOR, 'Major dye version', minimum=0, required=False, default=1) cls.minor_param = ParameterFactory.integer(MINOR, 'Minor dye version', minimum=0, required=False, default=0) cls.offset = ParameterFactory.integer( OFFSETS, 'Offset used to infer a dye model.', default=abs(DEFAULT_OFFSETS[0]), minimum=1, required=False) cls.use_iid_param = ParameterFactory.boolean(USE_IID, 'Use IID Peak Detection.', default_value=False, required=False) # identity parameters cls.dye_levels_param = ParameterFactory.dye_levels(required=False) cls.ignored_dyes_param = ParameterFactory.dyes(name=IGNORED_DYES, required=False) cls.filtered_dyes_param = ParameterFactory.dyes(name=FILTERED_DYES, required=False) cls.pico1_dye_param = ParameterFactory.dye(PICO1_DYE, 'picoinjection 1 dye.', required=False, default=None) cls.pico2_dye_param = ParameterFactory.dye(PICO2_DYE, 'picoinjection 2 dye.', required=False, default=DEFAULT_PICO2_DYE) cls.assay_dye_param = ParameterFactory.dye(ASSAY_DYE, 'Assay dye.', required=False, default=DEFAULT_ASSAY_DYE) cls.n_probes_param = ParameterFactory.integer(NUM_PROBES, NUM_PROBES_DESCRIPTION, minimum=4, required=False) cls.id_training_param = ParameterFactory.integer( ID_TRAINING_FACTOR, TRAINING_FACTOR_DESCRIPTION, minimum=1, required=False, default=DEFAULT_ID_TRAINING_FACTOR, ) cls.ui_threshold_param = ParameterFactory.float( UI_THRESHOLD, UI_THRESHOLD_DESCRIPTION, minimum=0.0, required=False, default=DEFAULT_UNINJECTED_THRESHOLD) cls.continuous_phase_param = ParameterFactory.boolean( CONTINUOUS_PHASE, CONTINUOUS_PHASE_DESCRIPTION, default_value=False, required=False) cls.max_ui_ratio_param = ParameterFactory.float( MAX_UNINJECTED_RATIO, MAX_UI_RATIO_DESCRIPTION, default=DEFAULT_UNINJECTED_RATIO, minimum=0.0) cls.ignore_lowest_barcode = ParameterFactory.boolean( IGNORE_LOWEST_BARCODE, IGNORE_LOWEST_BARCODE_DESCRIPTION, default_value=True, required=False) cls.use_pico1_filter = ParameterFactory.boolean( USE_PICO1_FILTER, USE_PICO1_FILTER_DESCRIPTION, default_value=True, required=False) cls.use_pico2_filter = ParameterFactory.boolean( USE_PICO2_FILTER, USE_PICO2_FILTER_DESCRIPTION, default_value=True, required=False) cls.dev_mode_param = ParameterFactory.boolean( DEV_MODE, 'Use development mode (more forgiving of mistakes).', default_value=DEFAULT_DEV_MODE, required=False) cls.drift_compensate_param = ParameterFactory.boolean( DRIFT_COMPENSATE, 'Compensate for data drift.', default_value=DEFAULT_DRIFT_COMPENSATE, required=False) # assay caller params cls.ac_training_param = ParameterFactory.integer( AC_TRAINING_FACTOR, TRAINING_FACTOR_DESCRIPTION, minimum=1, required=False, default=DEFAULT_AC_TRAINING_FACTOR) cls.ctrl_thresh = ParameterFactory.float( CTRL_THRESH, CTRL_THRESH_DESCRIPTION, default=DEFAULT_AC_CTRL_THRESHOLD, minimum=0.0, maximum=100.0) cls.ctrl_filter = ParameterFactory.boolean(CTRL_FILTER, CTRL_FILTER_DESCRIPTION, default_value=False, required=True) cls.ac_method = ParameterFactory.ac_method(AC_METHOD, AC_METHOD_DESCRIPTION) cls.ac_model = ParameterFactory.cs_string( AC_MODEL, AC_MODEL_DESCRIPTION, required=False, enum=[ m for model_dict in MODEL_FILES.values() for m in model_dict ]) # genotyper params cls.req_drops_param = ParameterFactory.integer(REQUIRED_DROPS, REQ_DROPS_DESCRIPTION, required=False, minimum=0, default=0) parameters = [ cls.pa_data_src_param, cls.dyes_param, cls.device_param, cls.major_param, cls.minor_param, cls.job_name_param, cls.offset, cls.use_iid_param, cls.pico1_dye_param, cls.pico2_dye_param, cls.assay_dye_param, cls.n_probes_param, cls.id_training_param, cls.dye_levels_param, cls.ignored_dyes_param, cls.dev_mode_param, cls.drift_compensate_param, cls.use_pico1_filter, cls.use_pico2_filter, cls.filtered_dyes_param, cls.ui_threshold_param, cls.continuous_phase_param, cls.max_ui_ratio_param, cls.ignore_lowest_barcode, cls.ac_training_param, cls.ctrl_thresh, cls.ctrl_filter, cls.ac_method, cls.ac_model, cls.req_drops_param, cls.exp_def_param, cls.mask_param, ] return parameters
def process_request(cls, params_dict): plate_file = params_dict[ParameterFactory.file( "Raw plate reader data file.")][0] probe_sequence = params_dict[ParameterFactory.cs_string( "probe_sequence", "Probe sequence.")][0] probe_tm = params_dict[ParameterFactory.float( "probe_tm", "Probe melting temperature (degrees celsius).")][0] probe_length = params_dict[ParameterFactory.integer( "probe_length", "Probe length.")][0] target_sequence = params_dict[ParameterFactory.cs_string( "target_sequence", "Target sequence.")][0] variant_location = params_dict[ParameterFactory.cs_string( "variant_location", "Variant location.")][0] variant_allele = params_dict[ParameterFactory.cs_string( "variant_allele", "Variant allele.")][0] reference_allele = params_dict[ParameterFactory.cs_string( "reference_allele", "Reference allele.")][0] incubation_temp = params_dict[ParameterFactory.float( "incubation_temp", "Incubation temperature (degrees celsius).")][0] incubation_time = params_dict[ParameterFactory.float( "incubation_time", "Incubation time (minutes).")][0] json_response = { FILENAME: plate_file.filename, "probe_sequence": probe_sequence, "probe_tm": probe_tm, "probe_length": probe_length, "target_sequence": target_sequence, "variant_location": variant_location, "variant_allele": variant_allele, "reference_allele": reference_allele, "incubation_temp": incubation_temp, "incubation_time": incubation_time, } http_status_code = 200 file_uuid = str(uuid4()) path = os.path.join(PLATES_UPLOAD_PATH, file_uuid) existing_filenames = cls._DB_CONNECTOR.distinct( PLATES_COLLECTION, FILENAME) if os.path.exists(path) or plate_file.filename in existing_filenames: http_status_code = 403 else: try: plate_file.save(path) plate_file.close() json_response[URL] = "http://%s/uploads/%s/plates/%s" % ( HOSTNAME, PORT, file_uuid) json_response[FILEPATH] = path json_response[UUID] = file_uuid json_response[DATESTAMP] = datetime.today() json_response[TYPE] = "plate" cls._DB_CONNECTOR.insert(PLATES_COLLECTION, [json_response]) except: APP_LOGGER.exception(traceback.format_exc()) json_response[ERROR] = str(sys.exc_info()[1]) http_status_code = 500 finally: if ID in json_response: del json_response[ID] silently_remove_file(path) return make_clean_response(json_response, http_status_code)