[PyMOL] detecting the existence of a selection

2003-12-01 Thread Tina Li
Hello,

I wonder if there is a quick and simple way of detecting whether a selection
exists without triggering any errors. e.g. to check if there are currently any
atoms picked (and collect the residue IDs if there is any), I do:

cmd.iterate((lb),stored.list.append((resi)))

if no atoms were picked, I would see the alarming error messages:

Selector-Error: Unknown keyword or selection.
Selector-Error: Malformed selection.
( ( lb--

Is it possible to suppress them and still get the result?

Thanks in advance!

Tina





[PyMOL] transforming all atoms by a matrix

2003-09-29 Thread Tina Li
Hello,

I have two questions:

1. I want to superpose object1 and object2 on top of each other, and have
derived a rotation matrix to transform object2 by. How do I apply this matrix
to all its atoms? Either I parse its PDB coordinates, multiply them by the
matrix, and load the object (which can be really slow), or, I specify the
(axis, angle) data via PyMOL's rotate command, which needs me to solve for
three angles from the matrix, and it's messy. Is there a better way to specify
a matrix to be multiplied to the atom coordinates?

(I saw set_view. But it rotates the viewing coordinates system (i.e. camera),
which would alter both object1 and object2.)

2. I have a series of commands in a python script to highlight secondary
structures:

cmd.do( util.ss)
cmd.do( color red, ss h)
cmd.do( color yellow, ss s)
cmd.do( color blue, ss l+'')

I found the color commands race ahead of util.ss and some odd color schemes
show up. I tried cmd.sync(timeout=5.0, poll=2) with numerous combinations of
timeout and poll after util.ss but it still happened. Now I'm using
time.sleep(1.5), which does block the main thread till util.ss finishes, but
it isn't nice for the program to freeze for the 1.5 seconds. My question is:
why does the sync command not work as expected? This race condition doesn't
occur if the commands are put in a PyMOL script or program (I guess there is
only one thread of execution in those cases?).


Thanks,

Tina






[PyMOL] getting color of a residue + selecting non-natural residues

2003-09-16 Thread Tina Li
Hello,

I have two operations that I want to perform, and am not aware of a simple way
(if possible) of doing them. So here it goes:

1. how (if possible) to retrieve the color for a residue as identified in an
expression, e.g. resi 9? Note that it's not a range so no multiple answers
is possible. I guess the question could extend to other attributes like
representation, etc. The reason I need that is to be able to switch back to a
residue's original color after highlighting it in another.

2. how to select all non-natural residues (anything that's not in the list of
20 standard AAs)?

I'm going the brute-force way, i.e.

naturals1='asp+glu+lys+arg+phe+tyr+cys+met+ser+thr'
naturals2='asn+gln+leu+val+ile+gly+ala+his+trp+pro'
select naturals1, resn naturals1
select naturals2, resn naturals2
select nonnaturals, !naturals1  !naturals2

which is ugly. I couldn't find a predefined keyword for them though.

Many thanks!

Tina





[PyMOL] adding a new external GUI

2003-09-05 Thread Tina Li
Hello,

I'm trying to add another external GUI to be positioned at the bottom of the
structure window for displaying sequence alignments, with not much luck. Here
is what I want and what I've done:

Goal: when opening a sequence alignment file in the existing GUI, launch a new
GUI at the bottom displaying the alignments. So:

- in \modules\pmg_tk, add a new class alignApp that inherits from AbstractApp
(very similar to PMGApp for the exsting GUI), which adds widgets to the new
GUI and will parse files, etc..

- in \modules\pmg_tk\startup, add startNewGUI.py, whose __init__() adds an
additional file open option (all files in this directory are __init__'d upon
startup of the existing GUI) to the existing GUI's File menu:

---
from pmg_tk.alignApp import *

def run_alignApp():
if not hasattr(sys,argv):
  sys.argv=[pymol]
alignApp(balloon_state='both').run()

def alignment_open(self):
  ofile = askopenfilename(initialdir = self.initialdir,
  filetypes=[(XML File,*.xml),
 (All Files,*.*),
 (All Files,*),])
  if len(ofile):
 self.initialdir = re.sub(r[^\/\\]*$,,ofile)
 t_alignApp = threading.Thread(target=run_alignApp,args=())
 t_alignApp.setDaemon(1)
 t_alignApp.start()

def __init__(self):
  self.menuBar.addmenuitem('File', 'command', 'Open alignment file.',
label=self.pad+'Open alignments',
command=lambda s=self:alignment_open(s))
---

The result: the new GUI appears as a one-piece small square frame (1/6 the
width of the existing). No menu, output area or other widgets is shown. After
clicking in either GUI, the cursor turns busy, and both GUIs turn
non-responding.

I'm not sure if it's a Python thread problem on my part. Has anyone done
something similar before? Let me know if it's more appropriate to ask in a
Python newsgroup.

Thanks much!

Tina





[PyMOL] Re: cannot find _cmd module

2003-08-27 Thread Tina Li
Hello,

So I figured that in my $PYMOL_PATH\build\lib.win32-2.2\pymol, there is a
_cmd.pyd that's missing in $PYMOL_PATH\modules\pymol. I copied it over, and
PyMOL started up, but said that it failed to import the xray module, which
however exists in $PYMOL_PATH\modules\pymol, so I don't understand why it
doesn't import that. Anyways, it seems to be up. I guess every time I build
PyMOL, I'll have to copy the _cmd.pyd file over.

Tina

- Original Message - 
| From: Tina Li t...@bioinformaticssolutions.com
| To: pymol-users@lists.sourceforge.net
| Date: Mon, 25 Aug 2003 11:57:27 -0400
| Subject: [PyMOL] cannot find _cmd module
|
| Hello,
|
| Eh, I think this is a rather basic question. So I built PyMOL on Win32,
tried
| to run pymol.bat, which calls python $PYMOL_PATH/modules/pymol/__init__.py,
| which complained:
|
| Traceback (most recent call last):
|   File D:\thli\root\misc\pymol-0.90\modules\pymol\__init__.py, line 92, in
?
| import pymol
|   File D:\thli\root\misc\pymol-0.90\modules\pymol\__init__.py, line 300,
in
| ?
| import _cmd
| ImportError: No module named _cmd
|
| I have PYTHONPATH set to $PYMOL_PATH/modules. Is it something obvious I'm
| missing?
|
| Thanks much!
|
| Tina





Re: [PyMOL] Re: cannot find _cmd module

2003-08-27 Thread Tina Li
Hello,

Ah, I see why now. I did do a full installation, during which the _cmd and
sglite extension files, etc. were copied to
C:\Python22\Lib\site-packages\pymol. According to comment in
C:\Python22\Lib\site.py, a path configuration file must exist in the
\site-packages directory indicating which sub-directories are to be appended
to sys.path. So I added a file, pymol.pth in \site-packages that contains:

# pymol package configuration
pymol

Now Python knows where to look for modules. And it works.

Thanks so much!

Tina


- Original Message - 
From: Warren L. DeLano war...@delanoscientific.com
To: 'Tina Li' t...@bioinformaticssolutions.com;
pymol-users@lists.sourceforge.net
Sent: Wednesday, August 27, 2003 2:32 PM
Subject: RE: [PyMOL] Re: cannot find _cmd module


| Tina,
|
| Did you do a full installation?  After running:
|
| python setup.py build install
| python setup2.py
|
| (in that order)
|
| pymol.bat should just work.  There shouldn't be any need to copy
| anything over, nor should you set PYMOL_PATH -- that is all taken care
| of automatically with this approach.
|
| Cheers,
| Warren
|
|
| --
| mailto:war...@delanoscientific.com
| Warren L. DeLano, Ph.D.
| Principal Scientist
| DeLano Scientific LLC
| Voice (650)-346-1154
| Fax   (650)-593-4020
|
|  -Original Message-
|  From: pymol-users-ad...@lists.sourceforge.net [mailto:pymol-users-
|  ad...@lists.sourceforge.net] On Behalf Of Tina Li
|  Sent: Wednesday, August 27, 2003 8:34 AM
|  To: pymol-users@lists.sourceforge.net
|  Subject: [PyMOL] Re: cannot find _cmd module
| 
|  Hello,
| 
|  So I figured that in my $PYMOL_PATH\build\lib.win32-2.2\pymol, there
| is a
|  _cmd.pyd that's missing in $PYMOL_PATH\modules\pymol. I copied it
| over,
|  and
|  PyMOL started up, but said that it failed to import the xray module,
| which
|  however exists in $PYMOL_PATH\modules\pymol, so I don't understand why
| it
|  doesn't import that. Anyways, it seems to be up. I guess every time I
|  build
|  PyMOL, I'll have to copy the _cmd.pyd file over.
| 
|  Tina
| 
|  - Original Message -
|  | From: Tina Li t...@bioinformaticssolutions.com
|  | To: pymol-users@lists.sourceforge.net
|  | Date: Mon, 25 Aug 2003 11:57:27 -0400
|  | Subject: [PyMOL] cannot find _cmd module
|  |
|  | Hello,
|  |
|  | Eh, I think this is a rather basic question. So I built PyMOL on
| Win32,
|  tried
|  | to run pymol.bat, which calls python
|  $PYMOL_PATH/modules/pymol/__init__.py,
|  | which complained:
|  |
|  | Traceback (most recent call last):
|  |   File D:\thli\root\misc\pymol-0.90\modules\pymol\__init__.py,
| line
|  92, in
|  ?
|  | import pymol
|  |   File D:\thli\root\misc\pymol-0.90\modules\pymol\__init__.py,
| line
|  300,
|  in
|  | ?
|  | import _cmd
|  | ImportError: No module named _cmd
|  |
|  | I have PYTHONPATH set to $PYMOL_PATH/modules. Is it something
| obvious
|  I'm
|  | missing?
|  |
|  | Thanks much!
|  |
|  | Tina
| 
| 
| 
| 
|  ---
|  This sf.net email is sponsored by:ThinkGeek
|  Welcome to geek heaven.
|  http://thinkgeek.com/sf
|  ___
|  PyMOL-users mailing list
|  PyMOL-users@lists.sourceforge.net
|  https://lists.sourceforge.net/lists/listinfo/pymol-users
|





[PyMOL] cannot find _cmd module

2003-08-25 Thread Tina Li
Hello,

Eh, I think this is a rather basic question. So I built PyMOL on Win32, tried
to run pymol.bat, which calls python $PYMOL_PATH/modules/pymol/__init__.py,
which complained:

Traceback (most recent call last):
  File D:\thli\root\misc\pymol-0.90\modules\pymol\__init__.py, line 92, in ?
import pymol
  File D:\thli\root\misc\pymol-0.90\modules\pymol\__init__.py, line 300, in
?
import _cmd
ImportError: No module named _cmd

I have PYTHONPATH set to $PYMOL_PATH/modules. Is it something obvious I'm
missing?

Thanks much!

Tina





[PyMOL] strand representation + free label

2003-08-14 Thread Tina Li
Hello,

I'm wondering if it's possible to simulate RasMol-styled strand
representation (a number of smooth curves that run parallel to one another
along the peptide plane of each residue). I would like something like that to
repersent gaps in a structural alignment (i.e. a segment that doesn't exist
in an approximated structure). Currently I'm using the dash lines as for
bonds. However, is there a way to change the distance label into something I
can specify, like 7 AA to indicate the gap length?


Thanks,

Tina





[PyMOL] comprehensive rules for selection-expressions

2003-08-04 Thread Tina Li
Hello,

We plan to use PyMOL as the alignment/structure viewer in a protein
threading package we developed. Mostly there will be some new
features/enhancements on the existing viewer. e.g.

- highlight/color by mappings of amino acid porperties (cysteines, charge
and hydrophobicity, size, secondary structure)
- a sequence alignment pane in sync with the structure window; selecting
residues in one selects them in the other
- show multiple alignments simultaneously
- permit structural superposition of templates (i.e. structures)

I'm personally new to PyMOL, and am poking around to explore the features
(BTW, excellent graphics!). Right now I'm having difficulty with the syntax
of selection-expressions. I don't see a comprehensive documentation of
what counts as selections. Can cysteines already be highlighted? Is any of
the mappings already available? On another note, I'm aware of the following
way to color by secondary structures:

color red, ss h
color yellow, ss s
color green, ss l+

which however seems a bit cumbersome. I'd prefer having a Color by... with
options like secondary structure, charge, size, etc. under the menu
item Display. But then, I figure many prefer command lines.

These are just some initial random thoughts. BTW, could someone explain what
the different elems CHNOS* represent? I'd really appreciate more
comprehensive documentation.

Thanks,

Tina