Пример #1
0
    def test_parse_multiple_functional_elements(self):
        """Test that functional elements rows consisting of multiple functional elements can be parsed."""

        functional_elements = [('--', ''), ('SN', '1'),
                               ('ID', 'Aferr subtype specific proteins'),
                               ('RQ', '0'),
                               ('EV', 'IPR017545; TIGR03114; sufficient;'),
                               ('TG', 'GO:0043571;'),
                               ('ID', 'Yolo subtype specific proteins'),
                               ('RQ', '1'), ('EV', 'IPR017546; TIGR03115;'),
                               ('TG', 'GO:0043571;')]

        parsed_functional_elements = parse_functional_elements(
            functional_elements)
        functional_element_one = parsed_functional_elements[0]
        functional_element_two = parsed_functional_elements[1]

        self.assertEqual(len(parsed_functional_elements), 2)

        evidence_one = functional_element_one.evidence[0]
        evidence_two = functional_element_two.evidence[0]

        self.assertEqual(evidence_one.evidence_identifiers,
                         ['IPR017545', 'TIGR03114'])
        self.assertEqual(evidence_two.evidence_identifiers,
                         ['IPR017546', 'TIGR03115'])
Пример #2
0
    def test_assign_functional_element_none_sufficient_all_not_present(self):
        """Test assignment of a functional element when no sufficient identifiers and none present."""

        test_cache = AssignmentCache(interpro_member_database_identifiers=[
            'TIGR03115', 'TIGR03118', 'TIGR03121'
        ])

        functional_element = [
            ('--', ''),
            ('SN', '1'),
            ('ID', 'Aferr subtype specific proteins'),
            ('RQ', '0'),
            ('EV', 'IPR017545; TIGR03114;'),  # NO
            ('EV', 'IPR017547; TIGR03117;'),  # NO
            ('TG', 'GO:0043571;'),
            ('EV', 'IPR017552; TIGR03120;'),  # NO
            ('TG', 'GO:0043573;')
        ]

        parsed_functional_element = parse_functional_elements(
            functional_element)[0]

        assignment = assign_functional_element(test_cache,
                                               parsed_functional_element)

        self.assertEqual(assignment, 'NO')
Пример #3
0
    def test_assign_functional_element_all_identifiers(self):
        """Test assignment of a functional element when all evidence markers are present."""

        test_cache = AssignmentCache(interpro_member_database_identifiers=[
            'TIGR03114', 'TIGR03117', 'TIGR03120'
        ])

        functional_element = [
            ('--', ''),
            ('SN', '1'),
            ('ID', 'Aferr subtype specific proteins'),
            ('RQ', '0'),
            ('EV', 'IPR017545; TIGR03114; sufficient;'),  # Yes
            ('EV', 'IPR017547; TIGR03117;'),  # Yes
            ('TG', 'GO:0043571;'),
            ('EV', 'IPR017552; TIGR03120;'),  # Yes
            ('TG', 'GO:0043573;')
        ]

        parsed_functional_element = parse_functional_elements(
            functional_element)[0]

        assignment = assign_functional_element(test_cache,
                                               parsed_functional_element)

        self.assertEqual(assignment, 'YES')
Пример #4
0
    def test_parse_missing_rows(self):
        """Test that functional elements can be parsed if they are missing non-essential rows."""
        functional_element = [('--', ''), ('SN', '2'),
                              ('ID', 'Apern subtype specific proteins')]

        parsed_functional_elements = parse_functional_elements(
            functional_element)

        second_functional_element = parsed_functional_elements[0]
        self.assertEqual(second_functional_element.required, False)
        self.assertEqual(second_functional_element.evidence, [])
Пример #5
0
    def test_parse_functional_element(self):
        """Test that functional element rows can be parsed."""
        functional_element = [('ID', 'Aferr subtype specific proteins'),
                              ('DN', 'Crispy Proteins'), ('RQ', '0'),
                              ('EV', 'IPR017545; TIGR03114; sufficient;'),
                              ('TG', 'GO:0043571; GO:0043579;')]

        parsed_functional_element = parse_functional_elements(
            functional_element)

        self.assertEqual(len(parsed_functional_element), 1)
        first_functional_element = parsed_functional_element[0]
        self.assertEqual(first_functional_element.id,
                         'Aferr subtype specific proteins')
        self.assertEqual(first_functional_element.name, 'Crispy Proteins')
        self.assertEqual(first_functional_element.required, False)
        self.assertEqual(len(first_functional_element.evidence), 1)