Ejemplo n.º 1
0
    def on_save_settings(self, evt):
        # for saving the experimental file, the text file may have the following nomenclature
        # Date(YYYY_MM_DD)_ExperimenterNumber_Experimenter Name_ first 20 words from the aim

        meta = ExperimentSettings.getInstance()

        #-- Get Experimental Date/number ---#
        exp_date = meta.get_field('Overview|Project|ExptDate')
        exp_num = meta.get_field('Overview|Project|ExptNum')
        exp_title = meta.get_field('Overview|Project|Title')
        if None not in [exp_date, exp_num, exp_title]:
            day, month, year = exp_date.split('/')
            filename = '%s%s%s_%s_%s.txt' % (year, month, day, exp_num,
                                             exp_title)
        else:
            filename = 'new_experiment.txt'

        dlg = wx.FileDialog(None,
                            message='Saving experimental metadata...',
                            defaultDir=os.getcwd(),
                            defaultFile=filename,
                            wildcard='.txt',
                            style=wx.SAVE | wx.FD_OVERWRITE_PROMPT)
        if dlg.ShowModal() == wx.ID_OK:
            os.chdir(os.path.split(dlg.GetPath())[0])
            ExperimentSettings.getInstance().save_to_file(dlg.GetPath())
Ejemplo n.º 2
0
 def on_load_settings(self, evt):
     dlg = wx.FileDialog(
         None,
         "Select the file containing your ProtocolNavigator workspace...",
         defaultDir=os.getcwd(),
         style=wx.OPEN | wx.FD_CHANGE_DIR)
     if dlg.ShowModal() == wx.ID_OK:
         ExperimentSettings.getInstance().load_from_file(dlg.GetPath())
 def on_load_settings(self, evt):
     meta = ExperimentSettings.getInstance()
     dlg = wx.FileDialog(
         None,
         "Select the file containing your ProtocolNavigator workspace...",
         defaultDir=os.getcwd(),
         style=wx.OPEN | wx.FD_CHANGE_DIR,
     )
     if dlg.ShowModal() == wx.ID_OK:
         ExperimentSettings.getInstance().load_from_file(dlg.GetPath(), self.loadSettingsMenuItem)
         if meta.get_field("Overview|Project|Title") is not None:
             self.settings_frame.SetTitle("ProtocolNavigator - %s" % meta.get_field("Overview|Project|Title"))
 def on_save_settings(self, evt):
     # for saving the experimental file, the text file may have the following nomenclature
     # Date(YYYY_MM_DD)_ExperimenterNumber_Experimenter Name_ first 20 words from the aim
     meta = ExperimentSettings.getInstance()
     if meta.get_field("Overview|Project|Title") is not None:
         self.settings_frame.SetTitle("ProtocolNavigator - %s" % meta.get_field("Overview|Project|Title"))
     meta.save_file_dialogue()
    def OnAddStep(self, event):
	meta = ExperimentSettings.getInstance()
	
	steps = sorted([step for step in self.curr_protocol.keys()
	 if not step.startswith('ADMIN')] , key = meta.stringSplitByNumbers)
	
	for step in steps:
	    if not self.curr_protocol[step]:
		dial = wx.MessageDialog(None, 'Please fill the description in %s !!' %step, 'Error', wx.OK | wx.ICON_ERROR)
		dial.ShowModal()  
		return

	ctrl = event.GetEventObject()
	
	 #Rearrange the steps numbers in the experimental settings
	temp_steps = {}
	
	for step in steps:
	    stepNo = int(step.split('Step')[1])
	    step_info =  self.curr_protocol[step]	
	    	    
	    if stepNo > ctrl.GetId() and temp_steps[stepNo] is not []:
		temp_steps[stepNo+1] =self.curr_protocol[step]
		del self.curr_protocol[step]
	    else:
		temp_steps[stepNo] = self.curr_protocol[step]
		temp_steps[stepNo+1] = []
		del self.curr_protocol[step]
	
	for stepNo in sorted(temp_steps.iterkeys()):
	    self.curr_protocol['Step%s'%str(stepNo)] = temp_steps[stepNo]	
	
	self.fgs.Clear(deleteWindows=True)
	
	self.showSteps()
