Re: [PyMOL] cartoon range transparency help

2018-07-23 Thread Christian Becke
Hi Paul,

check out
https://pymolwiki.org/index.php/Cartoon#Breaking_Up_a_Visualization_with_Cartoon_Skip

You'll want to skip the residues you want to make transparent in the
original (opaque) object, and include some more residues on both ends in
the copy you want to make transparent. Skip the additional residues and
make the copy transparent.

HTH,

Christian


Am 23.07.2018 um 17:00 schrieb Paul Miller:
>
> Hi Jarrett
>
>
> Thanks for this, however, the trajectories of the cartoon change when
> only part of it is shown so that the transparent and non-transparent
> segments to not connect seamlessly.
>
>
> Cheers, Paul
>
>
> Paul Steven Miller (PhD)
> Postdoctoral Researcher
> University of Oxford
> Wellcome Trust Centre for Human Genetics
> Division of Structural Biology
> Roosevelt Drive
> Oxford
> OX3 7BN
>  
>
> 
> -Original Message-
> From: "Jarrett Johnson"  >
> To: "Paul Miller" mailto:p...@strubi.ox.ac.uk>>
> Cc: "Pymol User list"  >
> Date: 07/23/18 15:47
> Subject: Re: [PyMOL] cartoon range transparency help
>
> Hello,
>
> That seems to be the case for that command. One workaround for
> this is to use the 'create' command to create a new object
> identical to your source object and make that one transparent.
> I've attached a quick example.
>
> Jarrett J.
>
> On Mon, Jul 23, 2018 at 9:36 AM, Paul Miller  > wrote:
>
> Hi
>
>
> I have Pymol version 2
>
>
> When I try to make a range of a cartoon transparent
>
>
> e.g. I type: set cartoon_transparency, 0.5, /4COF//A/1:20
>
>
> it comes up with following error:
>
>
> Setting-Warning: 'cartoon_transparency' is a
> object-state-level setting
>
>
> Does this mean one cannot make part of a cartoon transparent?
>
>
> Cheers, Paul
>
>
> Paul Steven Miller (PhD)
> Postdoctoral Researcher
> University of Oxford
> Wellcome Trust Centre for Human Genetics
> Division of Structural Biology
> Roosevelt Drive
> Oxford
> OX3 7BN
>
> 
> --
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> ___
> 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
> 
>
>
>
>
> --
> Jarrett Johnson,
> Schrödinger
>
>
>
> --
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>
>
> ___
> 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

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
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] Help for saving movie in png

2015-11-19 Thread Christian Becke
Hi Pranab,

Am 13.11.2015 um 17:00 schrieb Pranab Jyoti Bhuyan:
> Can you please tell me how to save a movie as a series of *.png files
> from terminal in linux?
This can be done with the mpng command. See
http://pymolwiki.org/index.php/Mpng


Cheers,

Christian

--
___
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] scripting: pymol.session

2015-01-30 Thread Christian Becke
Works perfectly, thanks a lot!

