本文整理汇总了Python中cogent.seqsim.searchpath.SearchPath._get_nmer方法的典型用法代码示例。如果您正苦于以下问题:Python SearchPath._get_nmer方法的具体用法?Python SearchPath._get_nmer怎么用?Python SearchPath._get_nmer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cogent.seqsim.searchpath.SearchPath
的用法示例。
在下文中一共展示了SearchPath._get_nmer方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_nmer_len0
# 需要导入模块: from cogent.seqsim.searchpath import SearchPath [as 别名]
# 或者: from cogent.seqsim.searchpath.SearchPath import _get_nmer [as 别名]
def test_get_nmer_len0(self):
"""get_nmer should return an empty string if n is 0"""
#if n is zero, this should return "" even when stack is empty
test_path = SearchPath(SearchPathHelper.alphabets, \
SearchPathHelper.standard_forbid_seq)
real_result = test_path._get_nmer(0)
self.assertEquals(real_result, "")
示例2: test_get_nmer_len1
# 需要导入模块: from cogent.seqsim.searchpath import SearchPath [as 别名]
# 或者: from cogent.seqsim.searchpath.SearchPath import _get_nmer [as 别名]
def test_get_nmer_len1(self):
"""get_nmer should return correct result for nmer 1 on full stack"""
test_path = SearchPath(SearchPathHelper.alphabets, \
SearchPathHelper.standard_forbid_seq)
test_node = SearchNode(SearchNodeHelper.alphabet)
test_path._add_node(test_node)
correct_result = test_node.Value
real_result = test_path._get_nmer(1)
self.assertEquals(real_result, correct_result)
示例3: test_get_nmer_tooLong
# 需要导入模块: from cogent.seqsim.searchpath import SearchPath [as 别名]
# 或者: from cogent.seqsim.searchpath.SearchPath import _get_nmer [as 别名]
def test_get_nmer_tooLong(self):
"""get_nmer should return None for n > length of stack"""
test_path = SearchPath(SearchPathHelper.alphabets, \
SearchPathHelper.standard_forbid_seq)
test_node = SearchNode(SearchNodeHelper.alphabet)
test_path._add_node(test_node)
#stack is 1 long. Ask for a 2 mer
real_result = test_path._get_nmer(2)
self.assertEquals(real_result, None)
示例4: test_get_nmer
# 需要导入模块: from cogent.seqsim.searchpath import SearchPath [as 别名]
# 或者: from cogent.seqsim.searchpath.SearchPath import _get_nmer [as 别名]
def test_get_nmer(self):
"""get_nmer should return correct nmer for n <= length of stack"""
node_values = []
n = 4
test_path = SearchPath(SearchPathHelper.alphabets, \
SearchPathHelper.standard_forbid_seq)
for i in xrange(n+1):
curr_node = SearchNode(SearchNodeHelper.alphabet)
test_path._add_node(curr_node)
node_values.append(curr_node.Value)
#next
#get a nmer, and get the last n values that were put on stack;
#should be the same
real_result = test_path._get_nmer(n)
correct_result = "".join(node_values[-n:])
self.assertEquals(real_result, correct_result)