Ejemplo n.º 1
0
    def test_count_gene_region_condition(self):
        self.config.excluded = load_excluded(self.config)
        self.config.annotations_dict = load_annotations_dict(self.config)

        count = self.get_count(gene_region_condition)

        self.assertEqual(count, 292)
Ejemplo n.º 2
0
 def test_exclude_condition(self):
     self.config.excluded = load_excluded(self.config)
     self.config.annotations_dict = {
         self.config.annotations.id_name: [['cg00000165']]
     }
     condition = exclude_condition(self.config, 0)
     self.assertEqual(False, condition)
Ejemplo n.º 3
0
    def test_load_excluded_check_pkl_creation(self):
        self.config.annotations.exclude = 'excluded'
        fn = get_data_base_path(
            self.config) + '/' + self.config.annotations.exclude + '.pkl'

        self.config.excluded = load_excluded(self.config)

        self.assertEqual(True, os.path.isfile(fn))
Ejemplo n.º 4
0
    def initialize(self):

        self.excluded = load_excluded(self)

        self.annotations_dict = load_annotations_dict(self)
        subset_annotations(self)

        self.attributes_dict = load_attributes_dict(self)
        self.attributes_indexes = get_indexes(self)
        subset_attributes(self)
        self.cells_dict = load_cells_dict(self)
        subset_cells(self)
Ejemplo n.º 5
0
    def test_check_conditions(self):
        self.config.excluded = load_excluded(self.config)

        self.config.annotations_dict = {
            self.config.annotations.id_name: [['cg00001249']],
            'CROSS_R': [['0']],
            'Probe_SNPs': [[]],
            'Probe_SNPs_10': [[]],
            'CHR': [['14']],
            'UCSC_REFGENE_NAME': [['PRR4', 'TAS2R20']],
            'RELATION_TO_UCSC_CPG_ISLAND': [['S_Shelf']],
            'Class': [['ClassA']]
        }
        condition = global_check(self.config, 0)
        self.assertEqual(True, condition)

        self.config.annotations_dict['CHR'] = [['X']]
        condition = global_check(self.config, 0)
        self.assertEqual(False, condition)
Ejemplo n.º 6
0
    def test_count_check_conditions(self):
        self.config.excluded = load_excluded(self.config)
        tmp_dict = load_annotations_dict(self.config)

        for i, value in enumerate(tmp_dict['Class']):
            if value == 'ClassA':
                tmp_dict['Class'][i] = 'A'
            elif value == 'ClassB':
                tmp_dict['Class'][i] = 'B'
            elif value == 'ClassC':
                tmp_dict['Class'][i] = 'C'
            elif value == 'ClassD':
                tmp_dict['Class'][i] = 'D'

        self.config.annotations_dict = tmp_dict

        count = self.get_count(check_conditions)

        self.assertEqual(count, 151)
Ejemplo n.º 7
0
    def test_check_conditions(self):
        self.config.excluded = load_excluded(self.config)

        annotations_dict = {
            AnnotationKey.cpg.value: 'cg00001249',
            AnnotationKey.cross_reactive.value: '0',
            AnnotationKey.Probe_SNPs.value: '',
            AnnotationKey.Probe_SNPs_10.value: '',
            AnnotationKey.chr.value: '14',
            AnnotationKey.gene.value: ['PRR4', 'TAS2R20'],
            AnnotationKey.geo.value: 'S_Shelf',
            AnnotationKey.probe_class.value: 'A'
        }
        condition1 = check_conditions(self.config, annotations_dict)

        annotations_dict[AnnotationKey.chr.value] = 'X'
        condition2 = check_conditions(self.config, annotations_dict)

        self.assertEqual((True, False), (condition1, condition2))
Ejemplo n.º 8
0
    def initialize(self):

        if self.is_init:

            if self.annotations is not None:
                self.excluded = load_excluded(self)
                self.annotations_dict = load_annotations_dict(self)
                subset_annotations(self)

            self.observables_dict = load_observables_dict(self)
            self.observables_categorical_dict = load_observables_categorical_dict(
                self)
            self.is_observables_categorical = get_is_observables_categorical(
                self)
            self.attributes_indexes = get_indexes(self)
            subset_observables(self)

            if self.attributes.cells is not None:
                self.cells_dict = load_cells_dict(self)
                subset_cells(self)
Ejemplo n.º 9
0
 def test_load_excluded_check_len_excluded(self):
     self.config.annotations.exclude = 'excluded'
     self.config.excluded = load_excluded(self.config)
     self.assertEqual(3, len(self.config.excluded))
Ejemplo n.º 10
0
 def test_load_excluded_check_none_excluded(self):
     self.assertEqual([], load_excluded(self.config))
Ejemplo n.º 11
0
 def test_count_check_conditions(self):
     self.config.excluded = load_excluded(self.config)
     self.config.annotations_dict = load_annotations_dict(self.config)
     count = self.get_count(global_check)
     self.assertEqual(count, 151)
Ejemplo n.º 12
0
 def test_exclude_condition(self):
     self.config.excluded = load_excluded(self.config)
     ex_cpg = {AnnotationKey.cpg.value: 'cg00000165'}
     is_not_excluded = exclude_condition(self.config, ex_cpg)
     self.assertEqual(False, is_not_excluded)