On 30.01.2015 21:31, Thomas Holder wrote:
 Hi Christian,

 the pymol.session variable is not really part of the API -- means,
 not intended to be modified or accessed by the user. However, it's
 all Python and obviously not hidden, so you can mess around with it,
 if you do it right. Short answer is: Always access it as
 pymol.session, don't do from pymol import session. This works:

 --- script.py --- import pymol from pymol import cmd

 @cmd.extend def print_session_id(): print id(pymol.session)

 @cmd.extend def set_foo(value): pymol.session.foo = value

 @cmd.extend def print_foo(): print pymol.session.foo --- end
 script.py ---

 Cheers, Thomas

 On 29 Jan 2015, at 20:20, Christian Becke
 christian.be...@fu-berlin.de wrote:

 Dear pymol experts,

 I found some odd behaviour when trying to use pymol.session in my
 script. I'm using open source pymol 1.7.4.0 (built from svn) on
 linux. Here comes a minimal example:

 1) Create a directory, containing the following 2 files:

 --- script.py --- from pymol import cmd, session

 def print_session_id(): print id(session)
 cmd.extend(print_session_id, print_session_id)

 def set_foo(value): session.foo = value cmd.extend(set_foo,
 set_foo)

 def print_foo(): print session.foo cmd.extend(print_foo,
 print_foo) --- end script.py ---

 --- .pymolrc.py --- import script --- end .pymolrc.py ---

 2) Change to this directory and start pymol.

 3) In the pymol CLI, do:

 script_set_foo bar script_print_foo script_session_id python print
 id(session) print session.foo session.foo = foo python end
 script_print_foo save test.pse

 This produces the output given below. Note that the id of the
 session object is the same when printed from the script and from
 within the pymol session, and how the script reflects changes made
 to the session.foo variable from the pymol CLI and vice versa.

 --- pymol log --- PyMOLscript_set_foo bar PyMOLscript_print_foo
 bar PyMOLscript_session_id 139958033268464 PyMOLpython
 PyMOLprint id(session) 1:print id(session) PyMOLprint
 session.foo 2:print session.foo PyMOLsession.foo = foo
 3:session.foo = foo PyMOLpython end PyMOLpython end
 139958033268464 bar PyMOLscript_print_foo foo PyMOLsave test.pse
 Save: Please wait -- writing session file... Save: wrote
 test.pse. PyMOLquit PyMOL: normal program termination. --- end
 pymol log ---

 4) If I now start pymol, load test.pse and run the following
 commands in the pymol CLI:

 script_print_foo script_session_id script_set_foo bar python print
 id(session) print session.foo python end

 I get the following results:

 --- pymol log --- Executive: Loading version 1.740 session...
 PyMOLscript_print_foo Traceback (most recent call last): File
 /usr/lib64/python2.7/site-packages/pymol/parser.py, line 256, in
 parse self.result=apply(layer.kw[0],layer.args,layer.kw_args) File
 script.py, line 12, in script_print_foo print session.foo
 AttributeError: Session_Storage instance has no attribute 'foo'
 PyMOLscript_session_id 139950852452080 PyMOLscript_set_foo bar
 PyMOLpython PyMOLprint id(session) 1:print id(session)
 PyMOLprint session.foo 2:print session.foo PyMOLpython end
 PyMOLpython end 139950603504528 foo PyMOLscript_print_foo bar ---
 end pymol log ---

 Note that the ids of the session objects differ when printed from
 the script or from the pymol CLI, and the contents of the variable
 session.foo differs between pymol CLI and script.

 If I do not import script.py from .pymolrc.py, everything works as
 expected.

 Apparently, loading of a new session file creates a new instance of
 the pymol.session object. Shouldn't the pymol.session instance be
 created once upon startup, so it can be shared between all scripts?
 And only values assigned to this instance upon loading a session
 from file?

 Is there a way to import scripts from .pymolrc.py, load a session
 file *and* get the correct pymol.session object within the script?
 Or is there an alternative way to get custom data saved in session
 files that can be used in scripts?


 Best,

 Christian


--
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
___
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


[PyMOL] scripting: pymol.session

2015-01-29 Thread Christian Becke
Dear pymol experts,

I found some odd behaviour when trying to use pymol.session in my 
script. I'm using open source pymol 1.7.4.0 (built from svn) on linux. 
Here comes a minimal example:

1) Create a directory, containing the following 2 files:

--- script.py ---
from pymol import cmd, session

def print_session_id():
 print id(session)
cmd.extend(print_session_id, print_session_id)

def set_foo(value):
 session.foo = value
cmd.extend(set_foo, set_foo)

def print_foo():
 print session.foo
cmd.extend(print_foo, print_foo)
--- end script.py ---

--- .pymolrc.py ---
import script
--- end .pymolrc.py ---

2) Change to this directory and start pymol.

3) In the pymol CLI, do:

script_set_foo bar
script_print_foo
script_session_id
python
print id(session)
print session.foo
session.foo = foo
python end
script_print_foo
save test.pse

This produces the output given below. Note that the id of the session 
object is the same when printed from the script and from within the 
pymol session, and how the script reflects changes made to the 
session.foo variable from the pymol CLI and vice versa.

--- pymol log ---
PyMOLscript_set_foo bar
PyMOLscript_print_foo
bar
PyMOLscript_session_id
139958033268464
PyMOLpython
PyMOLprint id(session)
 1:print id(session)
PyMOLprint session.foo
 2:print session.foo
PyMOLsession.foo = foo
 3:session.foo = foo
PyMOLpython end
PyMOLpython end
139958033268464
bar
PyMOLscript_print_foo
foo
PyMOLsave test.pse
  Save: Please wait -- writing session file...
  Save: wrote test.pse.
