本文整理汇总了Python中Bio.Crystal.Chain类的典型用法代码示例。如果您正苦于以下问题:Python Chain类的具体用法?Python Chain怎么用?Python Chain使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Chain类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testRemove
def testRemove(self):
chain = Chain(self.a[:])
elements = self.a.strip().split()
num_elements = len(elements)
num_a = chain.data.count(Hetero('a'))
chain.remove('a')
num_a_remaining = chain.data.count(Hetero('a'))
self.assertEqual(num_a_remaining, num_a - 1)
self.assertEqual(len(chain), num_elements - 1)
chain = Chain(self.b[:])
elements = self.b.strip().split()
num_elements = len(elements)
num_b = chain.data.count(Hetero('t'))
chain.remove('t')
num_b_remaining = chain.data.count(Hetero('t'))
self.assertEqual(num_b_remaining, num_b - 1)
self.assertEqual(len(chain), num_elements - 1)
chain = Chain(self.c[:])
elements = self.c.strip().split()
num_elements = len(elements)
num_leu = chain.data.count(Hetero('leu'))
chain.remove('leu')
num_leu_remaining = chain.data.count(Hetero('leu'))
self.assertEqual(num_leu_remaining, num_leu - 1)
self.assertEqual(len(chain), num_elements - 1)
示例2: testCount
def testCount(self):
chain = Chain(self.a[:])
num_a = chain.data.count(Hetero('a'))
self.assertEqual(chain.count('a'), num_a)
chain = Chain(self.b[:])
num_a = chain.data.count(Hetero('t'))
self.assertEqual(chain.count('t'), num_a)
chain = Chain(self.c[:])
num_a = chain.data.count(Hetero('leu'))
self.assertEqual(chain.count('leu'), num_a)
chain = Chain(self.c[:])
num_a = chain.data.count(Hetero('cys'))
self.assertEqual(chain.count('cys'), num_a)
示例3: testIndex
def testIndex(self):
chain = Chain(self.a[:])
index_g = chain.data.index(Hetero('g'))
self.assertEqual(chain.index('g'), index_g)
chain = Chain(self.b[:])
index_c = chain.data.index(Hetero('c'))
self.assertEqual(chain.index('c'), index_c)
chain = Chain(self.c[:])
index_met = chain.data.index(Hetero('met'))
self.assertEqual(chain.index('met'), index_met)
示例4: testAppend
def testAppend(self):
chain = Chain(self.a[:])
chain.append('U')
elements = self.a.strip().split()
num_elements = len(elements)
last_element = chain.data[ -1 ]
self.assertEqual('u', last_element.data)
self.assertEqual(len(chain), num_elements + 1)
chain = Chain(self.a[:])
chain.append(Hetero('A'))
elements = self.a.strip().split()
num_elements = len(elements)
last_element = chain.data[ -1 ]
self.assertEqual('a', last_element.data)
self.assertEqual(len(chain), num_elements + 1)
chain = Chain(self.b[:])
chain.append('t')
elements = self.b.strip().split()
num_elements = len(elements)
last_element = chain.data[ -1 ]
self.assertEqual('t', last_element.data)
self.assertEqual(len(chain), num_elements + 1)
chain = Chain(self.b[:])
chain.append(Hetero('C'))
elements = self.b.strip().split()
num_elements = len(elements)
last_element = chain.data[ -1 ]
self.assertEqual('c', last_element.data)
self.assertEqual(len(chain), num_elements + 1)
chain = Chain(self.c[:])
chain.append('ser')
elements = self.c.strip().split()
num_elements = len(elements)
last_element = chain.data[ -1 ]
self.assertEqual('ser', last_element.data)
self.assertEqual(len(chain), num_elements + 1)
示例5: testInsert
def testInsert(self):
chain = Chain(self.a[:])
i = 4
chain.insert(i, 'g')
elements = self.a.strip().split()
num_elements = len(elements)
target_element = chain.data[ i ]
self.assertEqual('g', target_element.data)
self.assertEqual(len(chain), num_elements + 1)
chain = Chain(self.a[:])
i = 0
chain.insert(i, 't')
elements = self.a.strip().split()
num_elements = len(elements)
target_element = chain.data[ i ]
self.assertEqual('t', target_element.data)
self.assertEqual(len(chain), num_elements + 1)
chain = Chain(self.b[:])
i = 9
chain.insert(i, Hetero('a'))
elements = self.a.strip().split()
num_elements = len(elements)
target_element = chain.data[ i ]
self.assertEqual('a', target_element.data)
self.assertEqual(len(chain), num_elements + 1)
chain = Chain(self.c[:])
i = 5
chain.insert(i, 'gln')
elements = self.c.strip().split()
num_elements = len(elements)
target_element = chain.data[ i ]
self.assertEqual('gln', target_element.data)
self.assertEqual(len(chain), num_elements + 1)