Exemplo n.º 1
0
 def OnOutlineMarked(self, evt=None):
     '''Outlines all non-NULL values of the current annotation
     '''
     # Disable filters when outlining marked wells
     #if self.outlineMarked.IsChecked():
         #self.filterChoice.SetStringSelection(FilterComboBox.NO_FILTER)
         #self.filterChoice.Disable()
     #else:
         #if not self.annotationShowVals.IsChecked():
             #self.filterChoice.Enable()
     # Update outlined wells in PlateMapPanels
     for pm in self.plateMaps:
         if self.outlineMarked.IsChecked():
             column = self.annotationCol.Value
             if p.plate_id:
                 res = db.execute('SELECT %s, %s FROM %s WHERE %s="%s"'%(
                     dbconnect.UniqueWellClause(), column, p.image_table, 
                     p.plate_id, pm.plate))
             else:
                 # if there's no plate_id, we assume there is only 1 plate
                 # and fetch all the data
                 res = db.execute('SELECT %s, %s FROM %s'%(
                     dbconnect.UniqueWellClause(), column, p.image_table))
             keys = [tuple(r[:-1]) for r in res if r[-1] is not None]
             pm.SetOutlinedWells(keys)
         else:
             pm.SetOutlinedWells([])
     self.UpdatePlateMaps()
Exemplo n.º 2
0
    def AddPlateMap(self, plateIndex=0):
        '''
        Adds a new blank plateMap to the PlateMapSizer.
        '''
        data = np.ones(p.plate_shape)

        # Try to get explicit labels for all wells.
        res = db.execute('SELECT DISTINCT %s FROM %s WHERE %s != "" and %s IS NOT NULL'%
                         (dbconnect.UniqueWellClause(), p.image_table, p.well_id, p.well_id))

        if p.plate_id:
            self.plateMapChoices += [ComboBox(self, choices=db.GetPlateNames(), size=(400,-1))]
            self.plateMapChoices[-1].Select(plateIndex)
            self.plateMapChoices[-1].Bind(wx.EVT_COMBOBOX, self.OnSelectPlate)
    
            #plate_col_type = db.GetColumnType(p.image_table, p.plate_id)
            #plate_id = plate_col_type(self.plateMapChoices[-1].GetString(plateIndex))
            
            plateMapChoiceSizer = wx.BoxSizer(wx.HORIZONTAL)
            plateMapChoiceSizer.Add(wx.StaticText(self, label='Plate:'), flag=wx.ALIGN_CENTER_VERTICAL)
            plateMapChoiceSizer.Add(self.plateMapChoices[-1], flag=wx.ALIGN_CENTER_VERTICAL)
        well_keys = res

        platemap = pmp.PlateMapPanel(self, data, well_keys, p.plate_shape,
                                     colormap = self.colorMapsChoice.Value,
                                     well_disp = self.wellDisplayChoice.Value)
        platemap.add_well_selection_handler(self.OnSelectWell)
        self.plateMaps += [platemap]

        singlePlateMapSizer = wx.BoxSizer(wx.VERTICAL)
        if p.plate_id:
            singlePlateMapSizer.Add(plateMapChoiceSizer, 0, wx.ALIGN_CENTER)
        singlePlateMapSizer.Add(platemap, 1, wx.EXPAND|wx.ALIGN_CENTER)

        self.plateMapSizer.Add(singlePlateMapSizer, 1, wx.EXPAND|wx.ALIGN_CENTER)