def test_reverse_complement(self): s = dna("GGGGaaaaaaaatttatatat") rc = s.reverse_complement() self.assertEqual(rc, dna("atatataaattttttttCCCC")) self.assertEqual( dna("ACGTRYSWKMBDHVN").reverse_complement(), dna("NBDHVKMWSRYACGT")) self.assertRaises(ValueError, protein("G").reverse_complement)
def test_reverse_complement(self): s = dna('GGGGaaaaaaaatttatatat') rc = s.reverse_complement() self.assertEqual(rc, dna('atatataaattttttttCCCC')) self.assertEqual( dna('ACGTRYSWKMBDHVN').reverse_complement(), dna('NBDHVKMWSRYACGT')) self.assertRaises(ValueError, protein('G').reverse_complement)
def test_shortcuts(self): protein('gGGGGG-PPPPP') dna('ACGTRYSWKMBDHVN') dna('t') dna('actgta') dna('acgtrysw-kmb-dhvn') rna('ACUUUUU')
def test_shortcuts(self): protein("gGGGGG-PPPPP") dna("ACGTRYSWKMBDHVN") dna("t") dna("actgta") dna("acgtrysw-kmb-dhvn") rna("ACUUUUU")
def test_bad_mask(): with pytest.raises(ValueError): dna('AAaaaaAAA').mask(mask='ABC')
def test_slice(self): s1 = dna('ACGTRYSWKMBDHVN') s2 = s1[4:6] assert s2 == dna('RY')
def test_casechange(self): s1 = dna('ACGTRYSWKMBDHVN') s2 = s1.lower().upper() self.assertEqual(s1, s2)
def test_mask(self): s = dna('AAaaaaAAA').mask() self.assertEqual(str(s), 'AAXXXXAAA')
def test_translate(self): s = dna('GCCATTGTAATGGGCCGCTGAAAGGGTGCCCGA') p = s.translate() self.assertEqual(str(p), 'AIVMGR*KGAR') p.back_translate()
def test_bad_mask(): with pytest.raises(ValueError): dna("AAaaaaAAA").mask(mask="ABC")
def test_slice(self): s1 = dna("ACGTRYSWKMBDHVN") s2 = s1[4:6] assert s2 == dna("RY")
def test_mask(self): s = dna("AAaaaaAAA").mask() self.assertEqual(str(s), "AAXXXXAAA")