Example #1
0
    def test_parse_multiple_evidences(self):
        """Test that literature reference rows consisting of multiple references can be parsed."""

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

        parsed_evidences = parse_evidences(evidences)
        first_evidence = parsed_evidences[0]
        second_evidence = parsed_evidences[1]
        third_evidence = parsed_evidences[2]

        self.assertEqual(len(parsed_evidences), 3)
        self.assertEqual(first_evidence.evidence_identifiers, ['IPR017545', 'TIGR03114'])
        self.assertEqual(first_evidence.gene_ontology_terms, [])
        self.assertEqual(second_evidence.evidence_identifiers, ['IPR017547', 'TIGR03117'])
        self.assertEqual(third_evidence.gene_ontology_terms, ['GO:0043573'])
Example #2
0
    def test_has_genome_property(self):
        """Test that we can determine that an evidence is a genome property."""

        evidences = [('--', ''), ('SN', '3'),
                     ('ID', 'Selfish genetic elements'), ('RQ', '0'),
                     ('EV', 'GenProp0066;')]

        evidence = parse_evidences(evidences)[0]
        self.assertEqual(evidence.has_genome_property, True)
Example #3
0
    def test_parse_evidence_insufficient(self):
        """Test that the evidence rows can be properly parsed if the evidence is insufficient."""
        evidence = [('--', ''), ('SN', '1'),
                    ('ID', 'Aferr subtype specific proteins'),
                    ('DN', 'Crispy Proteins'), ('RQ', '1'),
                    ('EV', 'IPR017545; TIGR03114;'), ('TG', 'GO:0043571;')]

        parsed_evidence = parse_evidences(evidence)
        first_evidence = parsed_evidence[0]
        self.assertEqual(first_evidence.sufficient, False)
Example #4
0
    def test_get_genome_property_identifiers(self):
        """Test that we can determine that an evidence is a genome property."""

        evidences = [('--', ''), ('SN', '3'),
                     ('ID', 'Selfish genetic elements'), ('RQ', '0'),
                     ('EV', 'GenProp0066; GenProp0067;')]

        evidence = parse_evidences(evidences)[0]
        self.assertEqual(evidence.genome_property_identifiers,
                         ['GenProp0066', 'GenProp0067'])
Example #5
0
    def test_parse_evidence_no_go_terms(self):
        """Test that the evidence rows can be properly parsed if the evidence has no go terms."""
        evidence = [
            ('--', ''),
            ('SN', '1'),
            ('ID', 'Aferr subtype specific proteins'),
            ('DN', 'Crispy Proteins'),
            ('RQ', '1'),
            ('EV', 'IPR017545; TIGR03114;'),
        ]

        parsed_evidence = parse_evidences(evidence)
        first_evidence = parsed_evidence[0]
        self.assertEqual(first_evidence.gene_ontology_terms, [])
Example #6
0
    def test_get_consortium_identifiers(self):
        """Test that we can get the consortium identifiers for an evidence."""

        evidence = [
            ('--', ''),
            ('SN', '1'),
            ('ID', 'Aferr subtype specific proteins'),
            ('DN', 'Crispy Proteins'),
            ('RQ', '0'),
            ('EV', 'IPR017545; TIGR03114; sufficient;'),
            ('TG', 'GO:0043571;')
        ]

        evidence = parse_evidences(evidence)[0]

        self.assertEqual(evidence.consortium_identifiers, ['TIGR03114'])
Example #7
0
    def test_assign_evidence_from_no_interpro_identifiers(self):
        """Test we can assign evidence when no InterPro identifiers are in the assignment cache."""

        test_cache = AssignmentCache()

        evidence = [('--', ''), ('SN', '1'),
                    ('ID', 'Aferr subtype specific proteins'),
                    ('DN', 'Crispy Proteins'), ('RQ', '0'),
                    ('EV', 'IPR017545; TIGR03114; sufficient;'),
                    ('TG', 'GO:0043571;')]

        evidence = parse_evidences(evidence)[0]

        assignment = assign_evidence(test_cache, evidence)

        self.assertEqual(assignment, 'NO')
Example #8
0
    def test_parse_evidence(self):
        """Test that evidence rows can be parsed."""
        evidence = [('--', ''), ('SN', '1'),
                    ('ID', 'Aferr subtype specific proteins'),
                    ('DN', 'Crispy Proteins'), ('RQ', '0'),
                    ('EV', 'IPR017545; TIGR03114; sufficient;'),
                    ('TG', 'GO:0043571;')]

        parsed_evidence = parse_evidences(evidence)

        self.assertEqual(len(parsed_evidence), 1)
        first_evidence = parsed_evidence[0]

        self.assertEqual(first_evidence.evidence_identifiers,
                         ['IPR017545', 'TIGR03114'])
        self.assertEqual(first_evidence.gene_ontology_terms, ['GO:0043571'])
        self.assertEqual(first_evidence.sufficient, True)
Example #9
0
    def test_assign_evidence_when_missing_interpro_identifiers(self):
        """Test assign evidence based on InterPro identifiers that are missing from the assignment cache."""

        test_cache = AssignmentCache(interpro_member_database_identifiers=[
            'TIGR03192', 'TIGR03193', 'TIGR03194'
        ])

        evidence = [('--', ''), ('SN', '1'),
                    ('ID', 'Aferr subtype specific proteins'),
                    ('DN', 'Crispy Proteins'), ('RQ', '0'),
                    ('EV', 'IPR017545; TIGR03114; sufficient;'),
                    ('TG', 'GO:0043571;')]

        evidence = parse_evidences(evidence)[0]

        assignment = assign_evidence(test_cache, evidence)

        self.assertEqual(assignment, 'NO')