本文整理匯總了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)