Exemplo n.º 1
0
    def add_operation(self, operation):
        # add the new operation after the selected workflow item or at the end
        # of the workflow if no wi is selected
        
        # make a new workflow item
        wi = WorkflowItem(operation = operation,
                          deletable = (operation.id != "edu.mit.synbio.cytoflow.operations.import"))

        # they say in Python you should ask for forgiveness instead of permission
        try:
            wi.default_view = operation.default_view()
            wi.views.append(wi.default_view)
        except AttributeError:
            pass

        if self.workflow and self.selected:
            idx = self.workflow.index(self.selected) + 1
        elif self.workflow:
            idx = len(self.workflow)
        else:
            idx = 0
            
        # the add_remove_items handler takes care of updating the linked list
        self.workflow.insert(idx, wi)
 
        # select (open) the new workflow item
        self.selected = wi
        if wi.default_view:
            wi.current_view = wi.default_view
Exemplo n.º 2
0
    def setUp(self):
        super().setUp()

        plugin = ChannelStatisticPlugin()
        op = plugin.get_operation()

        op.name = "Count"
        op.channel = "Y2-A"
        op.statistic_name = "Count"
        op.by = ['Dox', 'Well']

        wi = WorkflowItem(operation=op)
        self.workflow.workflow.append(wi)

        plugin = TransformStatisticPlugin()
        self.op = op = plugin.get_operation()

        op.name = "Mean"
        op.statistic = ("Count", "Count")
        op.statistic_name = "Count"
        op.by = ["Dox"]
        op.subset_list.append(CategorySubset(name="Well", values=["A", "B"]))

        self.wi = wi = WorkflowItem(operation=op,
                                    status='waiting',
                                    view_error="Not yet plotted")
        self.workflow.workflow.append(wi)
        self.workflow.selected = wi

        self.workflow.wi_waitfor(wi, 'status', "valid")
Exemplo n.º 3
0
    def activated(self):
        # add an import plugin
        plugin = ImportPlugin()
        wi = WorkflowItem(task = self)
        wi.operation = plugin.get_operation()

        self.model.workflow.append(wi)
        self.model.selected = wi
        
        # if we're debugging, add a few data bits
        if self.debug:
            from cytoflow import Tube
                     
            wi.operation.conditions["Dox"] = "log"
        
            tube1 = Tube(file = "../cytoflow/tests/data/Plate01/CFP_Well_A4.fcs",
                         conditions = {"Dox" : 0.1})
        
            tube2 = Tube(file = "../cytoflow/tests/data/Plate01/RFP_Well_A3.fcs",
                         conditions = {"Dox" : 1.0})
        
            wi.operation.tubes.append(tube1)
            wi.operation.tubes.append(tube2)
                        
            self.add_operation('edu.mit.synbio.cytoflowgui.op_plugins.hlog')
            self.model.selected.operation.channels = ["V2-A", "Y2-A"]
            self.model.selected.operation.name = "H"
              
            self.add_operation('edu.mit.synbio.cytoflowgui.op_plugins.threshold')
            self.model.selected.operation.channel = "Y2-A"
            self.model.selected.operation.threshold = 2000
            self.model.selected.operation.name = "T"        
Exemplo n.º 4
0
    def activated(self):
        # add an import plugin
        plugin = ImportPlugin()
        wi = WorkflowItem(task=self)
        wi.operation = plugin.get_operation()

        self.model.workflow.append(wi)
        self.model.selected = wi

        # if we're debugging, add a few data bits
        if self.debug:
            from cytoflow import Tube

            wi.operation.conditions["Dox"] = "log"

            tube1 = Tube(file="../cytoflow/tests/data/Plate01/CFP_Well_A4.fcs",
                         conditions={"Dox": 0.1})

            tube2 = Tube(file="../cytoflow/tests/data/Plate01/RFP_Well_A3.fcs",
                         conditions={"Dox": 1.0})

            wi.operation.tubes.append(tube1)
            wi.operation.tubes.append(tube2)

            self.add_operation(
                'edu.mit.synbio.cytoflowgui.op_plugins.threshold')
            self.model.selected.operation.channel = "Y2-A"
            self.model.selected.operation.threshold = 2000
            self.model.selected.operation.name = "T"
Exemplo n.º 5
0
    def setUp(self):
        ImportedDataTest.setUp(self)

        plugin = ChannelStatisticPlugin()
        op = plugin.get_operation()

        op.name = "Count"
        op.channel = "Y2-A"
        op.statistic_name = "Count"
        op.by = ['Dox', 'Well']

        wi = WorkflowItem(operation=op)
        self.workflow.workflow.append(wi)
        self.assertTrue(wait_for(wi, 'status', lambda v: v == 'valid', 30))

        plugin = TransformStatisticPlugin()
        self.op = op = plugin.get_operation()

        op.name = "Mean"
        op.statistic = ("Count", "Count")
        op.statistic_name = "Count"
        op.by = ["Dox"]
        op.subset_list.append(CategorySubset(name="Well", values=["A", "B"]))

        self.wi = wi = WorkflowItem(operation=op)
        self.workflow.workflow.append(wi)
        self.workflow.selected = wi

        self.assertTrue(wait_for(wi, 'status', lambda v: v == 'valid', 30))
