Ejemplo n.º 1
0
    def setUpClass(cls):
        """Set up testing data for testing."""
        """
               Test Properties Rooted DAG Structure:

                           --> GenProp0089
               GenProp0066
                           --> GenProp0092
        """

        property_rows_one = [('AC', 'GenProp0066'),
                             ('DE', 'Coenzyme F420 utilization'),
                             ('TP', 'GUILD'), ('--', ''), ('SN', '1'),
                             ('ID', 'Selfish genetic elements'), ('RQ', '0'),
                             ('EV', 'GenProp0089;')]

        property_rows_two = [('AC', 'GenProp0089'),
                             ('DE', 'Coenzyme F420 utilization'),
                             ('TP', 'GUILD'), ('--', ''), ('SN', '1'),
                             ('ID', 'LLM-family F420-associated subfamilies'),
                             ('RQ', '0'),
                             ('EV', 'IPR019910; TIGR03564; sufficient;')]

        property_one = parse_genome_property(property_rows_one)
        property_two = parse_genome_property(property_rows_two)

        cls.tree = GenomePropertiesTree(property_one, property_two)
Ejemplo n.º 2
0
    def setUpClass(cls):
        """Set up testing data for testing."""

        prebuilt_cache = AssignmentCache()

        prebuilt_cache.cache_property_assignment('GenProp0053', 'YES')
        prebuilt_cache.cache_property_assignment('GenProp0052', 'NO')
        prebuilt_cache.cache_property_assignment('GenProp0051', 'PARTIAL')

        prebuilt_cache.cache_step_assignment('GenProp0053', 1, 'YES')
        prebuilt_cache.cache_step_assignment('GenProp0053', 2, 'NO')
        prebuilt_cache.cache_step_assignment('GenProp0053', 3, 'YES')

        cls.cache = prebuilt_cache
        """
        Test Properties Rooted DAG Structure:

                    --> GenProp0089
        GenProp0066
                    --> GenProp0092
        """

        property_rows_one = [('AC', 'GenProp0066'),
                             ('DE', 'Coenzyme F420 utilization'),
                             ('TP', 'GUILD'), ('--', ''), ('SN', '1'),
                             ('ID', 'Selfish genetic elements'), ('RQ', '0'),
                             ('EV', 'GenProp0089;'), ('--', ''), ('SN', '2'),
                             ('ID', 'Selfish genetic elements'), ('RQ', '0'),
                             ('EV', 'GenProp0092;')]

        property_rows_two = [('AC', 'GenProp0089'),
                             ('DE', 'Coenzyme F420 utilization'),
                             ('TP', 'GUILD'), ('--', ''), ('SN', '1'),
                             ('ID', 'LLM-family F420-associated subfamilies'),
                             ('RQ', '0'),
                             ('EV', 'IPR019910; TIGR03564; sufficient;')]

        property_rows_three = [('AC', 'GenProp0092'),
                               ('DE', 'Coenzyme F420 utilization'),
                               ('TP', 'GUILD'), ('--', ''), ('SN', '1'),
                               ('ID',
                                'LLM-family F420-associated subfamilies'),
                               ('RQ', '0'),
                               ('EV', 'IPR019910; TIGR03565; sufficient;')]

        property_one = parse_genome_property(property_rows_one)
        property_two = parse_genome_property(property_rows_two)
        property_three = parse_genome_property(property_rows_three)

        raw_properties = [property_one, property_two, property_three]

        cls.tree = GenomePropertiesTree(*raw_properties)
