本文整理汇总了Python中cogent.seqsim.usage.Rates.isValid方法的典型用法代码示例。如果您正苦于以下问题:Python Rates.isValid方法的具体用法?Python Rates.isValid怎么用?Python Rates.isValid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cogent.seqsim.usage.Rates
的用法示例。
在下文中一共展示了Rates.isValid方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_isValid
# 需要导入模块: from cogent.seqsim.usage import Rates [as 别名]
# 或者: from cogent.seqsim.usage.Rates import isValid [as 别名]
def test_isValid(self):
"""Rates isValid should check row sums and neg off-diags"""
r = Rates([-2,1,1,0,-1,1,0,0,0], self.abc_pairs)
assert r.isValid()
r = Rates([0,0,0,0,0,0,0,0,0], self.abc_pairs)
assert r.isValid()
#not valid if negative off-diagonal
r = Rates([-2,-1,3,1,-1,0,2,2,-4], self.abc_pairs)
assert not r.isValid()
#not valid if rows don't all sum to 0
r = Rates([0,0.0001,0,0,0,0,0,0,0], self.abc_pairs)
assert not r.isValid()
示例2: test_fixNegsConstrainedOpt
# 需要导入模块: from cogent.seqsim.usage import Rates [as 别名]
# 或者: from cogent.seqsim.usage.Rates import isValid [as 别名]
def test_fixNegsConstrainedOpt(self):
"""Rates fixNegsConstrainedOpt should fix negatives w/ constrained opt"""
q = Rates(array([[-0.28936029, 0.14543346, -0.02648614, 0.17041297],
[ 0.00949624, -0.31186005, 0.17313171, 0.1292321 ],
[ 0.10443209, 0.16134479, -0.30480186, 0.03902498],
[ 0.01611264, 0.12999161, 0.15558259, -0.30168684]]), DnaPairs)
r = q.fixNegsFmin()
assert not q.isValid()
assert r.isValid()