Пример #1
0
 def by_well_tag(self):
     well_tag_field = fl.well_tag_field(str(self.form_result['well_tag']))
     c.group_by_plate = self.form_result['group_by_plate']
     c.tag_id = self.form_result['well_tag']
     c.tag_name = Session.query(WellTag).get(c.tag_id).name
     c.form = h.LiteralFormSelectPatch(
         value = {'well_tag': well_tag_field['value'],
                  'group_by_plate': [u'1' if c.group_by_plate else u'0']},
         option = {'well_tag': [('--','--')]+well_tag_field['options'],
                   'group_by_plate': [(u'1', '')]}
     )
     
     well_tags = Session.query(WellTag).\
                         filter_by(id=c.tag_id).\
                         options(joinedload_all(WellTag.tag_wells, QLBWell.plate, QLBPlate.file, innerjoin=True),
                                 joinedload_all(WellTag.tag_wells, QLBWell.plate, QLBPlate.plate, innerjoin=True)).\
                         all()
     
     c.label_names = []
     
     if not len(well_tags):
         c.wells = []
         c.well_groups = []
     elif c.group_by_plate:
         wells = sorted(well_tags[0].wells, key=lambda well: (well.plate_id, well.well_name))
         well_groups = [(plate, list(wells)) for plate, wells in itertools.groupby(wells, lambda well: well.plate)]
         c.well_groups = sorted(well_groups, key=lambda tup: tup[0].host_datetime)
         c.well_groups.reverse()
     else:
         c.wells = sorted(well_tags[0].wells, key=lambda well: well.host_datetime)
         c.wells.reverse()
     
     return render('/box2/by_well_tag.html')
Пример #2
0
 def well_tag(self):
     well_tag_field = fl.well_tag_field()
     c.form = h.LiteralFormSelectPatch(
         value = {'well_tag': well_tag_field['value'],
                  'group_by_plate': [u'0']},
         option = {'well_tag': [('--','--')]+well_tag_field['options'],
                   'group_by_plate': [(u'1', '')]}
     )
     return render('/box2/well_tag.html')