Esempio n. 1
0
    def validateField(self, field_name, new_field_value):
        self.validationErrors.pop(field_name, None)

        if field_name == SaveTemplateStepDataFieldNames.TEMPLATE_NAME:
            errors = validate_plan_name(
                new_field_value,
                field_label=_(
                    "workflow.step.savetemplate.fields.templateName.label"),
            )  #'Template Name'
            if errors:
                self.validationErrors[field_name] = "\n".join(errors)
        elif field_name == SaveTemplateStepDataFieldNames.NOTE:
            errors = validate_notes(
                new_field_value,
                field_label=_("workflow.step.savetemplate.fields.note.label"),
            )
            if errors:
                self.validationErrors[field_name] = "\n".join(errors)

        # validate all qc thresholds must be positive integers
        elif field_name in self.qcNames:
            errors = validate_QC(new_field_value,
                                 ModelsQcTypeToLabelsQcType(field_name))
            if errors:
                self.validationErrors[field_name] = errors[0]

        else:
            for section, sectionObj in list(self.step_sections.items()):
                self.validationErrors.pop(field_name, None)
 def validateField(self, field_name, new_field_value):
     if field_name == 'templateName':
         errors = validate_plan_name(new_field_value, 'Template Name')
         if errors:
             self.validationErrors[field_name] = errors
         else:
             self.validationErrors.pop(field_name, None)
 def validateStep(self):
     new_field_value = self.savedFields[SavePlanBySampleFieldNames.TEMPLATE_NAME]
     errors = validate_plan_name(new_field_value, 'Plan Name')
     if errors:
         self.validationErrors['invalidPlanName'] = errors
     else:
         self.validationErrors.pop('invalidPlanName', None)
Esempio n. 4
0
 def validateField(self, field_name, new_field_value):
     if field_name == 'templateName':
         errors = validate_plan_name(new_field_value, 'Template Name')
         if errors:
             self.validationErrors[field_name] = errors
         else:
             self.validationErrors.pop(field_name, None)
Esempio n. 5
0
 def validateStep(self):
     new_field_value = self.savedFields[SavePlanBySampleFieldNames.TEMPLATE_NAME]
     errors = validate_plan_name(new_field_value, 'Plan Name')
     if errors:
         self.validationErrors['invalidPlanName'] = errors
     else:
         self.validationErrors.pop('invalidPlanName', None)
 def validateStep(self):
     new_field_value = self.savedFields[
         SavePlanBySampleFieldNames.TEMPLATE_NAME]
     errors = validate_plan_name(
         new_field_value,
         field_label=_(
             "workflow.step.saveplan.bysample.fields.planName.label"),
     )  #'Plan Name'
     if errors:
         self.validationErrors["invalidPlanName"] = errors
     else:
         self.validationErrors.pop("invalidPlanName", None)
Esempio n. 7
0
def _validate_plan_name(input, selectedTemplate, planObj):
    """
    validate plan name with leading/trailing blanks in the input ignored
    """    
    errorMsg = None
    errors = validate_plan_name(input)
    if errors:
        errorMsg = '  '.join(errors)
    else:
        value = input.strip()
        planObj.get_planObj().planDisplayedName = value
        planObj.get_planObj().planName = value.replace(' ', '_')
    
    return errorMsg
Esempio n. 8
0
def _validate_plan_name(input, selectedTemplate, planObj):
    """
    validate plan name with leading/trailing blanks in the input ignored
    """    
    errorMsg = None
    errors = validate_plan_name(input)
    if errors:
        errorMsg = '  '.join(errors)
    else:
        value = input.strip()
        planObj.get_planObj().planDisplayedName = value
        planObj.get_planObj().planName = value.replace(' ', '_')
    
    return errorMsg
Esempio n. 9
0
 def validateField(self, field_name, new_field_value):
     self.validationErrors.pop(field_name, None)
     
     if field_name == SavePlanFieldNames.PLAN_NAME:
         errors = validate_plan_name(new_field_value, 'Plan Name')
         if errors:
             self.validationErrors[field_name] = '\n'.join(errors)
     elif field_name == SavePlanFieldNames.NOTE:
         errors = validate_notes(new_field_value)
         if errors:
             self.validationErrors[field_name] = '\n'.join(errors)
     elif field_name == SavePlanFieldNames.BARCODE_SAMPLE_TUBE_LABEL:
         errors = validate_sample_tube_label(new_field_value)
         if errors:
             self.validationErrors[field_name] = '\n'.join(errors)
Esempio n. 10
0
    def validateField(self, field_name, new_field_value):
        self.validationErrors.pop(field_name, None)

        if field_name == SaveTemplateStepDataFieldNames.TEMPLATE_NAME:
            errors = validate_plan_name(new_field_value, 'Template Name')
            if errors:
                self.validationErrors[field_name] = '\n'.join(errors)

        elif field_name == SaveTemplateStepDataFieldNames.NOTE:
            errors = validate_notes(new_field_value)
            if errors:
                self.validationErrors[field_name] = '\n'.join(errors)

        # validate all qc thresholds must be positive integers
        elif field_name in self.qcNames:
            errors = validate_QC(new_field_value, field_name)
            if errors:
                self.validationErrors[field_name] = errors[0]
