コード例 #1
0
ファイル: test_stats_2d.py プロジェクト: ritika-giri/cytoflow
    def setUp(self):
        ImportedDataTest.setUp(self)

        self.ex = flow.ChannelStatisticOp(name="Y",
                                          channel="Y2-A",
                                          by=['Well', 'Dox'],
                                          function=flow.geom_mean).apply(
                                              self.ex)

        self.ex = flow.ChannelStatisticOp(name="Y",
                                          channel="Y2-A",
                                          by=['Well', 'Dox'],
                                          function=flow.geom_sd_range).apply(
                                              self.ex)

        self.ex = flow.ChannelStatisticOp(name="V",
                                          channel="V2-A",
                                          by=['Well', 'Dox'],
                                          function=flow.geom_mean).apply(
                                              self.ex)

        self.ex = flow.ChannelStatisticOp(name="V",
                                          channel="V2-A",
                                          by=['Well', 'Dox'],
                                          function=flow.geom_sd_range).apply(
                                              self.ex)

        self.view = flow.Stats2DView(xstatistic=("Y", "geom_mean"),
                                     x_error_statistic=("Y", "geom_sd_range"),
                                     ystatistic=("V", "geom_mean"),
                                     y_error_statistic=("V", "geom_sd_range"),
                                     variable="Dox",
                                     huefacet="Well")
コード例 #2
0
ファイル: test_table.py プロジェクト: ritika-giri/cytoflow
    def setUp(self):
        ImportedDataTest.setUp(self)
        self.ex = flow.ThresholdOp(name="T", channel="Y2-A",
                                   threshold=500).apply(self.ex)

        self.ex = flow.ChannelStatisticOp(name="ByDox",
                                          channel="Y2-A",
                                          by=['Dox'],
                                          function=flow.geom_mean).apply(
                                              self.ex)

        self.ex = flow.ChannelStatisticOp(name="ByDoxWell",
                                          channel="Y2-A",
                                          by=['Dox', 'Well'],
                                          function=flow.geom_mean).apply(
                                              self.ex)

        self.ex = flow.ChannelStatisticOp(name="ByDox",
                                          channel="Y2-A",
                                          by=['Dox'],
                                          function=flow.geom_sd_range).apply(
                                              self.ex)

        self.ex = flow.ChannelStatisticOp(name="ByDoxWell",
                                          channel="Y2-A",
                                          by=['Dox', 'Well'],
                                          function=flow.geom_sd_range).apply(
                                              self.ex)
コード例 #3
0
    def testBadSet(self):

        self.ex = flow.ChannelStatisticOp(name="Y_bad",
                                          channel="Y2-A",
                                          by=['Well'],
                                          function=flow.geom_sd_range).apply(
                                              self.ex)
コード例 #4
0
    def testStats2D(self):
        import numpy as np

        ex2 = flow.ChannelStatisticOp(name="StatsV",
                                      by=["Dox"],
                                      channel="V2-A",
                                      function=np.mean).apply(self.ex)

        ex3 = flow.ChannelStatisticOp(name="StatsY",
                                      by=["Dox"],
                                      channel="Y2-A",
                                      function=np.mean).apply(ex2)

        flow.Stats2DView(xstatistic=("StatsV", "mean"),
                         ystatistic=("StatsY", "mean"),
                         variable="Dox").plot(ex3)
コード例 #5
0
    def testTuple(self):
        ex1 = flow.ChannelStatisticOp(name="ByDox",
                                      channel="Y2-A",
                                      by=['T'],
                                      function=flow.geom_sd_range).apply(
                                          self.ex)

        ex2 = flow.ChannelStatisticOp(name="ByDox",
                                      channel="Y2-A",
                                      by=['T', 'Dox'],
                                      function=flow.geom_sd_range).apply(
                                          self.ex)

        self.assertEqual(
            type(ex1.statistics[('ByDox', 'geom_sd_range')].iloc[0]),
            type(ex2.statistics[('ByDox', 'geom_sd_range')].iloc[0]))
コード例 #6
0
ファイル: test_barchart.py プロジェクト: roshih/cytoflow
    def testErrorStat(self):
        self.ex = flow.ChannelStatisticOp(name="ByDox",
                                          by=['Dox', 'Well'],
                                          channel="Y2-A",
                                          function=util.geom_sd_range).apply(
                                              self.ex)

        self.view.error_statistic = ("ByDox", "geom_sd_range")
        self.view.plot(self.ex)
コード例 #7
0
    def setUp(self):
        super().setUp()
        self.ex = flow.ThresholdOp(name="T", channel="Y2-A",
                                   threshold=500).apply(self.ex)

        self.ex = flow.ChannelStatisticOp(name="ByDox",
                                          by=['Dox', 'T'],
                                          channel="Y2-A",
                                          function=len).apply(self.ex)
コード例 #8
0
    def testBadFunction(self):

        op = flow.ChannelStatisticOp(name="ByDox",
                                     by=['T'],
                                     channel="Y2-A",
                                     subset="Dox == 10.0",
                                     function=lambda x: len(x) / 0.0)

        with self.assertRaises(util.CytoflowOpError):
            op.apply(self.ex)
コード例 #9
0
    def testSubset(self):
        ex = flow.ChannelStatisticOp(name="ByDox",
                                     by=['T'],
                                     channel="Y2-A",
                                     subset="Dox == 10.0",
                                     function=len).apply(self.ex)
        stat = ex.statistics[("ByDox", "len")]

        self.assertEqual(stat.loc[False].values[0], 5601)
        self.assertEqual(stat.loc[True].values[0], 4399)
