<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.pymol.org/index.php?action=history&amp;feed=atom&amp;title=PDB_Web_Services_Script</id>
	<title>PDB Web Services Script - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.pymol.org/index.php?action=history&amp;feed=atom&amp;title=PDB_Web_Services_Script"/>
	<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=PDB_Web_Services_Script&amp;action=history"/>
	<updated>2026-07-17T23:34:56Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.1</generator>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=PDB_Web_Services_Script&amp;diff=7147&amp;oldid=prev</id>
		<title>Pyadmin: 6 revisions</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=PDB_Web_Services_Script&amp;diff=7147&amp;oldid=prev"/>
		<updated>2014-03-28T02:00:28Z</updated>

		<summary type="html">&lt;p&gt;6 revisions&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left diff-editfont-monospace&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 02:00, 28 March 2014&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Pyadmin</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=PDB_Web_Services_Script&amp;diff=7146&amp;oldid=prev</id>
		<title>Newacct: /* The Code */</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=PDB_Web_Services_Script&amp;diff=7146&amp;oldid=prev"/>
		<updated>2010-01-26T10:22:50Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;The Code&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left diff-editfont-monospace&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 10:22, 26 January 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l34&quot; &gt;Line 34:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 34:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# fetch the secondary structure assignment from the PDB &amp;amp;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# fetch the secondary structure assignment from the PDB &amp;amp;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# split it up into an array of characters&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# split it up into an array of characters&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;stored.ss = &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;[ x for x in &lt;/del&gt;server.getKabschSander(&amp;quot;1foo&amp;quot;, &amp;quot;A&amp;quot;) &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;]&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;stored.ss = &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;list( &lt;/ins&gt;server.getKabschSander(&amp;quot;1foo&amp;quot;, &amp;quot;A&amp;quot;) &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;)&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# get the sequence&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# get the sequence&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Newacct</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=PDB_Web_Services_Script&amp;diff=7145&amp;oldid=prev</id>
		<title>Newacct at 10:22, 26 January 2010</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=PDB_Web_Services_Script&amp;diff=7145&amp;oldid=prev"/>
		<updated>2010-01-26T10:22:29Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Overview ==&lt;br /&gt;
A short snippet of code utilizing the new PDB Web Services.&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
# See [http://www.rcsb.org/robohelp/webservices/summary.htm PDB Web Services]&lt;br /&gt;
# You need [http://pywebsvcs.sourceforge.net/ SOAP for Python] installed&lt;br /&gt;
# The sequence of a chain fetched from the PDB does not always equal the sequence of a chain fetched from the PDB Web Services.  I believe the PDB Web Services has the complete biological chain, not just what's in the structure.&lt;br /&gt;
# The offset is a hack; it uses a trick in PyMOL and may not be robust at all.  Use at your own caution.&lt;br /&gt;
&lt;br /&gt;
== The Code ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import pymol&lt;br /&gt;
from pymol import stored, cmd&lt;br /&gt;
import SOAPpy&lt;br /&gt;
&lt;br /&gt;
# define a mapping from three letters to one&lt;br /&gt;
# Thanks to whomever posted this on the PyMOLWiki:&lt;br /&gt;
#   http://www.pymolwiki.org/index.php/Label&lt;br /&gt;
one_letter ={'VAL':'V', 'ILE':'I', 'LEU':'L', 'GLU':'E', 'GLN':'Q', \&lt;br /&gt;
'ASP':'D', 'ASN':'N', 'HIS':'H', 'TRP':'W', 'PHE':'F', 'TYR':'Y',    \&lt;br /&gt;
'ARG':'R', 'LYS':'K', 'SER':'S', 'THR':'T', 'MET':'M', 'ALA':'A',    \&lt;br /&gt;
'GLY':'G', 'PRO':'P', 'CYS':'C'}&lt;br /&gt;
&lt;br /&gt;
# fetch some molecule; yes, 1foo exists in the PDB&lt;br /&gt;
cmd.fetch(&amp;quot;1foo&amp;quot;, async=0)&lt;br /&gt;
# get the sequence from PyMOL&lt;br /&gt;
stored.pyMOLSeq = []&lt;br /&gt;
cmd.iterate( &amp;quot;1foo and c. A and n. CA&amp;quot; , &amp;quot;stored.pyMOLSeq.append( one_letter[resn] )&amp;quot; )&lt;br /&gt;
&lt;br /&gt;
# open up the PDB web services and make a connection&lt;br /&gt;
stored.pyMOLSeq = ''.join( stored.pyMOLSeq )&lt;br /&gt;
server = SOAPpy.SOAPProxy(&amp;quot;http://www.pdb.org/pdb/services/pdbws&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
# fetch the secondary structure assignment from the PDB &amp;amp;&lt;br /&gt;
# split it up into an array of characters&lt;br /&gt;
stored.ss = [ x for x in server.getKabschSander(&amp;quot;1foo&amp;quot;, &amp;quot;A&amp;quot;) ]&lt;br /&gt;
&lt;br /&gt;
# get the sequence&lt;br /&gt;
pdbSeq = server.getSequenceForStructureAndChain(&amp;quot;1foo&amp;quot;, &amp;quot;A&amp;quot;)&lt;br /&gt;
# danger: hackishly foolish, but worked for 1foo.&lt;br /&gt;
offset = pdbSeq.find( stored.pyMOLSeq )&lt;br /&gt;
&lt;br /&gt;
# make the assignment in PyMOL&lt;br /&gt;
cmd.alter( &amp;quot;1foo and c. A and n. CA and i. &amp;quot; + str(offset) + &amp;quot;-&amp;quot;, &amp;quot;ss=stored.ss.pop(0)&amp;quot; )&lt;br /&gt;
&lt;br /&gt;
# show as cartoons&lt;br /&gt;
cmd.as(&amp;quot;cartoon&amp;quot;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Script_Library]]&lt;br /&gt;
[[Category:UI_Scripts]]&lt;/div&gt;</summary>
		<author><name>Newacct</name></author>
	</entry>
</feed>