コード例 #1
0
ファイル: PlotsPostFunction.py プロジェクト: dicara/flask-app
    def parameters(cls):
        cls.job_uuid = ParameterFactory.job_uuid(PA_PROCESS_COLLECTION)

        parameters = [
            cls.job_uuid,
        ]
        return parameters
コード例 #2
0
    def parameters(cls):
        cls.job_uuid_param  = ParameterFactory.job_uuid(SA_ASSAY_CALLER_COLLECTION)
        cls.job_name_param  = ParameterFactory.lc_string(JOB_NAME, JOB_NAME_DESC)
        cls.exp_defs_param  = ParameterFactory.experiment_definition()
        cls.req_drops_param = ParameterFactory.integer(REQUIRED_DROPS,
                                                       REQ_DROPS_DESCRIPTION,
                                                       required=True, default=0,
                                                       minimum=0)

        parameters = [
                      cls.job_uuid_param,
                      cls.job_name_param,
                      cls.exp_defs_param,
                      cls.req_drops_param,
                      ]
        return parameters
コード例 #3
0
    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
コード例 #4
0
 def process_request(cls, params_dict, del_file_keys=(RESULT,)):
     response         = {}
     http_status_code = 200
     
     uuids     = params_dict[ParameterFactory.job_uuid(cls.get_collection())]
     criteria  = {UUID: {"$in": uuids}}
     
     APP_LOGGER.info("Deleting the following jobs: %s" % ",".join(uuids))
     records = cls._DB_CONNECTOR.find(cls.get_collection(), criteria, 
                                      {ID:0})
     response["deleted"] = {}
     if len(records) > 0:
         # Record records
         for record in records:
             response["deleted"][record[UUID]] = record
         
         # Delete records from database
         result = cls._DB_CONNECTOR.remove(cls.get_collection(), 
                                           criteria)
         
         # Delete files from disk only if removal from DB was successful
         if result and result['n'] == len(response["deleted"]):
             for _,record in response["deleted"].iteritems():
                 for key in del_file_keys:
                     file_path = record.get(key, None)
                     if file_path is not None and os.path.isfile(file_path):
                         os.remove(file_path)
         else:
             del response["deleted"]
             raise Exception("Error deleting records from the " \
                             "database: %s" % result)
         APP_LOGGER.info("Successfully deleted the following jobs: %s" \
                         % ",".join(uuids))
     else:
         http_status_code = 404
         
     return response, http_status_code
コード例 #5
0
    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
コード例 #6
0
 def parameters(cls):
     parameters = [
                   ParameterFactory.job_uuid(cls.get_collection()),
                  ]
     return parameters