def cut_and_religate_Dseq(seq_string, enz, top): ds = Dseq(seq_string, linear=top) frags = list(ds.cut(enz)) if not frags: return a = frags.pop(0) for f in frags: a += f if not top: a = a.looped() assert eq(a, ds)
def test_eq(): from pydna.dseqrecord import Dseqrecord from pydna.utils import eq from Bio.Seq import Seq from Bio.SeqRecord import SeqRecord assert eq( "AAA" ,"TTT", linear = True ) assert eq( "AAA" ,"TTT", linear = False) assert eq( "aAA" ,"TtT", linear = True ) assert eq( "AAa" ,"TtT", linear = False) assert eq( "ATA" ,"AAT", circular = True ) assert not eq( "ATA" ,"AAT", circular = False) assert eq( "AAA" ,"AAA", linear = True ) assert eq( "AAA" ,"AAA", linear = False) assert eq( "ATA" ,Seq("AAT"), circular = True ) assert not eq( "ATA" ,Seq("AAT"), circular = False) assert eq( "AAA" ,Seq("AAA"), linear = True ) assert eq( "AAA" ,Seq("AAA"), linear = False) assert eq( "ATA" ,SeqRecord("AAT"), circular = True ) assert not eq( "ATA" ,SeqRecord("AAT"), circular = False) assert eq( "AAA" ,SeqRecord("AAA"), linear = True ) assert eq( "AAA" ,SeqRecord("AAA"), linear = False) assert eq( "ATA" ,Dseqrecord("AAT"), circular = True ) assert not eq( "ATA" ,Dseqrecord("AAT"), circular = False) assert eq( "AAA" ,Dseqrecord("AAA"), linear = True ) assert eq( "AAA" ,Dseqrecord("AAA"), linear = False) assert eq( Seq("ATA") ,SeqRecord("AAT"), circular = True ) assert not eq( Seq("ATA") ,SeqRecord("AAT"), circular = False) assert eq( Seq("AAA") ,SeqRecord("AAA"), linear = True ) assert eq( Seq("AAA") ,SeqRecord("AAA"), linear = False) assert eq( Seq("ATA") ,Dseqrecord("AAT"), circular = True ) assert not eq( Seq("ATA") ,Dseqrecord("AAT"), circular = False) assert eq( Seq("AAA") ,Dseqrecord("AAA"), linear = True ) assert eq( Seq("AAA") ,Dseqrecord("AAA"), linear = False) assert eq( Dseqrecord("AAA",circular=False) ,Dseqrecord("AAA",circular=False)) assert eq( Dseqrecord("AAA",circular=True) ,Dseqrecord("AAA",circular=True)) assert not eq( Dseqrecord("ATA",circular=False) ,Dseqrecord("AAT",circular=False)) assert eq( Dseqrecord("ATA",circular=True) ,Dseqrecord("AAT",circular=True)) with pytest.raises(ValueError): eq(Dseqrecord("ATA",circular=True), Dseqrecord("ATA",circular=False)) assert not eq(Dseqrecord("ATA",circular=True), Dseqrecord("ATAA",circular=True)) assert eq(Dseqrecord("ATA"), Dseqrecord("ATA"), circular=True) assert not eq(Dseqrecord("ATA"), Dseqrecord("CCC"), circular=True) assert not eq(Dseqrecord("ATA"), Dseqrecord("ATA"), Dseqrecord("CCC"), circular=True)