Ejemplo n.º 6
0
    def OnAddStep(self, event):
        meta = ExperimentSettings.getInstance()

        #if meta.get_field(self.tag_stump+'|ProtocolName|'+self.instance) is None:
        #dial = wx.MessageDialog(None, 'Please fill the Title/Name filed!!', 'Error', wx.OK | wx.ICON_ERROR)
        #dial.ShowModal()
        #return
        # also check whether the description field has been filled by users
        steps = sorted(meta.get_attribute_list_by_instance(
            self.tag_stump + '|Step', self.instance),
                       key=meta.stringSplitByNumbers)

        for step in steps:
            step_info = meta.get_field(self.tag_stump + '|%s|%s' %
                                       (step, self.instance))
            if not step_info[0]:
                dial = wx.MessageDialog(
                    None, 'Please fill the description in %s !!' % step,
                    'Error', wx.OK | wx.ICON_ERROR)
                dial.ShowModal()
                return

        ctrl = event.GetEventObject()

        ## Rearrange the steps numbers in the experimental settings
        temp_steps = {}

        for step in steps:
            stepNo = int(step.split('Step')[1])

            if stepNo > ctrl.GetId() and temp_steps[stepNo] is not []:
                temp_steps[stepNo +
                           1] = meta.get_field(self.tag_stump + '|%s|%s' %
                                               (step, self.instance))
                meta.remove_field(self.tag_stump + '|%s|%s' %
                                  (step, self.instance))
            else:
                temp_steps[stepNo] = meta.get_field(self.tag_stump + '|%s|%s' %
                                                    (step, self.instance))
                temp_steps[stepNo + 1] = []
                meta.remove_field(self.tag_stump + '|%s|%s' %
                                  (step, self.instance))

        for stepNo in sorted(temp_steps.iterkeys()):
            meta.set_field(
                self.tag_stump + '|%s|%s' %
                ('Step%s' % str(stepNo), self.instance), temp_steps[stepNo])

        #clear the bottom panel
        self.fgs.Clear(deleteWindows=True)

        #redraw the panel
        self.showSteps()
 def on_save_settings(self, evt):
     # for saving the experimental file, the text file may have the following nomenclature
     # Date(YYYY_MM_DD)_ExperimenterNumber_Experimenter Name_ first 20 words from the aim
 
     meta = ExperimentSettings.getInstance()
     
     #-- Get Experimental Date/number ---#
     exp_date = meta.get_field('Overview|Project|ExptDate')
     exp_num = meta.get_field('Overview|Project|ExptNum')
     exp_title = meta.get_field('Overview|Project|Title')
     if None not in [exp_date, exp_num, exp_title]:
         day, month, year = exp_date.split('/')
         filename = '%s%s%s_%s_%s.txt'%(year, month, day , exp_num, exp_title)
     else:
         filename = 'new_experiment.txt'
     
     dlg = wx.FileDialog(None, message='Saving experimental metadata...', 
                         defaultDir=os.getcwd(), defaultFile=filename, 
                         wildcard='.txt', 
                         style=wx.SAVE|wx.FD_OVERWRITE_PROMPT)
     if dlg.ShowModal() == wx.ID_OK:
         os.chdir(os.path.split(dlg.GetPath())[0])
         ExperimentSettings.getInstance().save_to_file(dlg.GetPath())
    def OnAddStep(self, event):
	meta = ExperimentSettings.getInstance()
	
	#if meta.get_field(self.tag_stump+'|ProtocolName|'+self.instance) is None:
	    #dial = wx.MessageDialog(None, 'Please fill the Title/Name filed!!', 'Error', wx.OK | wx.ICON_ERROR)
	    #dial.ShowModal()  
	    #return
	# also check whether the description field has been filled by users
	steps = sorted(meta.get_attribute_list_by_instance(self.tag_stump+'|Step', self.instance), key = meta.stringSplitByNumbers)
	
	for step in steps:
	    step_info = meta.get_field(self.tag_stump+'|%s|%s' %(step, self.instance))
	    if not step_info[0]:
		dial = wx.MessageDialog(None, 'Please fill the description in %s !!' %step, 'Error', wx.OK | wx.ICON_ERROR)
		dial.ShowModal()  
		return
	    
	ctrl = event.GetEventObject()
	
	## Rearrange the steps numbers in the experimental settings
	temp_steps = {}
	
	for step in steps:
	    stepNo = int(step.split('Step')[1])
	    
	    if stepNo > ctrl.GetId() and temp_steps[stepNo] is not []:
		temp_steps[stepNo+1] = meta.get_field(self.tag_stump+'|%s|%s' %(step, self.instance))
		meta.remove_field(self.tag_stump+'|%s|%s' %(step, self.instance))
	    else:
		temp_steps[stepNo] = meta.get_field(self.tag_stump+'|%s|%s' %(step, self.instance))
		temp_steps[stepNo+1] = []
		meta.remove_field(self.tag_stump+'|%s|%s' %(step, self.instance))		
	
	for stepNo in sorted(temp_steps.iterkeys()):
	    meta.set_field(self.tag_stump+'|%s|%s' %('Step%s'%str(stepNo),  self.instance),  temp_steps[stepNo])	
	
	#clear the bottom panel
	self.fgs.Clear(deleteWindows=True)
	
	#redraw the panel
	self.showSteps()
    def OnAddStep(self, event):
        meta = ExperimentSettings.getInstance()

        steps = sorted([
            step for step in self.curr_protocol.keys()
            if not step.startswith('ADMIN')
        ],
                       key=meta.stringSplitByNumbers)

        for step in steps:
            if not self.curr_protocol[step]:
                dial = wx.MessageDialog(
                    None, 'Please fill the description in %s !!' % step,
                    'Error', wx.OK | wx.ICON_ERROR)
                dial.ShowModal()
                return

        ctrl = event.GetEventObject()

        #Rearrange the steps numbers in the experimental settings
        temp_steps = {}

        for step in steps:
            stepNo = int(step.split('Step')[1])
            step_info = self.curr_protocol[step]

            if stepNo > ctrl.GetId() and temp_steps[stepNo] is not []:
                temp_steps[stepNo + 1] = self.curr_protocol[step]
                del self.curr_protocol[step]
            else:
                temp_steps[stepNo] = self.curr_protocol[step]
                temp_steps[stepNo + 1] = []
                del self.curr_protocol[step]

        for stepNo in sorted(temp_steps.iterkeys()):
            self.curr_protocol['Step%s' % str(stepNo)] = temp_steps[stepNo]

        self.fgs.Clear(deleteWindows=True)

        self.showSteps()
