def remove_harvest_seed_track(self, h_tag): """Completely removes all events associated with a harvest_seed (sample transfer) track including the harvest seed coupled event""" h_instance = exp.get_tag_instance(h_tag) harvest_tp = exp.get_tag_timepoint(h_tag) tag_list = [h_tag] for s_instance in meta.get_field_instances("Transfer|Seed|HarvestInstance"): if meta.get_field("Transfer|Seed|HarvestInstance|%s" % s_instance) == h_instance: s_tag = "Transfer|Seed|Wells|%s|%s" % ( s_instance, str(harvest_tp + 1), ) # coupled seed is always 1 min after from harvest for tpnode in self.nodes_by_timepoint[harvest_tp + 1]: if tpnode: if s_tag in tpnode.tags: for c_tag in self.get_children_tags(tpnode, 5): if c_tag.startswith( "Transfer|Harvest" ): # in case further harvest-seed is there then make it recursive self.remove_harvest_seed_track(c_tag) else: for s_well in meta.get_field(s_tag): c_wells = meta.get_field(c_tag) if s_well in c_wells: c_wells.remove(s_well) meta.remove_associated_dataacquis_tag([s_well]) if c_wells: # if at least one other affected well meta.set_field(c_tag, c_wells) else: meta.remove_field(c_tag) # tag with single well meta.remove_timeline_attachments(exp.get_tag_timepoint(c_tag)) meta.remove_field(h_tag) meta.remove_field(s_tag) meta.remove_harvest_seed_tags(h_instance, s_instance)
def _on_mouse_click(self, evt): if self.current_node is None: return for tag in self.current_node.get_tags(): if (tag.startswith('DataAcquis|TLM') or tag.startswith('DataAcquis|HCS')): for well in self.current_node.get_well_ids(): image_tag = '%s|Images|%s|%s|%s'%(exp.get_tag_stump(tag, 2), exp.get_tag_instance(tag), exp.get_tag_timepoint(tag), well) urls = meta.get_field(image_tag, []) for url in urls: im = Image.open(url) im.show() elif tag.startswith('DataAcquis|FCS'): for well in self.current_node.get_well_ids(): image_tag = '%s|Images|%s|%s|%s'%(exp.get_tag_stump(tag, 2), exp.get_tag_instance(tag), exp.get_tag_timepoint(tag), well) urls = meta.get_field(image_tag, []) for url in urls: os.startfile(url) ## message = '' ## for well in sorted(self.current_node.get_well_ids()): ## message += ', '.join(well) ## message += '\n' ## msg = wx.MessageDialog(self, message, caption='Info', style=wx.OK | wx.ICON_INFORMATION | wx.STAY_ON_TOP, pos=(200,200)) ## msg.ShowModal() ## msg.Destroy() try: bench = wx.GetApp().get_bench() except: return # --- Update the Bench view --- bench.set_timepoint(self.current_node.get_timepoint()) bench.taglistctrl.set_selected_protocols( [exp.get_tag_protocol(tag) for tag in self.current_node.get_tags()]) bench.group_checklist.SetCheckedStrings( [exp.PlateDesign.get_plate_group(well[0]) for well in self.current_node.get_well_ids()]) bench.update_plate_groups() bench.update_well_selections()
def _on_mouse_click(self, evt): if self.current_node is None: return for tag in self.current_node.get_tags(): if tag.startswith("DataAcquis|TLM") or tag.startswith("DataAcquis|HCS"): for well in self.current_node.get_well_ids(): image_tag = "%s|Images|%s|%s|%s" % ( exp.get_tag_stump(tag, 2), exp.get_tag_instance(tag), exp.get_tag_timepoint(tag), well, ) urls = meta.get_field(image_tag, []) image_viewer_path = "" if os.path.isfile("C:\Program Files\ImageJ\ImageJ.exe"): ImageJPath = "C:\Program Files\ImageJ\ImageJ.exe" subprocess.Popen("%s %s" % (ImageJPath, " ".join(urls))) else: dlg = wx.lib.dialogs.ScrolledMessageDialog( self, str("\n".join(urls)), "ERROR!! ImageJ was not found in C\Program Files directory to show following images", ) dlg.ShowModal() return # for url in urls: # im = Image.open(url) # im.show() ##TODO: make it Try with ImageJ first then Exception is Image.open(url) # ImageJPath = r'C:\Program Files\ImageJ\ImageJ' # subprocess.Popen("%s %s" % (ImageJPath, url)) elif tag.startswith("DataAcquis|FCS"): for well in self.current_node.get_well_ids(): image_tag = "%s|Images|%s|%s|%s" % ( exp.get_tag_stump(tag, 2), exp.get_tag_instance(tag), exp.get_tag_timepoint(tag), well, ) urls = meta.get_field(image_tag, []) for url in urls: os.startfile(url) # print self.current_node.get_well_ids() # print self.current_node.get_parent() ## message = '' ## for well in sorted(self.current_node.get_well_ids()): ## message += ', '.join(well) ## message += '\n' ## msg = wx.MessageDialog(self, message, caption='Info', style=wx.OK | wx.ICON_INFORMATION | wx.STAY_ON_TOP, pos=(200,200)) ## msg.ShowModal() ## msg.Destroy() try: bench = wx.GetApp().get_bench() except: return # --- Update the Bench view --- bench.set_timepoint(self.current_node.get_timepoint()) bench.taglistctrl.set_selected_protocols([exp.get_tag_protocol(tag) for tag in self.current_node.get_tags()]) bench.group_checklist.SetCheckedStrings( [exp.PlateDesign.get_plate_group(well[0]) for well in self.current_node.get_well_ids()] ) bench.update_plate_groups() bench.update_well_selections() try: exptsettings = wx.GetApp().get_exptsettings() except: return # -- Update the expt setting/metadata view --# exptsettings.OnLeafSelect() if self.current_node.get_tags(): exptsettings.ShowInstance(self.current_node.get_tags()[0]) ancestors = [ exp.get_tag_stump(ptag, 2) for pnode in timeline.reverse_iter_tree(self.current_node) if pnode for ptag in pnode.tags ]
def get_timepoint(self): return exp.get_tag_timepoint(self.welltag)