Пример #1
0
    def __init__(self,
                 sh_type=StepHelperType.CREATE_NEW_TEMPLATE,
                 previous_template_id=-1,
                 previous_plan_id=-1):
        self.sh_type = sh_type
        self.previous_template_id = previous_template_id
        self.previous_plan_id = previous_plan_id
        self.parentName = None

        if (sh_type in [
                StepHelperType.EDIT_PLAN, StepHelperType.EDIT_PLAN_BY_SAMPLE,
                StepHelperType.EDIT_RUN, StepHelperType.EDIT_TEMPLATE
        ] and previous_template_id == -1 and previous_plan_id == -1):
            logger.error(
                "step_helper - StepHelper.init() for EDIT should have an existing ID."
            )
            raise ValueError("You must pass in a plan id or a template id.")

        self.steps = OrderedDict()
        if sh_type == StepHelperType.CREATE_NEW_PLAN_BY_SAMPLE or sh_type == StepHelperType.EDIT_PLAN_BY_SAMPLE or sh_type == StepHelperType.COPY_PLAN_BY_SAMPLE:
            steps_list = [
                IonreporterStepData(),
                ApplicationStepData(),
                KitsStepData(),
                MonitoringStepData(),
                ReferenceStepData(),
                PluginsStepData(),
                BarcodeBySampleStepData(),
                OutputStepData(),
                SavePlanBySampleStepData()
            ]

        elif sh_type == StepHelperType.CREATE_NEW_TEMPLATE_BY_SAMPLE:
            steps_list = [
                IonreporterStepData(),
                ApplicationStepData(),
                KitsStepData(),
                MonitoringStepData(),
                ReferenceStepData(),
                PluginsStepData(),
                OutputStepData(),
                SaveTemplateBySampleStepData()
            ]
        else:
            steps_list = [
                IonreporterStepData(),
                ApplicationStepData(),
                KitsStepData(),
                MonitoringStepData(),
                ReferenceStepData(),
                PluginsStepData(),
                OutputStepData(),
                SaveTemplateStepData(),
                SavePlanStepData()
            ]

        for step in steps_list:
            self.steps[step.getStepName()] = step
        self.update_dependent_steps(self.steps[StepNames.APPLICATION])
Пример #2
0
    def __init__(self, sh_type=StepHelperType.CREATE_NEW_TEMPLATE, previous_template_id=-1, previous_plan_id=-1):
        self.sh_type = sh_type
        self.previous_template_id = previous_template_id
        self.previous_plan_id = previous_plan_id
        self.parentName = None
        
        self.steps = OrderedDict()
        if sh_type == StepHelperType.CREATE_NEW_PLAN_BY_SAMPLE or sh_type == StepHelperType.EDIT_PLAN_BY_SAMPLE or sh_type == StepHelperType.COPY_PLAN_BY_SAMPLE:
            steps_list = [IonreporterStepData(), ApplicationStepData(), KitsStepData(), MonitoringStepData(),
                      ReferenceStepData(), PluginsStepData(), BarcodeBySampleStepData(), 
                      OutputStepData(), SavePlanBySampleStepData()]

        elif sh_type == StepHelperType.CREATE_NEW_TEMPLATE_BY_SAMPLE:
            steps_list = [IonreporterStepData(), ApplicationStepData(), KitsStepData(), MonitoringStepData(),
                      ReferenceStepData(), PluginsStepData(), 
                      OutputStepData(), SaveTemplateBySampleStepData()]            
        else:
            steps_list = [IonreporterStepData(), ApplicationStepData(), KitsStepData(), MonitoringStepData(),
                      ReferenceStepData(), PluginsStepData(), OutputStepData(),
                      SaveTemplateStepData(), SavePlanStepData()]    
        
        for step in steps_list:
            self.steps[step.getStepName()] = step
        self.update_dependant_steps(self.steps[StepNames.APPLICATION])