Exemplo n.º 6
0
    def setUp(self):
        TasbeTest.setUp(self)

        plugin = ThresholdPlugin()
        op = plugin.get_operation()

        op.name = "Morpho"
        op.channel = "FSC-A"
        op.threshold = 100000

        wi = WorkflowItem(operation=op)
        self.workflow.workflow.append(wi)
        self.assertTrue(wait_for(wi, 'status', lambda v: v == 'valid', 30))

        plugin = AutofluorescencePlugin()
        self.op = op = plugin.get_operation()

        self.cwd = os.path.dirname(os.path.abspath(__file__))
        op.blank_file = self.cwd + "/../../cytoflow/tests/data/tasbe/blank.fcs"
        op.channels = ["FITC-A", "Pacific Blue-A", "PE-Tx-Red-YG-A"]
        op.subset_list.append(BoolSubset(name="Morpho"))
        op.subset_list[0].selected_t = True

        self.wi = wi = WorkflowItem(operation=op)
        wi.default_view = self.op.default_view()
        wi.view_error = "Not yet plotted"
        wi.views.append(self.wi.default_view)

        self.workflow.workflow.append(wi)
        self.workflow.selected = self.wi

        # run the estimate
        op.do_estimate = True
        self.assertTrue(wait_for(wi, 'status', lambda v: v == 'valid', 30))
Exemplo n.º 7
0
    def setUp(self):
        super().setUp()

        plugin = ImportPlugin()
        op = plugin.get_operation()

        from cytoflow import Tube

        self.cwd = os.path.dirname(os.path.abspath(__file__))

        tube = Tube(file=self.cwd + "/../../cytoflow/tests/data/tasbe/rby.fcs")
        op.tubes = [tube]

        wi = WorkflowItem(operation=op,
                          status="waiting",
                          view_error="Not yet plotted")
        self.workflow.workflow.append(wi)

        op.do_estimate = True
        self.workflow.wi_waitfor(wi, 'status', 'valid')
        self.assertTrue(
            self.workflow.remote_eval("self.workflow[0].result is not None"))

        plugin = ThresholdPlugin()
        op = plugin.get_operation()

        op.name = "Morpho"
        op.channel = "FSC-A"
        op.threshold = 100000

        wi = WorkflowItem(operation=op, status='waiting')
        self.workflow.workflow.append(wi)
        self.workflow.wi_waitfor(wi, 'status', 'valid')
Exemplo n.º 8
0
 def add_operation(self, op_id):
     # first, find the matching plugin
     plugin = next((x for x in self.op_plugins if x.id == op_id))
     
     # next, get an operation
     op = plugin.get_operation()
     
     # make a new workflow item
     wi = WorkflowItem(operation = op,
                       deletable = (op_id != 'edu.mit.synbio.cytoflowgui.op_plugins.import'))
     
     # if the op has a default view, add it to the wi
     try:
         wi.default_view = op.default_view()
         wi.views.append(wi.default_view)
         wi.current_view = wi.default_view
     except AttributeError:
         pass
     
     # figure out where to add it
     if self.model.selected:
         idx = self.model.workflow.index(self.model.selected) + 1
     else:
         idx = len(self.model.workflow)
          
     # the add_remove_items handler takes care of updating the linked list
     self.model.workflow.insert(idx, wi)
     
     # and make sure to actually select the new wi
     self.model.selected = wi
