def edit(self, id): """ Edits an assay. """ assay_q = Session.query(Assay) assay = assay_q.filter_by(id=id).first() dye_field = fl.assay_dye_field(assay.dye) quencher_field = fl.assay_quencher_field(assay.quencher) secondary_structure = fl.tertiary_field(assay.secondary_structure) if assay is None: abort(404) else: c.assay = assay owner_field = fl.person_field(c.assay.owner_id) c.form = h.LiteralFormSelectPatch( value={ "dye": dye_field["value"], "quencher": quencher_field["value"], "owner_id": unicode(owner_field["value"]), "secondary_structure": secondary_structure["value"], }, option={ "chromosome": [("", "--")] + [(chr, chr) for chr in Chromosome.chrom_list], "owner_id": owner_field["options"], "dye": dye_field["options"], "quencher": quencher_field["options"], "secondary_structure": secondary_structure["options"], }, ) values = { "name": assay.name, "gene": assay.gene, "owner_id": unicode(assay.owner_id), "primer_fwd": assay.primer_fwd, "primer_rev": assay.primer_rev, "chromosome": assay.chromosome, "probe_pos": assay.probe_pos, "probe_seq": assay.probe_seq, "dye": assay.dye, "quencher": assay.quencher, "secondary_structure": secondary_structure["value"], "amplicon_width": assay.amplicon_width, "snp_rsid": assay.snp_rsid, "notes": assay.notes, "reference_source": assay.reference_source, "optimal_anneal_temp": assay.optimal_anneal_temp, } if assay.assay_type == Assay.TYPE_LOCATION: c.selectedTab = 1 elif assay.assay_type == Assay.TYPE_SNP: c.selectedTab = 2 else: c.selectedTab = 0 return htmlfill.render(render("/assay/edit.html"), values)
def new(self): dye_field = fl.assay_dye_field() quencher_field = fl.assay_quencher_field() owner_field = fl.person_field() secondary_structure = fl.tertiary_field() c.form = h.LiteralFormSelectPatch( value={ "dye": dye_field["value"], "quencher": quencher_field["value"], "owner_id": owner_field["value"], "secondary_structure": secondary_structure["value"], }, option={ "chromosome": [("", "--")] + [(chr, chr) for chr in Chromosome.chrom_list], "owner_id": [("", "--")] + owner_field["options"], "dye": dye_field["options"], "quencher": quencher_field["options"], "secondary_structure": secondary_structure["options"], }, ) return render("/assay/new.html")