Ejemplo n.º 10
0
 def on_load_settings(self, evt):
     dlg = wx.FileDialog(None, "Select the file containing your CPAnalyst workspace...",
                         defaultDir=os.getcwd(), style=wx.OPEN|wx.FD_CHANGE_DIR)
     if dlg.ShowModal() == wx.ID_OK:
         ExperimentSettings.getInstance().load_from_file(dlg.GetPath())
 def on_new_experiment(self, evt):
     '''clears the existing Experiment settings
     '''
     return ExperimentSettings.getInstance().clear()
        exp_num = meta.get_field('Overview|Project|ExptNum')
        exp_title = meta.get_field('Overview|Project|Title')
        if None not in [exp_date, exp_num, exp_title]:
            day, month, year = exp_date.split('/')
            filename = '%s%s%s_%s_%s.txt'%(year, month, day , exp_num, exp_title)
        else:
            filename = 'new_experiment.txt'
        
        dlg = wx.FileDialog(None, message='Saving experimental metadata...', 
                            defaultDir=os.getcwd(), defaultFile=filename, 
                            wildcard='.txt', 
                            style=wx.SAVE|wx.FD_OVERWRITE_PROMPT)
        if dlg.ShowModal() == wx.ID_OK:
            os.chdir(os.path.split(dlg.GetPath())[0])
            ExperimentSettings.getInstance().save_to_file(dlg.GetPath())
    
            
    def on_load_settings(self, evt):
        dlg = wx.FileDialog(None, "Select the file containing your CPAnalyst workspace...",
                            defaultDir=os.getcwd(), style=wx.OPEN|wx.FD_CHANGE_DIR)
        if dlg.ShowModal() == wx.ID_OK:
            ExperimentSettings.getInstance().load_from_file(dlg.GetPath())


