예제 #1
0
    def test_get_sample_gate_events(self):
        wsp_path = "examples/data/8_color_data_set/8_color_ICS_simple.wsp"
        sample_grp = 'DEN'
        sample_id = '101_DEN084Y5_15_E01_008_clean.fcs'
        gate_name = 'CD3+'

        fks = Session(copy.deepcopy(test_samples_8c_full_set))
        fks.import_flowjo_workspace(wsp_path, ignore_missing_files=True)

        fks.analyze_samples(sample_grp, sample_id)

        sample_comp = fks.get_sample_comp_matrices(sample_grp, sample_id)[0]
        sample_xform = transforms.LogicleTransform('my_logicle',
                                                   param_t=262144.0,
                                                   param_w=1.0,
                                                   param_m=4.418539922,
                                                   param_a=0.0)

        df_gated_events = fks.get_gate_events(sample_grp,
                                              sample_id,
                                              gate_name,
                                              matrix=sample_comp,
                                              transform=sample_xform)

        self.assertIsInstance(df_gated_events, pd.DataFrame)
        self.assertEqual(len(df_gated_events), 133670)
예제 #2
0
    def test_transform_sample_logical(self):
        xform = transforms.LogicleTransform('logicle',
                                            param_t=10000,
                                            param_w=0.5,
                                            param_m=4.5,
                                            param_a=0)
        data1_sample.apply_transform(xform)

        self.assertIsInstance(data1_sample._transformed_events, np.ndarray)
예제 #3
0
    def test_inverse_logicle_transform():
        xform = transforms.LogicleTransform('logicle',
                                            param_t=10000,
                                            param_w=0.5,
                                            param_m=4.5,
                                            param_a=0)
        y = xform.apply(test_data_range1)
        x = xform.inverse(y)

        np.testing.assert_array_almost_equal(test_data_range1, x, decimal=10)
예제 #4
0
import sys
import os
from pathlib import Path
import numpy as np
import pandas as pd

sys.path.append(os.path.abspath('..'))

from flowkit import Sample, transforms

data1_fcs_path = 'examples/gate_ref/data1.fcs'
data1_sample = Sample(data1_fcs_path)

xform_logicle = transforms.LogicleTransform('logicle',
                                            param_t=10000,
                                            param_w=0.5,
                                            param_m=4.5,
                                            param_a=0)


class LoadSampleTestCase(unittest.TestCase):
    """Tests for loading FCS files as Sample objects"""
    def test_load_from_fcs_file_path(self):
        """Test creating Sample object from an FCS file path"""
        fcs_file_path = "examples/test_data_2d_01.fcs"

        sample = Sample(fcs_path_or_data=fcs_file_path)

        self.assertIsInstance(sample, Sample)

    def test_load_from_pathlib(self):