當前位置: 首頁>>代碼示例>>Python>>正文


Python SearchPath._add_node方法代碼示例

本文整理匯總了Python中cogent.seqsim.searchpath.SearchPath._add_node方法的典型用法代碼示例。如果您正苦於以下問題:Python SearchPath._add_node方法的具體用法?Python SearchPath._add_node怎麽用?Python SearchPath._add_node使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在cogent.seqsim.searchpath.SearchPath的用法示例。


在下文中一共展示了SearchPath._add_node方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_add_node_first

# 需要導入模塊: from cogent.seqsim.searchpath import SearchPath [as 別名]
# 或者: from cogent.seqsim.searchpath.SearchPath import _add_node [as 別名]
 def test_add_node_first(self):
     """add_node should correctly add first node and increase top index."""
     
     test = SearchPath(SearchPathHelper.alphabets, \
             SearchPathHelper.standard_forbid_seq)
     test_node = SearchNode(SearchNodeHelper.alphabet)
     test._add_node(test_node)
     self.assertEquals(len(test._path_stack), 1)
     self.assertEquals(test._top_index, 0)
開發者ID:miklou,項目名稱:pycogent,代碼行數:11,代碼來源:test_searchpath.py

示例2: test_findAllowedOption_currentAllowed

# 需要導入模塊: from cogent.seqsim.searchpath import SearchPath [as 別名]
# 或者: from cogent.seqsim.searchpath.SearchPath import _add_node [as 別名]
 def test_findAllowedOption_currentAllowed(self):
     """Should return true when current option is allowed"""
     
     #searchpath with no forbidden seqs, so anything should work
     test = SearchPath(SearchPathHelper.alphabets)
     test._add_node(SearchNode(SearchNodeHelper.alphabet))
     allowed_found = test.findAllowedOption()
     
     self.assertEquals(allowed_found, True)
開發者ID:miklou,項目名稱:pycogent,代碼行數:11,代碼來源:test_searchpath.py

示例3: test_get_nmer_len1

# 需要導入模塊: from cogent.seqsim.searchpath import SearchPath [as 別名]
# 或者: from cogent.seqsim.searchpath.SearchPath import _add_node [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)
開發者ID:miklou,項目名稱:pycogent,代碼行數:12,代碼來源:test_searchpath.py

示例4: test_get_top

# 需要導入模塊: from cogent.seqsim.searchpath import SearchPath [as 別名]
# 或者: from cogent.seqsim.searchpath.SearchPath import _add_node [as 別名]
    def test_get_top(self):
        """Should return a reference to top node on stack if there is one"""

        test = SearchPath(SearchPathHelper.alphabets)
        test._add_node(SearchNode(SearchNodeHelper.alphabet))       
        topnode = SearchNode(SearchNodeHelper.alphabet)
        test._add_node(topnode)
        
        resultnode = test._get_top()
        self.assertEquals(resultnode, topnode)
開發者ID:miklou,項目名稱:pycogent,代碼行數:12,代碼來源:test_searchpath.py

示例5: test_get_nmer_tooLong

# 需要導入模塊: from cogent.seqsim.searchpath import SearchPath [as 別名]
# 或者: from cogent.seqsim.searchpath.SearchPath import _add_node [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)        
開發者ID:miklou,項目名稱:pycogent,代碼行數:13,代碼來源:test_searchpath.py

示例6: test_add_node_subsequent

# 需要導入模塊: from cogent.seqsim.searchpath import SearchPath [as 別名]
# 或者: from cogent.seqsim.searchpath.SearchPath import _add_node [as 別名]
 def test_add_node_subsequent(self):
     """add_node should correctly add additional nodes and up top index."""
     
     test = SearchPath(SearchPathHelper.alphabets, \
             SearchPathHelper.standard_forbid_seq)
     test_node = SearchNode(SearchNodeHelper.alphabet)
     test_node2 = SearchNode(SearchNodeHelper.alphabet)
     test._add_node(test_node)
     test._add_node(test_node2)
     self.assertEquals(len(test._path_stack), 2)
     self.assertEquals(test._top_index, 1)        
開發者ID:miklou,項目名稱:pycogent,代碼行數:13,代碼來源:test_searchpath.py

示例7: _fill_path

# 需要導入模塊: from cogent.seqsim.searchpath import SearchPath [as 別名]
# 或者: from cogent.seqsim.searchpath.SearchPath import _add_node [as 別名]
 def _fill_path(self, num_nodes, node_vals = []):
     """create a searchpath and add searchnodes; return path"""
     
     test = SearchPath(SearchPathHelper.alphabets, \
             SearchPathHelper.standard_forbid_seq)
     for i in xrange(num_nodes):
         curr_node = SearchNode(SearchNodeHelper.alphabet)
         node_vals.append(curr_node.Value)
         test._add_node(curr_node)
     #next i  
     
     return test
開發者ID:miklou,項目名稱:pycogent,代碼行數:14,代碼來源:test_searchpath.py

示例8: test_check_forbidden_seqs_none

# 需要導入模塊: from cogent.seqsim.searchpath import SearchPath [as 別名]
# 或者: from cogent.seqsim.searchpath.SearchPath import _add_node [as 別名]
    def test_check_forbidden_seqs_none(self):
        """Should return False if path includes no forbidden seqs"""
        
        #a seq that isn't in the standard fixed forbidden lib
        allowed_seq = ["C", "U", "A", "T"]        
        
        test = SearchPath(SearchPathHelper.alphabets, \
                SearchPathHelper.standard_forbid_seq)
        test._add_node(SearchNode(SearchNodeHelper.alphabet))

        #add more values, and cheat so as to make them something known
        for known_val in allowed_seq:
            curr_node = SearchNode(SearchNodeHelper.alphabet)
            curr_node._options[0] = known_val #torque the node's innards
            test._add_node(curr_node)
        #next bad_val
        
        real_result = test._check_forbidden_seqs()
        self.assertEquals(real_result, False)            
開發者ID:miklou,項目名稱:pycogent,代碼行數:21,代碼來源:test_searchpath.py

示例9: test_check_forbidden_seqs_fixed

# 需要導入模塊: from cogent.seqsim.searchpath import SearchPath [as 別名]
# 或者: from cogent.seqsim.searchpath.SearchPath import _add_node [as 別名]
 def test_check_forbidden_seqs_fixed(self):
     """Should return True if path includes a fixed forbidden seq"""
     
     forbidden_seq = ["G", "U", "A"]     
     user_input = ["".join(forbidden_seq)]
     user_input.extend(SearchPathHelper.standard_forbid_seq)
     
     test = SearchPath(SearchPathHelper.alphabets, user_input)
     test._add_node(SearchNode(SearchNodeHelper.alphabet))
     
     #add more values, and cheat so as to make them something forbidden
     for bad_val in forbidden_seq:
         curr_node = SearchNode(SearchNodeHelper.alphabet)
         curr_node._options[0] = bad_val #torque the node's innards
         test._add_node(curr_node)
     #next bad_val
     
     real_result = test._check_forbidden_seqs()
     self.assertEquals(real_result, True)            
開發者ID:miklou,項目名稱:pycogent,代碼行數:21,代碼來源:test_searchpath.py

示例10: test_get_nmer

# 需要導入模塊: from cogent.seqsim.searchpath import SearchPath [as 別名]
# 或者: from cogent.seqsim.searchpath.SearchPath import _add_node [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)
開發者ID:miklou,項目名稱:pycogent,代碼行數:22,代碼來源:test_searchpath.py


注:本文中的cogent.seqsim.searchpath.SearchPath._add_node方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。