def bootstrap_assignments(assignment_cache, genome_properties_tree): """ Recursively fills in assignments for all genome properties in the genome properties tree based of existing cached assignments and InterPro member database identifiers. :param assignment_cache: A cache containing step and property assignments and InterPro member database matches. :param genome_properties_tree: :return: """ # Bootstrap the other assignments from the leaf assignments. assign_genome_property(assignment_cache, genome_properties_tree.root) return assignment_cache
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')
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')
def test_genome_property_assignment_non_required_none_present(self): """Test assignment of genome properties when no markers are present and none are required.""" test_cache = AssignmentCache() test_property = self.tree.root assignment = assign_genome_property(test_cache, test_property) self.assertEqual(assignment, 'NO')
def test_genome_property_assignment_non_required_one_present(self): """Test assignment of a genome property when one marker is present but none are required.""" test_cache = AssignmentCache( interpro_member_database_identifiers=['TIGR03565']) test_property = self.tree.root assignment = assign_genome_property(test_cache, test_property) self.assertEqual(assignment, 'PARTIAL')