Exemplo n.º 9
0
    def setUp(self):
        TasbeTest.setUp(self)

        plugin = ThresholdPlugin()
        op = plugin.get_operation()

        op.name = "Morpho"
        op.channel = "FSC-A"
        op.threshold = 100000

        wi = WorkflowItem(operation=op)
        self.workflow.workflow.append(wi)
        self.assertTrue(wait_for(wi, 'status', lambda v: v == 'valid', 30))

        plugin = TasbePlugin()
        self.op = op = plugin.get_operation()
        self.cwd = os.path.dirname(os.path.abspath(__file__))

        self.wi = wi = WorkflowItem(operation=op)
        wi.default_view = self.op.default_view()
        wi.view_error = "Not yet plotted"
        wi.views.append(self.wi.default_view)

        self.workflow.workflow.append(wi)
        self.workflow.selected = self.wi

        op.channels = ["FITC-A", "Pacific Blue-A", "PE-Tx-Red-YG-A"]

        op.blank_file = self.cwd + "/../../cytoflow/tests/data/tasbe/blank.fcs"

        op.bleedthrough_list = [
            _BleedthroughControl(channel="FITC-A",
                                 file=self.cwd +
                                 "/../../cytoflow/tests/data/tasbe/eyfp.fcs"),
            _BleedthroughControl(channel="Pacific Blue-A",
                                 file=self.cwd +
                                 "/../../cytoflow/tests/data/tasbe/ebfp.fcs"),
            _BleedthroughControl(channel="PE-Tx-Red-YG-A",
                                 file=self.cwd +
                                 "/../../cytoflow/tests/data/tasbe/mkate.fcs")
        ]

        op.beads_name = "Spherotech RCP-30-5A Lot AG01, AF02, AD04 and AAE01"
        op.beads_file = self.cwd + "/../../cytoflow/tests/data/tasbe/beads.fcs"
        op.beads_unit = "MEFL"

        op.to_channel = "FITC-A"

        self.op.translation_list[
            0].file = self.cwd + "/../../cytoflow/tests/data/tasbe/rby.fcs"
        self.op.translation_list[
            1].file = self.cwd + "/../../cytoflow/tests/data/tasbe/rby.fcs"

        op.subset_list.append(BoolSubset(name="Morpho"))
        op.subset_list[0].selected_t = True

        # run the estimate
        op.do_estimate = True
        self.assertTrue(wait_for(wi, 'status', lambda v: v == 'valid', 30))
Exemplo n.º 10
0
    def on_new(self):
        self.model.workflow = []
        
        # add an import plugin
        plugin = ImportPlugin()
        wi = WorkflowItem(task = self)
        wi.operation = plugin.get_operation()

        self.model.workflow.append(wi)
        self.model.selected = wi
Exemplo n.º 11
0
    def on_new(self):
        self.model.workflow = []

        # add an import plugin
        plugin = ImportPlugin()
        wi = WorkflowItem(task=self)
        wi.operation = plugin.get_operation()

        self.model.workflow.append(wi)
        self.model.selected = wi
Exemplo n.º 12
0
    def setUp(self):
        super().setUp()
        
        stats_plugin = ChannelStatisticPlugin()

        stats_op_3 = stats_plugin.get_operation()
        stats_op_3.name = "MeanByDoxIP2"
        stats_op_3.channel = "B1-A"
        stats_op_3.statistic_name = "Geom.Mean"
        stats_op_3.by = ['Dox', 'IP']
        stats_op_3.subset_list.append(CategorySubset(name = "Well",
                                                     values = ['A', 'B']))
        stats_op_3.subset_list.append(RangeSubset(name = "Dox",
                                                  values = [1.0, 10.0, 100.0]))
        stats_op_3.subset_list.append(RangeSubset(name = "IP",
                                                  values = [1.0, 10.0]))

        stats_wi_3 = WorkflowItem(operation = stats_op_3,
                                  status = "waiting",
                                  view_error = "Not yet plotted")
        self.workflow.workflow.append(stats_wi_3)
        self.workflow.wi_waitfor(stats_wi_3, 'status', 'valid')
        
        stats_op_4 = stats_plugin.get_operation()
        stats_op_4.name = "SDByDoxIP2"
        stats_op_4.channel = "B1-A"
        stats_op_4.statistic_name = "Geom.SD"
        stats_op_4.by = ['Dox', 'IP']
        stats_op_4.subset_list.append(CategorySubset(name = "Well",
                                                     values = ['A', 'B']))
        stats_op_4.subset_list.append(RangeSubset(name = "Dox",
                                                  values = [1.0, 10.0, 100.0]))
        stats_op_4.subset_list.append(RangeSubset(name = "IP",
                                                  values = [1.0, 10.0]))
        
        stats_wi_4 = WorkflowItem(operation = stats_op_4,
                                  status = "waiting",
                                  view_error = "Not yet plotted")
        self.workflow.workflow.append(stats_wi_4)
        self.workflow.wi_waitfor(stats_wi_4, 'status', 'valid')
                
        self.wi = wi = self.workflow.workflow[-1]      

        plugin = Stats2DPlugin()
        self.view = view = plugin.get_view()
        wi.views.append(view)
        wi.current_view = view
        
        super().setUpView()

        self.workflow.selected = wi
