示例#1
0
def test_download():
    a = pydna.Genbank("*****@*****.**")
    v = os.environ["pydna_cache"]
    os.environ["pydna_cache"] = "nocache"
    gb = pydna.Genbank("*****@*****.**")
    result = gb.nucleotide("L09137")
    assert len(result) == 2686
    assert seguid(result.seq) == "71B4PwSgBZ3htFjJXwHPxtUIPYE"
    os.environ["pydna_cache"] = v
示例#2
0
def test_download():
    a = pydna.Genbank("*****@*****.**")
    v = os.environ["pydna_cache"]
    os.environ["pydna_cache"] = "nocache"
    gb = pydna.Genbank("*****@*****.**")
    result = gb.nucleotide("L09137")
    assert len(result) == 2686
    assert seguid(result.seq) == "71B4PwSgBZ3htFjJXwHPxtUIPYE"
    os.environ["pydna_cache"] = v
示例#3
0
    def test_copy_features(self):

        from pydna.utils import seguid
        from pydna import read,copy_features
        a=read("./pCAPs.gb")
        b=read("./pCAPs_fasta.txt")

        for sh in [1,2,3,3127,3128,3129]:
            newb = (b[sh:]+b[:sh]).looped()
            copy_features(a, newb)
            #print "a",[len(str(f.extract(a).seq.lower()) for f in a.features if len(f)>10]
            #print "b",[len(str(f.extract(newb).seq).lower()) for f in newb.features]

            self.assertTrue( sorted([str(f.extract(a).seq).lower() for f in a.features if len(f)>10],key=len)
                            == sorted([str(f.extract(newb).seq).lower() for f in newb.features],key=len))

        b=b.rc()

        for sh in [1,2,3,3127,3128,3129]:
            newb = b[sh:]+b[:sh]
            copy_features(a, newb)
            self.assertTrue( sorted([str(f.extract(a).seq).lower() for f in a.features if len(f)>10],key=len) == sorted([str(f.extract(newb).seq).lower() for f in newb.features],key=len))

        seguid_bla = "riT98j2v4NxVS8sbw_Q8epCwQwo"
        seguid_cre = "xLZ2xs2O8CUMmWh2OrhmNFp5ZLg"

        copy_features(a, b)
        assert [seguid(f.extract(b).seq) for f in b.features] == [seguid_cre, seguid_cre, seguid_bla, seguid_bla]

        b=read("./pCAPs_fasta.txt").looped()

        b=b.synced("attaacgagtgccgtaaacgacgatggttttacc")

        copy_features(a, b)
        assert [seguid(f.extract(b).seq) for f in b.features] == [seguid_cre,seguid_cre,seguid_bla,seguid_bla]

        b=read("./pCAPs_fasta.txt").looped()
        b=b.synced("ttaacgagtgccgtaaacgacgatggttttacc")

        copy_features(a, b)
        assert [seguid(f.extract(b).seq) for f in b.features] == [seguid_cre,seguid_cre,seguid_bla,seguid_bla]

        b=read("./pCAPs_fasta.txt").looped()
        b=b.synced("taacgagtgccgtaaacgacgatggttttacc")

        copy_features(a, b)
        assert [seguid(f.extract(b).seq) for f in b.features] == [seguid_bla,seguid_bla]

        b=read("./pCAPs_fasta.txt").looped()
        b=b.synced("gttaccaatgcttaatcagtgaggcacctatctcagc")

        copy_features(a, b)
        assert [seguid(f.extract(b).seq) for f in b.features] == [seguid_cre,seguid_cre,seguid_bla,seguid_bla]

        b=read("./pCAPs_fasta.txt").looped()
        b=b.synced("ttaccaatgcttaatcagtgaggcacctatctcagc")

        copy_features(a, b)
        assert [seguid(f.extract(b).seq) for f in b.features] == [seguid_cre,seguid_cre,seguid_bla,seguid_bla]

        b=read("./pCAPs_fasta.txt").looped()
        b=b.synced("taccaatgcttaatcagtgaggcacctatctcagc")

        copy_features(a, b)
        assert [seguid(f.extract(b).seq) for f in b.features] == [seguid_cre,seguid_cre,]
示例#4
0
    def test_copy_features(self):

        from pydna.utils import seguid
        from pydna import read, copy_features
        a = read("./pCAPs.gb")
        b = read("./pCAPs_fasta.txt")

        for sh in [1, 2, 3, 3127, 3128, 3129]:
            newb = (b[sh:] + b[:sh]).looped()
            copy_features(a, newb)
            #print "a",[len(str(f.extract(a).seq.lower()) for f in a.features if len(f)>10]
            #print "b",[len(str(f.extract(newb).seq).lower()) for f in newb.features]

            self.assertTrue(
                sorted([
                    str(f.extract(a).seq).lower()
                    for f in a.features if len(f) > 10
                ],
                       key=len) ==
                sorted(
                    [str(f.extract(newb).seq).lower() for f in newb.features],
                    key=len))

        b = b.rc()

        for sh in [1, 2, 3, 3127, 3128, 3129]:
            newb = b[sh:] + b[:sh]
            copy_features(a, newb)
            self.assertTrue(
                sorted([
                    str(f.extract(a).seq).lower()
                    for f in a.features if len(f) > 10
                ],
                       key=len) ==
                sorted(
                    [str(f.extract(newb).seq).lower() for f in newb.features],
                    key=len))

        seguid_bla = "riT98j2v4NxVS8sbw_Q8epCwQwo"
        seguid_cre = "xLZ2xs2O8CUMmWh2OrhmNFp5ZLg"

        copy_features(a, b)
        assert [seguid(f.extract(b).seq) for f in b.features
                ] == [seguid_cre, seguid_cre, seguid_bla, seguid_bla]

        b = read("./pCAPs_fasta.txt").looped()

        b = b.synced("attaacgagtgccgtaaacgacgatggttttacc")

        copy_features(a, b)
        assert [seguid(f.extract(b).seq) for f in b.features
                ] == [seguid_cre, seguid_cre, seguid_bla, seguid_bla]

        b = read("./pCAPs_fasta.txt").looped()
        b = b.synced("ttaacgagtgccgtaaacgacgatggttttacc")

        copy_features(a, b)
        assert [seguid(f.extract(b).seq) for f in b.features
                ] == [seguid_cre, seguid_cre, seguid_bla, seguid_bla]

        b = read("./pCAPs_fasta.txt").looped()
        b = b.synced("taacgagtgccgtaaacgacgatggttttacc")

        copy_features(a, b)
        assert [seguid(f.extract(b).seq)
                for f in b.features] == [seguid_bla, seguid_bla]

        b = read("./pCAPs_fasta.txt").looped()
        b = b.synced("gttaccaatgcttaatcagtgaggcacctatctcagc")

        copy_features(a, b)
        assert [seguid(f.extract(b).seq) for f in b.features
                ] == [seguid_cre, seguid_cre, seguid_bla, seguid_bla]

        b = read("./pCAPs_fasta.txt").looped()
        b = b.synced("ttaccaatgcttaatcagtgaggcacctatctcagc")

        copy_features(a, b)
        assert [seguid(f.extract(b).seq) for f in b.features
                ] == [seguid_cre, seguid_cre, seguid_bla, seguid_bla]

        b = read("./pCAPs_fasta.txt").looped()
        b = b.synced("taccaatgcttaatcagtgaggcacctatctcagc")

        copy_features(a, b)
        assert [seguid(f.extract(b).seq) for f in b.features] == [
            seguid_cre,
            seguid_cre,
        ]