Hi,

 

I would like to get secondary structure information from a PyMol file. I know that the following command gives a long list of every residue:

 

>> iterate <object name> & n. ca, print resn,resi,ss
 

 

I found the following script, that gives you a more “condensed” list (see below):

 

 

>> PyMOL>@../..\ss.pml

>> PyMOL>class SSList:\

>> PyMOL>list = []\

>> PyMOL>def purge( self, resi, ss ):\

>> PyMOL>if not self.list or self.list[-1][0] != ss:\

>> PyMOL>self.list.append( [ss, resi, resi ] )\

>> PyMOL>else:\

>> PyMOL>self.list[-1][2] = resi\

>> PyMOL>def __repr__( self ):\

>> PyMOL>return "\n".join( map( self.repr_item, self.list ) )\

>> PyMOL>def repr_item( self, item ):\

>> PyMOL>return item[0]+" ("+item[1]+"-"+item[2]+")"

>> PyMOL>sslist = SSList()

>> PyMOL>cmd.iterate( "n. ca", "sslist.purge( resi, ss )" )

>> PyMOL>print sslist

>> L (2-3)

>> H (4-14)

>> L (15-23)

>> H (24-44)

>> L (45-50)

>> H (51-72)

>> L (73-73)

>> H (74-84)

>> L (85-86)

 

I have two problems: the command  >> PyMOL>@../..\ss.pml << gives the following answer in PyMol: “No such file or directory”

When I leave this command away, and I copy & paste the initial iteration followed by the script,

 

iterate SH3 & n. ca, print resn,resi,ss

class SSList:\

 list = []\

 def purge( self, resi, ss ):\

  if not self.list or self.list[-1][0] != ss:\

    self.list.append( [ss, resi, resi ] )\

  else:\

    self.list[-1][2] = resi\

  def __repr__( self ):\

    return "\n".join( map( self.repr_item, self.list ) )\

  def repr_item( self, item ):\

    return item[0]+" ("+item[1]+"-"+item[2]+")"

    sslist = SSList()

    cmd.iterate( "n. ca", "sslist.purge( resi, ss )" )

    print sslist

 

 

PyMol gives me the following answer:

 

Iterate: iterated over 68 atoms.

<pymol.SSList instance at 0x000000000688C648>

 

 

I still get the long list with every single residue mentioned, but not the desired “condensed” form.

Maybe I just don’t know how to print the list on the screen. Or is there more about it?

 

 

Thanks for any help,

 

Ferdi