コード例 #1
0
ファイル: test_cds_feature.py プロジェクト: stogqy/antismash
 def test_translation_outside_record(self):
     rec = DummyRecord(seq="A" * 10)
     for location in [
             FeatureLocation(0, AfterPosition(6), strand=1),
             FeatureLocation(BeforePosition(4), 10, strand=-1)
     ]:
         bio = SeqFeature(location, type="CDS")
         bio.qualifiers["translation"] = ["M" * 5]
         with self.assertRaisesRegex(SecmetInvalidInputError,
                                     "translation extends out of record"):
             CDSFeature.from_biopython(bio, record=rec)
コード例 #2
0
    def test_without_genefunctions(self):
        bio = self.convert()
        assert "gene_functions" not in bio.qualifiers
        assert "gene_kind" not in bio.qualifiers

        regen = CDSFeature.from_biopython(bio)
        assert not regen.gene_functions
コード例 #3
0
 def test_mixed_strand(self):
     bio = self.cds.to_biopython()[0]
     for location in [
             CompoundLocation([
                 FeatureLocation(1, 5, strand=-1),
                 FeatureLocation(8, 10, strand=1)
             ]),
             CompoundLocation([
                 FeatureLocation(1, 5, strand=1),
                 FeatureLocation(8, 10, strand=None)
             ])
     ]:
         bio.location = location
         with self.assertRaisesRegex(
                 ValueError, "compound locations with mixed strands"):
             CDSFeature.from_biopython(bio)
コード例 #4
0
    def test_without_secmet(self):
        assert not self.cds.sec_met
        bio = self.convert()
        assert "sec_met" not in bio.qualifiers  # for detecting legacy versions
        assert "sec_met_domain" not in bio.qualifiers

        regen = CDSFeature.from_biopython(bio)
        assert not regen.sec_met
コード例 #5
0
    def test_with_genefunctions(self):
        self.cds.gene_functions.add(GeneFunction.ADDITIONAL, "testtool",
                                    "dummy")
        bio = self.convert()
        assert "gene_functions" in bio.qualifiers
        assert bio.qualifiers["gene_kind"] == [str(
            self.cds.gene_function)] == ["biosynthetic-additional"]

        regen = CDSFeature.from_biopython(bio)
        assert regen.gene_function == self.cds.gene_function
        assert regen.gene_functions.get_by_tool(
            "testtool") == self.cds.gene_functions.get_by_tool("testtool")
コード例 #6
0
    def test_basics(self):
        bio = self.convert()
        assert bio.location == self.cds.location
        assert bio.qualifiers["locus_tag"] == ["loctag"]
        assert bio.qualifiers["gene"] == ["gene"]
        assert bio.qualifiers["protein_id"] == ["prot_id"]
        assert bio.qualifiers["translation"] == ["A" * 4]

        regen = CDSFeature.from_biopython(bio)
        assert regen.location == self.cds.location
        assert regen.locus_tag == self.cds.locus_tag
        assert regen.gene == self.cds.gene
        assert regen.protein_id == self.cds.protein_id
コード例 #7
0
    def test_with_secmet(self):
        domains = [
            SecMetQualifier.Domain("testA", 0.1, 1.1, 3, "test"),
            SecMetQualifier.Domain("testB", 5.1, 3.9, 5, "dummy")
        ]
        self.cds.sec_met = SecMetQualifier(domains)
        bio = self.convert()
        assert "sec_met" not in bio.qualifiers  # again, detecting leftover legacy versions
        assert len(bio.qualifiers["sec_met_domain"]) == 2
        assert bio.qualifiers["sec_met_domain"] == list(map(str, domains))

        regen = CDSFeature.from_biopython(bio)
        assert regen.sec_met
        assert len(regen.sec_met.domains) == len(domains)
        assert regen.sec_met.domains == domains
コード例 #8
0
ファイル: test_cds_feature.py プロジェクト: stogqy/antismash
 def test_invalid_translation_table(self):
     bio = self.cds.to_biopython()[0]
     bio.qualifiers["transl_table"] = ["11a"]
     with self.assertRaisesRegex(SecmetInvalidInputError,
                                 "invalid translation table"):
         CDSFeature.from_biopython(bio)