This is a read-only mirror of pymolwiki.org

Difference between revisions of "Removealt"

From PyMOL Wiki
Jump to navigation Jump to search
(obj=all, comma)
 
Line 1: Line 1:
 +
{{Infobox script-repo
 +
|type      = script
 +
|filename  = removealt.py
 +
|author    = [[Users:Inchoate|Jason Vertrees]]
 +
|license  = Free
 +
}}
 +
 
= Overview =
 
= Overview =
 
[[removeAlt]] removes all atoms from '''obj''' that have alternate locations but aren't altloc '''keep'''.
 
[[removeAlt]] removes all atoms from '''obj''' that have alternate locations but aren't altloc '''keep'''.
  
= The Code =
+
=== Example 1 ===
<source lang="python">
+
{{Template:PymolScriptRepoDownload|examples/removealt_1.pml}}
def removeAlt(obj="(all)", keep="A"):
+
<include src="https://raw.github.com/Pymol-Scripts/Pymol-script-repo/master/examples/removealt_1.pml" highlight="python" />
        """
 
        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)
 
</source>
 
  
 
= See Also =
 
= See Also =
 
[[Property_Selectors#Alternate_Locations|Handling Alternate Locations]] and [[alter]]
 
[[Property_Selectors#Alternate_Locations|Handling Alternate Locations]] and [[alter]]
 
 
[[Category:Script_Library]]
 
[[Category:Script_Library]]
 
[[Category:ObjSel_Scripts]]
 
[[Category:ObjSel_Scripts]]

Revision as of 22:08, 13 December 2011

Type Python Script
Download removealt.py
Author(s) Jason Vertrees
License Free
This code has been put under version control in the project Pymol-script-repo

Overview

removeAlt removes all atoms from obj that have alternate locations but aren't altloc keep.

Example 1

Download: examples/removealt_1.pml
This code has been put under version control in the project Pymol-script-repo

<include src="https://raw.github.com/Pymol-Scripts/Pymol-script-repo/master/examples/removealt_1.pml" highlight="python" />

See Also

Handling Alternate Locations and alter