Example #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)
Example #2
0
def _validate_notes(input, selectedTemplate, planObj):
    """
    validate notes with leading/trailing blanks in the input ignored
    """    
    errorMsg = None
    if input:
        errors = validate_notes(input)
        if errors:
            errorMsg = '  '.join(errors)
        else:                
            planObj.get_expObj().notes = input.strip()
    else:
        planObj.get_expObj().notes = ""
        
    return errorMsg
Example #3
0
def _validate_notes(input, selectedTemplate, planObj):
    """
    validate notes with leading/trailing blanks in the input ignored
    """    
    errorMsg = None
    if input:
        errors = validate_notes(input)
        if errors:
            errorMsg = '  '.join(errors)
        else:                
            planObj.get_expObj().notes = input.strip()
    else:
        planObj.get_expObj().notes = ""
        
    return errorMsg
Example #4
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)
    def validateField(self, field_name, new_field_value):
        self.validationErrors.pop(field_name, None)

        if field_name == SavePlanBySampleFieldNames.NOTE:
            errors = validate_notes(new_field_value)
            if errors:
                self.validationErrors[field_name] = '\n'.join(errors)    
        
        '''
        All qc thresholds must be positive integers
        '''
        if field_name in self.qcNames:
            errors = validate_QC(new_field_value, field_name)
            if errors:
                self.validationErrors[field_name] = errors[0]
            else:
                self.validationErrors.pop(field_name, None)
Example #6
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]
Example #7
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]
Example #8
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)
    def validateField(self, field_name, new_field_value):
        self.validationErrors.pop(field_name, None)

        if field_name == SavePlanBySampleFieldNames.NOTE:
            errors = validate_notes(
                new_field_value,
                field_label=_(
                    "workflow.step.saveplan.bysample.fields.note.label"),
            )
            if errors:
                self.validationErrors[field_name] = "\n".join(errors)
        """
        All qc thresholds must be positive integers
        """
        if field_name in self.qcNames:

            errors = validate_QC(new_field_value,
                                 ModelsQcTypeToLabelsQcType(field_name))
            if errors:
                self.validationErrors[field_name] = errors[0]
            else:
                self.validationErrors.pop(field_name, None)
Example #10
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)