Ejemplo n.º 3
0
    def test_genome_property_assignment_two_required_all_present(self):
        """Test assignment of genome properties when two markers are required and all are present."""

        test_cache = AssignmentCache(interpro_member_database_identifiers=[
            'TIGR03564', 'TIGR03567', 'TIGR03568'
        ])

        property_rows = [
            ('AC', 'GenProp0089'),
            ('DE', 'Coenzyme F420 utilization'),
            ('TP', 'GUILD'),
            ('--', ''),
            ('SN', '1'),
            ('ID', 'LLM-family F420-associated subfamilies'),
            ('RQ', '1'),
            ('EV', 'IPR019910; TIGR03564; sufficient;'),  # YES
            ('--', ''),
            ('SN', '2'),
            ('ID', 'LLM-family F420-associated subfamilies'),
            ('RQ', '1'),
            ('EV', 'IPR019910; TIGR03567; sufficient;'),  # YES
            ('--', ''),
            ('SN', '3'),
            ('ID', 'LLM-family F420-associated subfamilies'),
            ('RQ', '0'),
            ('EV', 'IPR019910; TIGR03568; sufficient;')  # YES
        ]

        test_property = parse_genome_property(property_rows)

        test_property.threshold = 0
        assignment = assign_genome_property(test_cache, test_property)

        self.assertEqual(assignment, 'YES')
Ejemplo n.º 4
0
    def test_genome_property_assignment_two_required_three_absent(self):
        """Test assignment of genome properties when two markers are required and none are present."""

        test_cache = AssignmentCache()

        property_rows = [
            ('AC', 'GenProp0089'),
            ('DE', 'Coenzyme F420 utilization'),
            ('TP', 'GUILD'),
            ('--', ''),
            ('SN', '1'),
            ('ID', 'LLM-family F420-associated subfamilies'),
            ('RQ', '1'),
            ('EV', 'IPR019910; TIGR03564; sufficient;'),  # NO
            ('--', ''),
            ('SN', '2'),
            ('ID', 'LLM-family F420-associated subfamilies'),
            ('RQ', '1'),
            ('EV', 'IPR019910; TIGR03567; sufficient;'),  # NO
            ('--', ''),
            ('SN', '3'),
            ('ID', 'LLM-family F420-associated subfamilies'),
            ('RQ', '0'),
            ('EV', 'IPR019910; TIGR03568; sufficient;')  # NO
        ]

        test_property = parse_genome_property(property_rows)

        test_property.threshold = 0
        assignment = assign_genome_property(test_cache, test_property)

        self.assertEqual(assignment, 'NO')
Ejemplo n.º 5
0
    def setUpClass(cls):
        """
        Test Properties

                    --> GenProp0089
        GenProp0066
                    --> GenProp0092
        """

        property_rows_one = [
            ('AC', 'GenProp0066'),
            ('DE', 'Coenzyme F420 utilization'),
            ('TP', 'GUILD'),
            ('--', ''),
            ('SN', '1'),
            ('ID', 'Selfish genetic elements'),
            ('RQ', '0'),
            ('EV', 'GenProp0089;'),
            ('--', ''),
            ('SN', '2'),
            ('ID', 'Selfish genetic elements'),
            ('RQ', '0'),
            ('EV', 'GenProp0092;'),
        ]

        property_rows_two = [('AC', 'GenProp0089'),
                             ('DE', 'Coenzyme F420 utilization'),
                             ('TP', 'GUILD'), ('--', ''), ('SN', '1'),
                             ('ID', 'LLM-family F420-associated subfamilies'),
                             ('RQ', '0'),
                             ('EV', 'IPR019910; TIGR03564; sufficient;')]

        property_rows_three = [('AC', 'GenProp0092'),
                               ('DE', 'Coenzyme F420 utilization'),
                               ('TP', 'GUILD'), ('--', ''), ('SN', '1'),
                               ('ID',
                                'LLM-family F420-associated subfamilies'),
                               ('RQ', '0'),
                               ('EV', 'IPR019910; TIGR03564; sufficient;')]

        property_one = parse_genome_property(property_rows_one)
        property_two = parse_genome_property(property_rows_two)
        property_three = parse_genome_property(property_rows_three)

        cls.properties = [property_one, property_two, property_three]
Ejemplo n.º 6
0
    def test_child_genome_property_identifiers(self):
        """Test that we can get child genome property identifiers."""

        new_property = parse_genome_property(self.property_rows[1])
        child_genome_property_identifiers = new_property.child_genome_property_identifiers

        self.assertEqual(
            child_genome_property_identifiers,
            ['GenProp0066', 'GenProp0067', 'GenProp0068', 'GenProp0069'])
