def post(self, request, *args, **kwargs): self.load(request, *args, **kwargs) species = self.getModel().listOfSpecies.getBySbmlId(str(request.POST['sbml_id'])) self.data.update({ 'id': self.getModel().listOfSpecies.index(species), 'name': "" if species.getName() is None else species.getName(), 'sbml_id': species.getSbmlId(), 'compartment_name': species.getCompartment().getNameOrSbmlId(), 'compartment_id': self.getModel().listOfCompartments.index(species.getCompartment()), 'value': species.getValue(), 'isConcentration': 1 if not species.hasOnlySubstanceUnits else 0, 'constant': (1 if species.constant else 0), 'boundaryCondition': (1 if species.boundaryCondition else 0), 'notes': "" if species.getNotes() is None else species.getNotes(), }) if species.getUnits() is not None: self.data.update({ 'unit_name': "" if species.getUnits().getName() is None else species.getUnits().getName(), 'unit_id': self.getModel().listOfUnitDefinitions.index(species.getUnits()), }) if species.getAnnotation().getSBOTerm() is not None: self.data.update({ 'sboterm': species.getAnnotation().getSBOTerm(), 'sboterm_name': species.getAnnotation().getSBOTermDescription() }) return JsonRequest.post(self, request, *args, **kwargs)
def post(self, request, *args, **kwargs): self.load(request, *args, **kwargs) rule_ind = int(request.POST['rule_ind']) self.data.update({'rule_id': rule_ind}) if rule_ind < len(self.getModel().listOfRules): rule = self.getModel().listOfRules[rule_ind] self.data.update({'rule_type': rule.getRuleType(), 'rule_type_label': rule.getRuleTypeDescription()}) else: rule_ind -= len(self.getModel().listOfRules) rule = self.getModel().listOfInitialAssignments[rule_ind] self.data.update({'rule_type': 3, 'rule_type_label': 'Initial assignment'}) self.data.update({ 'expression': rule.getPrettyPrintDefinition() }) if self.data['rule_type'] != 0: self.data.update({ 'variable': self.listOfVariables.index(rule.getVariable()), 'variable_label': rule.getVariable().getNameOrSbmlId() }) return JsonRequest.post(self, request, *args, **kwargs)
def post(self, request, *args, **kwargs): self.load(request, *args, **kwargs) parameter = None if str(request.POST['reaction']) == "": parameter = self.getModel().listOfParameters.getBySbmlId(str(request.POST['sbml_id'])) self.data.update({ "reaction_id": "", "reaction_name": "", "id": self.getModel().listOfParameters.index(parameter) }) else: reaction = self.getModel().listOfReactions[int(request.POST['reaction'])-1] parameter = reaction.listOfLocalParameters.getBySbmlId(str(request.POST['sbml_id'])) self.data.update({ "reaction_id": (int(request.POST['reaction'])-1), "reaction_name": reaction.getName(), "id": reaction.listOfLocalParameters.index(parameter) }) self.data.update({ 'name': "" if parameter.getName() is None else parameter.getName(), 'sbml_id': parameter.getSbmlId(), 'value': parameter.getValue(), 'constant': (1 if parameter.constant else 0), 'unit_name': "Choose a unit" if parameter.getUnits() is None else parameter.getUnits().getName(), 'unit_id': "" if parameter.getUnits() is None else self.getModel().listOfUnitDefinitions.index(parameter.getUnits()), 'notes': "" if parameter.getNotes() is None else parameter.getNotes() }) if parameter.getAnnotation().getSBOTerm() is not None: self.data.update({ 'sboterm': parameter.getAnnotation().getSBOTerm(), 'sboterm_name': parameter.getAnnotation().getSBOTermDescription() }) return JsonRequest.post(self, request, *args, **kwargs)
def post(self, request, *args, **kwargs): if self.isUserLoggedIn(request): search_type = int(request.POST['search_type']) search_string = str(request.POST['search_string']) try: biomodels = BioModels() search_res = [] if search_string != "": if search_type == 0: search_res = biomodels.getModelsIdByName(search_string) elif search_type == 1: search_res = biomodels.getModelsIdByPerson(search_string) elif search_type == 2: search_res = biomodels.getModelsIdByPublication(search_string) elif search_type == 3: search_res = biomodels.getModelsIdByTaxonomy(search_string) elif search_type == 4: search_res = biomodels.getModelsIdByUniprot(search_string) self.data.update({'results': [model_id for model_id in sorted(search_res) if model_id.startswith("BIOMD")]}) except: self.data.update({'error': "Unable to connect to Biomodels"}) return JsonRequest.post(self, request, *args, **kwargs)
def post(self, request, *args, **kwargs): self.load(request, *args, **kwargs) continuation_id = int(request.POST['id']) continuation = self.listOfComputations[continuation_id] if continuation.result is not None and continuation.result != '': parameter = self.getModel().listOfVariables.getBySymbolStr( str(continuation.parameter)) if parameter.getUnits() is not None: parameter_unit = str(parameter.getUnits()) else: parameter_unit = "" t_object = loads(continuation.result.encode('Latin-1')) x, ys, stab = t_object.getStabilitySlicedCurves() points = t_object.getPoints() self.data.update({ 'curve_x': x, 'curve_ys': ys, 'stability': stab, 'points': points, 'parameter': parameter.getNameOrSbmlId(), 'parameter_unit': parameter_unit }) if t_object.hasHopfBifurcations(): x, ys = t_object.getLimitCycleCurves() self.data.update({'curve_lc_x': x, 'curve_lc_ys': ys}) return JsonRequest.post(self, request, *args, **kwargs)
def post(self, request, *args, **kwargs): self.data.update({ 'status': settings.RUN_INSTALL }) return JsonRequest.post(self, request, *args, **kwargs)
def post(self, request, *args, **kwargs): self.load(request, *args, **kwargs) t_sbml_id = str(request.POST['sbml_id']).strip() if ( 'reaction_id' in request.POST and request.POST['reaction_id'] != "" and int(request.POST['reaction_id']) > 0 ): t_reaction = self.getModel().listOfReactions[int(request.POST['reaction_id'])-1] if t_reaction.listOfLocalParameters.containsSbmlId(t_sbml_id): self.data.update({'error': 'sbml id already exists in reaction %s' % t_reaction.getName()}) elif not SyntaxChecker.isValidSBMLSId(str(request.POST['sbml_id'])): self.data.update({'error': 'sbml id is not valid'}) else: self.data.update({'error': ''}) elif self.getModel().listOfVariables.containsSbmlId(t_sbml_id): self.data.update({'error': 'sbml id already exists'}) elif not SyntaxChecker.isValidSBMLSId(str(request.POST['sbml_id'])): self.data.update({'error': 'sbml id is not valid'}) else: self.data.update({'error': ''}) return JsonRequest.post(self, request, *args, **kwargs)
def post(self, request, *args, **kwargs): self.load(request, *args, **kwargs) t_list = self.getListOfObjects(request) self.data.update({'list': t_list}) return JsonRequest.post(self, request, *args, **kwargs)
def post(self, request, *args, **kwargs): self.load(request, *args, **kwargs) rule_ind = int(request.POST['rule_ind']) self.data.update({'rule_id': rule_ind}) if rule_ind < len(self.getModel().listOfRules): rule = self.getModel().listOfRules[rule_ind] self.data.update({ 'rule_type': rule.getRuleType(), 'rule_type_label': rule.getRuleTypeDescription() }) else: rule_ind -= len(self.getModel().listOfRules) rule = self.getModel().listOfInitialAssignments[rule_ind] self.data.update({ 'rule_type': 3, 'rule_type_label': 'Initial assignment' }) self.data.update({'expression': rule.getPrettyPrintDefinition()}) if self.data['rule_type'] != 0: self.data.update({ 'variable': self.listOfVariables.index(rule.getVariable()), 'variable_label': rule.getVariable().getNameOrSbmlId() }) return JsonRequest.post(self, request, *args, **kwargs)
def post(self, request, *args, **kwargs): self.load(request, *args, **kwargs) compartment = self.getModel().listOfCompartments.getBySbmlId( str(request.POST['sbml_id'])) self.data.update({ 'id': self.getModel().listOfCompartments.index(compartment), 'name': "" if compartment.getName() is None else compartment.getName(), 'sbml_id': compartment.getSbmlId(), 'value': compartment.getValue(), 'constant': (1 if compartment.constant else 0), 'unit_name': "Choose a unit" if compartment.getUnits() is None else compartment.getUnits().getName(), 'unit_id': "" if compartment.getUnits() is None else self.getModel().listOfUnitDefinitions.index( compartment.getUnits()), 'notes': "" if compartment.getNotes() is None else compartment.getNotes() }) if compartment.getAnnotation().getSBOTerm() is not None: self.data.update({ 'sboterm': compartment.getAnnotation().getSBOTerm(), 'sboterm_name': compartment.getAnnotation().getSBOTermDescription() }) return JsonRequest.post(self, request, *args, **kwargs)
def post(self, request, *args, **kwargs): self.load(request, *args, **kwargs) dataset_ind = int(request.POST['dataset_ind']) experiment_data = Experiment.objects.filter(project=self.project)[dataset_ind] experiment = buildExperiment(experiment_data) experiment_variables = experiment.getVariables() model_variables = {} model_xpaths = {} for variable in experiment_variables: if self.getModelInstance().listOfVariables.containsSbmlId(variable): var = self.getModelInstance().listOfVariables.getBySbmlId(variable) model_variables.update({variable: var.getNameOrSbmlId()}) model_xpaths.update({variable: var.getXPath()}) elif self.getModelInstance().listOfVariables.containsName(variable): var = self.getModelInstance().listOfVariables.getByName(variable) model_variables.update({variable: var.getNameOrSbmlId()}) model_xpaths.update({variable: var.getXPath()}) else: model_variables.update({variable: None}) model_xpaths.update({variable: None}) self.data.update({ 'dataset_ind': dataset_ind, 'dataset_id': experiment_data.id, 'dataset_name': experiment_data.name, 'model_variables': model_variables, 'model_xpaths': model_xpaths }) return JsonRequest.post(self, request, *args, **kwargs)
def post(self, request, *args, **kwargs): self.load(request, *args, **kwargs) event_ind = int(request.POST['event_ind']) if event_ind < len(self.getModel().listOfEvents): event = self.getModel().listOfEvents[event_ind] self.data.update({ 'event_ind': event_ind, 'event_name': event.getName(), 'event_sbmlid': event.getSbmlId(), 'event_trigger': event.trigger.getPrettyPrintMathFormula(), 'event_persistent': 1 if event.trigger.isPersistent else 0, 'event_initialvalue': 1 if event.trigger.initialValue else 0, 'event_valuefromtrigger': 1 if event.useValuesFromTriggerTime else 0, 'event_delay': event.delay.getPrettyPrintMathFormula() if event.delay is not None else "", 'event_priority': event.priority.getPrettyPrintMathFormula() if event.priority is not None else "", 'list_of_assignments': [ ( self.listOfVariables.index(event_assignment.getVariable()), event_assignment.getVariable().getNameOrSbmlId(), event_assignment.getDefinition().getPrettyPrintMathFormula() ) for event_assignment in event.listOfEventAssignments ] }) # for ind, event_assignment in enumerate(event.listOfEventAssignments): # self.data.update({ # ('event_assignment_variable_%d' % ind): self.listOfVariables.index(event_assignment.getVariable()), # ('event_assignment_definition_%d' % ind): event_assignment.getDefinition().getPrettyPrintMathFormula() # }) return JsonRequest.post(self, request, *args, **kwargs)
def post(self, request, *args, **kwargs): field = str(request.POST['value']) required = not ("required" in request.POST.keys() and str(request.POST['required']) == "false") self.data.update({'error': self.readFloat(field, required)}) return JsonRequest.post(self, request, *args, **kwargs)
def post(self, request, *args, **kwargs): self.load(request, *args, **kwargs) reaction = self.getModel().listOfReactions[int( request.POST['reaction_id'])] self.data.update({'kinetic_law': reaction.getReactionKineticLaw()}) return JsonRequest.post(self, request, *args, **kwargs)
def post(self, request, *args, **kwargs): self.load(request, *args, **kwargs) parameter = None if str(request.POST['reaction']) == "": parameter = self.getModel().listOfParameters.getBySbmlId( str(request.POST['sbml_id'])) self.data.update({ "reaction_id": "", "reaction_name": "", "id": self.getModel().listOfParameters.values().index(parameter) }) else: reaction = self.getModel().listOfReactions[int( request.POST['reaction'])] parameter = reaction.listOfLocalParameters.getBySbmlId( str(request.POST['sbml_id'])) self.data.update({ "reaction_id": int(request.POST['reaction']), "reaction_name": reaction.getName(), "id": reaction.listOfLocalParameters.values().index(parameter) }) self.data.update({ 'name': "" if parameter.getName() is None else parameter.getName(), 'sbml_id': parameter.getSbmlId(), 'value': parameter.getValue(), 'constant': (1 if parameter.constant else 0), 'unit_name': "Choose a unit" if parameter.getUnits() is None else parameter.getUnits().getName(), 'unit_id': "" if parameter.getUnits() is None else self.getModel().listOfUnitDefinitions.values().index( parameter.getUnits()), 'notes': "" if parameter.getNotes() is None else parameter.getNotes() }) if parameter.getAnnotation().getSBOTerm() is not None: self.data.update({ 'sboterm': parameter.getAnnotation().getSBOTerm(), 'sboterm_name': parameter.getAnnotation().getSBOTermDescription() }) return JsonRequest.post(self, request, *args, **kwargs)
def post(self, request, *args, **kwargs): self.load(request, *args, **kwargs) substitution_id = int(request.POST['id']) listOfSubstitutions = self.getModel().listOfSbmlObjects.getListOfSubstitutions() if substitution_id < len(listOfSubstitutions): substitution = listOfSubstitutions[substitution_id] self.data.update({ 'id': substitution_id, }) if isinstance(substitution, ReplacedElement): self.data.update({ 'type': 0, 'object_id': self.listOfObjects.index(substitution.getParentObject()), 'object_name': substitution.getParentObject().getName(), }) submodel = self.getModel().listOfSubmodels.getBySbmlId(substitution.getSubmodelRef()) submodel_objects = [] for t_object in submodel.getModelObject().listOfSbmlObjects: if isinstance(t_object, Variable) and not t_object.isStoichiometry(): submodel_objects.append(t_object) self.data.update({ 'submodel_id': self.listOfSubmodels.index(submodel), 'submodel_name': submodel.getName(), 'submodel_object_id': submodel_objects.index(substitution.getReplacedElementObject()), 'submodel_object_name': substitution.getReplacedElementObject().getNameOrSbmlId(), }) elif isinstance(substitution, ReplacedBy): self.data.update({ 'type': 1, 'object_id': self.listOfObjects.index(substitution.getParentObject()), 'object_name': substitution.getParentObject().getName(), }) submodel = self.getModel().listOfSubmodels.getBySbmlId(substitution.getSubmodelRef()) submodel_objects = [] for t_object in submodel.getModelObject().listOfSbmlObjects: if isinstance(t_object, Variable) and not t_object.isStoichiometry(): submodel_objects.append(t_object) self.data.update({ 'submodel_id': self.listOfSubmodels.index(submodel), 'submodel_name': submodel.getName(), 'submodel_object_id': submodel_objects.index(substitution.getReplacingElement()), 'submodel_object_name': substitution.getReplacingElement().getNameOrSbmlId(), }) return JsonRequest.post(self, request, *args, **kwargs)
def post(self, request, *args, **kwargs): uri = URI() uri.setSBO(int(request.POST['sboterm'])) name = uri.getName() self.data.update({ 'name': "" if name is None else name, }) return JsonRequest.post(self, request, *args, **kwargs)
def post(self, request, *args, **kwargs): self.load(request, *args, **kwargs) name = str(request.POST['name']).strip() if SbmlModel.objects.filter(name=name).exists(): self.data.update({'error': 'already exists'}) else: self.data.update({'error': ''}) return JsonRequest.post(self, request, *args, **kwargs)
def post(self, request, *args, **kwargs): self.load(request, *args, **kwargs) t_list = self.getListOfObjects(request) self.data.update({'list': t_list}) print "Index : %d" % int(request.POST['model_id']) # print "List of objects : " # print t_list # print "" return JsonRequest.post(self, request, *args, **kwargs)
def post(self, request, *args, **kwargs): self.load(request, *args, **kwargs) t_str = request.POST['continuation_id'] if t_str != "": t_id = int(t_str) t_computation = self.listOfComputations[t_id] self.data.update({'status': str(t_computation.status)}) return JsonRequest.post(self, request, *args, **kwargs)
def post(self, request, *args, **kwargs): if self.isUserLoggedIn(request): if Project.objects.filter(id=int(request.POST['id'])).exists(): project = Project.objects.get(id=int(request.POST['id'])) self.data.update({ 'name': project.name, 'public': 1 if project.access == "PU" else 0 }) return JsonRequest.post(self, request, *args, **kwargs)
def post(self, request, *args, **kwargs): self.load(request, *args, **kwargs) try: t_math = MathFormula(self.model) t_math.setPrettyPrintMathFormula(str(request.POST['math'])) self.data.update({'valid': 'true'}) except ModelException as e: self.data.update({'valid': 'false'}) return JsonRequest.post(self, request, *args, **kwargs)
def post(self, request, *args, **kwargs): HasWorkingProject.load(self, request, *args, **kwargs) if (Condition.objects.filter(id=int(request.POST['id'])).exists()): condition = Condition.objects.get(id=int(request.POST['id'])) self.data.update({ 'name': "" if condition.name is None else condition.name, 'notes': "" if condition.notes is None else condition.notes }) return JsonRequest.post(self, request, *args, **kwargs)
def post(self, request, *args, **kwargs): HasWorkingProject.load(self, request, *args, **kwargs) if Experiment.objects.filter(project=self.project, id=int(request.POST['id'])).exists(): experiment = Experiment.objects.get(project=self.project, id=int(request.POST['id'])) self.data.update({ 'name': "" if experiment.name is None else experiment.name, 'notes': "" if experiment.notes is None else experiment.notes }) return JsonRequest.post(self, request, *args, **kwargs)
def post(self, request, *args, **kwargs): username = str(request.POST['username']).strip() if username == "": self.data.update({'error': 'is empty !'}) elif User.objects.filter(username=username).exists(): self.data.update({'error': ''}) else: self.data.update({'error': "doesn't exists !"}) return JsonRequest.post(self, request, *args, **kwargs)
def post(self, request, *args, **kwargs): HasWorkingProject.load(self, request, *args, **kwargs) if Treatment.objects.filter(id=int(request.POST['id'])).exists(): treatment = Treatment.objects.get(id=int(request.POST['id'])) self.data.update({ 'species': treatment.species, 'time': treatment.time, 'value': treatment.value }) return JsonRequest.post(self, request, *args, **kwargs)
def post(self, request, *args, **kwargs): self.load(request, *args, **kwargs) unit_id = str(request.POST['unit_id']) if not self.getModel().listOfUnitDefinitions.isUnitIdAvailable(unit_id): self.data.update({'valid': 'false'}) elif not SyntaxChecker.isValidUnitSId(unit_id): self.data.update({'valid': 'false'}) else: self.data.update({'valid': 'true'}) return JsonRequest.post(self, request, *args, **kwargs)
def post(self, request, *args, **kwargs): if self.isUserLoggedIn(request): model_id = str(request.POST['model_id']) try: biomodels = BioModels() name = biomodels.getModelNameById(model_id) self.data.update({'name': name}) except: self.data.update({'error': "Unable to connect to Biomodels"}) return JsonRequest.post(self, request, *args, **kwargs)
def post(self, request, *args, **kwargs): if "sboterm" in request.POST.keys(): name = None if request.POST['sboterm'] != "": uri = URI() uri.setSBO(int(request.POST['sboterm'])) name = uri.getName() self.data.update({ 'name': "" if name is None else name, }) return JsonRequest.post(self, request, *args, **kwargs)
def post(self, request, *args, **kwargs): self.load(request, *args, **kwargs) species = self.getModel().listOfSpecies.getBySbmlId( str(request.POST['sbml_id'])) self.data.update({ 'id': self.getModel().listOfSpecies.values().index(species), 'name': "" if species.getName() is None else species.getName(), 'sbml_id': species.getSbmlId(), 'compartment_name': species.getCompartment().getNameOrSbmlId(), 'compartment_id': self.getModel().listOfCompartments.values().index( species.getCompartment()), 'value': species.getValue(), 'isConcentration': 1 if not species.hasOnlySubstanceUnits else 0, 'constant': (1 if species.constant else 0), 'boundaryCondition': (1 if species.boundaryCondition else 0), 'notes': "" if species.getNotes() is None else species.getNotes(), }) if species.getUnits() is not None: self.data.update({ 'unit_name': "" if species.getUnits().getName() is None else species.getUnits().getName(), 'unit_id': self.getModel().listOfUnitDefinitions.values().index( species.getUnits()), }) if species.getAnnotation().getSBOTerm() is not None: self.data.update({ 'sboterm': species.getAnnotation().getSBOTerm(), 'sboterm_name': species.getAnnotation().getSBOTermDescription() }) return JsonRequest.post(self, request, *args, **kwargs)
def post(self, request, *args, **kwargs): self.load(request, *args, **kwargs) try: if 'scope' in request.POST: reaction = self.model.listOfReactions[int( request.POST['scope'])] t_math = MathFormula(self.model, isFromReaction=reaction) else: t_math = MathFormula(self.model) t_math.setPrettyPrintMathFormula(str(request.POST['math'])) self.data.update({'valid': 'true'}) except ModelException as e: self.data.update({'valid': 'false'}) return JsonRequest.post(self, request, *args, **kwargs)
def post(self, request, *args, **kwargs): self.load(request, *args, **kwargs) try: if 'scope' in request.POST: reaction = self.model.listOfReactions[int(request.POST['scope'])] t_math = MathFormula(self.model, isFromReaction=reaction) else: t_math = MathFormula(self.model) t_math.setPrettyPrintMathFormula(str(request.POST['math'])) self.data.update({'valid': 'true'}) except ModelException as e: self.data.update({'valid': 'false'}) return JsonRequest.post(self, request, *args, **kwargs)
def post(self, request, *args, **kwargs): if self.isUserLoggedIn(request): search_type = int(request.POST['search_type']) search_string = str(request.POST['search_string']) try: biomodels = BioModels() search_res = [] if search_string != "": if search_type == 0: search_res = biomodels.getModelsIdByName(search_string) elif search_type == 1: search_res = biomodels.getModelsIdByPerson( search_string) elif search_type == 2: search_res = biomodels.getModelsIdByPublication( search_string) elif search_type == 3: search_res = biomodels.getModelsIdByTaxonomy( search_string) elif search_type == 4: search_res = biomodels.getModelsIdByUniprot( search_string) self.data.update({ 'results': [ model_id for model_id in sorted(search_res) if model_id.startswith("BIOMD") ] }) except: self.data.update({'error': "Unable to connect to Biomodels"}) return JsonRequest.post(self, request, *args, **kwargs)
def post(self, request, *args, **kwargs): HasWorkingProject.load(self, request, *args, **kwargs) if Observation.objects.filter(id=int(request.POST['id'])).exists(): observation = Observation.objects.get(id=int(request.POST['id'])) self.data.update({ 'species': observation.species, 'time': observation.time, 'value': observation.value, 'value': observation.value, 'stddev': observation.stddev, 'steady_state': 1 if observation.steady_state else 0, 'min_steady_state': 0 if observation.min_steady_state is None else observation.min_steady_state, 'max_steady_state': 0 if observation.max_steady_state is None else observation.max_steady_state }) return JsonRequest.post(self, request, *args, **kwargs)
def post(self, request, *args, **kwargs): self.load(request, *args, **kwargs) unit_definition_id = int(request.POST['id']) unit_definition = self.getModel().listOfUnitDefinitions[unit_definition_id] self.data.update({ 'unit_id': unit_definition.getSbmlId(), 'name': unit_definition.getName(), 'desc': unit_definition.printUnitDefinition(), 'list_of_units': [ ( str(unit), list(Unit.unit_id.keys()).index(unit.getKind()), unit.getKindName(), unit.getExponent(), unit.getScale(), unit.getMultiplier() ) for unit in unit_definition.listOfUnits ] }) return JsonRequest.post(self, request, *args, **kwargs)
def post(self, request, *args, **kwargs): self.load(request, *args, **kwargs) unit_definition_id = int(request.POST['id']) unit_definition = self.getModel( ).listOfUnitDefinitions[unit_definition_id] self.data.update({ 'unit_id': unit_definition.getSbmlId(), 'name': unit_definition.getName(), 'desc': unit_definition.printUnitDefinition(), 'list_of_units': [(str(unit), list(Unit.unit_id.keys()).index(unit.getKind()), unit.getKindName(), unit.getExponent(), unit.getScale(), unit.getMultiplier()) for unit in unit_definition.listOfUnits] }) return JsonRequest.post(self, request, *args, **kwargs)
def post(self, request, *args, **kwargs): self.load(request, *args, **kwargs) compartment = self.getModel().listOfCompartments.getBySbmlId(str(request.POST['sbml_id'])) self.data.update({ 'id': self.getModel().listOfCompartments.index(compartment), 'name': "" if compartment.getName() is None else compartment.getName(), 'sbml_id': compartment.getSbmlId(), 'value': compartment.getValue(), 'constant': (1 if compartment.constant else 0), 'unit_name': "Choose a unit" if compartment.getUnits() is None else compartment.getUnits().getName(), 'unit_id': "" if compartment.getUnits() is None else self.getModel().listOfUnitDefinitions.index(compartment.getUnits()), 'notes': "" if compartment.getNotes() is None else compartment.getNotes() }) if compartment.getAnnotation().getSBOTerm() is not None: self.data.update({ 'sboterm': compartment.getAnnotation().getSBOTerm(), 'sboterm_name': compartment.getAnnotation().getSBOTermDescription() }) return JsonRequest.post(self, request, *args, **kwargs)
def post(self, request, *args, **kwargs): self.load(request, *args, **kwargs) dataset_ind = int(request.POST['dataset_ind']) experiment_data = Experiment.objects.filter( project=self.project)[dataset_ind] experiment = buildExperiment(experiment_data) experiment_variables = experiment.getVariables() model_variables = {} model_xpaths = {} for variable in experiment_variables: if self.getModelInstance().listOfVariables.containsSbmlId( variable): var = self.getModelInstance().listOfVariables.getBySbmlId( variable) model_variables.update({variable: var.getNameOrSbmlId()}) model_xpaths.update({variable: var.getXPath()}) elif self.getModelInstance().listOfVariables.containsName( variable): var = self.getModelInstance().listOfVariables.getByName( variable) model_variables.update({variable: var.getNameOrSbmlId()}) model_xpaths.update({variable: var.getXPath()}) else: model_variables.update({variable: None}) model_xpaths.update({variable: None}) self.data.update({ 'dataset_ind': dataset_ind, 'dataset_id': experiment_data.id, 'dataset_name': experiment_data.name, 'model_variables': model_variables, 'model_xpaths': model_xpaths }) return JsonRequest.post(self, request, *args, **kwargs)
def post(self, request, *args, **kwargs): self.load(request, *args, **kwargs) continuation_id = int(request.POST['id']) continuation = self.listOfComputations[continuation_id] if continuation.result is not None and continuation.result != '': parameter = self.getModel().listOfVariables.getBySymbolStr(str(continuation.parameter)) if parameter.getUnits() is not None: parameter_unit = str(parameter.getUnits()) else: parameter_unit = "" t_object = loads(continuation.result.encode('Latin-1')) x, ys, stab = t_object.getStabilitySlicedCurves() points = t_object.getPoints() self.data.update({ 'curve_x': x, 'curve_ys': ys, 'stability': stab, 'points': points, 'parameter': parameter.getNameOrSbmlId(), 'parameter_unit': parameter_unit }) if t_object.hasHopfBifurcations(): x, ys = t_object.getLimitCycleCurves() self.data.update({ 'curve_lc_x': x, 'curve_lc_ys': ys }) return JsonRequest.post(self, request, *args, **kwargs)
def __init__(self): JsonRequest.__init__(self) HasWorkingModel.__init__(self)
def __init__(self): JsonRequest.__init__(self) HasWorkingProject.__init__(self)
def __init__(self): JsonRequest.__init__(self) HasWorkingModel.__init__(self) self.listOfVariables = []
def __init__(self): JsonRequest.__init__(self) HasUserLoggedIn.__init__(self)
def __init__(self): JsonRequest.__init__(self)