PyMOLquit
  PyMOL: normal program termination.
--- end pymol log ---

4) If I now start pymol, load test.pse and run the following commands in 
the pymol CLI:

script_print_foo
script_session_id
script_set_foo bar
python
print id(session)
print session.foo
python end

I get the following results:

--- pymol log ---
  Executive: Loading version 1.740 session...
PyMOLscript_print_foo
Traceback (most recent call last):
   File /usr/lib64/python2.7/site-packages/pymol/parser.py, line 256, 
in parse
 self.result=apply(layer.kw[0],layer.args,layer.kw_args)
   File script.py, line 12, in script_print_foo
 print session.foo
AttributeError: Session_Storage instance has no attribute 'foo'
PyMOLscript_session_id
139950852452080
PyMOLscript_set_foo bar
PyMOLpython
PyMOLprint id(session)
 1:print id(session)
PyMOLprint session.foo
 2:print session.foo
PyMOLpython end
PyMOLpython end
139950603504528
foo
PyMOLscript_print_foo
bar
--- end pymol log ---

Note that the ids of the session objects differ when printed from the 
script or from the pymol CLI, and the contents of the variable 
session.foo differs between pymol CLI and script.

If I do not import script.py from .pymolrc.py, everything works as expected.

Apparently, loading of a new session file creates a new instance of the 
pymol.session object. Shouldn't the pymol.session instance be created 
once upon startup, so it can be shared between all scripts? And only 
values assigned to this instance upon loading a session from file?

Is there a way to import scripts from .pymolrc.py, load a session file 
*and* get the correct pymol.session object within the script?
Or is there an alternative way to get custom data saved in session files 
that can be used in scripts?


Best,

Christian

--
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
___
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] REGARDING_PyMOL_3D_Movie_in_FFMPEG

2014-09-24 Thread Christian Becke
Hi Tarun,
you are right, there was a typo in my previous email. The command should indeed 
read run mpng_3d.py. Just copy the file mpng_3d.py to a directory, start 
pymol from this directory and enter run mpng_3d.py on the pymol command line. 
Once you ran this command, you can run mpng_3d my_movie, 1920, 1080.
Please note that you only need the mpng_3d command to prepare stereoscopic 3D 
movies (you will need special displays and/or glasses to see them properly). If 
you want to prepare movies e.g. for a powerpoint presentation, you could just 
use the regular mpng command instead.
HTH,
Christian


P.S.: Please reply to the PyMol list - this way, the messages will be 
publically available and can be found using e.g. google. This might help others 
with similar questions in the future.
Am Montag, den 22.09.2014, 23:39 +0530 schrieb Tarun JaiRaj Narwani:
 Hi C.Becke,
 
 This is in regards to your reply to a thread titled [PyMOL] pymol 3D movies 
 in pymol mailerList at sourceforge.net.
 I am a juvenile in preparing movies in PyMOL and all I have learnt by now is 
 to prepare movie using the e-movie plugin. Now I require my PyMOL movie to 
 run independent of PyMOL interface, eg. on Windows Media Player.
 For which I saw your post and it has helped me so far, but there is a doubt. 
 You have mentioned in step 2 to run mpng_3d.sh script, but the attached 
 file is mpng_3d.py script. How should I try to run the .py file? I have tried 
 putting it in the pymol/modules/ folder along with other *.py scripts but 
 could not find out how is it going to work. Yopu have also mentioned that it 
 would create another pymol command, which I am confused with.
 I humbly seek your assistance for running the python script(mpng.py) for 
 saving my movie into right-left png images.
 Looking forward to your reply...
 
 --
 Sincerely,
 Tarun JaiRaj Narwani..
 Protein Evolution Lab- Dr. S.Srikrishna
 IMTECH, Chandigarh
 @+91-8591641998
 
-- 
Christian Becke

Freie Universität Berlin
Fachbereich Biologie, Chemie, Pharmazie
Institut für Chemie und Biochemie
AG Strukturbiochemie

Takustr. 6
14195 Berlin
Germany

Phone: +49 (0)30 838-57344
Fax: +49 (0)30 838-56981
E-mail: christian.be...@fu-berlin.de

--
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311iu=/4140/ostg.clktrk___
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] pymol 3D movies

2014-08-25 Thread Christian Becke

