本文整理汇总了Python中Bio.Seq.MutableSeq.__radd__方法的典型用法代码示例。如果您正苦于以下问题:Python MutableSeq.__radd__方法的具体用法?Python MutableSeq.__radd__怎么用?Python MutableSeq.__radd__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bio.Seq.MutableSeq
的用法示例。
在下文中一共展示了MutableSeq.__radd__方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestMutableSeq
# 需要导入模块: from Bio.Seq import MutableSeq [as 别名]
# 或者: from Bio.Seq.MutableSeq import __radd__ [as 别名]
class TestMutableSeq(unittest.TestCase):
def setUp(self):
self.s = Seq.Seq("TCAAAAGGATGCATCATG", IUPAC.unambiguous_dna)
self.mutable_s = MutableSeq("TCAAAAGGATGCATCATG", IUPAC.ambiguous_dna)
def test_mutableseq_creation(self):
"""Test creating MutableSeqs in multiple ways"""
mutable_s = MutableSeq("TCAAAAGGATGCATCATG", IUPAC.ambiguous_dna)
self.assertIsInstance(mutable_s, MutableSeq, "Creating MutableSeq")
mutable_s = self.s.tomutable()
self.assertIsInstance(mutable_s, MutableSeq, "Converting Seq to mutable")
array_seq = MutableSeq(array.array(array_indicator, "TCAAAAGGATGCATCATG"),
IUPAC.ambiguous_dna)
self.assertIsInstance(array_seq, MutableSeq, "Creating MutableSeq using array")
def test_repr(self):
self.assertEqual("MutableSeq('TCAAAAGGATGCATCATG', IUPACAmbiguousDNA())",
repr(self.mutable_s))
def test_truncated_repr(self):
seq = "TCAAAAGGATGCATCATGTCAAAAGGATGCATCATGTCAAAAGGATGCATCATGTCAAAAGGA"
expected = "MutableSeq('TCAAAAGGATGCATCATGTCAAAAGGATGCATCATGTCAAAAGGATGCATCATG...GGA', IUPACAmbiguousDNA())"
self.assertEqual(expected, repr(MutableSeq(seq, IUPAC.ambiguous_dna)))
def test_equal_comparison(self):
"""Test __eq__ comparison method"""
self.assertEqual(self.mutable_s, "TCAAAAGGATGCATCATG")
def test_equal_comparison_of_incompatible_alphabets(self):
with warnings.catch_warnings(record=True):
self.mutable_s == MutableSeq('UCAAAAGGA', IUPAC.ambiguous_rna)
def test_not_equal_comparison(self):
"""Test __ne__ comparison method"""
self.assertNotEqual(self.mutable_s, "other thing")
def test_less_than_comparison(self):
"""Test __lt__ comparison method"""
self.assertTrue(self.mutable_s[:-1] < self.mutable_s)
def test_less_than_comparison_of_incompatible_alphabets(self):
with warnings.catch_warnings(record=True):
self.mutable_s[:-1] < MutableSeq("UCAAAAGGAUGCAUCAUG", IUPAC.ambiguous_rna)
def test_less_than_comparison_without_alphabet(self):
self.assertTrue(self.mutable_s[:-1] < "TCAAAAGGATGCATCATG")
def test_less_than_or_equal_comparison(self):
"""Test __le__ comparison method"""
self.assertTrue(self.mutable_s[:-1] <= self.mutable_s)
def test_less_than_or_equal_comparison_of_incompatible_alphabets(self):
with warnings.catch_warnings(record=True):
self.mutable_s[:-1] <= MutableSeq("UCAAAAGGAUGCAUCAUG", IUPAC.ambiguous_rna)
def test_less_than_or_equal_comparison_without_alphabet(self):
self.assertTrue(self.mutable_s[:-1] <= "TCAAAAGGATGCATCATG")
def test_add_method(self):
"""Test adding wrong type to MutableSeq"""
with self.assertRaises(TypeError):
self.mutable_s + 1234
def test_radd_method(self):
self.assertEqual("TCAAAAGGATGCATCATGTCAAAAGGATGCATCATG",
self.mutable_s.__radd__(self.mutable_s))
def test_radd_method_incompatible_alphabets(self):
with self.assertRaises(TypeError):
self.mutable_s.__radd__(MutableSeq("UCAAAAGGA", IUPAC.ambiguous_rna))
def test_radd_method_using_seq_object(self):
self.assertEqual("TCAAAAGGATGCATCATGTCAAAAGGATGCATCATG",
self.mutable_s.__radd__(self.s))
def test_radd_method_wrong_type(self):
with self.assertRaises(TypeError):
self.mutable_s.__radd__(1234)
def test_as_string(self):
self.assertEqual("TCAAAAGGATGCATCATG", str(self.mutable_s))
def test_length(self):
self.assertEqual(18, len(self.mutable_s))
def test_converting_to_immutable(self):
self.assertIsInstance(self.mutable_s.toseq(), Seq.Seq)
def test_first_nucleotide(self):
self.assertEqual('T', self.mutable_s[0])
def test_setting_slices(self):
self.assertEqual(MutableSeq('CAAA', IUPAC.ambiguous_dna),
self.mutable_s[1:5], "Slice mutable seq")
self.mutable_s[1:3] = "GAT"
self.assertEqual(MutableSeq("TGATAAAGGATGCATCATG", IUPAC.ambiguous_dna),
self.mutable_s,
#.........这里部分代码省略.........