Example #1
0
    def test_write_fcs_preserves_channels(self):
        orig_fd = FlowData('examples/fcs_files/100715.fcs')
        expected = orig_fd.channels

        with tempfile.NamedTemporaryFile() as tmpfile:
            orig_fd.write_fcs(tmpfile.name)
            out_data = FlowData(tmpfile.name)
            actually = out_data.channels

            self.assertDictEqual(expected, actually)
Example #2
0
 def test_load_temp_file(self):
     with tempfile.TemporaryFile() as tmp_file:
         with open('examples/fcs_files/3FITC_4PE_004.fcs', 'r+b') as f:
             shutil.copyfileobj(f, tmp_file)
         tmp_file.seek(0)
         out_data = FlowData(tmp_file)
     self.assertIsInstance(out_data, FlowData)
Example #3
0
    def test_write_fcs(self):
        file_name = 'flowio/tests/flowio_test_write_fcs.fcs'
        self.flow_data_spill.write_fcs(file_name)

        fcs_export = FlowData(file_name)

        self.assertIsInstance(fcs_export, FlowData)
        os.unlink(file_name)
Example #4
0
    def test_parse_var_int_data(self):
        event_values = [
            49135, 61373, 48575, 49135, 61373, 48575, 7523, 598, 49135, 61373,
            48575, 49135, 61373, 48575, 28182, 61200, 48575, 49135, 32445,
            30797, 19057, 49135, 61373, 48575, 5969, 142482809, 61266, 48575,
            49135, 20925, 61265, 48575, 27961, 25200, 61287, 48575, 9795,
            49135, 29117, 49135, 61373, 48575, 61228, 48575, 22, 21760, 49135,
            20413, 49135, 23997, 19807, 3220139858
        ]

        fcs_file = "examples/fcs_files/variable_int_example.fcs"
        sample = FlowData(fcs_file)

        self.assertListEqual(event_values, sample.events)
Example #5
0
    def test_create_fcs(self):
        event_data = self.flow_data.events
        channel_names = self.flow_data.channels
        pnn_labels = [v['PnN'] for k, v in channel_names.items()]

        export_file_path = "examples/fcs_files/test_fcs_export.fcs"
        fh = open(export_file_path, 'wb')
        create_fcs(event_data, channel_names=pnn_labels, file_handle=fh)
        fh.close()

        exported_flow_data = FlowData(export_file_path)
        os.unlink(export_file_path)

        self.assertIsInstance(exported_flow_data, FlowData)
Example #6
0
    def test_issue_03(self):
        """
        Tests Attune FCS files for error in FlowData method parse_float_data:

        flowio/flowdata.py in __parse_float_data(self, offset, start, stop, data_type, order)
            256
            257         tmp = unpack('%s%d%s' % (order, num_items, data_type),
        --> 258                      self.__read_bytes(offset, start, stop))
            259         return tmp
            260

        error: unpack requires a buffer of 277676 bytes
        """
        flow_data = FlowData('examples/fcs_files/G11.fcs')

        self.assertIsInstance(flow_data, FlowData)
Example #7
0
 def setUp(self):
     self.flow_data = FlowData('examples/fcs_files/coulter.lmd')
Example #8
0
 def setUp(self):
     self.flowdata = FlowData('sample_data/coulter.lmd')
Example #9
0
 def setUp(self):
     self.maxDiff = None
     self.flow_data = FlowData('examples/fcs_files/3FITC_4PE_004.fcs')
     self.flow_data_spill = FlowData('examples/fcs_files/100715.fcs')
Example #10
0
 def test_load_fcs_from_memory():
     with open('examples/fcs_files/3FITC_4PE_004.fcs', 'rb') as f:
         mem_file = io.BytesIO(f.read())
         FlowData(mem_file)
Example #11
0
 def setUp(self):
     self.flowdata = FlowData('sample_data/3FITC_4PE_004.fcs')
Example #12
0
 def test_load_fcs():
     for unused in range(100):
         FlowData('sample_data/3FITC_4PE_004.fcs')
Example #13
0
 def setUp(self):
     self.flow_data = FlowData('examples/fcs_files/100715.fcs')