Hi,

Am 25.08.2014 21:44, schrieb Marcelo Marcet:

Thank you for taking the time to reply to this question and for
offering your help. I am also interested in quad-buffered stereo play
back.


Sorry, maybe I wasn't clear in my first mail: I don't have experience
with quad-buffered stereo playback. All I have done is preparing 3D
stereo movie files using PyMOL and ffmpeg[1] which I can play on a 3D TV 
(using a side-by-side stereo movie file and polarization glasses) or on 
a regular beamer (anaglyph red/cyan movie with red/cyan glasses).
I expect that one could play these (or similarly prepared) movie files 
with a movie player that makes use of OpenGL quad-buffered 3D 
capabilities of a graphics card - but I never tried this myself.
AFAIU, there is no such thing as a quad-buffered movie file - it's just 
the movie player that plays back a 3D stereo movie file using OpenGL 
quad-buffered stereo on hardware that supports it. A player that might 
work is bino[2], but, as I said, I never got around to try it out.



Would you be able to provide us with a bit more methodology information?
It sounds like you have a script that helps you save the side-by-side
images and later you use a software called ffmpeg to render the movie.
Is this correct?


Yes, this is correct. Here is how I did it:
1) Prepare a movie in PyMOL
2) run the attached python script (run /path/to/mpng_3d.sh). This will 
add a new command to pymol: mpng_3d
It works similar to the mpng command, but saves 2 images for each movie 
frame, one for the left and one for the right eye. If ray traced frames 
are desired, do set ray_trace_frames, 1. You can also play around with 
the stereo_angle setting (e.g. set stereo_angle, 3). This defines the 
difference in viewing angle of the images for the left and right eye.

The mpng_3d command takes the following options:
mpng_3d prefix, width, height, [start=1], [end=-1]
render stereoscopic frames sized width x height pixels.
Files will be named prefix_%04d.png.
Render frames start to end (default: all frames)

Example: mpng_3d my_movie, 1920, 1080 will write png files called 
my_movie_0001.png, my_movie_0002.png, ...
If ray_trace_frames is set (recommended), the images will be ray traced 
and have a size of 1920x1080 pixels (i.e. full HD).
3) Use ffmpeg to encode a movie from the individual frames saved with 
mpng_3d:

For h.264 encoding:
ffmpeg -i my_movie_%04d.png \
-an \
-r 30 -aspect 1.78 -pix_fmt yuv420p \
-c:v libx264 -tune animation \
-vf stereo3d=al:sbsl \
-profile:v baseline -level 3.0 -refs 4 -qmin 4 \
my_movie.mp4

For WMV encoding:
ffmpeg -i my_movie_%04d.png \
-an \
-r 30 -aspect ${aspect} \
-vf stereo3d=al:sbsl \
-q:v 2 -c:v msmpeg4v3 \
my_movie.wmv

These are the commands I used on linux. Similar ffmpeg commands should 
also work on Windows or OS X. Video quality and file size were 
reasonable with the above settings, and the files played all right on 
almost all video players I tested (the wmv files work with all versions 
of PowerPoint I tested, the h.264 movies do not work with WinXP).
If you change the size of the images, also change the -aspect parameter 
in the ffmpeg commands accordingly (for 1920x1080 pixel images: 
aspect=1920/1080=1.78).
The above commands produce side-by-side stereo movies, i.e. the images 
for the left and right eye are shown next to each other in each frame

of the movie. Check the ffmpeg docs[3] for other output options.
For some movie players (e.g. the one on my LG 3D TV) it might be 
necessary to scale the pymol-rendered frames to half-width before 
encoding them to a side-by-side stereo movie with ffmpeg. This can be 
done e.g. with the convert command from the imagmagick[4] suite.


I hope this helps!

Christian

[1] http://ffmpeg.org
[2] http://bino3d.org
[3] http://ffmpeg.org/ffmpeg-filters.html#stereo3d
[4] http://www.imagemagick.org

--
Christian Becke

Freie Universität Berlin
Fachbereich Biologie, Chemie, Pharmazie
Institut für Chemie und Biochemie
AG Strukturbiochemie

Takustr. 6
14195 Berlin
Germany

Phone: +49 (0)30 838-57344
Fax: +49 (0)30 838-56981
E-mail: christian.be...@fu-berlin.de
# vim: set fileencoding=utf8 ts=4 sw=4 noexpandtab :

