本文整理汇总了Python中RNA.free_pf_arrays方法的典型用法代码示例。如果您正苦于以下问题:Python RNA.free_pf_arrays方法的具体用法?Python RNA.free_pf_arrays怎么用?Python RNA.free_pf_arrays使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RNA
的用法示例。
在下文中一共展示了RNA.free_pf_arrays方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: local_search
# 需要导入模块: import RNA [as 别名]
# 或者: from RNA import free_pf_arrays [as 别名]
def local_search(start_seq_, target_structs_, seq_constraint_,
context_front=None, context_back=None):
global start_seq
global seq_constraint
global target_structs
rna.check_struct_seq_match(target_structs_[0], start_seq_)
rna.check_struct_seq_match(target_structs_[1], start_seq_)
start_seq = start_seq_
target_structs = target_structs_
seq_constraint = seq_constraint_
# # TODO: has to be checked
# preset_dangles = RNA.dangles
# if preset_dangles != 0:
# RNA.dangles = 1
if (SEARCH_STRATEGY == SearchStrategy.adaptive_walk or
SEARCH_STRATEGY == SearchStrategy.stochastic_local_search):
seq, cost, steps = local_search_sls_pf()
elif SEARCH_STRATEGY == SearchStrategy.full_local_search:
seq, cost, steps = local_search_fls_pf()
else:
raise ValueError("Specified search strategy not valid.")
eval_seq_container.reset()
vienna_rna.free_pf_arrays()
vienna_rna.free_arrays()
# RNA.dangles = preset_dangles
return seq, cost, steps
示例2: getBPPM
# 需要导入模块: import RNA [as 别名]
# 或者: from RNA import free_pf_arrays [as 别名]
def getBPPM(sequence, structure = "", bppm_cutoff = 0.00001):
"""
Requires ViennaRNAtools Python module
Returns the base pair probability matrix using Vienna pf_fold, get_pr and free_pf_arrays functions.
returns upper triangular matrix, whose entries exceed a threshold
"""
bppm = {}
#'--noPS', '-d 2', t, P
if structure != "":
RNA.cvar.fold_constrained = 1
else:
RNA.cvar.fold_constrained = 0
#print "Before", structure
RNA.pf_fold(sequence, structure)
#print "After", structure
seq_len = len(sequence)+1
for i in xrange(1, seq_len):
for j in xrange(1, seq_len):
if i<j:
bpp = RNA.get_pr(i,j)
if bpp > bppm_cutoff:
bppm[str(i) + "_" + str(j)] = bpp
else:
bppm[str(i) + "_" + str(j)] = 0
RNA.free_pf_arrays()
#print bppm
#exit(1)
return bppm