Corrected get_bridges func
parent
e363f37ce0
commit
4cd628fa50
|
|
@ -1,13 +1,14 @@
|
|||
|
||||
class Turn:
|
||||
|
||||
def __init__(self, turn_type):
|
||||
def __init__(self, turn_type, res_num):
|
||||
self.turn_type = turn_type
|
||||
|
||||
class Bridge:
|
||||
|
||||
def __init__(self, bridge_type):
|
||||
def __init__(self, bridge_type, res_num):
|
||||
self.bridge_type = bridge_type
|
||||
self.res_num = res_num
|
||||
|
||||
class Helix:
|
||||
|
||||
|
|
@ -20,11 +21,13 @@ def get_turns(residues):
|
|||
for j in range(3,6):
|
||||
if(i+j<len(residues)):
|
||||
if(res.h_bond(residues[i+j]<-0.5)):
|
||||
turns.append(Turn(j))
|
||||
turns.append(Turn(j,i))
|
||||
return(turns)
|
||||
|
||||
def get_bridges(residues):
|
||||
bridges = []
|
||||
bridge = {}
|
||||
strongest_bridge = {}
|
||||
for i in range(1,len(residues)-4):
|
||||
E_min = 0
|
||||
for j in range(i+2,len(residues)-1):
|
||||
|
|
@ -32,28 +35,72 @@ def get_bridges(residues):
|
|||
|
||||
if(residues[i-1].h_bond(residues[j])<-0.5
|
||||
and residues[j].h_bond(residues[i+1])<-0.5):
|
||||
if(residues[i-1].h_bond(residues[j])+
|
||||
residues[j].h_bond(residues[i+1]))<E_min:
|
||||
E_min = residues[i-1].h_bond(residues[j])
|
||||
+residues[j].h_bond(residues[i+1])
|
||||
bridge = {'res1':residues[i-1].h_bond(residues[j]),
|
||||
'res2':residues[j].h_bond(residues[i+1]),
|
||||
'ipos':i,
|
||||
'jpos':j,
|
||||
'btype':"para"}
|
||||
# if(residues[i-1].h_bond(residues[j])+
|
||||
# residues[j].h_bond(residues[i+1]))<E_min:
|
||||
# E_min = residues[i-1].h_bond(residues[j])
|
||||
# +residues[j].h_bond(residues[i+1])
|
||||
# bridge_type = "para"
|
||||
|
||||
if(residues[j-1].h_bond(residues[i])<-0.5
|
||||
and residues[i].h_bond(residues[j+1])<-0.5):
|
||||
if(residues[j-1].h_bond(residues[i])+
|
||||
residues[i].h_bond(residues[j+1]))<E_min:
|
||||
E_min = residues[j-1].h_bond(residues[i])
|
||||
+residues[i].h_bond(residues[j+1])
|
||||
#bridges.append(Bridge("para"))
|
||||
|
||||
|
||||
if((residues[i].h_bond(residues[j])<-0.5
|
||||
and residues[j].h_bond(residues[i])<-0.5)
|
||||
or(residues[i-1].h_bond(residues[j+1])<-0.5
|
||||
and residues[j-1].h_bond(residues[i+1])<-0.5)):
|
||||
bridge = {'res1':residues[j-1].h_bond(residues[i]),
|
||||
'res2':residues[i].h_bond(residues[j+1]),
|
||||
'ipos':i,
|
||||
'jpos':j,
|
||||
'btype':"para"}
|
||||
# if(residues[j-1].h_bond(residues[i])+
|
||||
# residues[i].h_bond(residues[j+1]))<E_min:
|
||||
# E_min = residues[j-1].h_bond(residues[i])
|
||||
# +residues[i].h_bond(residues[j+1])
|
||||
# bridge_type = "para"
|
||||
|
||||
#bridges.append(Bridge("anti"))
|
||||
#bridges.append(strongest_bridge)
|
||||
return(bridges)
|
||||
if(residues[i].h_bond(residues[j])<-0.5
|
||||
and residues[j].h_bond(residues[i])<-0.5):
|
||||
bridge = {'res1':residues[i].h_bond(residues[j]),
|
||||
'res2':residues[j].h_bond(residues[i]),
|
||||
'ipos':i,
|
||||
'jpos':j,
|
||||
'btype':"anti"}
|
||||
# if(residues[i].h_bond(residues[j])+
|
||||
# residues[j].h_bond(residues[i]))<E_min:
|
||||
# E_min = residues[i].h_bond(residues[j])
|
||||
# +residues[j].h_bond(residues[i])
|
||||
# bridge_type = "anti"
|
||||
|
||||
if(residues[i-1].h_bond(residues[j+1])<-0.5
|
||||
and residues[j-1].h_bond(residues[i+1])<-0.5):
|
||||
bridge = {'res1':residues[i-1].h_bond(residues[j+1]),
|
||||
'res2':residues[j-1].h_bond(residues[i+1]),
|
||||
'ipos':i,
|
||||
'jpos':j,
|
||||
'btype':"anti"}
|
||||
# if(residues[i-1].h_bond(residues[j+1])+
|
||||
# residues[j-1].h_bond(residues[i+1]))<E_min:
|
||||
# E_min = residues[i-1].h_bond(residues[j+1])
|
||||
# +residues[j-1].h_bond(residues[i+1])
|
||||
# bridge_type = "anti"
|
||||
if(bridge):
|
||||
if(bridge['res1']+bridge['res2']<E_min):
|
||||
E_min = bridge['res1']+bridge['res2']
|
||||
strongest_bridge = bridge
|
||||
bridge = {}
|
||||
# finally add the strongest bridge at i and j pos
|
||||
if(strongest_bridge):
|
||||
bridges.append(Bridge(strongest_bridge['btype'],
|
||||
strongest_bridge['ipos']))
|
||||
bridges.append(Bridge(strongest_bridge['btype'],
|
||||
strongest_bridge['jpos']))
|
||||
if(len(bridges)>0):
|
||||
return(bridges)
|
||||
else:
|
||||
return(False)
|
||||
|
||||
def get_helix(turns):
|
||||
pass
|
||||
def get_helix(residues, turns):
|
||||
for i in range(residues):
|
||||
for j in range(i+1,i+5):
|
||||
if
|
||||
|
|
|
|||
Loading…
Reference in New Issue