Пример #3
0
    def __init__(self,
                 sh_type=StepHelperType.CREATE_NEW_TEMPLATE,
                 previous_template_id=-1,
                 previous_plan_id=-1,
                 experiment_id=-1):
        self.sh_type = sh_type
        self.previous_template_id = previous_template_id
        self.previous_plan_id = previous_plan_id
        self.experiment_id = experiment_id
        self.parentName = None
        self.isFromScratch = False
        # set to true if we are creating a plan or template from a system template
        self.isParentSystem = False

        if (sh_type in [
                StepHelperType.EDIT_PLAN, StepHelperType.EDIT_PLAN_BY_SAMPLE,
                StepHelperType.EDIT_RUN, StepHelperType.EDIT_TEMPLATE
        ] and previous_template_id == -1 and previous_plan_id == -1):
            logger.error(
                "step_helper - StepHelper.init() for EDIT should have an existing ID."
            )
            raise ValueError("You must pass in a plan id or a template id.")

        self.steps = OrderedDict()
        if sh_type == StepHelperType.CREATE_NEW_PLAN_BY_SAMPLE or sh_type == StepHelperType.EDIT_PLAN_BY_SAMPLE or sh_type == StepHelperType.COPY_PLAN_BY_SAMPLE:
            referenceStepData = ReferenceStepData(sh_type)
            barcodeBySampleStepData = BarcodeBySampleStepData(sh_type)
            analysisParamsStepData = AnalysisParamsStepData(sh_type)

            steps_list = [
                IonreporterStepData(sh_type),
                ApplicationStepData(sh_type),
                KitsStepData(sh_type), referenceStepData,
                analysisParamsStepData,
                PluginsStepData(sh_type), barcodeBySampleStepData,
                OutputStepData(sh_type),
                SavePlanBySampleStepData(sh_type)
            ]

            # some section can appear in multiple chevrons, key is the step name and value is the step_data object
            barcodeBySampleStepData.step_sections.update(
                {StepNames.REFERENCE: referenceStepData})
            barcodeBySampleStepData.step_sections.update(
                {StepNames.ANALYSIS_PARAMS: analysisParamsStepData})

        elif sh_type == StepHelperType.CREATE_NEW_TEMPLATE_BY_SAMPLE:
            referenceStepData = ReferenceStepData(sh_type)
            saveTemplateBySampleData = SaveTemplateBySampleStepData(sh_type)
            analysisParamsStepData = AnalysisParamsStepData(sh_type)

            steps_list = [
                IonreporterStepData(sh_type),
                ApplicationStepData(sh_type),
                KitsStepData(sh_type), referenceStepData,
                analysisParamsStepData,
                PluginsStepData(sh_type),
                OutputStepData(sh_type), saveTemplateBySampleData
            ]

            saveTemplateBySampleData.step_sections.update(
                {StepNames.REFERENCE: referenceStepData})
            saveTemplateBySampleData.step_sections.update(
                {StepNames.ANALYSIS_PARAMS: analysisParamsStepData})

        elif sh_type == StepHelperType.COPY_TEMPLATE or sh_type == StepHelperType.CREATE_NEW_TEMPLATE or sh_type == StepHelperType.EDIT_TEMPLATE:
            referenceStepData = ReferenceStepData(sh_type)
            saveTemplateStepData = SaveTemplateStepData(sh_type)
            analysisParamsStepData = AnalysisParamsStepData(sh_type)

            steps_list = [
                IonreporterStepData(sh_type),
                ApplicationStepData(sh_type),
                KitsStepData(sh_type), referenceStepData,
                analysisParamsStepData,
                PluginsStepData(sh_type),
                OutputStepData(sh_type), saveTemplateStepData
            ]

            saveTemplateStepData.step_sections.update(
                {StepNames.REFERENCE: referenceStepData})
            saveTemplateStepData.step_sections.update(
                {StepNames.ANALYSIS_PARAMS: analysisParamsStepData})

        else:

            referenceStepData = ReferenceStepData(sh_type)
            # SaveTemplateStepData is needed for the last chevron during plan creation
            saveTemplateStepData = SaveTemplateStepData(sh_type)
            savePlanStepData = SavePlanStepData(sh_type)
            analysisParamsStepData = AnalysisParamsStepData(sh_type)

            steps_list = [
                IonreporterStepData(sh_type),
                ApplicationStepData(sh_type),
                KitsStepData(sh_type), referenceStepData,
                analysisParamsStepData,
                PluginsStepData(sh_type),
                OutputStepData(sh_type), saveTemplateStepData, savePlanStepData
            ]

            savePlanStepData.step_sections.update({
                StepNames.REFERENCE:
                referenceStepData
            })  ###referenceStepData.sectionParentStep = savePlanStepData
            savePlanStepData.step_sections.update(
                {StepNames.ANALYSIS_PARAMS: analysisParamsStepData})

        for step in steps_list:
            self.steps[step.getStepName()] = step

        self.update_dependent_steps(self.steps[StepNames.APPLICATION])