Exemplo n.º 13
0
    def setUp(self):
        super().setUp()

        plugin = BeadCalibrationPlugin()
        self.op = op = plugin.get_operation()

        self.cwd = os.path.dirname(os.path.abspath(__file__))
        op.beads_name = "Spherotech RCP-30-5A Lot AG01, AF02, AD04 and AAE01"
        op.beads_file = self.cwd + "/../../cytoflow/tests/data/tasbe/beads.fcs"
        op.units_list = [
            _Unit(channel="FITC-A", unit="MEFL"),
            _Unit(channel="Pacific Blue-A", unit="MEBFP")
        ]

        self.wi = wi = WorkflowItem(operation=op,
                                    status='waiting',
                                    view_error="Not yet plotted")
        wi.default_view = self.op.default_view()
        wi.views.append(self.wi.default_view)

        self.workflow.workflow.append(wi)
        self.workflow.selected = self.wi

        # run the estimate
        op.do_estimate = True
        self.workflow.wi_waitfor(wi, 'status', "valid")
Exemplo n.º 14
0
    def setUp(self):
        super().setUp()

        plugin = PolygonPlugin()
        self.op = op = plugin.get_operation()
        op.name = "Poly"
        op.xchannel = "Y2-A"
        op.xscale = "logicle"
        op.ychannel = "V2-A"
        op.yscale = "logicle"
        op.vertices = [(23.411982294776319, 5158.7027015021222), 
                       (102.22182270573683, 23124.0588433874530), 
                       (510.94519955277201, 23124.0588433874530), 
                       (1089.5215641232173, 3800.3424832180476), 
                       (340.56382570202402, 801.98947404942271), 
                       (65.42597937575897, 1119.3133482602157)]
        
        self.wi = wi = WorkflowItem(operation = op,
                                    status = 'waiting',
                                    view_error = "Not yet plotted")

        self.view = view = wi.default_view = op.default_view()
        view.subset_list.append(CategorySubset(name = "Well", values = ["A", "B"]))
        wi.view_error = "Not yet plotted"
        wi.views.append(self.wi.default_view)
        self.wi.current_view = self.wi.default_view
        
        self.workflow.workflow.append(wi)
        self.workflow.selected = wi
        
        self.workflow.wi_waitfor(self.wi, 'status', 'valid')
Exemplo n.º 15
0
    def setUp(self):
        super().setUp()
        
        stats_plugin = ChannelStatisticPlugin()

        stats_op = stats_plugin.get_operation()
        stats_op.name = "MeanByDoxWell"
        stats_op.channel = "Y2-A"
        stats_op.statistic_name = "Geom.Mean"
        stats_op.by = ['Dox', 'Well']
        stats_op.subset_list.append(CategorySubset(name = "Well",
                                                   values = ['A', 'B']))
        stats_op.subset_list.append(RangeSubset(name = "Dox",
                                                values = [1.0, 10.0, 100.0]))
        stats_op.subset_list.append(RangeSubset(name = "IP",
                                                values = [1.0, 10.0]))

        stats_wi = WorkflowItem(operation = stats_op,
                                  status = "waiting",
                                  view_error = "Not yet plotted")
        self.workflow.workflow.append(stats_wi)
        self.workflow.wi_waitfor(stats_wi, 'status', 'valid')

        self.wi = wi = self.workflow.workflow[-1]
        self.op = self.wi.operation
        self.workflow.selected = wi
Exemplo n.º 16
0
    def setUp(self):
        super().setUp()

        plugin = Range2DPlugin()
        self.op = op = plugin.get_operation()
        op.name = "Range2D"
        op.xchannel = "Y2-A"
        op.xlow = 100
        op.xhigh = 1000
        op.ychannel = "V2-A"
        op.ylow = 1000
        op.yhigh = 10000
              
        self.wi = wi = WorkflowItem(operation = op,
                                    status = 'waiting',
                                    view_error = "Not yet plotted")
        
        self.view = wi.default_view = op.default_view()
        wi.views.append(self.wi.default_view)        
        self.wi.current_view = self.wi.default_view

        self.workflow.workflow.append(wi)
        self.workflow.selected = wi
        
        self.workflow.wi_waitfor(self.wi, 'status', 'valid')
Exemplo n.º 17
0
    def setUp(self):
        ImportedDataTest.setUp(self)

        plugin = PCAPlugin()
        self.op = op = plugin.get_operation()

        op.name = "PCA"
        op.channels_list = [
            _Channel(channel="V2-A", scale="log"),
            _Channel(channel="V2-H", scale="log"),
            _Channel(channel="Y2-A", scale="log"),
            _Channel(channel="Y2-H", scale="log")
        ]
        op.num_components = 2

        op.subset_list.append(CategorySubset(name="Well", values=["A", "B"]))

        self.wi = wi = WorkflowItem(operation=op)

        self.workflow.workflow.append(wi)
        self.workflow.selected = wi

        # run estimate
        op.do_estimate = True
        self.assertTrue(wait_for(wi, 'status', lambda v: v == 'valid', 30))
