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] self.view = view = Stats2DWorkflowView() wi.views.append(view) wi.current_view = view super().setUpView() self.workflow.selected = wi self.workflow.wi_waitfor(self.wi, 'view_error', '')
def setUp(self): super().setUp() self.op = op = GaussianMixture2DWorkflowOp() op.name = "Gauss" op.xchannel = "V2-A" op.ychannel = "Y2-A" op.xscale = "logicle" op.yscale = "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.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')
def setUpView(self): super().setUpView() self.view.subset_list.append( CategorySubset(name="Well", values=['A', 'B'])) self.view.subset_list.append( RangeSubset(name="Dox", values=[1.0, 10.0, 100.0]))
def setUp(self): super().setUp() self.op = op = PCAWorkflowOp() op.name = "PCA" op.channels_list = [ PCAChannel(channel="V2-A", scale="log"), PCAChannel(channel="V2-H", scale="log"), PCAChannel(channel="Y2-A", scale="log"), PCAChannel(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')
def setUp(self): super().setUp() op = ChannelStatisticWorkflowOp() 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.op = op = TransformStatisticWorkflowOp() 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")
def testSubset(self): self.workflow.wi_sync(self.wi, 'view_error', 'waiting') self.view.subset_list.append( CategorySubset(name="Well", values=['A', 'B'])) self.view.subset_list.append( RangeSubset(name="Dox", values=[0.0, 10.0, 100.0])) self.view.subset_list[0].selected = ["A"] self.workflow.wi_waitfor(self.wi, 'view_error', '')
def _on_conditions_change(self, obj, name, old, new): value_names = set([subset.name for subset in self.value]) condition_names = set([ x for x in list(self.conditions.keys()) if self.include_condition(x) ]) loading = (self.ui.context["context"].status == "loading") if not loading: for name in value_names - condition_names: # remove subsets that aren't in conditions subset = next((x for x in self.value if x.name == name)) self.value.remove(subset) for name in condition_names - value_names: # add subsets that are new conditions values = self.conditions[name].sort_values() dtype = pd.Series(list(values)).dtype if dtype.kind == 'b': subset = BoolSubset(name=name) elif dtype.kind in "ifu": subset = RangeSubset(name=name, values=list(values)) elif dtype.kind in "OSU": subset = CategorySubset(name=name, values=sorted(list(values))) else: raise util.CytoflowError( "Unknown dtype {} in ViewController".format(dtype)) self.value.append(subset) for name in condition_names & value_names: # update values for subsets we're already tracking subset = next((x for x in self.value if x.name == name)) if set(subset.values) != set(self.conditions[name]): subset.values = list(self.conditions[name].sort_values()) self.value = sorted(self.value, key=lambda x: x.name)
def setUp(self): super().setUp() stats_op = ChannelStatisticWorkflowOp() 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
def setUp(self): super().setUp() self.op = op = ThresholdWorkflowOp() 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 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")
def setUp(self): super().setUp() import_plugin = ImportPlugin() import_op = import_plugin.get_operation() from cytoflow import Tube import_op.conditions = { "Dox": "float", "IP": "float", "Well": "category" } self.cwd = os.path.dirname(os.path.abspath(__file__)) tube1 = Tube(file=self.cwd + "/../../cytoflow/tests/data/Plate01/CFP_Well_A4.fcs", conditions={ "Dox": 1.0, "IP": 1.0, "Well": 'A' }) tube2 = Tube(file=self.cwd + "/../../cytoflow/tests/data/Plate01/RFP_Well_A3.fcs", conditions={ "Dox": 1.0, "IP": 10.0, "Well": 'B' }) tube3 = Tube(file=self.cwd + "/../../cytoflow/tests/data/Plate01/YFP_Well_A7.fcs", conditions={ "Dox": 10.0, "IP": 1.0, "Well": 'A' }) tube4 = Tube(file=self.cwd + "/../../cytoflow/tests/data/Plate01/CFP_Well_B4.fcs", conditions={ "Dox": 10.0, "IP": 10.0, "Well": 'B' }) tube5 = Tube(file=self.cwd + "/../../cytoflow/tests/data/Plate01/RFP_Well_A6.fcs", conditions={ "Dox": 100.0, "IP": 1.0, "Well": 'A' }) tube6 = Tube(file=self.cwd + "/../../cytoflow/tests/data/Plate01/YFP_Well_C7.fcs", conditions={ "Dox": 100.0, "IP": 100.0, "Well": 'B' }) import_op.tubes = [tube1, tube2, tube3, tube4, tube5, tube6] wi = WorkflowItem(operation=import_op, status="waiting", view_error="Not yet plotted") self.workflow.workflow.append(wi) import_op.do_estimate = True self.workflow.wi_waitfor(wi, 'status', 'valid') self.assertTrue( self.workflow.remote_eval("self.workflow[0].result is not None")) stats_plugin = ChannelStatisticPlugin() stats_op_1 = stats_plugin.get_operation() stats_op_1.name = "MeanByDoxIP" stats_op_1.channel = "Y2-A" stats_op_1.statistic_name = "Geom.Mean" stats_op_1.by = ['Dox', 'IP'] stats_op_1.subset_list.append( CategorySubset(name="Well", values=['A', 'B'])) stats_op_1.subset_list.append( RangeSubset(name="Dox", values=[1.0, 10.0, 100.0])) stats_op_1.subset_list.append( RangeSubset(name="IP", values=[1.0, 10.0])) stats_wi_1 = WorkflowItem(operation=stats_op_1, status="waiting", view_error="Not yet plotted") self.workflow.workflow.append(stats_wi_1) self.workflow.wi_waitfor(stats_wi_1, 'status', 'valid') stats_op_2 = stats_plugin.get_operation() stats_op_2.name = "SDByDoxIP" stats_op_2.channel = "Y2-A" stats_op_2.statistic_name = "Geom.SD" stats_op_2.by = ['Dox', 'IP'] stats_op_2.subset_list.append( CategorySubset(name="Well", values=['A', 'B'])) stats_op_2.subset_list.append( RangeSubset(name="Dox", values=[1.0, 10.0, 100.0])) stats_op_2.subset_list.append( RangeSubset(name="IP", values=[1.0, 10.0])) stats_wi_2 = WorkflowItem(operation=stats_op_2, status="waiting", view_error="Not yet plotted") self.workflow.workflow.append(stats_wi_2) self.workflow.selected = stats_wi_2 self.workflow.wi_waitfor(stats_wi_2, 'status', 'valid')