本文整理汇总了Python中RNA.fold_compound方法的典型用法代码示例。如果您正苦于以下问题:Python RNA.fold_compound方法的具体用法?Python RNA.fold_compound怎么用?Python RNA.fold_compound使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RNA
的用法示例。
在下文中一共展示了RNA.fold_compound方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: import RNA [as 别名]
# 或者: from RNA import fold_compound [as 别名]
def main():
""" for sequence string, calculate mfe structure, mfe, pf, base pair probability matrix, plot structures and bppms, calculate accessibilities"""
print 'name mfe_low mfe_high pf_low pf_high RRS_acces_low RRS_acces_high AUG_acces_low AUG_acces_high'
for seq_file in SeqIO.parse(sys.stdin, 'fasta'):
sequ = str(seq_file.seq)
fc_low = RNA.fold_compound(sequ, MODEL_LOW_TEMPERATURE)
fc_high = RNA.fold_compound(sequ, MODEL_HIGH_TEMPERATURE)
struct_low, mfe_low = fc_low.mfe()
struct_high, mfe_high = fc_high.mfe()
pfstruct_low, pf_low = fc_low.pf()
pfstruct_high, pf_high = fc_high.pf()
bppm_low = fc_low.bpp()
bppm_high = fc_high.bpp()
plot_2bppms(bppm_low, bppm_high, seq_file.id)
RNA.PS_rna_plot(sequ, struct_low, '{:s}_low_ss.ps'.format(str2filename(seq_file.id)))
RNA.PS_rna_plot(sequ, struct_high, '{:s}_high_ss.ps'.format(str2filename(seq_file.id)))
constr1, constr2 = seqconstraints(sequ,RRS,START,SPACER)
RRS_acces_low = accessibility(sequ,MODEL_LOW_TEMPERATURE,constr1,pf_low)
RRS_acces_high = accessibility(sequ,MODEL_HIGH_TEMPERATURE,constr1,pf_high)
AUG_acces_low = accessibility(sequ,MODEL_LOW_TEMPERATURE,constr2,pf_low)
AUG_acces_high = accessibility(sequ,MODEL_HIGH_TEMPERATURE,constr2,pf_high)
print seq_file.id, mfe_low, mfe_high, pf_low, pf_high, RRS_acces_low, RRS_acces_high, AUG_acces_low, AUG_acces_high
print versions_used()
示例2: temperature_reactivity
# 需要导入模块: import RNA [as 别名]
# 或者: from RNA import fold_compound [as 别名]
def temperature_reactivity( sequence, structure, temperature1, temperature2 ):
"""Evaluate temperature-dependent difference in energy, entropy, enthalpy."""
temperature_model1 = RNA.md()
temperature_model2 = RNA.md()
temperature_model1.temperature = temperature1
temperature_model2.temperature = temperature2
fc1 = RNA.fold_compound(sequence, temperature_model1)
fc2 = RNA.fold_compound(sequence, temperature_model2)
energy_of_struct1 = fc1.eval_structure(structure)
energy_of_struct2 = fc2.eval_structure(structure)
# normalize delta_energy, add 0.001 to prevent division by 0
delta_energy = abs((energy_of_struct2 - energy_of_struct1) / (energy_of_struct2 + 0.001))
return (delta_energy, energy_of_struct1, energy_of_struct2)
示例3: test_eval_structure_pt
# 需要导入模块: import RNA [as 别名]
# 或者: from RNA import fold_compound [as 别名]
def test_eval_structure_pt(self):
print "test_eval_structure_pt\n"
fc=RNA.fold_compound(seq1)
energy= fc.eval_structure_pt(struct1_pt) /100; #/100 for dcal
self.assertEqual("%6.2f" % energy, "%6.2f" % -5.60)
print struct1, "[%6.2f" % energy,"]\n"
示例4: test_centroid
# 需要导入模块: import RNA [as 别名]
# 或者: from RNA import fold_compound [as 别名]
def test_centroid(self):
print "test_centroid\n"
fc=RNA.fold_compound(align)
fc.pf()
(sc,dist) = fc.centroid()
print sc,"\tDistance of : %6.2f" %dist ,"\n"
self.assertTrue(sc and dist)
示例5: __init__
# 需要导入模块: import RNA [as 别名]
# 或者: from RNA import fold_compound [as 别名]
def __init__(self, fullseq, vrna_md):
super(TrafoLandscape, self).__init__()
self._full_sequence = fullseq
self._model_details = vrna_md
self._fold_compound = RNA.fold_compound(fullseq, vrna_md)
# Adjust simulation parameters
self._RT = 0.61632077549999997
if vrna_md.temperature != 37.0:
kelvin = 273.15 + vrna_md.temperature
self._RT = (self._RT/310.15) * kelvin
# Private instance variables:
self._transcript_length = 0
self._total_time = 0
self._nodeid = 0
# Default parameters:
self._p_min = 0.01 # probability threshold
self._fpath = 20 # findpath_search_width
self._k0 = 2e5 # set directly
self._dG_max = 0 # set using t_slow
self._dG_min = 0 # set using t_fast
示例6: main
# 需要导入模块: import RNA [as 别名]
# 或者: from RNA import fold_compound [as 别名]
def main():
for monster in monsters:
# calculate 1) foldcompound 2) partition function 3) base pair probability matrix in that order (!)
foldmonster = RNA.fold_compound(str(monster))
pfstruct, pf = foldmonster.pf()
bppm = foldmonster.bpp()
plot_bppm(bppm, monster.id)
print versions_used()
示例7: test_E_int_loop
# 需要导入模块: import RNA [as 别名]
# 或者: from RNA import fold_compound [as 别名]
def test_E_int_loop(self):
print "test_E_int_loop"
# "123456789012"
seq1 = "AGACAAAAGACA"
struct1=".(.(....).)."
fc=RNA.fold_compound(seq1,None,RNA.OPTION_MFE)
e = fc.E_int_loop(2,11)
print seq1, " 2,7 = [ %6.2f" %e ,"] \n"
self.assertEqual("%6.2f" %e,"%6.2f" % +80)
示例8: test_pf
# 需要导入模块: import RNA [as 别名]
# 或者: from RNA import fold_compound [as 别名]
def test_pf(self):
print "test_pf"
fc= RNA.fold_compound(seq1)
(ss,gfe) = fc.pf()
print ss, "[ %6.2f" %gfe ,"]\n"
self.assertTrue(ss)
bp_dis = fc.mean_bp_distance()
print seq1 ,"\t meanBPDistance : ", bp_dis,"\n"
self.assertTrue(bp_dis)
示例9: accessibility
# 需要导入模块: import RNA [as 别名]
# 或者: from RNA import fold_compound [as 别名]
def accessibility ( sequence, md, constr, pf_noconstr ):
fc_constr = RNA.fold_compound(sequence, md)
fc_constr.constraints_add(constr, RNA.CONSTRAINT_DB_DEFAULT)
pf_constr_struct, pf_constr = fc_constr.pf()
if re.search('x', constr):
acces = exp((pf_noconstr - pf_constr)/(BOLTZMANN_K * (md.temperature + 273.15)))
else:
acces = 0
return acces
示例10: test_eval_hp_loop
# 需要导入模块: import RNA [as 别名]
# 或者: from RNA import fold_compound [as 别名]
def test_eval_hp_loop(self):
print "test_eval_hp_loop"
seq1 = "GCAAAAGG"
struct1= ".(....)."
fc=RNA.fold_compound(seq1)
#ehair = fc.eval_hp_loop(2,7)
ehair = fc.E_hp_loop(2,7)
print seq1, " 2,7 = [ %6.2f" %ehair ,"] \n"
self.assertEqual("%6.2f" %ehair,"%6.2f" % +410)
示例11: test_eval_covar_structure
# 需要导入模块: import RNA [as 别名]
# 或者: from RNA import fold_compound [as 别名]
def test_eval_covar_structure(self):
print "test_eval_covar_structure\n"
s1="CCCCAAAACGGG"
s2="CCCGAAAAGGGG"
s3="CCCCAAAAGGGG"
ali = [s1,s2,s3]
covarStructure = "((((....))))"
fc = RNA.fold_compound(ali)
pseudoEScore=fc.eval_covar_structure2(covarStructure)
print covarStructure, "[ %6.2f" %pseudoEScore ,"]\n"
self.assertTrue(pseudoEScore)
示例12: test_eval_structure_verbose
# 需要导入模块: import RNA [as 别名]
# 或者: from RNA import fold_compound [as 别名]
def test_eval_structure_verbose(self):
print "test_eval_structure_verbose"
fc = RNA.fold_compound(seq1)
filename= "test-RNA-mfe_eval.py.out"
try:
f = open(filename, "w")
print filename ," is opened for writing\n"
energy = fc.eval_structure_verbose(struct1,f)
energy2 = fc.eval_structure_verbose(struct1,None)
self.assertEqual("%6.2f" % energy, "%6.2f" % -5.60)
print struct1, "[%6.2f" % energy,"]\n"
except IOError:
print "Could not open ",filename
示例13: expand
# 需要导入模块: import RNA [as 别名]
# 或者: from RNA import fold_compound [as 别名]
def expand(self, extend=1, exp_mode='default', mfree=6, p_min=None, warning=False):
"""Find new secondary structures and add them to :obj:`TrafoLandscape()`
The function supports two move-sets: 1) The mfe structure for the current
sequence length is connected to all present structures, 2) The conformation
graph is expanded using helix-breathing.
Args:
extend (int, optional): number of nucleotide extensions before graph
expansion (updates the global variable transcript length). Defaults to 1.
exp_mode (str, optional): choose from "mfe-only": only use current mfe
structure as potential new neighbor. "breathing-only": only use breathing
neighborhood. "default": do both mfe and breathing.
mfree (int, optional): minimum number of freed bases during a
helix-opening step. Defaults to 6.
p_min (flt, optional): Minimum probability of a structure for neighbor
generation. Defaults to None: using global TrafoLandscape parameter.
warning (bool, optional): When using 'breathing-only' search mode,
print a warning if MFE structure is not part of the ensemble. Be
aware that calculating the MFE structure just for this warning is not
recommended for large systems!
Returns:
int: Number of new nodes
"""
if p_min is None:
p_min = self._p_min
fseq = self.full_sequence
self._transcript_length += extend
if self._transcript_length > len(fseq):
self._transcript_length = len(fseq)
seq = self.transcript
csid = self._nodeid
md = self._model_details
fc_full = self._fold_compound
if exp_mode not in ['default', 'mfe-only', 'breathing-only']:
raise TrafoUsageError('unknown expansion mode')
# Calculate MFE of current transcript
if exp_mode == 'default' or exp_mode == 'mfe-only' or len(self) == 0 or warning:
fc_tmp = RNA.fold_compound(seq, md)
ss, mfe = fc_tmp.mfe()
future = '.' * (len(fseq) - len(seq))
ss = ss + future
# If there is no node because we are in the beginning, add the node,
# otherwise, try to add transition edges from every node to MFE.
if len(self) == 0:
en = round(fc_full.eval_structure(ss), 2)
self.add_node(ss, energy=en, occupancy=1.0,
identity=self._nodeid, active=True, last_seen=0)
self._nodeid += 1
elif exp_mode == 'default' or exp_mode == 'mfe-only':
# Try to connect MFE to every existing state
fpathE = 9999
for ni in sorted(self.nodes(), key=lambda x: RNA.bp_distance(ss, x)):
if ni == ss:
continue
if self.node[ni]['active'] == False:
continue
if self.has_edge(ni, ss):
# in case it was there but inactive
self.node[ss]['active'] = True
self.node[ss]['last_seen'] = 0
assert self.get_saddle(ss, ni) is not None
fpathE = self.get_saddle(ss, ni) \
if self.get_saddle(ss, ni) < fpathE else fpathE
continue
if self.has_node(ss): # from a previous iteration
if self.add_transition_edge(ni, ss, fpathE=fpathE+1.00, call='mfe'):
# in case it was there but inactive
self.node[ss]['active'] = True
self.node[ss]['last_seen'] = 0
elif self.add_transition_edge(ni, ss, fpathE=fpathE+1.00, call='mfe'):
en = round(fc_full.eval_structure(ss), 2)
self.node[ss]['active'] = True
self.node[ss]['last_seen'] = 0
self.node[ss]['energy'] = en
self.node[ss]['occupancy'] = 0.0
self.node[ss]['identity'] = self._nodeid
self._nodeid += 1
if self.get_saddle(ss, ni) is not None:
fpathE = self.get_saddle(ss, ni) \
if self.get_saddle(ss, ni) < fpathE else fpathE
if exp_mode == 'default' or exp_mode == 'breathing-only':
# Do the helix breathing graph expansion
# Initialize a dictionary to store the feature expansion during each
# graph expansion round: ext_moves[ext_seq] = [set((con,paren),...),
# structure] where ext_seq = exterior-loop sequence with ((xxx))
#.........这里部分代码省略.........
示例14: test_eval_loop_pt
# 需要导入模块: import RNA [as 别名]
# 或者: from RNA import fold_compound [as 别名]
def test_eval_loop_pt(self):
print "test_eval_loop_pt"
fc= RNA.fold_compound(seq1)
energy= fc.eval_loop_pt(6,struct1_pt) /100; #/100 for dcal
print "[ %6.2f" %energy ,"]\n"
self.assertEqual("%6.2f" % energy,"%6.2f" % -3.3)
示例15: bla
# 需要导入模块: import RNA [as 别名]
# 或者: from RNA import fold_compound [as 别名]
import RNApath
RNApath.addSwigInterfacePath()
import RNA
import unittest
a = RNA.fold_compound("GGGGAAAACCCC")
b = { 'test': "something" }
c = { 'what' : "theheck" }
def bla(d, data=None):
if d == RNA.STATUS_MFE_PRE:
print "about to start MFE recursions\n"
if d == RNA.STATUS_MFE_POST:
print "finished MFE recursions\n"
print data
def blubb(i,j,k,l,d,data=None):
if d == RNA.DECOMP_PAIR_HP:
"""
Add -10 kcal/mol to any hairpin
"""
return -1000
return 0