# AUTHOR: Christian Becke christian.be...@fu-berlin.de
# DATE: 2013-12-15

from pymol import cmd

def mpng_3d (pfx, width, height, start=1, end=-1):
	mpng_3d prefix, width, height, [start=1], [end=-1]
render stereoscopic frames sized width x height pixels.
Files will be named prefix_%04d.png.
Render frames start to end (default: all frames)
	width = int (width)
	height = int (height)
	start = int (start)
	end = int (end)
	if end == -1:
		end = cmd.count_frames ()
	outframe = start
	stereo_angle = cmd.get ('stereo_angle')
	for frame in xrange (start, end + 1):
		print Rendering frame %d (%d of %d) % (
			frame, frame - start + 1, end - start + 1)

		cmd.frame (frame)
		
		# left frame
		if cmd.get (ray_trace_frames

Re: [PyMOL] movie, ~1700 residues, out of memory

2013-11-16 Thread Christian Becke
Dear Thomas,

that did the trick! Thank you so much!


Cheers,

Christian

Am 15.11.2013 15:59, schrieb Thomas Holder:
 Hi Christian,
 
 set defer_builds_mode to 3, this will prevent caching the geometry for all 
 states.
 
 http://pymolwiki.org/index.php/Defer_builds_mode
 
 Cheers,
   Thomas
 
 On 09 Nov 2013, at 13:58, Christian Becke christian.be...@fu-berlin.de 
 wrote:
 
 Dear pymol users,

 I'm trying to create a movie, using lsqman and pymol, of a molecule of 
 ~1700 residues (HETATMs deleted, no hydrogens, alternative conformations 
 removed). I created 60 pdb files with lsqman and loaded them (as 
 different states of the molecule) into pymol. In the default lines 
 representation, pymol plays all right through all 60 frames. However, as 
 soon as I try a more fancy representation (sticks or cartoon), pymol 
 runs out of memory, recommending to reduce the quality, size, or 
 complexity of the scene (this is on Linux, pymol svn revision 4037, on 
 a Core2 Duo, NVIDIA Quadro, 4 GB RAM). From what I read, people created 
 movies of the ribosome using pymol, so ~1700 residues should not be a 
 problem, right?
 I tried reducing the viewport to stamp size (120 x 240), to no avail. 
 Which other settings should I check in order to reduce quality, size, 
 or complexity?
 I would be grateful for any hints on how to get this going.


 Thanks in advance,

 Christian


-- 
Christian Becke

Freie Universität Berlin
Fachbereich Biologie, Chemie, Pharmazie
Institut für Chemie und Biochemie
AG Strukturbiochemie

Takustr. 6
14195 Berlin
Germany

Phone: +49 (0)30 838-57344
Fax: +49 (0)30 838-56981
E-mail: christian.be...@fu-berlin.de

--
DreamFactory - Open Source REST  JSON Services for HTML5  Native Apps
OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
Free app hosting. Or install the open source package on any LAMP server.
Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
http://pubads.g.doubleclick.net/gampad/clk?id=63469471iu=/4140/ostg.clktrk
___
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


[PyMOL] movie, ~1700 residues, out of memory

2013-11-09 Thread Christian Becke
Dear pymol users,

I'm trying to create a movie, using lsqman and pymol, of a molecule of 
~1700 residues (HETATMs deleted, no hydrogens, alternative conformations 
removed). I created 60 pdb files with lsqman and loaded them (as 
different states of the molecule) into pymol. In the default lines 
representation, pymol plays all right through all 60 frames. However, as 
soon as I try a more fancy representation (sticks or cartoon), pymol 
runs out of memory, recommending to reduce the quality, size, or 
complexity of the scene (this is on Linux, pymol svn revision 4037, on 
a Core2 Duo, NVIDIA Quadro, 4 GB RAM). From what I read, people created 
movies of the ribosome using pymol, so ~1700 residues should not be a 
problem, right?
I tried reducing the viewport to stamp size (120 x 240), to no avail. 
Which other settings should I check in order to reduce quality, size, 
or complexity?
I would be grateful for any hints on how to get this going.


Thanks in advance,

Christian

--
November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models. Explore
techniques for threading, error checking, porting, and tuning. Get the most 
from the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60136231iu=/4140/ostg.clktrk
___
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