def _to_python(self, value, state=None): if isinstance(value, cgi.FieldStorage): factory = ExperimentMetadataObjectFactory() try: plate = factory.parse_plate(None, infile=value.file) return plate except Exception, e: raise formencode.Invalid("Could not read file", value, state)
def from_plate(self, id=None): if not id: abort(404) plate = Session.query(Plate).get(id) if not plate: abort(404) # ignore possibility of reprocess config for now storage = QLStorageSource(config) path = storage.plate_path(plate) factory = ExperimentMetadataObjectFactory() qlp = factory.parse_plate(path) c.wells = qlp.analyzed_wells c.original_source = plate.name c.plate_template_id = None c.plate_setup_id = None c.id = id return self.__display(rowcol_order=qlp.acquisition_order)
def preview(self): template = os.path.basename(request.params.get('template')) # this is hacky, should be QLTStorageSource qlt_path = "%s/%s" % (config['qlb.setup_template_store'], template) factory = ExperimentMetadataObjectFactory() qlp = factory.parse_plate(qlt_path) c.wells = qlp.analyzed_wells c.original_source = None c.plate_template_id = None c.plate_setup_id = None c.id = None # this is ugly c.assay_field = {'value': '', 'options': [('','')]} c.class_decorator = lambda well: '' c.re_field = fl.instock_enzyme_field() c.form = h.LiteralForm( value = {'rowcol_order': str(ROWCOL_ORDER_ROW)}, option = {'rowcol_order': [(ROWCOL_ORDER_ROW, 'By Row (Left->Right)')]} ) c.preview_mode = True return render('/template/design.html')