if __name__ == '__main__':
    app = LineageProfiler(redirect=False)
    # Load a settings file if passed in args
    if len(sys.argv) > 1:
        ExperimentSettings.getInstance().load_from_file(sys.argv[1])
    app.MainLoop()
 def on_save_as_settings(self, evt):
     meta = ExperimentSettings.getInstance()
     if meta.get_field("Overview|Project|Title") is not None:
         self.settings_frame.SetTitle("ProtocolNavigator - %s" % meta.get_field("Overview|Project|Title"))
     meta.save_as_file_dialogue()
    def decode_event_description(self, protocol):
	meta = ExperimentSettings.getInstance()
	instance = exp.get_tag_attribute(protocol)
	header = ''
	footer = []
	info = []
	
        if exp.get_tag_type(protocol) == 'Overview':
            header += meta.get_field('Overview|Project|Title', default='Not specified')
            info.append(('Aims', meta.get_field('Overview|Project|Aims', default='Not specified')))
	    info.append(('Funding Code', meta.get_field('Overview|Project|Fund', default='Not specified')))
            info.append(('Keywords', meta.get_field('Overview|Project|Keywords', default='Not specified')))
	    info.append(('Experiment Number', meta.get_field('Overview|Project|ExptNum', default='Not specified')))
            info.append(('Experiment date', meta.get_field('Overview|Project|ExptDate', default='Not specified')))
            info.append(('Relevant publications', meta.get_field('Overview|Project|Publications', default='Not specified')))
	    info.append(('Experimenter', meta.get_field('Overview|Project|Experimenter', default='Not specified')))
            info.append(('Institution', meta.get_field('Overview|Project|Institution', default='Not specified')))
	    info.append(('Department', meta.get_field('Overview|Project|Department', default='Not specified')))
            info.append(('Address', meta.get_field('Overview|Project|Address', default='Not specified')))
	    info.append(('Experiment Status', meta.get_field('Overview|Project|Status', default='Not specified')))
	    
            return (header, info)
	
	if exp.get_tag_type(protocol) == 'StockCulture':
	    header += '%s cell line (Authority %s, Ref: %s) was used. This will be referred as Stock Instance %s' %(meta.get_field('StockCulture|Sample|CellLine|%s'%instance, default='Not specified'),
	                                                meta.get_field('StockCulture|Sample|Authority|%s'%instance, default='Not specified'),
	                                                                                                         str(instance),	                                                
	                                                 meta.get_field('StockCulture|Sample|CatalogueNo|%s'%instance, default='Not specified'),
	                                                 str(instance))
	    info.append(('Depositors', meta.get_field('StockCulture|Sample|Depositors|%s'%instance, default='Not specified')))
	    info.append(('Biosafety Level', meta.get_field('StockCulture|Sample|Biosafety|%s'%instance, default='Not specified')))
	    info.append(('Shipment', meta.get_field('StockCulture|Sample|Shipment|%s'%instance, default='Not specified')))
	    info.append(('Permit', meta.get_field('StockCulture|Sample|Permit|%s'%instance, default='Not specified')))
	    info.append(('Growth Property', meta.get_field('StockCulture|Sample|GrowthProperty|%s'%instance, default='Not specified')))
	    info.append(('Organism', meta.get_field('StockCulture|Sample|Organism|%s'%instance, default='Not specified')))
	    info.append(('Morphology', meta.get_field('StockCulture|Sample|Morphology|%s'%instance, default='Not specified')))
	    info.append(('Organ', meta.get_field('StockCulture|Sample|Organ|%s'%instance, default='Not specified')))    
	    info.append(('Disease', meta.get_field('StockCulture|Sample|Disease|%s'%instance, default='Not specified')))
	    info.append(('Products', meta.get_field('StockCulture|Sample|Products|%s'%instance, default='Not specified')))
	    info.append(('Applications', meta.get_field('StockCulture|Sample|Applications|%s'%instance, default='Not specified')))
	    info.append(('Receptors', meta.get_field('StockCulture|Sample|Receptors|%s'%instance, default='Not specified')))
	    info.append(('Antigen', meta.get_field('StockCulture|Sample|Antigen|%s'%instance, default='Not specified')))
	    info.append(('DNA', meta.get_field('StockCulture|Sample|DNA|%s'%instance, default='Not specified')))
	    info.append(('Cytogenetic', meta.get_field('StockCulture|Sample|Cytogenetic|%s'%instance, default='Not specified')))
	    info.append(('Isoenzymes', meta.get_field('StockCulture|Sample|Isoenzymes|%s'%instance, default='Not specified')))
	    info.append(('Age of Organism (days)', meta.get_field('StockCulture|Sample|Age|%s'%instance, default='Not specified')))
	    info.append(('Gender', meta.get_field('StockCulture|Sample|Gender|%s'%instance, default='Not specified')))
	    info.append(('Ethnicity', meta.get_field('StockCulture|Sample|Ethnicity|%s'%instance, default='Not specified')))
	    info.append(('Comments', meta.get_field('StockCulture|Sample|Comments|%s'%instance, default='Not specified')))
	    info.append(('Publications', meta.get_field('StockCulture|Sample|Publications|%s'%instance, default='Not specified')))
	    info.append(('Related Products', meta.get_field('StockCulture|Sample|RelProduct|%s'%instance, default='Not specified')))
	    info.append(('Original Passage Number', meta.get_field('StockCulture|Sample|OrgPassageNo|%s'%instance, default='Not specified')))
	    info.append(('Preservation', meta.get_field('StockCulture|Sample|Preservation|%s'%instance, default='Not specified')))
	    info.append(('GrowthMedium', meta.get_field('StockCulture|Sample|GrowthMedium|%s'%instance, default='Not specified')))
	    
	    passages = [attr for attr in meta.get_attribute_list_by_instance('StockCulture|Sample', instance)
			                        if attr.startswith('Passage')]
	    
	    if passages:
		footer += '%s passages were carried out according to the specifications' %str(len(passages))
		
	    return (header, info, footer)	    
	
	if exp.get_tag_event(protocol) == 'Microscope':	    
	    header += '%s settings' %meta.get_field('Instrument|Microscope|ChannelName|%s'%instance, default = 'Not specified')
	    
	    if meta.get_field('Instrument|Microscope|Stand|%s'%instance) is not None:
		info.append(('Component', 'Stand'))
		info.append(('Type', meta.get_field('Instrument|Microscope|Stand|%s'%instance)[0]))
		info.append(('Make', meta.get_field('Instrument|Microscope|Stand|%s'%instance)[1]))
		info.append(('Model', meta.get_field('Instrument|Microscope|Stand|%s'%instance)[2]))
		info.append(('Orientation', meta.get_field('Instrument|Microscope|Stand|%s'%instance)[3]))
		info.append(('Number of Lampss', str(meta.get_field('Instrument|Microscope|Stand|%s'%instance)[4])))
		info.append(('Number of Detectors', str(meta.get_field('Instrument|Microscope|Stand|%s'%instance)[5])))
	    if meta.get_field('Instrument|Microscope|Condensor|%s'%instance) is not None:
		info.append(('Component', 'Condensor'))
		info.append(('Type', meta.get_field('Instrument|Microscope|Condensor|%s'%instance)[0]))
		info.append(('Make', meta.get_field('Instrument|Microscope|Condensor|%s'%instance)[1]))
		info.append(('Model', meta.get_field('Instrument|Microscope|Condensor|%s'%instance)[2]))
	    if meta.get_field('Instrument|Microscope|Stage|%s'%instance) is not None:
		info.append(('Component', 'Stage'))
		info.append(('Type', meta.get_field('Instrument|Microscope|Stage|%s'%instance)[0]))
		info.append(('Make', meta.get_field('Instrument|Microscope|Stage|%s'%instance)[1]))
		info.append(('Model', meta.get_field('Instrument|Microscope|Stage|%s'%instance)[2]))
		info.append(('Stage Holder', meta.get_field('Instrument|Microscope|Stage|%s'%instance)[3]))
		info.append(('Holder Code', meta.get_field('Instrument|Microscope|Stage|%s'%instance)[4]))
	    if meta.get_field('Instrument|Microscope|Incubator|%s'%instance) is not None:
		info.append(('Component', 'Incubator'))
		info.append(('Make', meta.get_field('Instrument|Microscope|Incubator|%s'%instance)[0]))
		info.append(('Model', meta.get_field('Instrument|Microscope|Incubator|%s'%instance)[1]))
		info.append(('Temperature(C)', meta.get_field('Instrument|Microscope|Incubator|%s'%instance)[2]))
		info.append(('CO2%', meta.get_field('Instrument|Microscope|Incubator|%s'%instance)[3]))
		info.append(('Humidity', meta.get_field('Instrument|Microscope|Incubator|%s'%instance)[4]))
		info.append(('Pressure', meta.get_field('Instrument|Microscope|Incubator|%s'%instance)[5]))
	    if meta.get_field('Instrument|Microscope|LightSource|%s'%instance) is not None:
		info.append(('Component', 'Light Source'))
		info.append(('Type', meta.get_field('Instrument|Microscope|LightSource|%s'%instance)[0]))
		info.append(('Source', meta.get_field('Instrument|Microscope|LightSource|%s'%instance)[1]))
		info.append(('Make', meta.get_field('Instrument|Microscope|LightSource|%s'%instance)[2]))
		info.append(('Model', meta.get_field('Instrument|Microscope|LightSource|%s'%instance)[3]))
		info.append(('Measured Power (User)', meta.get_field('Instrument|Microscope|LightSource|%s'%instance)[4]))
		info.append(('Measured Power (Instrument)', meta.get_field('Instrument|Microscope|LightSource|%s'%instance)[5]))
		info.append(('Shutter Used', meta.get_field('Instrument|Microscope|LightSource|%s'%instance)[6]))
		info.append(('Shutter Type', meta.get_field('Instrument|Microscope|LightSource|%s'%instance)[7]))
		info.append(('Shutter Make', meta.get_field('Instrument|Microscope|LightSource|%s'%instance)[8]))
		info.append(('Shutter Model', meta.get_field('Instrument|Microscope|LightSource|%s'%instance)[9]))
	    if meta.get_field('Instrument|Microscope|ExtFilter|%s'%instance) is not None:
		info.append(('Component', 'Excitation Filter'))
		info.append(('Wavelength Range (nm)', str(meta.get_field('Instrument|Microscope|ExtFilter|%s'%instance)[0])+' - '+str(meta.get_field('Instrument|Microscope|ExtFilter|%s'%instance)[1])))
		info.append(('Make', meta.get_field('Instrument|Microscope|ExtFilter|%s'%instance)[2]))
		info.append(('Model', meta.get_field('Instrument|Microscope|ExtFilter|%s'%instance)[3]))
	    if meta.get_field('Instrument|Microscope|Mirror|%s'%instance) is not None:	    
		info.append(('Component', 'Dichroic Mirror'))
		info.append(('Wavelength Range (nm)', str(meta.get_field('Instrument|Microscope|Mirror|%s'%instance)[0])+' - '+str(meta.get_field('Instrument|Microscope|Mirror|%s'%instance)[1])))
		info.append(('Mode', meta.get_field('Instrument|Microscope|Mirror|%s'%instance)[2]))
		info.append(('Make', meta.get_field('Instrument|Microscope|Mirror|%s'%instance)[3]))
		info.append(('Model', meta.get_field('Instrument|Microscope|Mirror|%s'%instance)[4]))
		info.append(('Modification', meta.get_field('Instrument|Microscope|Mirror|%s'%instance)[5]))
	    if meta.get_field('Instrument|Microscope|EmsFilter|%s'%instance) is not None:
		info.append(('Component', 'Emission Filter'))
		info.append(('Wavelength Range (nm)', str(meta.get_field('Instrument|Microscope|EmsFilter|%s'%instance)[0])+' - '+str(meta.get_field('Instrument|Microscope|EmsFilter|%s'%instance)[1])))
		info.append(('Make', meta.get_field('Instrument|Microscope|EmsFilter|%s'%instance)[2]))
		info.append(('Model', meta.get_field('Instrument|Microscope|EmsFilter|%s'%instance)[3]))
	    if meta.get_field('Instrument|Microscope|Lens|%s'%instance) is not None:
		info.append(('Component', 'Lens'))
		info.append(('Make', meta.get_field('Instrument|Microscope|Lens|%s'%instance)[0]))
		info.append(('Model', meta.get_field('Instrument|Microscope|Lens|%s'%instance)[1]))
		info.append(('Objective Magnification', meta.get_field('Instrument|Microscope|Lens|%s'%instance)[2]))
		info.append(('Objective NA', meta.get_field('Instrument|Microscope|Lens|%s'%instance)[3]))
		info.append(('Calibrated Magnification', meta.get_field('Instrument|Microscope|Lens|%s'%instance)[4]))
		info.append(('Immersion', meta.get_field('Instrument|Microscope|Lens|%s'%instance)[5]))
		info.append(('Correction Collar', meta.get_field('Instrument|Microscope|Lens|%s'%instance)[6]))
		info.append(('Correction Value', meta.get_field('Instrument|Microscope|Lens|%s'%instance)[7]))
		info.append(('Correction Type', meta.get_field('Instrument|Microscope|Lens|%s'%instance)[8]))
	    if meta.get_field('Instrument|Microscope|Lens|%s'%instance) is not None:
		info.append(('Component', 'Detector'))
		info.append(('Type', meta.get_field('Instrument|Microscope|Detector|%s'%instance)[0]))
		info.append(('Make', meta.get_field('Instrument|Microscope|Detector|%s'%instance)[1]))
		info.append(('Model', meta.get_field('Instrument|Microscope|Detector|%s'%instance)[2]))
		info.append(('Binning', str(meta.get_field('Instrument|Microscope|Detector|%s'%instance)[3])))
		info.append(('Exposure Time', meta.get_field('Instrument|Microscope|Detector|%s'%instance)[4]+' '+meta.get_field('Instrument|Microscope|Detector|%s'%instance)[5]))
		info.append(('Gain', meta.get_field('Instrument|Microscope|Detector|%s'%instance)[6]+' '+meta.get_field('Instrument|Microscope|Detector|%s'%instance)[7]))
		info.append(('Offset', meta.get_field('Instrument|Microscope|Detector|%s'%instance)[8]+' '+meta.get_field('Instrument|Microscope|Detector|%s'%instance)[9]))
		
	    return (header, info)
	
	if exp.get_tag_event(protocol) == 'Flowcytometer':
	    header += meta.get_field('Instrument|Flowcytometer|Manufacter|%s'%instance, default='')
	    if meta.get_field('Instrument|Flowcytometer|Model|%s'%instance) is not None:
		header += '(model: %s)' %meta.get_field('Instrument|Flowcytometer|Model|%s'%instance, default = 'not specified')
	    header += ' was used. '
		
	    for attribute, description in sorted(meta.get_attribute_dict('Instrument|Flowcytometer|%s'%instance).iteritems()):
		if attribute.startswith('Manufacter')  or attribute.startswith('Model'):
		    continue
		else:
		    info.append((attribute, description))  # attribute is Ch# and description is the component list	

	    return(header, info)
	    
	
	if exp.get_tag_event(protocol) == 'Seed':
	    if meta.get_field('CellTransfer|Seed|StockInstance|%s'%instance) is not None:
		header += meta.get_field('StockCulture|Sample|CellLine|%s'%meta.get_field('CellTransfer|Seed|StockInstance|%s'%instance)) 
	    header += ' cells were seeded with a density of %s from the stock flask (Instance %s). ' %(meta.get_field('CellTransfer|Seed|SeedingDensity|%s'%instance, default = ''), meta.get_field('CellTransfer|Seed|StockInstance|%s'%instance))
	    #if meta.get_field('CellTransfer|Seed|HarvestInstance|%s'%instance) is not None:
		#header += meta.get_field('StockCulture|Sample|CellLine|%s'%meta.get_field('CellTransfer|Seed|HarvestInstance|%s'%instance)) 
		#header += ' cells were seeded with a density of %s from the Wells depicted bellow. ' %meta.get_field('CellTransfer|Seed|SeedingDensity|%s'%instance, default = '')	    
	    if meta.get_field('CellTransfer|Seed|MediumUsed|%s'%instance) is not None:
		header += meta.get_field('CellTransfer|Seed|MediumUsed|%s'%instance)+' medium was used '
	    if meta.get_field('CellTransfer|Seed|MediumAddatives|%s'%instance) is not None:
		header += 'with following medium additives: %s. ' %meta.get_field('CellTransfer|Seed|MediumAddatives|%s'%instance)
	    if meta.get_field('CellTransfer|Seed|Trypsinizatiton|%s'%instance) is 'Yes':   
		header += 'Also trypsinisation was performed'
	    
	    return (header, info)
	
	if exp.get_tag_event(protocol) == 'Chem':
	    if meta.get_field('Perturbation|Chem|ChemName|%s'%instance) is not None:                    
		header += meta.get_field('Perturbation|Chem|ChemName|%s'%instance)
		subtext = '%s,%s' %(meta.get_field('Perturbation|Chem|Manufacturer|%s'%instance, default=''), meta.get_field('Perturbation|Chem|CatNum|%s'%instance, default=''))
		if re.search('\w+', subtext): #if the mfg and or cat number of the chemical is mentioned
		    header += '[%s]'%subtext
		header += ' was added'
	    if meta.get_field('Perturbation|Chem|Conc|%s'%instance) is not None: 
		header += ' with a concentration of %s %s' %(meta.get_field('Perturbation|Chem|Conc|%s'%instance), meta.get_field('Perturbation|Chem|Unit|%s'%instance, default='')) 
	    if meta.get_field('Perturbation|Chem|Additives|%s'%instance) is not None:    
		header += '.  Following additives were included: %s' %meta.get_field('Perturbation|Chem|Additives|%s'%instance)
	    if meta.get_field('Perturbation|Chem|Other|%s'%instance) is not None: 
		header += '.  Other information: %s'%meta.get_field('Perturbation|Chem|Other|%s'%instance) 
		
	    return (header, info) 		    

        if exp.get_tag_event(protocol) == 'Bio':
	    header += 'Biological perturbation was done with following agent'
	    
            info.append(('RNAi Sequence', meta.get_field('Perturbation|Bio|SeqName|%s'%instance, default = 'Not specified')))
            info.append(('Acession Number', meta.get_field('Perturbation|Bio|AccessNumber|%s'%instance, default = 'Not specified')))
            info.append(('Target Gene Accession Number', meta.get_field('Perturbation|Bio|TargetGeneAccessNum|%s'%instance, default = 'Not specified')))
            info.append(('Concentration', meta.get_field('Perturbation|Bio|Conc|%s'%instance, default = 'Not specified')+' '+meta.get_field('Perturbation|Bio|Unit|%s'%instance, default = '')))
            info.append(('Additives', meta.get_field('Perturbation|Bio|Additives|%s'%instance, default = 'Not specified')))
            info.append(('Other Information', meta.get_field('Perturbation|Bio|Other|%s'%instance, default = 'Not specified')))     
            
            return (header, info)
	
	if exp.get_tag_event(protocol) == 'Dye':
	    header += meta.get_field('Staining|Dye|ProtocolName|%s'%instance)
	    steps = sorted(meta.get_attribute_list_by_instance('Staining|Dye|Step', str(instance)), key = meta.stringSplitByNumbers)
	    for step in steps:
		info.append(meta.get_field('Staining|Dye|%s|%s'%(step,instance)))
		
	    return (header, info)
	
	if exp.get_tag_event(protocol) == 'Immuno':
	    header += meta.get_field('Staining|Immuno|ProtocolName|%s'%instance)
	    if meta.get_field('Staining|Immuno|Target|%s'%instance) is not None:
		footer.append('Target antibody %s was used.'%meta.get_field('Staining|Immuno|Target|%s'%instance))
	    if meta.get_field('Staining|Immuno|Clonality|%s'%instance) is not None:
		footer.append('Clonality was %s.'%meta.get_field('Staining|Immuno|Clonality|%s'%instance))
	    if meta.get_field('Staining|Immuno|Primary|%s'%instance) is not None:
		token =''
		token += 'Primary antibody %s was used'%meta.get_field('Staining|Immuno|Primary|%s'%instance)[0]
		if len(meta.get_field('Staining|Immuno|Primary|%s'%instance)[1])>0:
		    token += ' with %s'%meta.get_field('Staining|Immuno|Primary|%s'%instance)[1]
		footer.append(token)
	    if meta.get_field('Staining|Immuno|Secondary|%s'%instance) is not None:
		token =''
		token += 'Secondary antibody %s was used'%meta.get_field('Staining|Immuno|Secondary|%s'%instance)[0]
		if len(meta.get_field('Staining|Immuno|Secondary|%s'%instance)[1])>0:
		    token += ' with %s'%meta.get_field('Staining|Immuno|Secondary|%s'%instance)[1]	
		footer.append(token)
	    if meta.get_field('Staining|Immuno|Tertiary|%s'%instance) is not None:
		token =''
		token += 'Tertiary antibody %s was used'%meta.get_field('Staining|Immuno|Tertiary|%s'%instance)[0]
		if len(meta.get_field('Staining|Immuno|Tertiary|%s'%instance)[1])>0:
		    token += ' with %s'%meta.get_field('Staining|Immuno|Tertiary|%s'%instance)[1]	
		footer.append(token)
	    steps = sorted(meta.get_attribute_list_by_instance('Staining|Immuno|Step', str(instance)), key = meta.stringSplitByNumbers)
	    for step in steps:
		info.append(meta.get_field('Staining|Immuno|%s|%s'%(step,instance)))	    
		
	    return (header, info, footer)  
	
	if exp.get_tag_event(protocol) == 'Genetic':
	    header += meta.get_field('Staining|Genetic|ProtocolName|%s'%instance)
	    footer.append(('Target Sequence', meta.get_field('Staining|Genetic|Target|%s'%instance, default = 'Not specified')))
	    footer.append(('Primer Sequence', meta.get_field('Staining|Genetic|Primer|%s'%instance, default = 'Not specified')))
	    footer.append(('Temperature', meta.get_field('Staining|Genetic|Temp|%s'%instance, default = 'Not specified')))
	    footer.append(('Temperature', meta.get_field('Staining|Genetic|GC|%s'%instance, default = 'Not specified')))	    
	    steps = sorted(meta.get_attribute_list_by_instance('Staining|Genetic|Step', str(instance)), key = meta.stringSplitByNumbers)
	    for step in steps:
		info.append(meta.get_field('Staining|Genetic|%s|%s'%(step,instance)))
		
	    return (header, info, footer)	
        
        if exp.get_tag_event(protocol) == 'Spin':
            header += meta.get_field('AddProcess|Spin|ProtocolName|%s'%instance)
	    steps = sorted(meta.get_attribute_list_by_instance('AddProcess|Spin|Step', str(instance)), key = meta.stringSplitByNumbers)	    
	    for step in steps:
		info.append(meta.get_field('AddProcess|Spin|%s|%s'%(step,instance)))
		
	    return (header, info)
	
	if exp.get_tag_event(protocol) == 'Wash':
	    header += meta.get_field('AddProcess|Wash|ProtocolName|%s'%instance)
	    steps = sorted(meta.get_attribute_list_by_instance('AddProcess|Wash|Step', str(instance)), key = meta.stringSplitByNumbers)	    
	    for step in steps:
		info.append(meta.get_field('AddProcess|Wash|%s|%s'%(step,instance)))
			
	    return (header, info)
	
	if exp.get_tag_event(protocol) == 'Dry':
	    header += meta.get_field('AddProcess|Dry|ProtocolName|%s'%instance)	    
	    steps = sorted(meta.get_attribute_list_by_instance('AddProcess|Dry|Step', str(instance)), key = meta.stringSplitByNumbers)
	    for step in steps:
		info.append(meta.get_field('AddProcess|Dry|%s|%s'%(step,instance)))
			
	    return (header, info)
	
	if exp.get_tag_event(protocol) == 'Medium':
	    header += meta.get_field('AddProcess|Medium|ProtocolName|%s'%instance)
	    if meta.get_field('AddProcess|Medium|MediumAdditives|%s'%instance) is not None:
		footer.append('Medium additives used: %s'%meta.get_field('AddProcess|Medium|MediumAdditives|%s'%instance))
	    steps = sorted(meta.get_attribute_list_by_instance('AddProcess|Medium|Step', str(instance)), key = meta.stringSplitByNumbers) 
	    for step in steps:
		info.append(meta.get_field('AddProcess|Medium|%s|%s'%(step,instance)))
			
	    return (header, info, footer)
	
	if exp.get_tag_event(protocol) == 'Incubator':
	    header += meta.get_field('AddProcess|Incubator|ProtocolName|%s'%instance)
	    footer.append(('Incubator settings', ''))
	    footer.append(('Manufacturer', meta.get_field('AddProcess|Incubator|Manufacter|%s'%instance, default = 'Not specified')))
	    footer.append(('Model', meta.get_field('AddProcess|Incubator|Model|%s'%instance, default = 'Not specified')))
	    footer.append(('Temperature', meta.get_field('AddProcess|Incubator|Temp|%s'%instance, default = 'Not specified')))
	    footer.append(('CO2%', meta.get_field('AddProcess|Incubator|CO2|%s'%instance, default = 'Not specified')))
	    footer.append(('Humidity', meta.get_field('AddProcess|Incubator|Humidity|%s'%instance, default = 'Not specified')))
	    footer.append(('Pressure', meta.get_field('AddProcess|Incubator|Pressure|%s'%instance, default = 'Not specified')))	    
	    steps = sorted(meta.get_attribute_list_by_instance('AddProcess|Medium|Step', str(instance)), key = meta.stringSplitByNumbers) 
	    for step in steps:
		info.append(meta.get_field('AddProcess|Medium|%s|%s'%(step,instance)))			
	    return (header, info, footer)	
	
	if exp.get_tag_event(protocol) == 'TLM':	    
	    if meta.get_field('DataAcquis|TLM|MicroscopeInstance|%s'%instance) is not None:
		ch_name = meta.get_field('DataAcquis|TLM|MicroscopeInstance|%s'%instance)
		cytometer_instance=meta.get_instance_by_field_value('Instrument|Microscope|ChannelName|', ch_name) 
		header += ch_name+' channel was used (see microscope instance %s for details)'%cytometer_instance		
	    info.append(('Image Format', meta.get_field('DataAcquis|TLM|Format|%s'%instance, default = 'Not specified')))
	    info.append(('Time Interval (min)', meta.get_field('DataAcquis|TLM|TimeInterval|%s'%instance, default = 'Not specified')))
	    info.append(('Total Frame/Pane Number', meta.get_field('DataAcquis|TLM|FrameNumber|%s'%instance, default = 'Not specified')))
	    info.append(('Stacking Order', meta.get_field('DataAcquis|TLM|StackProcess|%s'%instance, default = 'Not specified')))
	    info.append(('Pixel Size', meta.get_field('DataAcquis|TLM|PixelSize|%s'%instance, default = 'Not specified')))
	    info.append(('Pixel Conversion', meta.get_field('DataAcquis|TLM|PixelConvert|%s'%instance, default = 'Not specified')))
	    info.append(('Software', meta.get_field('DataAcquis|TLM|Software|%s'%instance, default = 'Not specified')))
	    return (header, info)
	
	if exp.get_tag_event(protocol) == 'HCS':	    
	    if meta.get_field('DataAcquis|HCS|MicroscopeInstance|%s'%instance) is not None:
		ch_name = meta.get_field('DataAcquis|HCS|MicroscopeInstance|%s'%instance)
		cytometer_instance=meta.get_instance_by_field_value('Instrument|Microscope|ChannelName|', ch_name) 
		header += ch_name+' channel was used (see microscope instance %s for details)'%cytometer_instance	
	    info.append(('Image Format', meta.get_field('DataAcquis|HCS|Format|%s'%instance, default = 'Not specified')))
	    info.append(('Pixel Size', meta.get_field('DataAcquis|HCS|PixelSize|%s'%instance, default = 'Not specified')))
	    info.append(('Pixel Conversion', meta.get_field('DataAcquis|HCS|PixelConvert|%s'%instance, default = 'Not specified')))
	    info.append(('Software', meta.get_field('DataAcquis|HCS|Software|%s'%instance, default = 'Not specified')))
	    return (header, info)
	
	if exp.get_tag_event(protocol) == 'FCS':	    
	    if meta.get_field('DataAcquis|FCS|FlowcytInstance|%s'%instance) is not None:
		cytometer_instance = meta.get_field('DataAcquis|FCS|FlowcytInstance|%s'%instance)
		header += meta.get_field('Instrument|Flowcytometer|Manufacter|%s'%cytometer_instance, default='')+' flowcytometer '
		if meta.get_field('Instrument|Flowcytometer|Model|%s'%cytometer_instance) is not None:
		    header += '(model: %s)' %meta.get_field('Instrument|Flowcytometer|Model|%s'%cytometer_instance, default = 'not specified')
		header += ' was used (see flowcytometer instance %s for details).'%cytometer_instance
	    if meta.get_field('DataAcquis|FCS|Software|%s'%instance) is not None:
		info.append(meta.get_field('DataAcquis|FCS|Software|%s'%instance)+' software was used for data acquisition. ')		
	    if meta.get_field('DataAcquis|FCS|Format|%s'%instance) is not None:
		info.append('FCS files in %s'%meta.get_field('DataAcquis|FCS|Format|%s'%instance)+' format were saved in following location\n')
		
	    return (header, info)
    def decode_event_description(self, protocol):
	meta = ExperimentSettings.getInstance()