Exemplo n.º 18
0
    def setUp(self):
        ImportedDataTest.setUp(self)

        plugin = FlowPeaksPlugin()
        self.op = op = plugin.get_operation()

        op.name = "FP"
        op.xchannel = "V2-A"
        op.ychannel = "Y2-A"
        op.xscale = "logicle"
        op.yscale = "logicle"
        op.h0 = 0.5

        op.subset_list.append(CategorySubset(name="Well", values=["A", "B"]))

        self.wi = wi = WorkflowItem(operation=op)
        wi.default_view = op.default_view()
        wi.view_error = "Not yet plotted"
        wi.views.append(self.wi.default_view)

        self.workflow.workflow.append(wi)
        self.workflow.selected = wi

        # run estimate
        op.do_estimate = True
        self.assertTrue(wait_for(wi, 'status', lambda v: v == 'valid', 120))
Exemplo n.º 19
0
    def setUp(self):
        super().setUp()

        plugin = KMeansPlugin()
        self.op = op = plugin.get_operation()

        op.name = "KM"
        op.xchannel = "V2-A"
        op.ychannel = "Y2-A"
        op.xscale = "logicle"
        op.yscale = "logicle"
        op.num_clusters = 2

        op.subset_list.append(CategorySubset(name="Well", values=['A', 'B']))
        op.subset_list.append(
            RangeSubset(name="Dox", values=[0.0, 10.0, 100.0]))

        self.wi = wi = WorkflowItem(operation=op,
                                    status='waiting',
                                    view_error="Not yet plotted")
        wi.default_view = op.default_view()
        wi.views.append(self.wi.default_view)
        self.workflow.workflow.append(wi)
        self.workflow.selected = wi

        # run estimate
        op.do_estimate = True
        self.workflow.wi_waitfor(self.wi, 'status', 'valid')
Exemplo n.º 20
0
    def setUp(self):
        super().setUp()

        plugin = ColorTranslationPlugin()
        self.op = op = plugin.get_operation()

        self.cwd = os.path.dirname(os.path.abspath(__file__))
        self.rby_file = self.cwd + "/../../cytoflow/tests/data/tasbe/rby.fcs"
        op.controls_list = [
            _Control(from_channel="Pacific Blue-A",
                     to_channel="FITC-A",
                     file=self.rby_file)
        ]
        #         op.channels = ["FITC-A", "Pacific Blue-A", "PE-Tx-Red-YG-A"]
        op.subset_list.append(BoolSubset(name="Morpho"))
        op.subset_list[0].selected_t = True

        self.wi = wi = WorkflowItem(operation=op,
                                    status='waiting',
                                    view_error="Not yet plotted")
        wi.default_view = self.op.default_view()
        wi.views.append(self.wi.default_view)
        self.workflow.workflow.append(wi)
        self.workflow.selected = self.wi

        # run the estimate
        op.do_estimate = True
        self.workflow.wi_waitfor(self.wi, 'status', 'valid')
    def setUp(self):
        super().setUp()

        plugin = BleedthroughLinearPlugin()
        self.op = op = plugin.get_operation()

        self.cwd = os.path.dirname(os.path.abspath(__file__))
        op.controls_list = [
            _Control(channel="FITC-A",
                     file=self.cwd +
                     '/../../cytoflow/tests/data/tasbe/eyfp.fcs'),
            _Control(channel="PE-Tx-Red-YG-A",
                     file=self.cwd +
                     '/../../cytoflow/tests/data/tasbe/mkate.fcs'),
            _Control(channel="Pacific Blue-A",
                     file=self.cwd +
                     '/../../cytoflow/tests/data/tasbe/ebfp.fcs')
        ]

        op.subset_list.append(BoolSubset(name="Morpho"))
        op.subset_list[0].selected_t = True

        self.wi = wi = WorkflowItem(operation=op,
                                    status='waiting',
                                    view_error="Not yet plotted")
        wi.default_view = self.op.default_view()
        wi.views.append(self.wi.default_view)
        self.workflow.workflow.append(wi)
        self.workflow.selected = self.wi

        # run the estimate
        op.do_estimate = True
        self.workflow.wi_waitfor(self.wi, 'status', 'valid')
Exemplo n.º 22
0
    def setUp(self):
        super().setUp()

        plugin = ThresholdPlugin()
        self.op = op = plugin.get_operation()
        op.name = "Thresh"
        op.channel = "Y2-A"
        op.threshold = 1000

        self.wi = wi = WorkflowItem(operation=op,
                                    status='waiting',
                                    view_error="Not yet plotted")

        self.view = view = wi.default_view = op.default_view()
        view.subset_list.append(CategorySubset(name="Well", values=["A", "B"]))

        wi.view_error = "Not yet plotted"
        wi.views.append(self.wi.default_view)
        self.wi.current_view = self.wi.default_view

        self.workflow.workflow.append(wi)
        self.workflow.selected = wi

        self.workflow.wi_waitfor(wi, 'view_error', "")
        self.workflow.wi_waitfor(wi, 'status', "valid")
