forked from Pymol-Scripts/Pymol-script-repo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathremovealt.py
More file actions
24 lines (18 loc) · 691 Bytes
/
removealt.py
File metadata and controls
24 lines (18 loc) · 691 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from pymol import cmd
def removealt(obj="(all)", keep="A"):
"""
removeAlt -- remove all alternate location-atoms not of altloc "keep" from object.
input:
obj -- the object(s) to remove the atoms frmo
keep -- which type of alt loc to keep
output: none -- removes atoms
examples:
removeAlt # remove all altLocations that aren't altloc A
removeAlt pdbID, C # remove all but C altlocations from pdbID
"""
# select & remove all non A altlocs
remStr = "%s and not (alt ''+%s)" % (obj, keep)
cmd.remove(remStr)
# reset the PDB information
cmd.alter(obj, "alt=''")
cmd.extend("removealt", removealt)