Пример #4
0
    def __init__(
        self,
        sh_type=StepHelperType.CREATE_NEW_TEMPLATE,
        previous_template_id=-1,
        previous_plan_id=-1,
        experiment_id=-1,
    ):
        self.sh_type = sh_type
        self.previous_template_id = previous_template_id
        self.previous_plan_id = previous_plan_id
        self.experiment_id = experiment_id
        self.parentName = None
        self.isFromScratch = False
        # set to true if we are creating a plan or template from a system template
        self.isParentSystem = False

        if (sh_type in [
                StepHelperType.EDIT_PLAN,
                StepHelperType.EDIT_PLAN_BY_SAMPLE,
                StepHelperType.EDIT_RUN,
                StepHelperType.EDIT_TEMPLATE,
        ] and previous_template_id == -1 and previous_plan_id == -1):
            logger.error(
                "step_helper - StepHelper.init() for EDIT should have an existing ID."
            )
            raise ValueError(
                validation.
                invalid_required_at_least_one_polymorphic_type_value(
                    validation.Entity_EntityFieldName(Plan.verbose_name, "id"),
                    validation.Entity_EntityFieldName(
                        PlanTemplate.verbose_name, "id"),
                ))  # "You must pass in a Plan id or a Template id."

        self.steps = OrderedDict()

        steps_list = []
        if settings.FEATURE_FLAGS.IONREPORTERUPLOADER:
            steps_list.append(IonreporterStepData(sh_type))
            steps_list.append(ApplicationStepData(sh_type))
        else:
            steps_list.append(IonreporterStepData(sh_type, next_step_url=None))
            steps_list.append(ApplicationStepData(sh_type, prev_step_url=None))

        if (sh_type == StepHelperType.CREATE_NEW_PLAN_BY_SAMPLE
                or sh_type == StepHelperType.EDIT_PLAN_BY_SAMPLE
                or sh_type == StepHelperType.COPY_PLAN_BY_SAMPLE):
            referenceStepData = ReferenceStepData(sh_type)
            barcodeBySampleStepData = BarcodeBySampleStepData(sh_type)
            analysisParamsStepData = AnalysisParamsStepData(sh_type)

            steps_list.extend([
                KitsStepData(sh_type),
                referenceStepData,
                analysisParamsStepData,
                PluginsStepData(sh_type),
                barcodeBySampleStepData,
                OutputStepData(sh_type),
                SavePlanBySampleStepData(sh_type),
            ])

            # some section can appear in multiple chevrons, key is the step name and value is the step_data object
            barcodeBySampleStepData.step_sections.update(
                {StepNames.REFERENCE: referenceStepData})
            barcodeBySampleStepData.step_sections.update(
                {StepNames.ANALYSIS_PARAMS: analysisParamsStepData})

        elif sh_type == StepHelperType.CREATE_NEW_TEMPLATE_BY_SAMPLE:
            referenceStepData = ReferenceStepData(sh_type)
            saveTemplateBySampleData = SaveTemplateBySampleStepData(sh_type)
            analysisParamsStepData = AnalysisParamsStepData(sh_type)

            steps_list.extend([
                KitsStepData(sh_type),
                referenceStepData,
                analysisParamsStepData,
                PluginsStepData(sh_type),
                OutputStepData(sh_type),
                saveTemplateBySampleData,
            ])

            saveTemplateBySampleData.step_sections.update(
                {StepNames.REFERENCE: referenceStepData})
            saveTemplateBySampleData.step_sections.update(
                {StepNames.ANALYSIS_PARAMS: analysisParamsStepData})

        elif (sh_type == StepHelperType.COPY_TEMPLATE
              or sh_type == StepHelperType.CREATE_NEW_TEMPLATE
              or sh_type == StepHelperType.EDIT_TEMPLATE):
            referenceStepData = ReferenceStepData(sh_type)
            saveTemplateStepData = SaveTemplateStepData(sh_type)
            analysisParamsStepData = AnalysisParamsStepData(sh_type)

            steps_list.extend([
                KitsStepData(sh_type),
                referenceStepData,
                analysisParamsStepData,
                PluginsStepData(sh_type),
                OutputStepData(sh_type),
                saveTemplateStepData,
            ])

            saveTemplateStepData.step_sections.update(
                {StepNames.REFERENCE: referenceStepData})
            saveTemplateStepData.step_sections.update(
                {StepNames.ANALYSIS_PARAMS: analysisParamsStepData})

        else:

            referenceStepData = ReferenceStepData(sh_type)
            # SaveTemplateStepData is needed for the last chevron during plan creation
            saveTemplateStepData = SaveTemplateStepData(sh_type)
            savePlanStepData = SavePlanStepData(sh_type)
            analysisParamsStepData = AnalysisParamsStepData(sh_type)

            steps_list.extend([
                KitsStepData(sh_type),
                referenceStepData,
                analysisParamsStepData,
                PluginsStepData(sh_type),
                OutputStepData(sh_type),
                saveTemplateStepData,
                savePlanStepData,
            ])

            savePlanStepData.step_sections.update({
                StepNames.REFERENCE:
                referenceStepData
            })  ###referenceStepData.sectionParentStep = savePlanStepData
            savePlanStepData.step_sections.update(
                {StepNames.ANALYSIS_PARAMS: analysisParamsStepData})

        for step in steps_list:
            self.steps[step.getStepName()] = step

        self.update_dependent_steps(self.steps[StepNames.APPLICATION])