本文整理汇总了Python中cogent.core.profile.Profile.Data[1,1]方法的典型用法代码示例。如果您正苦于以下问题:Python Profile.Data[1,1]方法的具体用法?Python Profile.Data[1,1]怎么用?Python Profile.Data[1,1]使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cogent.core.profile.Profile
的用法示例。
在下文中一共展示了Profile.Data[1,1]方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_copy
# 需要导入模块: from cogent.core.profile import Profile [as 别名]
# 或者: from cogent.core.profile.Profile import Data[1,1] [as 别名]
def test_copy(self):
"""copy: should act as expected while rebinding/modifying attributes
"""
p = Profile(array([[1,1],[.7,.3]]),{'A':'A','G':'G','R':'AG'},"AG")
p_copy = p.copy()
assert p.Data is p_copy.Data
assert p.Alphabet is p_copy.Alphabet
assert p.CharOrder is p_copy.CharOrder
#modifying p.Data modifies p_copy.Data
p.Data[1,1] = 100
assert p.Alphabet is p_copy.Alphabet
#normalizing p.Data rebinds it, so p_copy.Data is unchanged
p.normalizePositions()
assert not p.Data is p_copy.Data
#Adding something to the alphabet changes both p and p_copy
p.Alphabet['Y']='TC'
assert p.Alphabet is p_copy.Alphabet
#Rebinding the CharOrder does only change the original
p.CharOrder='XX'
assert not p.CharOrder is p_copy.CharOrder
示例2: test_copy
# 需要导入模块: from cogent.core.profile import Profile [as 别名]
# 或者: from cogent.core.profile.Profile import Data[1,1] [as 别名]
def test_copy(self):
"""copy: should act as expected while rebinding/modifying attributes
"""
p = Profile(array([[1, 1], [0.7, 0.3]]), {"A": "A", "G": "G", "R": "AG"}, "AG")
p_copy = p.copy()
assert p.Data is p_copy.Data
assert p.Alphabet is p_copy.Alphabet
assert p.CharOrder is p_copy.CharOrder
# modifying p.Data modifies p_copy.Data
p.Data[1, 1] = 100
assert p.Alphabet is p_copy.Alphabet
# normalizing p.Data rebinds it, so p_copy.Data is unchanged
p.normalizePositions()
assert not p.Data is p_copy.Data
# Adding something to the alphabet changes both p and p_copy
p.Alphabet["Y"] = "TC"
assert p.Alphabet is p_copy.Alphabet
# Rebinding the CharOrder does only change the original
p.CharOrder = "XX"
assert not p.CharOrder is p_copy.CharOrder