Exemplo n.º 23
0
    def setUp(self):
        super().setUp()

        plugin = GaussianMixture1DPlugin()
        self.op = op = plugin.get_operation()

        op.name = "Gauss"
        op.channel = "V2-A"
        op.channel_scale = "logicle"
        op.num_components = 2

        op.subset_list.append(CategorySubset(name="Well", values=["A", "B"]))
        op.subset_list.append(
            RangeSubset(name="Dox", values=[0.0, 10.0, 100.0]))

        self.wi = wi = WorkflowItem(operation=op,
                                    status='waiting',
                                    view_error="Not yet plotted")
        wi.default_view = op.default_view()
        wi.views.append(self.wi.default_view)
        self.workflow.workflow.append(wi)
        self.workflow.selected = wi

        # run estimate
        op.do_estimate = True
        self.workflow.wi_waitfor(self.wi, 'status', 'valid')
Exemplo n.º 24
0
    def setUp(self):
        super().setUp()

        plugin = PCAPlugin()
        self.op = op = plugin.get_operation()
        
        op.name = "PCA"
        op.channels_list = [_Channel(channel = "V2-A", scale = "log"),
                            _Channel(channel = "V2-H", scale = "log"),
                            _Channel(channel = "Y2-A", scale = "log"),
                            _Channel(channel = "Y2-H", scale = "log")]
        op.num_components = 2
                
        op.subset_list.append(CategorySubset(name = "Well",
                                             values = ['A', 'B']))
        op.subset_list.append(RangeSubset(name = "Dox",
                                          values = [0.0, 10.0, 100.0]))
        
        self.wi = wi = WorkflowItem(operation = op,
                                    status = 'waiting',
                                    view_error = "Not yet plotted")
        
        self.workflow.workflow.append(wi)
        self.workflow.selected = wi
        
        # run estimate
        op.do_estimate = True
        self.workflow.wi_waitfor(self.wi, 'status', 'valid')
Exemplo n.º 25
0
    def setUp(self):
        ImportedDataTest.setUp(self)

        plugin = Range2DPlugin()
        self.op = op = plugin.get_operation()
        op.name = "Range2D"
        op.xchannel = "Y2-A"
        op.xlow = 100
        op.xhigh = 1000
        op.ychannel = "V2-A"
        op.ylow = 1000
        op.yhigh = 10000

        self.wi = wi = WorkflowItem(operation=op)

        self.view = view = wi.default_view = op.default_view()
        view.subset_list.append(CategorySubset(name="Well", values=["A", "B"]))

        wi.view_error = "Not yet plotted"
        wi.views.append(self.wi.default_view)
        self.wi.current_view = self.wi.default_view

        self.workflow.workflow.append(wi)
        self.workflow.selected = wi

        self.assertTrue(wait_for(self.wi, 'view_error', lambda v: v == "", 30))
        self.assertTrue(
            wait_for(self.wi, 'status', lambda v: v == 'valid', 130))
Exemplo n.º 26
0
    def setUp(self):
        ImportedDataTest.setUp(self)

        plugin = ChannelStatisticPlugin()

        op = plugin.get_operation()
        op.name = "MeanByDox"
        op.channel = "Y2-A"
        op.statistic_name = "Geom.SD"
        op.by = ['Dox']

        wi = WorkflowItem(operation=op)
        self.workflow.workflow.append(wi)

        op = plugin.get_operation()
        op.name = "MeanByDoxAndWell"
        op.channel = "Y2-A"
        op.statistic_name = "Geom.SD"
        op.by = ['Dox', 'Well']

        wi = WorkflowItem(operation=op)
        self.workflow.workflow.append(wi)

        op = plugin.get_operation()
        op.name = "MeanByDox"
        op.channel = "Y2-A"
        op.statistic_name = "Geom.Mean"
        op.by = ['Dox']

        self.wi = wi = WorkflowItem(operation=op)
        self.workflow.workflow.append(wi)

        op = plugin.get_operation()
        op.name = "MeanByDoxAndWell"
        op.channel = "Y2-A"
        op.statistic_name = "Geom.Mean"
        op.by = ['Dox', 'Well']

        self.wi = wi = WorkflowItem(operation=op)
        self.workflow.workflow.append(wi)

        self.workflow.selected = wi

        self.assertTrue(wait_for(wi, 'status', lambda v: v == 'valid', 10))

        plugin = TablePlugin()
        self.view = view = plugin.get_view()
        view.statistic = ("MeanByDox", "Geom.Mean")
        view.row_facet = "Dox"

        self.workflow.remote_exec("self.workflow[-1].view_error = 'waiting'")
        self.assertTrue(
            wait_for(self.wi, 'view_error', lambda v: v == "waiting", 30))

        wi.views.append(view)
        wi.current_view = view
        self.workflow.selected = wi

        self.assertTrue(wait_for(self.wi, 'view_error', lambda v: v == "", 30))
