Skip to content

Commit

Permalink
tests for expanded dsDNA repr to Dseq obj
Browse files Browse the repository at this point in the history
  • Loading branch information
BjornFJohansson committed Nov 12, 2024
1 parent 5686ffb commit eb12053
Showing 1 changed file with 60 additions and 11 deletions.
71 changes: 60 additions & 11 deletions tests/test_module_dseq.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,15 +116,15 @@ def test_initialization():

obj2 = Dseq("gata")

assert obj2.circular == False
assert obj2.circular is False

l = Dseq("gt")
c = l.looped()
ln = Dseq("gt")
c = ln.looped()

assert not l.circular
assert not ln.circular
assert c.circular

assert Dseq("gt", circular=False) == l
assert Dseq("gt", circular=False) == ln
assert Dseq("gt", circular=True) == c

assert Dseq.from_string("A") == Dseq("A")
Expand Down Expand Up @@ -154,6 +154,54 @@ def test_initialization():
)
assert obj3.ovhg == 1

dsobj = Dseq("GATCaaa", "GATCttt", -4)

dsdnas = """
GATCaaa
tttCTAG
GATCaaa||||
||||tttCTAG
GATCaaa----
----tttCTAG
GATCaaa----
|||||||||||
----tttCTAG
"""

for dsdna in dsdnas.split("\n\n"):
assert dsobj == Dseq.from_representation(dsdna)

dsobj = Dseq("aaaCTAG", "tttCTAG", 4)

dsdnas = """
aaaCTAG
GATCttt
||||aaaCTAG
GATCttt||||
----aaaCTAG
GATCttt----
----aaaCTAG
|||||||||||
GATCttt----
"""

for dsdna in dsdnas.split("\n\n"):
assert dsobj == Dseq.from_representation(dsdna)

with pytest.raises(ValueError):
Dseq.from_representation(
"""\
CCGAATTAAT
"""
)


def test_cut_around_and_religate():
from pydna.dseq import Dseq
Expand Down Expand Up @@ -218,7 +266,7 @@ def test_Dseq_cutting_adding():
ovhg=0,
)

f, d, l = c.cut((EcoRI, PstI))
f, d, l_ = c.cut((EcoRI, PstI))

assert d.watson == "GtcatctactatcatcgtagcgtactgatctattctgctgctcatcatcggtactctctataattatatatatatgcgcgtG"
assert d.crick == "AATTCacgcgcatatatatataattatagagagtaccgatgatgagcagcagaatagatcagtacgctacgatgatagtagatgaCTGCA"
Expand Down Expand Up @@ -554,11 +602,12 @@ def test_dseq():

def test_Dseq_slicing():
from pydna.dseq import Dseq
from pydna.readers import read
from pydna.utils import eq

from Bio.Seq import Seq
from Bio.SeqRecord import SeqRecord as Srec
# from pydna.readers import read
# from pydna.utils import eq

# from Bio.Seq import Seq
# from Bio.SeqRecord import SeqRecord as Srec
from Bio.Restriction import BamHI

a = Dseq("ggatcc", "ggatcc", 0)
Expand Down Expand Up @@ -947,7 +996,7 @@ def test_apply_cut():
def test_cutsite_is_valid():

from pydna.dseq import Dseq
from Bio.Restriction import EcoRI, BsaI, PacI, NmeDI, Acc65I, NotI, BamHI, EcoRV
from Bio.Restriction import EcoRI, PacI, NmeDI, EcoRV

# Works for circular case
seqs = ["GAATTC", "TTAATTAAC", "GATATC"]
Expand Down

0 comments on commit eb12053

Please sign in to comment.