File: mutate02.py

package info (click to toggle)
pymol 2.4.0%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 43,312 kB
  • sloc: cpp: 480,106; python: 79,860; ansic: 28,343; javascript: 6,792; sh: 47; makefile: 30; csh: 8
file content (49 lines) | stat: -rw-r--r-- 826 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# This example mutates every residue of a chain to alanine.

import string

# load a structure

cmd.load("$TUT/1hpv.pdb")

# activate the mutagensis wizard

cmd.wizard("mutagenesis")

# set target residue type

cmd.get_wizard().set_mode("ALA")

from pymol import stored
stored.list = []

# generate our list of residues (CA-atoms) to mutate

cmd.iterate("1hpv//A//CA",
"stored.list.append('/'.join([model,segi,chain,resi,name]))")

# now iterate through each residue

for sele in stored.list:
   
   # pick a residue

   cmd.edit(sele)

   # notify the wizard about the picked residue

   cmd.get_wizard().do_pick(0)

   # apply the mutation

   cmd.get_wizard().apply()

   # update the screen, showing the mutation

   cmd.indicate("byres "+sele)
   cmd.refresh()
   
# now close the wizard

cmd.set_wizard()
cmd.deselect()