20 from rosetta
import Pose
21 from rosetta
import make_pose_from_sequence
22 from rosetta
import create_score_function
23 from rosetta
import TaskFactory
24 from rosetta.utility
import vector1_bool
25 from rosetta
import aa_from_oneletter_code
26 from rosetta
import PackRotamersMover
27 from rosetta.core.pose
import PDBInfo
34 pack_radius = 0.0 , pack_scorefxn =
'' ):
36 Replaces the residue at <mutant_position> in <pose> with <mutant_aa>
37 and repack any residues within <pack_radius> Angstroms of the mutating
38 residue's center (nbr_atom) using <pack_scorefxn>
39 note: <mutant_aa> is the single letter name for the desired ResidueType
42 mutate_residue(pose,30,A)
54 if pose.is_fullatom() ==
False:
55 IOError(
'mutate_residue only works with fullatom poses' )
58 test_pose.assign( pose )
62 pack_scorefxn = create_score_function(
'standard' )
69 aa_bool = rosetta.utility.vector1_bool()
75 mutant_aa = aa_from_oneletter_code( mutant_aa )
81 for i
in range( 1 , 21 ):
85 aa_bool.append( i == mutant_aa )
89 task.nonconst_residue_task( mutant_position
90 ).restrict_absent_canonical_aas( aa_bool )
94 center = pose.residue( mutant_position ).nbr_atom_xyz()
95 for i
in range( 1 , pose.total_residue() + 1 ):
97 if not i == mutant_position
or center.distance_squared(
98 test_pose.residue( i ).nbr_atom_xyz() ) > pack_radius**2:
99 task.nonconst_residue_task( i ).prevent_repacking()
102 packer = PackRotamersMover( pack_scorefxn , task )
103 packer.apply( test_pose )
110 Returns a pose generated from amino acid single letters in <seq> using
111 the <res_type> ResidueType, the new pose's PDBInfo is named <name>
112 and all residues have chain ID <chain_id>
115 pose=pose_from_sequence('LIGAND')
118 make_pose_from_sequence
123 make_pose_from_sequence(pose,seq,res_type)
125 pdb_info =
PDBInfo(pose.total_residue())
126 for i
in range(0,pose.total_residue()):
127 if pose.residue(i+1).is_protein():
129 pose.set_phi(i+1,-150)
130 pose.set_psi(i+1,150)
131 pose.set_omega(i+1,180)
139 pose.pdb_info(pdb_info)
143 pose.pdb_info().
name(name)
148 protein_letters =
'ACDEFGHIKLMNPQRSTVWY'
149 nucleic_letters = [
'A[ADE]',
'G[GUA]',
'C[CYT]',
'T[THY]']
153 return ''.
join( [letters[random.randint(0,
len(letters)-1)]
for i
in range( length ) ] )
159 seq1 = pose1.sequence()
160 seq2 = pose2.sequence()
161 for i
in range(pose1.total_residue()):
162 if not seq1[i]==seq2[i]:
163 print 'mutation '+seq1[i]+str(i+1)+seq2[i]
167 for i
in range(
len(seq1)):
168 if not seq1[i]==seq2[i]:
169 print 'discrepency at '+seq1[i]+str(i+1)+seq2[i]
175 hblist1 = hbond_list(pose1)
177 hblist2 = hbond_list(pose2)
182 for i
in range(
len(hblist1)):
183 for j
in range(
len(hblist2)):
184 if hblist1[i][1]==hblist2[j][1]
and hblist1[i][2]==hblist2[j][2]:
186 if abs((hblist2[j][3]-hblist1[i][3])/hblist1[i][3])>Ethresh:
188 delEn.append(hblist1[i])
189 delEn[
len(delEn)-1].append(hblist2[j][3])
190 delEn[
len(delEn)-1].append(hblist2[j][3]>hblist1[i][3])
192 delEn[
len(delEn)-1].append(hbset1.hbond(i))
198 for i
in range(hblist1.count((0,0,0))):
199 hblist1.remove((0,0,0))
200 for j
in range(hblist2.count((0,0,0))):
201 hblist2.remove((0,0,0))
204 names = [pose1.pdb_info().
name(),pose2.pdb_info().
name()]
208 print 'hbonds not in',names[0]
209 for j
in range(
len(hblist2)):
211 print hblist2[j][1],
'\t',hblist2[j][2]
215 hbond = hbset2.hbond(hblist2[j][0])
216 donor = pose2.residue(hbond.don_res()).
xyz(hbond.don_hatm())
217 acptr = pose2.residue(hbond.acc_res()).
xyz(hbond.acc_atm())
218 pymol.send_point(names[0]+
'_gains'+str(j),
'green',donor[0],donor[1],donor[2],
False,
False,
'')
219 pymol.send_point(names[0]+
'_gains'+str(j),
'green',acptr[0],acptr[1],acptr[2],
False,
False,
'')
222 print 'hbonds not in',names[1]
223 for i
in range(
len(hblist1)):
225 print hblist1[i][1],
'\t',hblist1[i][2]
228 hbond = hbset1.hbond(hblist1[i][0])
229 donor = pose1.residue(hbond.don_res()).
xyz(hbond.don_hatm())
230 acptr = pose1.residue(hbond.acc_res()).
xyz(hbond.acc_atm())
231 pymol.send_point(names[0]+
'_loses'+str(i),
'red',donor[0],donor[1],donor[2],
False,
False,
'')
232 pymol.send_point(names[0]+
'_loses'+str(i),
'red',acptr[0],acptr[1],acptr[2],
False,
False,
'')
235 print 'Energy change from',names[0],
'to',names[1]
236 for k
in range(
len(delEn)):
244 print sign,
'in',str(delEn[k][1]).
ljust(20),str(delEn[k][2]).
ljust(20),
'from %.4f to %.4f'%(delEn[k][3],delEn[k][4])
248 donor = pose1.residue(hbond.don_res()).
xyz(hbond.don_hatm())
249 acptr = pose1.residue(hbond.acc_res()).
xyz(hbond.acc_atm())
250 pymol.send_point(names[0]+group+str(k),color,donor[0],donor[1],donor[2],
False,
False,
'')
251 pymol.send_point(names[0]+group+str(k),color,acptr[0],acptr[1],acptr[2],
False,
False,
'')
xyzVector< Real > xyz(Real const &r1, Real const &omega1, Real const &t, Real const &dz1, Real const &delta_omega1, Real const &delta_z1)
Returns the x-, y-, and z-coordinates of a point on a helix given r1, omega1, and t...
Fstring::size_type len(Fstring const &s)
Length.
T abs(T const &x)
std::abs( x ) == | x |
Fstring ljust(Fstring const &s)
Left-Justified Copy.
rule< Scanner, string_closure::context_t > name