Re: [PyMOL] visualise NOEs

2012-10-29 Thread Thomas Holder
Hi Krisztina,

in PyMOL version 1.2 you cannot install this script as a "Plugin" (in 
version 1.5 you can!). Instead, use the "run" command to load it.

PyMOL> run path/to/plot_noe.py
PyMOL> plot_noe path/to/restraints.file

See also:
http://pymolwiki.org/index.php/Run

Cheers,
   Thomas

On 28.10.2012 22:14, Krisztina Feher wrote:
> Hi,
>
> I am looking for a script that could show CNS type distance restraints
> on a pdb structure. In fact I have found a script on Justin Lorieau's
> homepage
> (http://www.lorieau.com/software/biophysics-software/40-plot-xplor-noes-in-pymol.html)
> that seems to intend to do exactly what I want, but it does not seem to
> work (I have Pymol 1.2 version installed with package manager of
> Ubuntu). I installed it as Plugin, but it gives the message:
>
> Exception in plugin 'plot_noe' -- Traceback follows...
> Traceback (most recent call last):
>File "/usr/lib/python2.7/dist-packages/pmg_tk/PMGApp.py", line 321,
> in initializePlugins
>  mod.__init__(self)
> TypeError: module.__init__() argument 1 must be string, not instance
> Error: unable to initialize plugin 'plot_noe'.
>
> Upon execution with a distance .tbl file nothing happens on the
> structure. I attached the script, I would appreciate any ideas how to
> make it work.
> Thanks a lot!
> Krisztina

-- 
Thomas Holder
MPI for Developmental Biology
Spemannstr. 35
D-72076 Tübingen

--
The Windows 8 Center - In partnership with Sourceforge
Your idea - your app - 30 days.
Get started!
http://windows8center.sourceforge.net/
what-html-developers-need-to-know-about-coding-windows-8-metro-style-apps/
___
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


Re: [PyMOL] visualise NOEs

2012-10-29 Thread Krisztina Feher
Hi Thomas,

thanks a lot for your reply! Now I was running the 
script from command line and executed it: it did not display anything on
 the structure. I inserted a couple of print statements into the script 
(attached), but it seems that the "noe_regex" is not being found in the 
variable "line" by the .search method (see the output below: match is 
None). The pdb file does have residue 433 and all the listed atom names.
 The noe_regex looks sort of complicated, I have no idea how to fix it. 
If anyone had an idea how to fix it, I would very much appreciate it. 

Thanks,
Krisztina

ps. If this script works for on your
 system, please write me too!

--- On Sun, 10/28/12, Krisztina Feher  wrote:

From: Krisztina Feher 
Subject: [PyMOL] visualise NOEs
To: pymol-users@lists.sourceforge.net
Date: Sunday, October 28, 2012, 10:14 PM

Hi,

I am looking for a script that could show CNS type distance restraints on a pdb 
structure. In fact I have found a script on Justin Lorieau's homepage 
(http://www.lorieau.com/software/biophysics-software/40-plot-xplor-noes-in-pymol.html)
 that seems to intend to do exactly what I want, but it does not seem to work 
(I have Pymol 1.2 version installed with package manager of Ubuntu). I 
installed it as Plugin, but it
 gives the message:

Exception in plugin 'plot_noe' -- Traceback follows...
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/pmg_tk/PMGApp.py", line 321, in 
initializePlugins
    mod.__init__(self)
TypeError: module.__init__() argument 1 must be string, not instance
Error: unable to initialize plugin 'plot_noe'.

Upon execution with a distance .tbl file nothing happens
 on the structure. I attached the script, I would appreciate any ideas how to 
make it work.
Thanks a lot!
Krisztina

-Inline Attachment Follows-

--
WINDOWS 8 is here. 
Millions of people.  Your app in 30 days.
Visit The Windows 8 Center at Sourceforge for all your go to resources.
http://windows8center.sourceforge.net/
join-generation-app-and-make-money-coding-fast/
-Inline Attachment Follows-

___
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# plot_noe
#
#   Written by Justin L Lorieau
#   Version 20110923



from pymol import cmd

def plot_noe(filename, line_color='black', line_width='1.0', replace_pound='2'):
"""A function for plotting XPLOR NOE restraints on a structure using an impressive,
yet highly limited, regex for parsing.

:filename:
The filename of the NOE retraint file in XPLOR NIH format.

:line_color:
The color for the NOE lines. See the standard colors in PyMOL.
Default: 'black'

:line_width:
The thickness of the NOE lines.
Default: '1.0'

:replace_pound:
Replace the '#' character with the following character.
Default: '2'

NOE Restraint Format

assign (residue 5 and name HB#) (residue 21 and name HA) 3.0 0.7 0.7 # long
# assign (residue 3 and name HA) (residue 3 and name HB#) 2.2 0.3 0.3

Usage Notes
---
Commented 'assign' lines are skipped

This function cannot handle nested parentheses well. Please assign these to
one group or another. Also this function does not handle ranges with a ':'.

All atom groups denoted with a '#' are replaced with the replace_pound
character.

Usage Example
-
PyMOL> plot_noe noe_short.tbl
"""
from pymol import cmd
import re

noe_regex = re.compile(r"""\s*[^#]\s*assign\s*\((?P[^\)]+)\)(\s*assign\s*)?\((?P[^\)]+)\)\s*(?P\d+(\.\d+)?)""")

resid_regex = re.compile(r"resid(ue)?\s*(?P\d+)")
name_regex = re.compile(r"name\s*(?P[\w\#]+)")
count = 0

with open(filename) as f:

for line in f.readlines():
print line
print noe_regex.search(line)
match = noe_regex.search(line)
print match
if match is None:
continue

# Parse the assignments in each group
# ex: match['group1'] = 'residue 21 and name HB#'
group1 = match.groupdict()['group1']
group2 = match.groupdict()['group2']
dist = match.groupdict()['dist']

# Parse the residue number and atom names
name1 = name_regex.search(group1).groupdict()['name'].replace('#',replace_pound)
name2 = name_regex.search(group2).groupdict()['name'].replace('#',replace_pound)
resid1 = resid_regex.search(group1).groupdict()['resid']
resid2 = resid_regex.search(group2).groupdict()['resid']
#resid1, resid2 = map(float, (resid1, resid2))
count += 1
print group2

#

Re: [PyMOL] visualise NOEs

2012-10-29 Thread Thomas Holder

Hi Krisztina,

I slightly modified the script, see attachment. The regular expression 
is modified and I replaced "search" by "match".


The script could be further optimized (exception handling etc.) but with 
your example file it works fine now.


Cheers,
  Thomas

On 10/29/2012 04:06 PM, Krisztina Feher wrote:

Sure, thanks for looking at it!
Krisztina

--- On *Mon, 10/29/12, Thomas Holder wrote:

From: Thomas Holder 
Subject: Re: [PyMOL] visualise NOEs
To: "Krisztina Feher" 
Date: Monday, October 29, 2012, 4:04 PM

Hi Krisztina,

can you send me the restraints file and PDB file as well?

Cheers,
Thomas

On 10/29/2012 04:00 PM, Krisztina Feher wrote:
 > Hi Thomas,
 >
 > thanks a lot for your reply! Now I was running the script from
command
 > line and executed it: it did not display anything on the structure. I
 > inserted a couple of print statements into the script (attached),
but it
 > seems that the "noe_regex" is not being found in the variable
"line" by
 > the .search method (see the output below: match is None). The pdb
file
 > does have residue 433 and all the listed atom names. The
noe_regex looks
 > sort of complicated, I have no idea how to fix it. If anyone had
an idea
 > how to fix it, I would very much appreciate it.
 >
 > Thanks,
 > Krisztina
 >
 > ps. If this script works for on your system, please write me too!


--
Thomas Holder
MPI for Developmental Biology
Spemannstr. 35
D-72076 Tübingen


plot_noe.py
Description: application/chimera
--
The Windows 8 Center - In partnership with Sourceforge
Your idea - your app - 30 days.
Get started!
http://windows8center.sourceforge.net/
what-html-developers-need-to-know-about-coding-windows-8-metro-style-apps/___
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

Re: [PyMOL] visualise NOEs

2012-10-29 Thread Abdullah Kahraman
Dear Krisztina,

alternatively you could use Xwalk for visualizing distance constraints on PDB 
structures. Please have a look at the webserver (www.xwalk.org) or download the 
software if you find it useful (http://www.xwalk.org/cgi-bin/download.cgi).

With Xwalk you can calculate surface distances and Euclidean distances between 
atoms in PDB structures. For visualisation purposes it produces .pml PyMol 
scripts, which might be exactly what you are looking for. For targeted distance 
calculation all you need to do is provide Xwalk your PDB structure and a text 
file with a list of the atom pairs. The text file has to have the following 
format:

index\tproteinName\tAtomIdentifier1\tAtomIdentifier2

e.g:
1   test.pdbLYS-1-A-CA  LYS-2-A-CA
2   test.pdbLYS-4-A-CA  LYS-10-A-CA
...

Once you have your text file ready, simply run Xwalk as follows:

> java Xwalk -infile test.pdb -dist noe.txt -euc -pymol -out test_noe.pml

You can also try "java Xwalk -help" to get further information about additional 
commandline parameters. After Xwalk has finished its calculation, open the 
test_noe.pml file with PyMol.

Let me know if you need any further assistance.
Abdullah




On 29 Oct 2012, at 16:02, Krisztina Feher  wrote:

> 
> Hi Thomas,
> 
> thanks a lot for your reply! Now I was running the script from command line 
> and executed it: it did not display anything on the structure. I inserted a 
> couple of print statements into the script (attached), but it seems that the 
> "noe_regex" is not being found in the variable "line" by the .search method 
> (see the output below: match is None). The pdb file does have residue 433 and 
> all the listed atom names. The noe_regex looks sort of complicated, I have no 
> idea how to fix it. If anyone had an idea how to fix it, I would very much 
> appreciate it. 
> 
> Thanks,
> Krisztina
> 
> ps. If this script works for on your system, please write me too!
> 
> --- On Sun, 10/28/12, Krisztina Feher  wrote:
> 
> From: Krisztina Feher 
> Subject: [PyMOL] visualise NOEs
> To: pymol-users@lists.sourceforge.net
> Date: Sunday, October 28, 2012, 10:14 PM
> 
> Hi,
> 
> I am looking for a script that could show CNS type distance restraints on a 
> pdb structure. In fact I have found a script on Justin Lorieau's homepage 
> (http://www.lorieau.com/software/biophysics-software/40-plot-xplor-noes-in-pymol.html)
>  that seems to intend to do exactly what I want, but it does not seem to work 
> (I have Pymol 1.2 version installed with package manager of Ubuntu). I 
> installed it as Plugin, but it gives the message:
> 
> Exception in plugin 'plot_noe' -- Traceback follows...
> Traceback (most recent call last):
>   File "/usr/lib/python2.7/dist-packages/pmg_tk/PMGApp.py", line 321, in 
> initializePlugins
> mod.__init__(self)
> TypeError: module.__init__() argument 1 must be string, not instance
> Error: unable to initialize plugin 'plot_noe'.
> 
> Upon execution with a distance .tbl file nothing happens on the structure. I 
> attached the script, I would appreciate any ideas how to make it work.
> Thanks a lot!
> Krisztina
> 
> -Inline Attachment Follows-
> 
> --
> WINDOWS 8 is here. 
> Millions of people.  Your app in 30 days.
> Visit The Windows 8 Center at Sourceforge for all your go to resources.
> http://windows8center.sourceforge.net/
> join-generation-app-and-make-money-coding-fast/
> 
> -Inline Attachment Follows-
> 
> ___
> 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
> --
> The Windows 8 Center - In partnership with Sourceforge
> Your idea - your app - 30 days.
> Get started!
> http://windows8center.sourceforge.net/
> what-html-developers-need-to-know-about-coding-windows-8-metro-style-apps/___
> 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

--<--<---@
Abdullah Kahraman, PhD
Aebersold - Malmstroem Group
Institute of Molecular Systems Biology
ETH Zurich
HPT C75
Wolfgang-Pauli-Str. 16
8093 Zurich
Switzerland

http://www.imsb.ethz.ch/researchgroup/malars/people/abdullah_kahraman
abdul...@imsb.biol.ethz.ch
work: +41-(0)44-633 66 71
mobile: +41-(0)76-317 0305











--
The Windows 8 Center - In partnership with Sourceforge
Your idea - your app - 30 days.
Get started!
http://windows8center.sourceforge.net/
what-html-developers-need-to-know-about-coding-windows-8-metro-style-apps/

[PyMOL] red_white_blue palette color bar

2012-10-29 Thread Yamei Yu
Hi all,

Do any know how to generate a color bar for red_white_blue? Thank you very
much!

yamei
--
The Windows 8 Center - In partnership with Sourceforge
Your idea - your app - 30 days.
Get started!
http://windows8center.sourceforge.net/
what-html-developers-need-to-know-about-coding-windows-8-metro-style-apps/___
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

Re: [PyMOL] red_white_blue palette color bar

2012-10-29 Thread Thomas Holder
Hi Yamei,

you can create a dummy color ramp:

PyMOL> ramp_new colorbar, none, [-5, 0, 5], [red, white, blue]

There is also the spectrumbar script:
http://pymolwiki.org/index.php/Spectrumbar

Cheers,
   Thomas

Yamei Yu wrote, On 10/29/12 16:46:
> Hi all,
>
> Do any know how to generate a color bar for red_white_blue? Thank you
> very much!
>
> yamei

-- 
Thomas Holder
MPI for Developmental Biology
Spemannstr. 35
D-72076 Tübingen

--
The Windows 8 Center - In partnership with Sourceforge
Your idea - your app - 30 days.
Get started!
http://windows8center.sourceforge.net/
what-html-developers-need-to-know-about-coding-windows-8-metro-style-apps/
___
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