Hi Smith, and everybody who tried to help you so far, Short answer: copy and paste this into the PyMOL command line, it will save the view-transformed object to "transformed.pdb" in your home folder.
cv=list(cmd.get_view()) cmd.transform_selection("all", \ cv[0:3]+[0.0]+ \ cv[3:6]+[0.0]+ \ cv[6:9]+[0.0]+ \ cv[12:15]+[1.0], transpose=1) cmd.save('~/transformed.pdb') To comment on the many emails that have been posted so far: 1) I think you haven't used the script correct. Instead of "run save_trannsforme.py all, newpdb.pdb", you have to do "run save_transformed.py", followed by "save_transformed all, newpdb.pdb" 2) The script is actually wrong (missing transpose=1) 3) A correct solution has been posted for example here: https://sourceforge.net/p/pymol/mailman/message/27824450/ Hope that helps. Cheers, Thomas On 28 Nov 2015, at 02:52, Jordan Willis <jwillis0...@gmail.com> wrote: > Yes, but what you are describing, saving a new view is your purpose. All > orient does is move the camera. It does not do anything to the x,y,z > coordinates of the PDB. >> On Nov 27, 2015, at 11:49 PM, Smith Liu <smith_liu...@163.com> wrote: >> >> Dear Jordan, >> >> To save a new view is not my purpose, my purpose is to save a new set of >> PDB. For example, if the original PDB does not orient well by pymol by >> default, first I input "orient", and I want to save a set of new pdb, when I >> display by pymol the new pdb, it will display as "oriented“. Is any way we >> can get this oriented pdb? >> >> Smith >> >> >> At 2015-11-28 15:37:10, "Jordan Willis" <jwillis0...@gmail.com> wrote: >> get view takes in camera coordinates. You can’t open a PDB and it have know >> anything about the camera view. You will have to grab the view, save it >> somewhere, and then load it. You can’t code a view change within the PDB. >> >> >>> On Nov 27, 2015, at 11:27 PM, Smith Liu <smith_liu...@163.com> wrote: >>> >>> Dear Jordan, >>> >>> My purpose is, once you move a molecule in pymol, I want to save a new pdb, >>> when we open the new pdb, pymol will display the new position as default. >>> >>> The script is >>> >>> "# Adds the command save_transformed >>> # Usage: save_transformed object, file >>> def save_transformed(object,file): >>> m = cmd.get_view(0) >>> ttt = [m[0], m[1], m[2], 0.0, >>> m[3], m[4], m[5], 0.0, >>> m[6], m[7], m[8], 0.0, >>> 0.0, 0.0, 0.0, 1.0] >>> cmd.transform_object(object,ttt) >>> cmd.save(file,object) >>> cmd.extend('save_transformed',save_transformed)" >>> >>> shown in http://pymolwiki.org/index.php/Modeling_and_Editing_Structures >>> >>> Here I notice that once load a pdb, you move it a little, then you input >>> "get_view", you will get the matrix like >>> 0.448818117, 0.886667669, -0.111277729 >>> -0.889764965, 0.454960942, 0.036454394 >>> >>> which should be the m[0] to m[5] in the above script. >>> >>> In addition, in http://www.pymolwiki.org/index.php/Transform_odb, there is >>> also a transcript. For matrix it uses *.odb file. Is this *.odb same as >>> the get_view matrix, if not, can we convert get_view matrix to *.odb? >>> >>> Besides, in http://www.pymolwiki.org/index.php/Transform_selection there is >>> another script. >>> >>> I do not know how to use this scripts to realize my purpose. >>> >>> Smith >>> >>> >>> >>> At 2015-11-28 15:07:18, "Jordan Willis" <jwillis0...@gmail.com> wrote: >>> very possible, can you send me the script? >>>> On Nov 27, 2015, at 10:58 PM, Smith Liu <smith_liu...@163.com> wrote: >>>> >>>> By Jordan, >>>> >>>> by >>>> >>>> find ~/ -name “newpdb.pdb” or by >>>> >>>> find / -name “newpdb.pdb” >>>> >>>> still does not work. Is any possibility the original "save_transformed.py" >>>> does not work? >>>> >>>> >>>> Smith >>>> >>>> >>>> At 2015-11-28 13:11:25, "Jordan Willis" <jwillis0...@gmail.com> wrote: >>>> try running >>>> >>>> >>>> find ~/ -name “newpdb.pdb” >>>> >>>> >>>>> On Nov 27, 2015, at 9:08 PM, Smith Liu <smith_liu...@163.com> wrote: >>>>> >>>>> >>>>> Dear All, >>>>> >>>>> Osvaldo is new here for this question, so I repeat it a little. By pymol >>>>> I open a pdb and orient it and I want to save the oriented pdb. First I >>>>> input command "orient" after load the pdb, then I input command "run >>>>> save_trannsforme.py all, newpdb.pdb". I have tried to locate the >>>>> newpdb.pdb by locate newpdb.pdb or find newpdb.pdb, even as the root >>>>> user, but I cannot find the outpur newpdb.pdb. My pymol is Linux >>>>> Open-Source PyMOL 1.6.X. >>>>> >>>>> I am looking forward to getting a reply from you on how to get the >>>>> oriented pdb, which should be different from the original PDB I load. >>>>> >>>>> Smith >>>>> >>>>> >>>>> At 2015-11-28 00:44:07, "Shane Caldwell" <shane.caldwel...@gmail.com> >>>>> wrote: >>>>> Hi Smith, >>>>> >>>>> It will be in whatever folder pymol is launched from. If you launched >>>>> pymol from a specific place, it will be that folder. If not, it might be >>>>> in the system files for pymol, which will depend on your operating system >>>>> and architecture. >>>>> >>>>> Shane >>>>> >>>>> >>>>> Shane Caldwell >>>>> McGill University >>>>> >>>>> On Fri, Nov 27, 2015 at 12:59 AM, Smith Liu <smith_liu...@163.com> wrote: >>>>> Dear All, >>>>> >>>>> Once a molecule displayed in pymol, first I input command "orient", then >>>>> I input command "run save_trannsforme.py all, newpdb.pdb", I cannot get >>>>> the oriented newpdb.pdb. >>>>> >>>>> Will you please show me how to get the oriented newpdb.pdb? >>>>> >>>>> Smith >>>>> >>>>> >>>>> >>>>> At 2015-11-26 18:58:48, "Spencer Bliven" <spencer.bli...@gmail.com> wrote: >>>>> Smith– >>>>> >>>>> The code is intended to be saved to a file ("save_transformed.py") and >>>>> then loaded into pymol using `run /path/to/save_transformed.py`. There's >>>>> some general info on running pymol scripts: Simple_Scripting >>>>> Running_Scripts >>>>> >>>>> The script defines a new command which can be run e.g. `save_transformed >>>>> <object>, <file>`. You don't have to replace anything in the script >>>>> yourself. >>>>> >>>>> Note that the save_transformed command modifies the object it's run on, >>>>> so you might want to run it on a backup copy by first calling `create >>>>> <object>_backup, <object>` >>>>> >>>>> -Spencer >>>>> >>>>> On Thu, Nov 26, 2015 at 8:33 AM, Smith Liu <smith_liu...@163.com> wrote: >>>>> Dear All, >>>>> >>>>> For get view, we get something like >>>>> >>>>> set_view (\ >>>>> 0.999876618, -0.000452542, -0.015699286,\ >>>>> 0.000446742, 0.999999821, -0.000372844,\ >>>>> 0.015699454, 0.000365782, 0.999876678,\ >>>>> 0.000000000, 0.000000000, -150.258514404,\ >>>>> 11.842411041, 20.648729324, 8.775371552,\ >>>>> 118.464958191, 182.052062988, 0.000000000 ) >>>>> >>>>> For save trasformed pdb file, we need sonething like >>>>> >>>>> ttt = [m[0], m[1], m[2], 0.0, >>>>> m[3], m[4], m[5], 0.0, >>>>> m[6], m[7], m[8], 0.0, >>>>> 0.0, 0.0, 0.0, 1.0] >>>>> Will you please show me how to replace m[0], m[1].... from what we get by >>>>> get_view? Which item is which item? >>>>> >>>>> In addition, for the save_transformed.py, the last sentence is >>>>> "cmd.extend('save_transformed',save_transformed)". Should we replace the >>>>> second save_transformed with something, for example *.pdb? Ortherwise how >>>>> to get the output modified PDB? >>>>> >>>>> >>>>> I am looking forward to getting a reply from you. >>>>> >>>>> Smith >>>>> >>>>> >>>>> >>>>> At 2015-11-26 14:24:15, "Andreas Forster" <docandr...@gmail.com> wrote: >>>>> http://www.pymolwiki.org/index.php/Modeling_and_Editing_Structures >>>>> >>>>> >>>>> Andreas >>>>> >>>>> >>>>> On Thu, Nov 26, 2015 at 2:24 AM, Smith Liu <smith_liu...@163.com> wrote: >>>>> Dear Shane, >>>>> >>>>> >>>>> get_view is a nice command. Is any way to change the original PDB based >>>>> on what we get by set_view to get the new pdb? >>>>> >>>>> Smith >>>>> >>>>> >>>>> >>>>> >>>>> At 2015-11-26 03:54:32, "Shane Caldwell" <shane.caldwel...@gmail.com> >>>>> wrote: >>>>> Hi Smith, >>>>> >>>>> You can type >>>>> >>>>> >get_view >>>>> >>>>> and copy the output into a txt file for later use. The output set_view >>>>> command will return the window to the same camera settings >>>>> >>>>> Shane >>>>> >>>>> Shane Caldwell >>>>> McGill University >>>>> >>>>> On Tue, Nov 24, 2015 at 9:45 PM, Smith Liu <smith_liu...@163.com> wrote: >>>>> Dear All, >>>>> >>>>> Suppose the original PDB was not oriented. Once we have it oriented by >>>>> pymol, is any way we can save the new PDB oriented? >>>>> >>>>> Smith -- Thomas Holder PyMOL Principal Developer Schrödinger, Inc. ------------------------------------------------------------------------------ Go from Idea to Many App Stores Faster with Intel(R) XDK Give your users amazing mobile app experiences with Intel(R) XDK. Use one codebase in this all-in-one HTML5 development environment. Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs. http://pubads.g.doubleclick.net/gampad/clk?id=254741551&iu=/4140 _______________________________________________ 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