Ejemplo n.º 7
0
    def test_required_steps(self):
        """Test that a genome property can return its required steps."""

        new_property = parse_genome_property(self.property_rows[1])

        required_steps = new_property.required_steps

        self.assertEquals(len(required_steps), 1)
        self.assertEquals(required_steps[0].name,
                          'Selfish genetic elements One')
Ejemplo n.º 8
0
    def test_json_creation(self):
        """Test that json can be created properly."""

        new_property = parse_genome_property(self.property_rows[0])

        json_dict = new_property.to_json(as_dict=True)

        self.assertEqual(json_dict['id'], 'GenProp0002')
        self.assertEqual(json_dict['name'], 'Coenzyme F420 utilization')
        self.assertEqual(json_dict['type'], 'GUILD')
        self.assertEqual(
            json_dict['description'],
            'Coenzyme F420 (a 7,8-didemethyl-8-hydroxy 5-deazaflavin)')
        self.assertEqual(json_dict['notes'], 'Yo_Dog_its_Yolo')
Ejemplo n.º 9
0
    def test_parse_genome_property(self):
        """Test that we can parse genome property rows."""

        new_property = parse_genome_property(self.property_rows[0])

        self.assertEqual(new_property.id, 'GenProp0002')
        self.assertEqual(new_property.name, 'Coenzyme F420 utilization')
        self.assertEqual(new_property.type, 'GUILD')
        self.assertEqual(new_property.threshold, 0)
        self.assertEqual(new_property.parents, [])
        self.assertEqual(
            new_property.description,
            'Coenzyme F420 (a 7,8-didemethyl-8-hydroxy 5-deazaflavin)')
        self.assertEqual(new_property.private_notes, 'Yo_Dog_its_Yolo')
        self.assertEqual(new_property.public, True)
        self.assertEqual(len(new_property.databases), 1)
        self.assertEqual(len(new_property.references), 1)
        self.assertEqual(len(new_property.steps), 3)
Ejemplo n.º 10
0
    def test_collapse_genome_property_record(self):
        """Test that we can clean up the overall genome property file."""
        property_rows = [
            ('AC', 'GenProp0002'),
            ('DE', 'Coenzyme F420 utilization'),
            ('TP', 'GUILD'),
            ('AU', 'Haft DH'),
            ('TH', '0'),
            ('RN', '[1]'),
            ('RM', '11726492'),
            ('RT',
             'Structures of F420H2:NADP+ oxidoreductase with and without its'),
            ('RT', 'janky structure!'),
            ('RT', 'I surprised that worked!'),
            ('RA',
             'Warkentin E, Mamat B, Sordel-Klippert M, Wicke M, Thauer RK, Iwata M,'
             ),
            ('RL', 'EMBO J. 2001;20:6561-6569.'),
            ('DC', 'Methane Biosynthesis'),
            ('DR', 'IUBMB; misc; methane;'),
            ('CC', 'Coenzyme F420 (a 7,8-didemethyl-8-hydroxy 5-deazaflavin)'),
            ('CC', 'is a very important enzyme!'),
            ('**', 'Yo_Dog_its_Yolo'),
            ('**', 'a new film by the cool dudes!'),
            ('--', ''),
            ('SN', '1'),
            ('ID', 'LLM-family F420-associated subfamilies'),
            ('RQ', '0'),
            ('EV', 'IPR019910; TIGR03564; sufficient;'),
            ('--', ''),
            ('SN', '2'),
            ('ID', 'Methylene-5,6,7,8-tetrahydromethanopterin dehydrogenase'),
            ('RQ', '0'),
            ('EV', 'IPR002844; PF01993; sufficient;'),
            ('--', ''),
            ('SN', '3'),
            ('ID', 'PPOX-class probable F420-dependent enzyme'),
            ('RQ', '0'),
            ('EV', 'IPR019920; TIGR03618; sufficient;'),
            ('--', ''),
            ('SN', '10'),
            ('ID', 'F420-dependent oxidoreductase families'),
            ('RQ', '1'),
            ('EV', 'IPR019944; TIGR03554; sufficient;'),
            ('EV', 'IPR019946; TIGR03555; sufficient;'),
            ('EV', 'IPR019945; TIGR03557; sufficient;'),
            ('EV', 'IPR019951; TIGR03559; sufficient;'),
            ('EV', 'IPR019952; TIGR03560; sufficient;'),
            ('EV', 'IPR031017; TIGR04465; sufficient;'),
        ]

        clean_genome_property_record = unwrap_genome_property_record(
            property_rows)

        first_genome_property = parse_genome_property(
            clean_genome_property_record)
        first_reference = first_genome_property.references[0]

        self.assertEqual(
            first_genome_property.description,
            'Coenzyme F420 (a 7,8-didemethyl-8-hydroxy 5-deazaflavin) '
            'is a very important enzyme!')
        self.assertEqual(first_genome_property.private_notes,
                         'Yo_Dog_its_Yolo a new film by the cool dudes!')
        self.assertEqual(
            first_reference.title,
            'Structures of F420H2:NADP+ oxidoreductase with and without its janky '
            'structure! I surprised that worked!')

        final_step = first_genome_property.steps[-1]
        functional_elements = final_step.functional_elements

        self.assertEqual(len(functional_elements), 1)
        self.assertEqual(len(functional_elements[0].evidence), 6)
        self.assertEqual(final_step.required, True)
        self.assertEqual(final_step.functional_elements[0].name,
                         'F420-dependent oxidoreductase families')