Exemplo n.º 27
0
    def activated(self):
        self.model.backup_workflow = self.model.workflow
        self.model.workflow = []
        self.model.modified = False

        # add the op
        self.op = TasbeCalibrationOp()

        # make a new workflow item
        wi = WorkflowItem(operation=self.op, deletable=False)

        wi.default_view = self.op.default_view()
        wi.views.append(wi.default_view)
        wi.current_view = wi.default_view

        self.model.workflow.append(wi)
        self.model.selected = wi

        self.help_pane.html = self.op.get_help()
Exemplo n.º 28
0
    def setUp(self):
        ImportedDataTest.setUp(self)

        plugin = ChannelStatisticPlugin()

        op = plugin.get_operation()
        op.name = "MeanByDox"
        op.channel = "Y2-A"
        op.statistic_name = "Geom.SD"
        op.by = ['Dox', 'Well']

        wi = WorkflowItem(operation=op)
        self.workflow.workflow.append(wi)

        op = plugin.get_operation()
        op.name = "MeanByDox"
        op.channel = "Y2-A"
        op.statistic_name = "Geom.Mean"
        op.by = ['Dox', 'Well']
        op.subset_list.append(CategorySubset(name="Well", values=["A", "B"]))

        self.wi = wi = WorkflowItem(operation=op)
        self.workflow.workflow.append(wi)
        self.workflow.selected = wi

        self.assertTrue(wait_for(wi, 'status', lambda v: v == 'valid', 10))

        plugin = Stats1DPlugin()
        self.view = view = plugin.get_view()
        view.statistic = ("MeanByDox", "Geom.Mean")
        view.variable = "Dox"
        view.huefacet = "Well"

        self.workflow.remote_exec("self.workflow[-1].view_error = 'waiting'")
        self.assertTrue(
            wait_for(self.wi, 'view_error', lambda v: v == "waiting", 5))

        wi.views.append(view)
        wi.current_view = view
        self.workflow.selected = wi

        self.assertTrue(wait_for(self.wi, 'view_error', lambda v: v == "", 5))
Exemplo n.º 29
0
    def setUp(self):
        super().setUp()

        self.op = op = TasbeCalibrationOp()
        self.cwd = os.path.dirname(os.path.abspath(__file__))

        self.wi = wi = WorkflowItem(operation=op,
                                    status='waiting',
                                    view_error="Not yet plotted")
        wi.default_view = self.op.default_view()
        wi.views.append(self.wi.default_view)
        self.workflow.workflow.append(wi)
        self.workflow.selected = self.wi

        op.blank_file = self.cwd + "/../../cytoflow/tests/data/tasbe/blank.fcs"
        op.fsc_channel = "FSC-A"
        op.ssc_channel = "SSC-A"

        op._polygon_op.vertices = [(72417, 499), (74598, 1499), (118743, 3376),
                                   (216547, 6166), (246258, 4543),
                                   (237880, 1973), (139102, 872), (87822, 519)]

        op.channels = ["FITC-A", "Pacific Blue-A", "PE-Tx-Red-YG-A"]

        op.bleedthrough_list = [
            _BleedthroughControl(channel="FITC-A",
                                 file=self.cwd +
                                 "/../../cytoflow/tests/data/tasbe/eyfp.fcs"),
            _BleedthroughControl(channel="Pacific Blue-A",
                                 file=self.cwd +
                                 "/../../cytoflow/tests/data/tasbe/ebfp.fcs"),
            _BleedthroughControl(channel="PE-Tx-Red-YG-A",
                                 file=self.cwd +
                                 "/../../cytoflow/tests/data/tasbe/mkate.fcs")
        ]

        op.beads_name = "Spherotech RCP-30-5A Lot AG01, AF02, AD04 and AAE01"
        op.beads_file = self.cwd + "/../../cytoflow/tests/data/tasbe/beads.fcs"
        op.units_list = [
            _Unit(channel="FITC-A", unit="MEFL"),
            _Unit(channel="Pacific Blue-A", unit="MEBFP"),
            _Unit(channel="PE-Tx-Red-YG-A", unit="MEPTR")
        ]

        op.do_color_translation = False
        op.output_directory = tempfile.mkdtemp()

        # run the estimate
        self.workflow.remote_exec("pass")
        op.valid_model = False
        op.do_estimate = True
        wait_for_condition(lambda v: v.valid_model == True, self.op,
                           'valid_model', 30)
