Hi Lina,

as far as I know the secondary structure atom property is not state specific, so you cannot assign per state. But you can split states to individual objects. The DSSP plugin (I guess you are talking about http://www.pymolwiki.org/index.php/DSSP) however does not deal well with multiple objects (Hongbo, can you fix that?). The build-in command "dss" does, maybe you can use that?

Example:

fetch 1d7q, async=0
as cartoon
split_states 1d7q
delete 1d7q
dss all
rebuild

http://pymolwiki.org/index.php/Split_States
http://pymolwiki.org/index.php/Dss

I can also offer you my own dssp script which works with multiple objects, see attachment. It provides the PyMOL commands "dssp" and "stride". Check "help dssp".

Cheers,
  Thomas

lina wrote, On 09/16/11 17:45:
Hi,

a quick question,

how can update the ss for all states, not check one by one,

and run dssp and update ...

Thanks for any advice,

--
Best Regards,

lina

--
Thomas Holder
MPI for Developmental Biology
Spemannstr. 35
D-72076 Tübingen
'''
(c) 2010 Thomas Holder, Max Planck Institute for Developmental Biology

PyMOL wrapper for DSSP and STRIDE
'''

from pymol import cmd, stored
from subprocess import Popen, PIPE
import tempfile, os

def _common_ss_alter(selection, ss_dict, ss_map, raw=''):
	'''
DESCRIPTION

    Shared code of 'dssp' and 'stride' functions.
	'''
	if raw != 'ss':
		cmd.alter(selection, 'ss = ss_map.get(ss_dict.get((model,chain,resi)), "")',
				space={'ss_dict': ss_dict, 'ss_map': ss_map})
	if raw != '':
		cmd.alter(selection, raw + ' = ss_dict.get((model,chain,resi), "")',
				space={'ss_dict': ss_dict})
	cmd.rebuild(selection, 'cartoon')

def dssp(selection='(all)', exe='dsspcmbi', raw=''):
	'''
DESCRIPTION

    Secondary structure assignment with DSSP.
    http://swift.cmbi.ru.nl/gv/dssp/

ARGUMENTS

    selection = string: atom selection {default: all}

    exe = string: name of dssp executable {default: dsspcmbi}

    raw = string: atom property to load raw dssp class into {default: ''}

EXAMPLE

    dssp all, /sw/bin/dsspcmbi, raw=text_type
    color gray
    color red, text_type H
    color orange, text_type G
    color yellow, text_type E
    color wheat, text_type B
    color forest, text_type T
    color green, text_type S
    set cartoon_discrete_colors, 1

SEE ALSO

    dss, stride
	'''
	ss_map = {
		'B': 'S', # residue in isolated beta-bridge
		'E': 'S', # extended strand, participates in beta ladder
		'T': 'L', # hydrogen bonded turn
		'G': 'H', # 3-helix (3/10 helix)
		'H': 'H', # alpha helix
		'I': 'H', # 5 helix (pi helix)
		'S': 'L', # bend
		' ': 'L', # loop or irregular
	}
	tmpfilepdb = tempfile.mktemp('.pdb')
	ss_dict = dict()
	for model in cmd.get_object_list(selection):
		cmd.save(tmpfilepdb, '%s and (%s)' % (model, selection))
		process = Popen([exe, '-na', tmpfilepdb], stdout=PIPE)
		for line in process.stdout:
			if line.startswith('  #  RESIDUE'):
				break
		for line in process.stdout:
			resi = line[5:11].strip()
			chain = line[11].strip()
			ss = line[16]
			ss_dict[model,chain,resi] = ss
	os.remove(tmpfilepdb)
	_common_ss_alter(selection, ss_dict, ss_map, raw)
cmd.extend('dssp', dssp)

def stride(selection='(all)', exe='stride', raw=''):
	'''
DESCRIPTION

    Secondary structure assignment with STRIDE.
    http://webclu.bio.wzw.tum.de/stride/

SEE ALSO

    dss, dssp
	'''
	ss_map = {
		'C': 'L',
		'B': 'S',
		'b': 'S',
		'E': 'S',
		'T': 'L',
		'G': 'H',
		'H': 'H',
	}
	tmpfilepdb = tempfile.mktemp('.pdb')
	ss_dict = dict()
	for model in cmd.get_object_list(selection):
		cmd.save(tmpfilepdb, '%s and (%s)' % (model, selection))
		process = Popen([exe, tmpfilepdb], stdout=PIPE)
		for line in process.stdout:
			if not line.startswith('ASG'):
				continue
			chain = line[9].strip('-')
			resi = line[11:16].strip()
			ss = line[24]
			ss_dict[model,chain,resi] = ss_map.get(ss)
	os.remove(tmpfilepdb)
	_common_ss_alter(selection, ss_dict, ss_map, raw)
cmd.extend('stride', stride)

# tab-completion
cmd.auto_arg[0].update({
	'dssp'           : [ cmd.selection_sc           , 'selection'       , ', ' ],
	'stride'         : [ cmd.selection_sc           , 'selection'       , ', ' ],
})
------------------------------------------------------------------------------
BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA
http://p.sf.net/sfu/rim-devcon-copy2
_______________________________________________
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net

Reply via email to