Ejemplo n.º 11
0
    def setUpClass(cls):
        """
        Test Properties Rooted DAG Structure:

        GenProp0002 -->             --> GenProp0089
                        GenProp0066
        GenProp0003 -->             --> GenProp0092

        Note 1: The structure of the property tree used above is not the common case.
        Commonly there should be only a single root node.
        """

        property_rows_one = [('AC', 'GenProp0002'),
                             ('DE', 'Coenzyme F420 utilization'),
                             ('TP', 'GUILD'), ('--', ''), ('SN', '1'),
                             ('ID', 'Selfish genetic elements'), ('RQ', '0'),
                             ('EV', 'GenProp0066;')]

        property_rows_two = [('AC', 'GenProp0003'),
                             ('DE', 'Coenzyme F420 utilization'),
                             ('TP', 'GUILD'), ('--', ''), ('SN', '1'),
                             ('ID', 'Selfish genetic elements'), ('RQ', '0'),
                             ('EV', 'GenProp0066;')]

        property_rows_three = [
            ('AC', 'GenProp0066'),
            ('DE', 'Coenzyme F420 utilization'),
            ('TP', 'GUILD'),
            ('--', ''),
            ('SN', '1'),
            ('ID', 'Selfish genetic elements'),
            ('RQ', '0'),
            ('EV', 'GenProp0089;'),
            ('--', ''),
            ('SN', '2'),
            ('ID', 'Selfish genetic elements'),
            ('RQ', '0'),
            ('EV', 'GenProp0092;'),
        ]

        property_rows_four = [('AC', 'GenProp0089'),
                              ('DE', 'Coenzyme F420 utilization'),
                              ('TP', 'GUILD'), ('--', ''), ('SN', '1'),
                              ('ID', 'LLM-family F420-associated subfamilies'),
                              ('RQ', '0'),
                              ('EV', 'IPR019910; TIGR03564; sufficient;')]

        property_rows_five = [('AC', 'GenProp0092'),
                              ('DE', 'Coenzyme F420 utilization'),
                              ('TP', 'GUILD'), ('--', ''), ('SN', '1'),
                              ('ID', 'LLM-family F420-associated subfamilies'),
                              ('RQ', '0'),
                              ('EV', 'IPR019910; TIGR03564; sufficient;')]

        property_one = parse_genome_property(property_rows_one)
        property_two = parse_genome_property(property_rows_two)
        property_three = parse_genome_property(property_rows_three)
        property_four = parse_genome_property(property_rows_four)
        property_five = parse_genome_property(property_rows_five)

        cls.raw_properties = [
            property_one, property_two, property_three, property_four,
            property_five
        ]