Exemplo n.º 30
0
    def add_operation(self, op_id):
        # first, find the matching plugin
        plugin = next((x for x in self.op_plugins if x.id == op_id))
        
        # default to inserting at the end of the list if none selected
        after = self.model.selected
        if after is None:
            after = self.model.workflow[-1]
        
        idx = self.model.workflow.index(after)
        
        wi = WorkflowItem(task = self)
        wi.operation = plugin.get_operation()

        wi.next = after.next
        after.next = wi
        wi.previous = after
        if wi.next:
            wi.next.previous = wi
        self.model.workflow.insert(idx+1, wi)
        
        # set up the default view
        wi.default_view = plugin.get_default_view(wi.operation)
        if wi.default_view is not None:
            wi.default_view.handler = \
                wi.default_view.handler_factory(model = wi.default_view, wi = wi.previous)
            wi.views.append(wi.default_view)

        # select (open) the new workflow item
        self.model.selected = wi
        if wi.default_view:
            wi.current_view = wi.default_view
            
        # invalidate everything following
        self.operation_parameters_updated()
Exemplo n.º 31
0
    def setUp(self):
        TasbeTest.setUp(self)
        
        plugin = ThresholdPlugin()
        op = plugin.get_operation()
                
        op.name = "Morpho"
        op.channel = "FSC-A"
        op.threshold = 100000

        wi = WorkflowItem(operation = op)
        self.workflow.workflow.append(wi)        
        self.assertTrue(wait_for(wi, 'status', lambda v: v == 'valid', 5))
 
        plugin = BleedthroughLinearPlugin()
        self.op = op = plugin.get_operation()
        
        self.cwd = os.path.dirname(os.path.abspath(__file__))
        op.controls_list = [_Control(channel = "FITC-A",
                                     file = self.cwd + '/../../cytoflow/tests/data/tasbe/eyfp.fcs'),
                            _Control(channel = "PE-Tx-Red-YG-A",
                                     file = self.cwd + '/../../cytoflow/tests/data/tasbe/mkate.fcs'),
                            _Control(channel = "Pacific Blue-A",
                                     file = self.cwd + '/../../cytoflow/tests/data/tasbe/ebfp.fcs')]
        
        op.subset_list.append(BoolSubset(name = "Morpho"))
        op.subset_list[0].selected_t = True
        
        self.wi = wi = WorkflowItem(operation = op)
        wi.default_view = self.op.default_view()
        wi.view_error = "Not yet plotted"
        wi.views.append(self.wi.default_view)
        
        self.workflow.workflow.append(wi)
        self.workflow.selected = self.wi
          
        # run the estimate
        op.do_estimate = True
        self.assertTrue(wait_for(wi, 'status', lambda v: v == 'valid', 30))
Exemplo n.º 32
0
    def setUp(self):
        WorkflowTest.setUp(self)
        
        plugin = ImportPlugin()
        op = plugin.get_operation()

        from cytoflow import Tube
             
        self.cwd = os.path.dirname(os.path.abspath(__file__))
     
        tube = Tube(file = self.cwd + "/../../cytoflow/tests/data/tasbe/rby.fcs")
        op.tubes = [tube]
        
        wi = WorkflowItem(operation = op,
                          view_error = "Not yet plotted") 
        self.workflow.workflow.append(wi)
        self.assertTrue(wait_for(wi, 'status', lambda v: v == 'valid', 5))
        self.assertTrue(self.workflow.remote_eval("self.workflow[0].result is not None"))
Exemplo n.º 33
0
    def setUp(self):
        ImportedDataTest.setUp(self)

        plugin = BinningPlugin()
        self.op = op = plugin.get_operation()

        op.name = "Bin"
        op.channel = "V2-A"
        op.scale = "log"
        op.bin_width = 0.2

        self.wi = wi = WorkflowItem(operation=op)
        wi.default_view = op.default_view()
        wi.view_error = "Not yet plotted"
        wi.views.append(self.wi.default_view)

        self.workflow.workflow.append(wi)
        self.workflow.selected = wi

        self.assertTrue(wait_for(wi, 'status', lambda v: v == 'valid', 10))
Exemplo n.º 34
0
    def setUp(self):
        super().setUp()

        plugin = BinningPlugin()
        self.op = op = plugin.get_operation()
        op.name = "Bin"
        op.channel = "V2-A"
        op.scale = "log"
        op.bin_width = 0.2

        self.wi = wi = WorkflowItem(operation=op,
                                    status='waiting',
                                    view_error="Not yet plotted")
        self.view = wi.default_view = op.default_view()
        wi.views.append(self.wi.default_view)

        self.workflow.workflow.append(wi)
        self.workflow.selected = wi

        self.workflow.wi_waitfor(wi, 'status', "valid")