Esempio n. 11
0
    def validateField(self, field_name, new_field_value):
        self.validationErrors.pop(field_name, None)
        
        if field_name == SaveTemplateStepDataFieldNames.TEMPLATE_NAME:
            errors = validate_plan_name(new_field_value, 'Template Name')
            if errors:
                self.validationErrors[field_name] = '\n'.join(errors)

        elif field_name == SaveTemplateStepDataFieldNames.NOTE:
            errors = validate_notes(new_field_value)
            if errors:
                self.validationErrors[field_name] = '\n'.join(errors)    

        # validate all qc thresholds must be positive integers
        elif field_name in self.qcNames:
            errors = validate_QC(new_field_value, field_name)
            if errors:
                self.validationErrors[field_name] = errors[0]
Esempio n. 12
0
    def validateField(self, field_name, new_field_value):
        self.validationErrors.pop(field_name, None)

        if field_name == SaveTemplateStepDataFieldNames.TEMPLATE_NAME:
            errors = validate_plan_name(new_field_value, "Template Name")
            if errors:
                self.validationErrors[field_name] = "\n".join(errors)
        elif field_name == SaveTemplateStepDataFieldNames.NOTE:
            errors = validate_notes(new_field_value)
            if errors:
                self.validationErrors[field_name] = "\n".join(errors)

        # validate all qc thresholds must be positive integers
        elif field_name in self.qcNames:
            errors = validate_QC(new_field_value, field_name)
            if errors:
                self.validationErrors[field_name] = errors[0]

        else:
            for section, sectionObj in self.step_sections.items():
                self.validationErrors.pop(field_name, None)
Esempio n. 13
0
    def validateField(self, field_name, new_field_value):
        self.validationErrors.pop(field_name, None)

        # if the plan has been sequenced, do not enforce the target bed file to be selected
        planStatus = self.getDefaultSectionPrepopulatedFieldDict().get("planStatus", "")

        if field_name == SavePlanFieldNames.PLAN_NAME:
            errors = validate_plan_name(new_field_value, 'Plan Name')
            if errors:
                self.validationErrors[field_name] = '\n'.join(errors)
        elif field_name == SavePlanFieldNames.NOTE:
            errors = validate_notes(new_field_value)
            if errors:
                self.validationErrors[field_name] = '\n'.join(errors)
        elif field_name == SavePlanFieldNames.BARCODE_SAMPLE_TUBE_LABEL:
            errors = validate_sample_tube_label(new_field_value)
            if errors:
                self.validationErrors[field_name] = '\n'.join(errors)
        elif field_name == SavePlanFieldNames.CHIP_BARCODE_LABEL:
            errors = validate_chipBarcode(new_field_value)
            if errors:
                self.validationErrors[field_name] = '\n'.join(errors)

        elif field_name in self.qcNames:
            '''
            All qc thresholds must be positive integers
            '''
            errors = validate_QC(new_field_value, field_name)
            if errors:
                self.validationErrors[field_name] = errors[0]
            else:
                self.validationErrors.pop(field_name, None)

        elif field_name == SavePlanFieldNames.SAMPLES_TABLE:
            sample_table_list = json.loads(new_field_value)

            samples_errors = []

            applProduct = self.savedObjects[SavePlanFieldNames.APPL_PRODUCT]
            # applProduct object is not saved yet
            if applProduct:
                isTargetRegionSelectionRequired = applProduct.isTargetRegionBEDFileSelectionRequiredForRefSelection
            else:
                isTargetRegionSelectionRequired = False

            applicationGroupName = self.prepopulatedFields[SavePlanFieldNames.APPLICATION_GROUP_NAME]
            for row in sample_table_list:

                sample_name = row.get(SavePlanFieldNames.SAMPLE_NAME, '').strip()
                if sample_name:
                    sample_nucleotideType = row.get(SavePlanFieldNames.BARCODE_SAMPLE_NUCLEOTIDE_TYPE, "")

                    sampleReference = row.get(SavePlanFieldNames.BARCODE_SAMPLE_REFERENCE, "")
                    sampleTargetRegionBedFile = row.get(SavePlanFieldNames.BARCODE_SAMPLE_TARGET_REGION_BED_FILE, "")

                    runType = self.prepopulatedFields[SavePlanFieldNames.RUN_TYPE]

                    errors = []
                    # if the plan has been sequenced, do not enforce the target bed file to be selected
                    isMainBEDFileValidated = "default_targetBedFile" in self.validationErrors
                    if not isMainBEDFileValidated and planStatus != "run" and (self.sh_type not in StepHelperType.TEMPLATE_TYPES):
                        errors = validate_targetRegionBedFile_for_runType(sampleTargetRegionBedFile, runType, sampleReference, sample_nucleotideType, applicationGroupName, "Target Regions BED File for " + sample_name)

                    if errors:
                        samples_errors.append('\n'.join(errors))

                if samples_errors:
                    self.validationErrors[field_name] = '\n'.join(samples_errors)