コード例 #10
0
 def setUp(self):
     ImportedDataTest.setUp(self)
     self.ex = flow.ThresholdOp(name = "T",
                                channel = "Y2-A",
                                threshold = 500).apply(self.ex)
                                
     self.ex = flow.ChannelStatisticOp(name = "ByDox",
                          channel = "Y2-A",
                          by = ['T', 'Dox'],
                          function = flow.geom_mean).apply(self.ex)
                          
     self.ex = flow.ChannelStatisticOp(name = "ByDox",
                          channel = "Y2-A",
                          by = ['T', 'Dox'],
                          function = flow.geom_sd_range).apply(self.ex)
                                  
     self.view = flow.Stats1DView(statistic = ("ByDox", "geom_mean"),
                                  error_statistic = ("ByDox", "geom_sd_range"),
                                  variable = "Dox",
                                  huefacet = "T")
コード例 #11
0
    def testApply(self):
        ex = flow.ChannelStatisticOp(name="ByDox",
                                     by=['Dox', 'T'],
                                     channel="Y2-A",
                                     function=len).apply(self.ex)

        self.assertIn(("ByDox", "len"), ex.statistics)

        stat = ex.statistics[("ByDox", "len")]
        self.assertIn("Dox", stat.index.names)
        self.assertIn("T", stat.index.names)
コード例 #12
0
ファイル: test_barchart.py プロジェクト: roshih/cytoflow
    def setUp(self):
        ImportedDataTest.setUp(self)

        self.ex = flow.ChannelStatisticOp(name="ByDox",
                                          by=['Dox', 'Well'],
                                          channel="Y2-A",
                                          function=flow.geom_mean).apply(
                                              self.ex)

        self.view = flow.BarChartView(statistic=("ByDox", "geom_mean"),
                                      variable="Well",
                                      huefacet="Dox")
コード例 #13
0
 def testSubset(self):
     ex = flow.ChannelStatisticOp(name="ByDox",
                                  by=['T'],
                                  channel="Y2-A",
                                  subset="Dox == 10.0",
                                  function=len).apply(self.ex)
     stat = ex.statistics[("ByDox", "len")]
     from_df = ex.data.groupby(["T", "Dox"]).size()
     self.assertEqual(stat.loc[False], from_df.loc[False, 10.0])
     self.assertEqual(stat.loc[True], from_df.loc[True, 10.0])
     self.assertEqual(stat.loc[False], 5601)
     self.assertEqual(stat.loc[True], 4399)
コード例 #14
0
    def testBarChart(self):
        import numpy as np
        ex2 = flow.ChannelStatisticOp(name="Stats1D",
                                      by=["Dox"],
                                      channel="V2-A",
                                      function=np.mean).apply(self.ex)

        warnings.filterwarnings(
            'ignore',
            'axes.color_cycle is deprecated and replaced with axes.prop_cycle')

        flow.BarChartView(statistic=("Stats1D", "mean"),
                          variable="Dox").plot(ex2)
コード例 #15
0
    def testBadErrorStat(self):
        self.ex = flow.ChannelStatisticOp(name="ByDox_BAD",
                                          channel="Y2-A",
                                          by=['Dox'],
                                          function=flow.geom_sd_range).apply(
                                              self.ex)

        self.view = flow.Stats1DView(statistic=("ByDox", "geom_mean"),
                                     error_statistic=("ByDox_BAD",
                                                      "geom_sd_range"),
                                     variable="Dox",
                                     huefacet="T")

        self.assertRaises(util.CytoflowViewError, self.view.plot, self.ex)
コード例 #16
0
ファイル: test_stats_2d.py プロジェクト: stevenjkern/cytoflow
 def testBadYErrorStatistic(self):
     self.ex = flow.ChannelStatisticOp(name = "V_bad",
                          channel = "V2-A",
                          by = ['Well'],
                          function = flow.geom_sd_range).apply(self.ex)
                                  
     self.view = flow.Stats2DView(xstatistic = ("Y", "geom_mean"),
                                  x_error_statistic = ("Y", "geom_sd_range"),
                                  ystatistic = ("V", "geom_mean"),
                                  y_error_statistic = ("V_bad", "geom_sd_range"),
                                  variable = "Dox",
                                  huefacet = "Well")
     
     self.assertRaises(util.CytoflowViewError, self.view.plot, self.ex)
コード例 #17
0
    def testStats1D(self):
        import numpy as np

        ex2 = flow.ChannelStatisticOp(name="Stats1D",
                                      by=["Dox"],
                                      channel="V2-A",
                                      function=np.mean).apply(self.ex)

        flow.Stats1DView(statistic=("Stats1D", "mean"),
                         variable="Dox").plot(ex2)

        flow.Stats1DView(statistic=("Stats1D", "mean"),
                         variable="Dox",
                         variable_scale="log",
                         scale="logicle").plot(ex2)
コード例 #18
0
    def setUp(self):
        self.cwd = os.path.dirname(os.path.abspath(__file__)) + "/data/Plate01/"

        tube1 = flow.Tube(file = self.cwd + 'RFP_Well_A3.fcs', conditions = {"Dox" : 10.0})
        tube2 = flow.Tube(file= self.cwd + 'CFP_Well_A4.fcs', conditions = {"Dox" : 1.0})
        import_op = flow.ImportOp(conditions = {"Dox" : "float"},
                                  tubes = [tube1, tube2])
        self.ex = import_op.apply()
        
        self.ex = flow.ThresholdOp(name = "T",
                                   channel = "Y2-A",
                                   threshold = 500).apply(self.ex)
                                   
        self.ex = flow.ChannelStatisticOp(name = "ByDox",
                                          by = ['Dox', 'T'],
                                          channel = "Y2-A",
                                          function = len).apply(self.ex)