Pymol操作命令

【软件使用】PyMOL绘图 本篇基于PyMol 2.5.3版本,实测与当前最新版3.0.3基本通用 阅读详情

基本命令(也可使用鼠标操作,但不如命令来得简单)

pwd          # show current directory

dir          # list file in the current directory

cd directory #change directory 

load xxx                #注意要打上扩展名,例如1LMK.pdb,否则会errorc

reat name, (selection) #name=object to creat, selection=atom to include in the new object,非常实用的功能

Manipulating object:

show representation, (selection)

hide representation, (selection)

#the available representations are: (前面是个人比较常用的)lines, spheres, ribbon, cartoon, sticks, surface, /// mesh, dots, labels, extent

例如: stick mol1 & resi 100    # mol1为显示在pymol右边的分子名称

Turn an object on and off:(这个直接用鼠标就ok了)

enable/disable, object-name #turn on/off all representation

Basic atom selections:

name <atom names>   缩写 n.<>         例子:  show cartoon, (n. 1LDK/)

resn<residue types>       r.<>                   

resi<residue number>      i.<>

chain<chain ID>           c.<>

elem<element symbol>      e.<>

Selection algebra:就是怎么选择

交集是and、&,例如 1LDK and chain A and i. 1-103

并集是or/|,补集是not/!

Change your point of view:

zoom, (selection)  #fit the selection to screen

orient, (selection)  #align molecular axisc

enter, (selection) # size not changed

turn axis, angle #rotate camera

move axis, distance  #translate camera

Align (个人认为最重要的功能):

align (source), (target)   #the source object will be moved and rotated to fit the target object

例如: align (prot1 and chain A), (prot2 and chain B)  按整条链叠合

align mol1 & resi N1, mol2 & resi N2  按某一个残基叠合

align mol1 & resi N1-N2 & name n+ca+c+o,mol2 & resi N3-N4 & name n+ca+c+o 按某段残基的主链进行叠合

在align的过程中会产生一个root mean square deviation (RMSD),这个值可在一定程度上衡量alignment的效果。

Set control (可以通过这个命令来调整所有参数的值,可惜没有什么详细的介绍)

例如 set sphere_scale, 0.5, (n. Fe) #decrease Fe atom size to 0.5

set bg_rgb, [1,1,1] #set background as white

set ribbon_sampling, 1

Measurement (又一个十分重要的功能,可以真正挖掘结构的意义)

dist     #测量两个原子之间的距离,ctrl+右键选择第一个原子,ctrl+中键选择第二个原子,然后测量dist。

angel    # 测三个原子之间的夹角, ctrl+中键选择第三个原子,然后测量angle

dihedral #测量四个原子之间的二面角

Launching PyMOL

 

 

File for startup commands

Linux:
Whenever PyMol starts, a '.pymolrc' file containing commands is run. All you need to do is create ".pymolrc" and place it in your home directory. Alternatively, you can instead create ".pymolrc.py" which contains actual Python code instead of just PyMOL commands.

Windows:
On Windows, use 'pymolrc', 'pymolrc.py' or 'pymolrc.pym'.

Warren DeLano

 

Launching PyMOL from an external program

If PYMOL_PATH, LD_LIBRARY_PATH, and TCL_LIBRARY are correctly defined, then you can launch PyMOL from an external Python program as shown inexamples/devel/start_pymol.py.

NOTE: This approach is not recommended, since the PyMOL launching process is subject to change without warning. The recommended approach is to just use PyMOL as your python interpreter:

pymol -r <script.py>

pymol -qcr <script.py>

Warren DeLano

 

Running PyMOL in batch mode

To perform PyMOL commands from stdin (file, pipe) without opening an OpenGL window, try:

pymol -qc

 

Suppressing PyMOL output

Just type:

feedback disable,all,actions

feedback disable,all,results

-From Python:

cmd.feedback("disable","all","actions")

cmd.feedback("disable","all","results")

Will suppress most of PyMOL's normal chatter.

 

Launching Python programs

Running a Python script from PyMOL, usually the command:

run script.py

Is enough. Of course, the file script.py needs to be in the working directory.
For more detailed examples, see the commands to launch Python scripts when starting PyMOL. Asynchronous means, that a new Python thread is started:

pymol example.py     # synchronous, in PyMOL module

pymol -r example.py  # synchronous in __main__ module

pymol -l example.py  # asychronous in a new module

You can also launch python programs from within PyMOL with the commands:

run example.py        # synchronous in pymol module

run example.py,main   # synchronous in __main__ module

spawn example.py        # asychronous in a new module

spawn example.py,global # asychronous in the PyMOL module

spawn example.py,main   # asychronous in the __main__ module

Displaying biochemical Properties

 

 

Selecting secondary structures

Examples:

select helix, (ss h)

select sheet, (ss s)

select loop, (ss l+'')

 

Color by atom type from a script

The "util" module contains a number of functions that color the atoms according to type, with different colors for the C atoms. For instance,

  util.cbay three

in a .pml script will color object "three" by atom type, with the carbon atoms in yellow ("color by atom yellow").

Other functions from ../modules/pymol/util.py are cbag, cbac, cbas, cbap, cbak, cbaw and cbab (grey (carbon), cyan, salmon, purple, pink, white (hydrogen) and slate).

Lieven Buts

 

Displaying double bonds

You can try going into lines mode and turning on the valence display:

hide

show lines

set valence, 0.1

a higher value for valence spreads things out more. I don't know of a way to get the dotted notation.

Michael George Lerner

 

Calculating dihedral angles

The get_dihedral function requires four single-atom selections to work:

get_dihedral prot1///9/C, prot1///10/N, prot1///10/CA, prot1///10/C

 

Adding hydrogen bonds

Regarding H-bonds. There isn't a built-in function yet, but you can show H-bonds between two objects using atom selections so long as hydrogens are present in both molecules. If you don't have hydrogens, you can use h_add on the proteins or provide ligands with valence information and then use h_add.

Two examples are below. For clarity, they draw dashes between the heavy atoms and hide the hydrogens.

EXAMPLE 1: Show hydrogen bonds between protein and docked ligands
EXAMPLE 2: Show hydrogen bonds between two proteins
There is also a script drawing nice hydrogen bonds fromGareth Stockwell

Warren DeLano

 

Assign color by B-factor

Robert Campbell has a color_b.py python script on hisPyMOL web page that you can use.
it has a number of options including the selection and two types of colouring schemes (rainbow versus a blue-magenta-red gradient) and two types of binning of the colours (equal number of atoms in each colour or equal spacing of colours along the B-factor range).

See http://biophysics.med.jhmi.edu/rlc/work/pymol to download. There is a script 'data2bfacor' to display arbitrary data assigned to atoms as well.

Robert L. Campbell

 

Polar surface area

For a solvent accessible PSA approximation:

set dot_density, 3

remove hydro

remove solvent

show dots

set dot_solvent, on

get_area elem N+O

get_area elem C+S

get_area all

For molecular PSA approximation

set dot_density, 3

remove hydro

remove solvent

set dot_solvent, off

get_area elem N+O

get_area elem C+S

get_area all

Showing dots isn't mandatory, but it's a good idea to confirm that you're getting the value for the atom dot surface you think you're using.
Please realize that the resulting numbers are only approximate, reflecting the sum of partial surface areas for all the dots you see. To increase accuracy, set dot_density to 4, but be prepared to wait...

Warren DeLano

 

Display solvent accessible surface

Using the surface display mode, PyMOL doesn't show the solvent accessible surface, rather it shows the solvent/protein contact surface. The solvent accessible surface area is usually defined as the surface traced out by the center of a water sphere, having a radius of about 1.4 angstroms, rolled over the protein atoms. The contact surface is the surface traced out by the vdw surfaces of the water atoms when in contact with the protein.

PyMOL can only show solvent accessible surfaces using the dot or sphere representations:

for dots:

show dots

set dot_mode,1

set dot_density,3

for spheres:

alter all,vdw=vdw+1.4

show spheres

Kaushik Raha

 

Displaying the C-Alpha trace of proteins

hide

show ribbon

set ribbon_sampling,1

And if your model only contains CA atoms, you'll also need to issue:

set ribbon_trace,1

Warren DeLano

 

Displaying the Phosphate backbone of nucleic acids

Should you ever want to show the phosphate trace of a nucleic acid molecule:

def p_trace(selection="(all)"):

    s = str(selection)

    cmd.hide('lines',"("+s+")")

    cmd.hide('spheres',"("+s+")")

    cmd.hide('sticks',"("+s+")")

    cmd.hide('ribbon',"("+s+")")

    cmd.show('cartoon',"("+s+")")

    cmd.set('cartoon_sampling',1,"("+s+")")

    cmd.set('cartoon_tube_radius',0.5,"("+s+")")

cmd.extend('p_trace',p_trace)


and then:

p_trace (selection)

Luca Jovine

 

Align proteins with CA fit

If the proteins have significant homology, then you can use the align command:

align prot1////ca,prot2

which will perform a sequence alignment of prot1 against prot2, and then an optimizing fit using the CA positions. I'm not sure if the help text for align got into 0.82, but the next version will definitely have it.


Coloring molecules

   

Coloring secondary structures

Examples:

color red, ss h

color yellow, ss s

color green, ss l+''

When "the colour bleeds from the ends of helices and sheets into loops," try setting cartoon_discrete_colors to 'on' (or 1).

  set cartoon_discrete_colors, 1

or from the the "Cartoon" menu of the external GUI find "Discrete Colors" as the last item in the menu.

Robert Campbell

 

Color by atom type from a script

The "util" module contains a number of functions that color the atoms according to type, with different colors for the C atoms. For instance,

  util.cbay three

in a .pml script will color object "three" by atom type, with the carbon atoms in yellow ("color by atom yellow").

Other functions from ../modules/pymol/util.py are cbag, cbac, cbas, cbap, cbak, cbaw and cbab (grey (carbon), cyan, salmon, purple, pink, white (hydrogen) and slate).

Lieven Buts

 

Use CMYK-safe Colors

Some RGB triplets do have equivalents in CMYK space, and as a result, a figure that looks great on a screen can come out with unpredictable colors when printed.

Most applications do a good job with RGB-to-CMYK conversions for photos, but do not do such a good job with graphics that use pure primary colors. For example, reds are generally OK, but pure blues and greens do not translate very well.

Here are some RGB values that are within the CMYK gamut (i.e. are "CMYK-safe"). In general, colors in PyMOL can be assigned manually:

set_color green= [0.00 , 0.53 , 0.22]


Note that there are default atom colors such as "carbon", "nitrogen", "oxygen", "hydrogen", "sulfur", etc. which should also be redefined:

set_color carbon= [0.00 , 0.53 , 0.22]


Here's still another URL. Although the list of colors is not extensive, you can see colors:CMYK-safe RGB colors

Gil Prive, Dave Fahrney and Warren DeLano

 

Assign color by B-factor

Robert Campbell has a color_b.py python script on hisPyMOL web page that you can use.
it has a number of options including the selection and two types of colouring schemes (rainbow versus a blue-magenta-red gradient) and two types of binning of the colours (equal number of atoms in each colour or equal spacing of colours along the B-factor range).

See http://biophysics.med.jhmi.edu/rlc/work/pymol to download. There are other scripts there as well.

Robert L. Campbell

 

Creating a Color bar

To show a vertical/horizontal color bar indiacting the b-factor variation, use the scriptpseudobar.pml on the structurepseudobar.pdb, or do the following:
1. Create a pdb-file which contains CA positions only, whereas the numbers correspond to your wanted increments of colors. Be sure that CA's are separated by a contant value, say 5 Angstroem.
2. Load this new pseudobar-pdb file into PyMOL, make bonds between increment 1 and increment 2 [increment 2 and increment 3 and so on...], define/assign a smooth color for each increment (copy colors definition from automatically created colors made by b-factor script) and show the b-factor bar as lines (or sticks).

Bartholomeus Kuettner

 

Coloring insides and outsides of helices differently

Q: does anyone know how to color the inside of helices a different color than the outsides?
A:

set cartoon_highlight_color, red

Warren L. DeLano

 

Coloring all objects differently

Q: Is there a simple way to colour each object currently loaded, with a different colour?

A: There is a script color_obj.py that does the job.
The script is also available at
http://www.ebi.ac.uk/~gareth/misc

USAGE

        color_obj(rainbow=0)

        This function colours each object currently in the PyMOL heirarchy

        with a different colour.  Colours used are either the 22 named

        colours used by PyMOL (in which case the 23rd object, if it exists,

        gets the same colour as the first), or are the colours of the rainbow

Gareth Stockwell

 

List the color of atoms

To retrieve the color for a residue as identified in an expression, you can either iterate over a selection from the PyMOL command line

iterate all, print color

Alternatively, this can be done from a Python script.

Rendering molecules

 

Displaying in ball-and-stick mode

Q: I've tried several settings and commands but cannot figure out how to make a simple ball-and-stick representation of a molecule. Can it be done in Pymol?

A: Yes, but it is non-obvious:

hide lines

show sticks

show spheres

set stick_radius=0.1

set sphere_scale=0.25

You can change the two numbers above to fit preferences.

Warren DeLano

 

Adjusting width of cartoon

Try varying the following.

For strands:

cartoon_rect_length

cartoon_rect_width

For helices:

cartoon_oval_length

cartoon_oval_width

or for "fancy" helices:

cartoon_dumbell_length

cartoon_dumbell_width

cartoon_dumbell_radius  (radius of cylinder at edge of helix ribbon)

In each case "length" refers to what some might call the width and "width" refers to what some might call the thickness.

Robert Campbell

 

Calculating a partial surface

There is a, until now, undocumented way to calculate a surface for only a part of an object without creating a new one:

flag ignore, not A/49-63/, set

delete indicate

show surface

If the surface was already computed, then you'll also need to issue the command:

rebuild

Warren DeLano

 

Displaying surface inside a molecule

As far as I can tell, setting ambient to zero alone doesn't quite do the job, since some triangles still get lit by the light source.
The best combination I can find is:

set ambient=0

set direct=0.7

set reflect=0.0

set backface_cull=0

Which gives no shadows and only a few artifacts.
As an alternative, you might just consider showing the inside of the surface directly...that will create less visual artifacts, and so long as ambient and direct are sufficiently low, it will look reasonable in "ray".

util.ray_shadows("heavy")

set two_sided_lighting=1

set backface_cull=0

Warren DeLano

 

Displaying all states of a multiple model/NMR structure

Just go to the movies menue and click 'show all states'.

Jules Jacobsen

 

Displaying dashed lines between two atoms

I think the following commands will do what you want:

        select a, ///A/501/02

        select b, ///B/229/N

        distance d, a, b

This will give you a dashed line object d which is labelled with the distance between the two atoms 'a' and 'b' - you can get rid of the label using

        hide labels, d

btw, if you want to ray-trace the image, I find the dashes come out a bit fat - so I tend to use

        set dash_gap, 0.5

        set dash_radius, 0.1

before the 'ray' command.

Gareth Stockwell

·  Adjusting size of selection indicators

 

Adjusting size of selection indicators

Try:

        set selection_width, 6

        set selection_width, 7

Warren L. DeLano

 

Adjusting ray trace-image size

The pymol ray tracer can generate an image of any size.

ray height,width


Example:

ray 3000,2400

png filename.png


For more options, try 'help ray'

Evan Stein and Ben Cornett

 

Ray tracing maps

For better quality maps with a white background.

set ray_trace_fog,0

set ray_shadows,0

set antialias,1

ray 1600,1200

png img.png

(it will take quite a while...)
Then open img.png using an external image viewer. It should be high enough resolution to print nicely.

Warren DeLano

 

Nive PovRay settings

I typically use the make_pov.py script and "run" it from pymol once to load the function, and then I do "make_pov('povray.inp')" to create the povray.inp file.
Then I edit that file to insert some lines like:

fog {

  distance 10

  fog_type 2

  fog_alt 10.

  fog_offset -160.

  up <0.,1.,.4>

colour rgbt<1.0, 1.0, 1.0, 0.1>

turbulence 0.8

}

In this case I'm not really doing depth-cueing but adding fog at the lower background edge (there were two planes defining the background and a surface below the molecule) rising up towards the front upper edge of the scene.

"fog_type 2" means a "rising fog" along the "up" vector. fog_type 1 is a constant fog. To get pure depth cueing, you would want "up" to be along the <0., 0., 1.> vector (I think!). You'll need to play around with the distance and fog_offset parameters.
You wouldn't necessarily want the "turbulence" parameter in there either.
Check out "Atmospheric Effects" in the povray documentation for many more details:http://www.povray.org/documentation/view/201/

Robert Campbell

 

Making stereo pairs

Try:

ray angle=-3

png image1.png

ray angle=3

png image2.png

This is superior to using the "turn" command because it also rotates the light source. That way shadows will look right.

To make even more beautiful stereo images, use a program like Illustrator or Canvas to add the stereo/depth cued labels. This is a little tricky to describe, but I'll give it my best shot. Place the two images side by side with their centers separated by 6.0 - 6.5 cm, and aligned horizontally. Now add all your labels on the LEFT figure. select all of your labels and duplicate them. Move the duplicated labels to the RIGHT side. For clarity sake let's assume we have 3 labels on the LEFT side (a,b, and c -- we will call then aL and aR for the left and right labels, respectively). Place aL near a recognizable feature of the LEFT figure that you are trying to label. Now horizontilly align aR with aL. Now using only the L/R arrow keys move the aR label until the identical portion of the actual label (let's say the lower right hand tip of the 'a') is vertically aligned with the identical portion of your model (let's say where the C alpha-C beta bond leaves the ribbon backbone) on both the LEFT and RIGHT images. Repeat these steps for each pair of labels. This is a nice method for adding stereo labels because it does not require looking at your computer screen in wall-eyed stereo for 2 hours in order to get proper placement of labels.

By assuring that the labels are positioned in the LEFT and RIGHT images at positions that are identical with respect to the part of the model that is being labeled you automatically are also placing them so they are at the proper depth when the figure is finally viewed in stereo.

Scott Classen and Warren DeLano

 

Meaning of the get_view output

Of the 18 numbers in the output array,
0-8 is the 3x3 rotation matrix,
9-11 is the camera location,
12-14 is the origin of rotation,
15-16 are the clipping distances,
and 17 is the orthoscopic flag.

Robert Campbell, Paolo Martel and Warren

 

Viewing direction vectors

Create a python script (I call it axes.py):

# axes.py

from pymol.cgo import *

from pymol import cmd

from pymol.vfont import plain

# create the axes object, draw axes with cylinders coloured red, green,

#blue for X, Y and Z

obj = [

   CYLINDER, 0., 0., 0., 10., 0., 0., 0.2, 1.0, 1.0, 1.0, 1.0, 0.0, 0.,

   CYLINDER, 0., 0., 0., 0., 10., 0., 0.2, 1.0, 1.0, 1.0, 0., 1.0, 0.,

   CYLINDER, 0., 0., 0., 0., 0., 10., 0.2, 1.0, 1.0, 1.0, 0., 0.0, 1.0,

   ]

# add labels to axes object (requires pymol version 0.8 or greater, I

# believe

cyl_text(obj,plain,[-5.,-5.,-1],'Origin',0.20,axes=[[3,0,0],[0,3,0],[0,0,3]])

cyl_text(obj,plain,[10.,0.,0.],'X',0.20,axes=[[3,0,0],[0,3,0],[0,0,3]])

cyl_text(obj,plain,[0.,10.,0.],'Y',0.20,axes=[[3,0,0],[0,3,0],[0,0,3]])

cyl_text(obj,plain,[0.,0.,10.],'Z',0.20,axes=[[3,0,0],[0,3,0],[0,0,3]])

# then we load it into PyMOL

cmd.load_cgo(obj,'axes')


Then you just need to do "run axes.py" from the pymol command line.

You can modify the "3" in the above description of the text labels to change the size of the labels. If you are running a version of pymol older the 0.8, then you cannot add the text (that's why I included colour coding of the axes). You can also use just lines instead of cylinders if you wish:

obj = [

   BEGIN, LINES,

   COLOR, 1.0, 0.0, 0.0,

   VERTEX, 0.0, 0.0, 0.0, VERTEX, 10.0, 0.0, 0.0,

   COLOR, 0.0, 1.0, 0.0,

   VERTEX, 0.0, 0.0, 0.0, VERTEX, 0.0, 10.0, 0.0,

   COLOR, 0.0, 0.0, 1.0,

   VERTEX, 0.0, 0.0, 0.0, VERTEX, 0.0, 0.0, 10.0,

   END,

   ]


would work as well to define the axes object.

 

Ray-traceable labels

You can use the cgo text (line or cylinder versions) as I mentioned in my reply about drawing the xyz axes, but be warned that the labels rotate with your molecule, so getting them oriented perpendicular to the view may be a pain (unless there is something I've missed).

Warren's example from a previous reply of his (cgotext.py):

# draw text using cgo

from pymol import cmd

from pymol.cgo import *

from pymol.vfont import plain

cgo = []

axes = [[2.0,0.0,0.0],[0.0,2.0,0.0],[0.0,0.0,2.0]]

pos = [0.0,0.0,0.0]

wire_text(cgo,plain,pos,'Hello World',axes)

pos = [0.0,-3.0,0.0]

cyl_text(cgo,plain,pos,'Hello Universe',0.10,axes=axes)

cmd.set("cgo_line_radius",0.03)

cmd.load_cgo(cgo,'txt')

cmd.zoom("all",2.0)

Robert Campbell

 

CGO label orientation

You could use the cmd.rotate andcmd.translate to position the labels, but it is likely to be somewhat painful. If I'm not mistaken, the rotation will always be about and axis through the origin and so you may need to translate the label into the correct position.

Thus if you have your label in an object called 'text', you could do,

  cmd.rotate(axis='x',angle=20.,object='text')

and repeat this with different angles, until you get the orientation correct. Then use:

  cmd.translate(vector='[1.,2.,3.]',object='text')

(using the appropriate vector, of course!) to position the label.
Not ideal, but if it is sufficiently important, it can be done!

Modeling with PyMOL

 

Saving with transformed coordinates

Here is a simple script that saves the molecule with coordinates from the current orientation.
(invoke it with 'run save_transformed.py' and type the new save_transformed.py command thereafter).

Paulo Martel

 

Translate or rotate individual objects

There is a "translate" function similar to "rotate", the docs for these don't exist yet, because the implementation isn't finished. However, feel free to use them in the following forms:

translate vector,object-name,state

   (vector needs to be something like [x,y,z])

   translate [1,0,0],pept

rotate axis,angle,object-name,state

   (axis can be either the letter x,y,z or a 3D vector [x,y,z])

   rotate x,90,pept

   rotate [1,1,1],10,pept

Warren DeLano

 

Moving one segment relative to the rest

This means moving two parts of one object into different directions. The easiest way to do this is to split the objects and then use the rotate command.
EXAMPLE: split.pml

Warren DeLano

 

Split states to objects

There is also a new command in the 0.95 series:

   split_states object-name

which will spread a PDB "biological unit" (or any multi-state object -- including SD files) over a series of independent objects. This makes it possible to interact with such objects more naturally than with "all_states = 1".

Warren DeLano

 

Altering secondary structures:

Examples:

alter A/10:34/, ss='H'

alter A/35:40/, ss='L'

alter A/41:60/, ss='S'

 

Altering van der Waals radii

Example:

alter (elem Fe),vdw=1.8

rebuild

(The value for Fe is wrecked in PyMOL at the moment, so running the above line might be a good idea).

Warren DeLano

 

Altering atom coordinates

Example:

alter_state 1,(pdb1cse),x=x-10.0

The latter section can contain formulae involving at least the xyz coordinates, lots of constants and the (+-*/) operators.

 

Deleting bonds

Select the bond using Ctrl-right-click, then either

unbond pk1,pk2

or hit Ctrl-D.

Warren DeLano

 

Converting D- to L- amino acids

The inversion function was changed in version 0.95 to take advantage of multiple picked atoms. To invert a center, Ctrl-middle-click to pick the center atom as pk1 and two stationary atoms as pk2 and pk3. Then type Ctrl-E to invert.

Warren DeLano

 

Adding disulfide bonds

You can use the "bond" command to attach them:

bond 24/sg,26/sg

bond 56/sg,99/sg

unpick

(unpick will hide the bond baton which gets displayed.)
Additionally, the residue names can be changed for bonded cysteines:

alter cys/,name='CYX'

or for specific residues

alter 24+26+56+99/,name='CYX'

Warren DeLano

 

Adding hydrogen bonds

Regarding H-bonds. There isn't a built-in function yet, but you can show H-bonds between two objects using atom selections so long as hydrogens are present in both molecules. If you don't have hydrogens, you can use h_add on the proteins or provide ligands with valence information and then use h_add.

Two examples are below. For clarity, they draw dashes between the heavy atoms and hide the hydrogens.

EXAMPLE 1: Show hydrogen bonds between protein and docked ligands
EXAMPLE 2: Show hydrogen bonds between two proteins
There is also a script drawing nice hydrogen bonds fromGareth Stockwell

Warren DeLano

 

Protonating ligands

If your ligands come in with valid valencies and formal charges, PyMOL's h_add command can protonate ligands. (NOTE that there is a minor technical hiccup with SD-files which are loaded by default as immutable "discrete" objects.) Suffice it to say that in order to make changes to the chemical structure, an object must be loaded with the "discrete" flag set to zero.
Unfortunately, much of the molecular editing stuff remains to be documented. Here's an example sequence, but I'm not sure it will help to much...as indicated in the manual, this is immature functionality with some major gaps. Attach in particular is very limited...

# show valences

set valence=0.05

# load cysteine fragment

fragment cys

# remove hydrogens

remove (hydro)

# edit gamma S

edit cys////sg

# add hydrogen

attach H,1,1

# add planer, trivalent nitrogen onto C terminus

edit cys////C

attach N,3,3

# edit that nitrogen

edit (elem N and neighbor cys////C)

# attach a tetrahedral methyl (note random position)

attach C,4,4

# here's an example of adding a whole residue from the library

edit cys////N

editor.attach_amino_acid("pk1","ace")

# now restore missing hydrogens (note that the names are off...)

h_add

Warren DeLano

 

Superposition of two molecules

Using pair_fit requires that you specify a set of paired atoms in each structure. Fortunately, you no longer have to specify each pair separately, so long as the ordering is the same in each selection (almost always true).

pair_fit ( trna10 and resid 10:15 and name P ), ( ref4 and resid 10:15 and

name P )

Another example:

pair_fit prot1///11-26/CA, prot2///34-49/CA

would superimpose prot1 on prot2 using C-alphas from residues 11-26 in prot1 and 34-49 in prot2.

Movies with PyMOL

 

Encoding video files

Assuming you have created a lot of .png files and would like to encode a .mpeg, .avi or other video format, a number of solutions are known:

  • The DiVX encoder using mplayer/mencoder? There's binaries for Unix and Windows. It makes rather nice compression on a 800x600 (probably higher). It doesn't take too long to produce the nicer quailty movies, but much longer than simply

·mencoder "mf://*.png" -mf type=png:fps=18 -ovc lavc -o output.avi

·

·Another good program for converting images into movies of different formats isVideoMach : http://gromada.com/VideoMach.html

·

·

·

·TMPGEnc from http://www.tmpgenc.net/ is very fast, easy to use, and produces very nice ouput (MPEG-2). Unfortunately, it does not handle images larger than 720 x 576 pixels.

·

·

·

·The latest Adobe Premiere recipe:

·   Microsoft's MPEG4 V2, 960x720 @ 30 fps, which PowerPoint automatically

·treats as full-screen (due it's wacky metrics).

·

·Using this codec, a recent 24-second movie consumed only 4.5 MB of space,

·but looks much better than a 640x480 Cinepak-based movie with a file size of

·around ~40 MB.  It definitely pays to use the latest technology

·

·

·

·A freeware jiffy to convert png files to an animation isimgcon,

·which proved to be very useful:http://www.fmrib.ox.ac.uk/~yongyue/imgcondl.html

·

·

Advanced PyMOL features

 

Meaning of the get_view output

Of the 18 numbers in the output array,
0-8 is the 3x3 rotation matrix,
9-11 is the camera location,
12-14 is the origin of rotation,
15-16 are the clipping distances,
and 17 is the orthoscopic flag.

Robert Campbell, Paolo Martel and Warren

 

Altering atom coordinates

Example:

alter_state 1,(pdb1cse),x=x-10.0

The latter section can contain formulae involving at least the xyz coordinates, lots of constants and the (+-*/) operators.

 

Translate or rotate individual objects

There is a "translate" function similar to "rotate", the docs for these don't exist yet, because the implementation isn't finished. However, feel free to use them in the following forms:

translate vector,object-name,state

   vector needs to be something like [x,y,z]

   translate [1,0,0],pept

rotate axis,angle,object-name,state

   axis can be either the letter x,y,z or a 3D vector [x,y,z]

   rotate x,90,pept

   rotate [1,1,1],10,pept

Warren DeLano

 

Moving one segment relative to the rest

This means moving two parts of one object into different directions. The easiest way to do this is to split the objects and then use the rotate command.
EXAMPLE: split.pml

Warren DeLano

 

What is in a selection?

Atom selections aren't directly exposed to Python, but you can have PyMOL build a Python list containing whatever information you need:

Using PyMOL commands:

list=[]

iterate (name ca),list.append((resi,resn))

print list

[('ASP', '1'), ('CYS', '2'), ('ALA', '3'), ('TRP', '4'), ('HIS', '5'), ('LEU',

'6'), ('GLY', '7'), ('GLU', '8'), ('LEU', '9'), ('VAL', '10'), ('TRP', '11'),

('CYS', '12'), ('THR', '13')]

or using a Python script (in PyMOL):

from pymol import cmd,stored

stored.list=[]

cmd.iterate("(name ca)","stored.list.append((resi,resn))")

print stored.list

[('1', 'ASP'), ('2', 'CYS'), ('3', 'ALA'), ('4', 'TRP'), ('5', 'HIS'), ('6', '

LEU'), ('7', 'GLY'), ('8', 'GLU'), ('9', 'LEU'), ('10', 'VAL'), ('11', 'TRP'),

('12', 'CYS'), ('13', 'THR')]

Warren DeLano

 

How does the Density Wizard work?

The answer:

·  Load a map

·  Load a model structure

·  Activate the Density Wizard

·  Control-middle click to pick any atom in the model to get the map drawn about it. Each of the blue rows in the Wizard is a pop-up menu. You can select multiple or different maps to be displayed at different levels as you traverse the model.

Warren DeLano

 

What the heck is molecular sculpting?

Molecular sculpting works like a real-time energy minimizer, except that it isn't minimizing the energy. Instead, its just trying to return local atomic geometries (bonds, angles, chirality, planarity) to the configuration the molecules possess when they were first loaded into PyMOL.

To actually use this feature:

  1. Load a PDB file.
  2. Configure the mouse for editing (Mouse menu) or click in the mouse/key matrix box.
  3. Select "auto-sculpting" from the Sculpting menu.
  4. Select Sculpting from the Wizard menu.
  5. Ctrl-middle-click on any atom in your protein to activate sculpting
    the green part will be free to move
    the cyan part will be a fixed cushion to provide context
    the grey part will be excluded.
  6. Now perform any conformational editing operation in the green region such as:
    ctrl-left-click-and-drag on an atom
    ctrl-right-click on a bond, then ctrl-left-click-and-drag about that bond.

You can adjust the radius and cushion using the blue pop-up menus.

Right now I'm not sure the sculpting feature is more than entertainment, but my expectation is that it will become part of PyMOL's crystallographic model building system in the future.

Warren DeLano

 

Align proteins with CA fit

If the proteins have significant homology, then you can use the align command:

align prot1////ca,prot2

which will perform a sequence alignment of prot1 against prot2, and then an optimizing fit using the CA positions. I'm not sure if the help text for align got into 0.82, but the next version will definitely have it.

Python scripting

   

Launching Python programs

1. Running a Python script from PyMOL, usually the command:

run script.py

Is enough. Of course, the file script.py needs to be in the working directory.
You can also launch Python scripts when starting PyMOL. Asynchronous means, that a new Python thread is started:

pymol example.py     # synchronous, in PyMOL module

pymol -r example.py  # synchronous in __main__ module

pymol -l example.py  # asychronous in a new module

You can also launch python programs from within PyMOL with the commands:

run example.py        # synchronous in pymol module

run example.py,main   # synchronous in __main__ module

spawn example.py        # asychronous in a new module

spawn example.py,global # asychronous in the PyMOL module

spawn example.py,main   # asychronous in the __main__ module

2. Running PyMOL from a Python script requires two commands:

import pymol

pymol.finish_launching()

 

Using the PyMOL commandline

Are you aware that the PyMOL command line is also a Python command line? You can just use PyMOL interactively in that fashion.

PyMOL>print 1+1

2

PyMOL>from random import random

PyMOL>print random()

0.739460642143

The only major difference is that the default namespace for PyMOL is "pymol" not "__main__"

PyMOL>print __name__

pymol

Warren DeLano

 

What is in a selection?

Atom selections aren't directly exposed to Python, but you can have PyMOL build a Python list containing whatever information you need:

Using PyMOL commands:

list=[]

iterate (name ca),list.append((resi,resn))

print list

[('ASP', '1'), ('CYS', '2'), ('ALA', '3'), ('TRP', '4'), ('HIS', '5'), ('LEU',

'6'), ('GLY', '7'), ('GLU', '8'), ('LEU', '9'), ('VAL', '10'), ('TRP', '11'),

('CYS', '12'), ('THR', '13')]

or using a Python script (in PyMOL):

from pymol import cmd,stored

stored.list=[]

cmd.iterate("(name ca)","stored.list.append((resi,resn))")

print stored.list

[('1', 'ASP'), ('2', 'CYS'), ('3', 'ALA'), ('4', 'TRP'), ('5', 'HIS'), ('6', '

LEU'), ('7', 'GLY'), ('8', 'GLU'), ('9', 'LEU'), ('10', 'VAL'), ('11', 'TRP'),

('12', 'CYS'), ('13', 'THR')]

Warren DeLano

 

Does a selection exist?

The function below will return true if the selection is defined.

from pymol import cmd

from types import *

def sele_exists(sele):

    sess = cmd.get_session()

    for i in sess["names"]:

        if type(i) is ListType:

            if sele==i[0]:

                return 1

    return 0

Igor Pechersky

 

Get coordinates from Python

The actual C-langauge arrays aren't exposed, but there are at least three different ways you can modify coordinates from within Python:

·  You can get a python object which contains the molecular information, modify the coordinates in that object, load the modified molecule into PyMOL, update the modified coordinates to the original model, and then delete the modified object. (Example in a python script)

·  Another approach is the "alter_state" function, which can perform the same transformation in a single PyMOL command statement:

alter_state 1,pept,(x,y)=(-y,x)

Likewise sub-selections can be transformed as well:

alter_state 1,(pept and name ca),(x,y,z)=(x+5,y,z)

·  A third approach is to use alter_state with the global "stored" object:Example in a Python script) Approaches 2 gives the best performance, approach 3 gives more flexibility, and approach 1 gives you a reusable and fully modifiable Python object.

Warren DeLano

 

Create objects from PDB strings

I thought I'd post this example, just in case anyone else cares about this:

delete all

cmd.read_pdbstr("""HEADER    CREATED BY CONVERTPROSPECT              27-JAN-02   2tnf  \

REMARK   1                                                                       \

ATOM      1  N   PRO A   9       1.895  67.213 -38.182  1.00  0.00           N   \

ATOM      2  CA  PRO A   9       1.703  68.680 -38.402  1.00  0.00           C   \

....

ATOM   1153  C   GLY A 157       6.927  59.108 -38.901  1.00  6.00           C   \

ATOM   1154  O   GLY A 157       6.700  59.292 -37.676  1.00  6.00           O   \

TER    1155      GLY A 157                                                       \

MASTER                                                                           \

END                                                                              \

""","2tnfa")

hide all

show cartoon

color grey

....

Reece Hart

 

Measure distances from Python

Use Python (and the run command with .py files).

from pymol import cmd

f=open('dist.txt','w')

dst=cmd.distance('tmp','mol1///25/ha','mol1///26/ha')

f.write("%8.3f\n"%dst)

f.close()

You could measure the whole protein this way by putting a loop around the distance command:

from pymol import cmd

f=open('dist.txt','w')

atom = cmd.get_model("mol1////ha").atom

for i in range(len(atom)-1):

   sele1 = 'mol1///%s/HA'%atom[i].resi

   sele2 = 'mol1///%s/HA'%atom[i+1].resi

   dst=cmd.distance('tmp',sele1,sele2)

   f.write("%14s %14s %8.3f\n"%(sele1,sele2,dst))

f.close()

The output "dist.txt" would then look like:

   mol1///4/HA    mol1///5/HA    4.748

   mol1///5/HA    mol1///6/HA    4.828

   mol1///6/HA    mol1///7/HA    4.861

   mol1///7/HA    mol1///8/HA    4.784

   mol1///8/HA    mol1///9/HA    4.936

   mol1///9/HA   mol1///10/HA    4.833

  mol1///10/HA   mol1///11/HA    4.933

  mol1///11/HA   mol1///12/HA    4.813

Warren DeLano

 

Coloring all objects differently

Q: Is there a simple way to colour each object currently loaded, with a different colour (in the same way that you can colour each chain in a molecule differently)? This would be really useful in visualising a set of superposed structures.

A: There is a script color_obj.py that does the job.
The script is also available at
http://www.ebi.ac.uk/~gareth/misc

USAGE

        color_obj(rainbow=0)

        This function colours each object currently in the PyMOL heirarchy

        with a different colour.  Colours used are either the 22 named

        colours used by PyMOL (in which case the 23rd object, if it exists,

        gets the same colour as the first), or are the colours of the rainbow

Gareth Stockwell

 

List the color of atoms

To retrieve the color for a residue as identified in an expression, you can either iterate over a selection from the PyMOL command line

iterate all, print color

Alternatively, this can be done from aPython script.

import pymol

pymol.color_list = []

cmd.iterate('all', 'pymol.color_list.append(color)')

print pymol.color_list

Warren DeLano

 

List secondary structures

Secondary structures (both predefined and those calculated with the 'dss' command) can be exported as a long string ('HHHHLLLLSSS') with the following script:

import pymol

pymol.stored_ss = []

cmd.iterate('all', 'pymol.stored_ss.append(string.ljust(ss,1))')

print string.join(pymol.stored_ss)

Warren DeLano

 

Process key events from shell

The following scripts turns the view 30 deg around the y-axis, each time you press the enter key in the python shell (the original shell you started pymol from), just as an example:

#use "spawn spawn_demo.py, local" to invoke this python script from

within pymol

wait=""

i=0

while i < 12 and wait!="x":

  cmd.turn("y", 30)

  print "Press enter key to continue or x + enter to terminate"

  wait=raw_input()

  i=i+1

print "Done"

Markus Meier

 

Alter key bindings

It's not GUI, but you could simply bind a function key such as F1 to a command:

cmd.set_key('F1',lambda :cmd.show('sticks'))

Warren DeLano

 

Viewing direction vectors

Create a python script (I call it axes.py):

# axes.py

from pymol.cgo import *

from pymol import cmd

from pymol.vfont import plain

# create the axes object, draw axes with cylinders coloured red, green,

#blue for X, Y and Z

obj = [

   CYLINDER, 0., 0., 0., 10., 0., 0., 0.2, 1.0, 1.0, 1.0, 1.0, 0.0, 0.,

   CYLINDER, 0., 0., 0., 0., 10., 0., 0.2, 1.0, 1.0, 1.0, 0., 1.0, 0.,

   CYLINDER, 0., 0., 0., 0., 0., 10., 0.2, 1.0, 1.0, 1.0, 0., 0.0, 1.0,

   ]

# add labels to axes object (requires pymol version 0.8 or greater, I

# believe

cyl_text(obj,plain,[-5.,-5.,-1],'Origin',0.20,axes=[[3,0,0],[0,3,0],[0,0,3]])

cyl_text(obj,plain,[10.,0.,0.],'X',0.20,axes=[[3,0,0],[0,3,0],[0,0,3]])

cyl_text(obj,plain,[0.,10.,0.],'Y',0.20,axes=[[3,0,0],[0,3,0],[0,0,3]])

cyl_text(obj,plain,[0.,0.,10.],'Z',0.20,axes=[[3,0,0],[0,3,0],[0,0,3]])

# then we load it into PyMOL

cmd.load_cgo(obj,'axes')


Then you just need to do "run axes.py" from the pymol command line.

You can modify the "3" in the above description of the text labels to change the size of the labels. If you are running a version of pymol older the 0.8, then you cannot add the text (that's why I included colour coding of the axes). You can also use just lines instead of cylinders if you wish:

obj = [

   BEGIN, LINES,

   COLOR, 1.0, 0.0, 0.0,

   VERTEX, 0.0, 0.0, 0.0, VERTEX, 10.0, 0.0, 0.0,

   COLOR, 0.0, 1.0, 0.0,

   VERTEX, 0.0, 0.0, 0.0, VERTEX, 0.0, 10.0, 0.0,

   COLOR, 0.0, 0.0, 1.0,

   VERTEX, 0.0, 0.0, 0.0, VERTEX, 0.0, 0.0, 10.0,

   END,

   ]


would work as well to define the axes object.

 

Ray-traceable labels

You can use the cgo text (line or cylinder versions) as I mentioned in my reply about drawing the xyz axes, but be warned that the labels rotate with your molecule, so getting them oriented perpendicular to the view may be a pain (unless there is something I've missed).

Warren's example from a previous reply of his (cgotext.py):

# draw text using cgo

from pymol import cmd

from pymol.cgo import *

from pymol.vfont import plain

cgo = []

axes = [[2.0,0.0,0.0],[0.0,2.0,0.0],[0.0,0.0,2.0]]

pos = [0.0,0.0,0.0]

wire_text(cgo,plain,pos,'Hello World',axes)

pos = [0.0,-3.0,0.0]

cyl_text(cgo,plain,pos,'Hello Universe',0.10,axes=axes)

cmd.set("cgo_line_radius",0.03)

cmd.load_cgo(cgo,'txt')

cmd.zoom("all",2.0)

Robert Campbell

 

CGO label orientation

You could use the cmd.rotate andcmd.translate to position the labels, but it is likely to be somewhat painful. If I'm not mistaken, the rotation will always be about and axis through the origin and so you may need to translate the label into the correct position.

Thus if you have your label in an object called 'text', you could do,

  cmd.rotate(axis='x',angle=20.,object='text')

and repeat this with different angles, until you get the orientation correct. Then use:

  cmd.translate(vector='[1.,2.,3.]',object='text')

(using the appropriate vector, of course!) to position the label.
Not ideal, but if it is sufficiently important, it can be done!

Robert Campbell

 

3D marks on atoms

Here's a script graph.py which can be used to put marks on the positions of every atom in a selection. There are several types of marks included now, e.g. cube, rhombic dodecahedron, tetrahedron, plus and star. Using a matrix operator these can be extended a bit, to 2D counterparts for example, or to elongated or rotated shapes. I should still include some documentation but in brief the usage is as follows:

graph selection = '(all)', shape = 'plus' | 'sphere' | 'star' | 'tetrahedron' | 'dodecahedron', size = 1, r = 0.10, rgb1 = [1,0,0], rgb2 = [0,0,1], mtx = [[1,0,0],[0,1,0],[0,0,1]], name = "graph"

Selection should be obvious, as is shape. Size is a relative indicator for the size, though at present I haven't fixed things such that a size 1 tetrahedron matches a size 1 dodecahedron. r is the radius of the lines. rgb1 and rgb2 are the start and end color for each line. mtx is the matrix operator, which works on the original shape centered around the origin (before translation to the point of the atom from the selection).

Tserk Wassenaar

 

Save and load objects

There is a convenient format: ".pkl", that works like PDB, but is a Pickled copy of the PyMOL Model Class. The main advantage this has over .pdb is that it saves and restores extra properties such as secondary structure code, atom types, van der waals radii, formal and partial charges, etc.

load myprot.pdb

dss

show cartoon

alter 100-110/, ss='H'

alter 65-67,ss='L'

save myprot.pkl

... quit program, complete your PhD, take a vacation, and come back...

load myprot.pkl

show cartoon

will work.

".pkl" has the additional advantage of being a simple molecular object useful in straight Python, outside of PyMOL. All you need to do is have a copy of PyMOL's "chempy" module available in your PYTHONPATH

from chempy import io

model = io.pkl.fromFile("myprot.pkl")

for atom in model.atom:

   print atom.name

Warren DeLano

 

Building ChemPy models

This is a snap. Just "run" the following Python program from within PyMOL.

from chempy.models import Indexed

from chempy import Bond, Atom

from whrandom import random

from pymol import cmd

model = Indexed()

# create some atoms

for a in range(1,11):

   at = Atom()

   at.name = "X%02d"%a

   at.coord = [random()*5,random()*5,random()*5]

   model.atom.append(at)

# now create some bonds

for a in range(1,10):

   bd = Bond()

   bd.index = [a-1,a] # zero-based indices!

   model.bond.append(bd)

# now load and label

cmd.load_model(model,"example")

cmd.label("example","name")



http://blog.sciencenet.cn/blog-355217-279196.html

PyMOL绘图 PyMOL绘图安装PyMOLPyMOL的命令行我用的plot.pml文件批量画图其他问题 但凡是做结构生物学的或者是CADD的人应该都不会陌生PyMOL。简要记录一下PyMOL绘图的小过程,方便以后查阅。 PyMOL虽然有很方便的图形化界面,但是当批量画图的时候还是会很头疼。最近把之前跑的分子动力学的结果的代表构象都画个图,发现有210个图。画了两天终于画完了,但是发现文件名命名的时候竟然出了问题... 阅读详情

相关推荐

PyMol - script

从大二开始接触PyMol至今已有4年了,之前只会用PyMol展示PDB文件。记得有一回需要找蛋白质所有催化残基3.6埃以内的活性位点。想到PyMol打开PDB文件时肯定已经完成了解析,就想写一个脚本拿到感兴趣的位点然后遍历所有原子坐标找到3.6埃以内的残疾。由于对PyMol不是很熟悉,这个想法在脑海中闪现之后就夭折了。后来我写了个C++程序,从PDB文件开始解析,真是废了九牛二虎之力,现在想想,当时

苦逼的屌丝 1万+

PyMOL测量蛋白质中两个原子或残基空间距离

二、点击菜单栏中的Wizard->Measurement 就可以进行距离测量。然后分别选择两个2个原子就可以显示这2个原子的距离。一、 以PDB:4hbk为例,打开PyMOL运行命令载入蛋白(也可以直接 .pdb格式导入)2. 鼠标点击TYR48侧链上的O原子 和 LYS77 侧链上面的N原子;4. 测定完成后,点击Measurement 面板中的done 就可以了。3. 如要测定其他2个原子的距离,鼠标继续点击选择2个原子就可以了;在Pymol中实现两个原子间的空间距离测量。

PiDianBiJi的博客 3229

PyMOL作图:同时显示“Cartoon“ + “Surface“

用PyMol做出好看的图~

MurphyStar的博客 8191

Pymol使用技巧

一些pymol使用技巧汇总

Eumenidus的博客 1万+

PyMOL简单操作图文介绍

关于PyMoL简单的命令行操作及鼠标操作。 PyMOL 可以参考这篇文章: https://cloud.tencent.com/developer/news/338169 提示:以下是本篇文章正文内容,下面案例可供参考 一、pandas是什么? 示例:pandas 是基于NumPy 的一种工具,该工具是为了解决数据分析任务而创建的。 二、使用步骤 1.引入库 代码如下(示例): import numpy as np import pandas as pd import matpl

Obsidian_wz的博客 5971

pymol pymol-align两分子或蛋白距离误差计算RMSD;spyrmsd库计算RMSD

参考:https://zhuanlan.zhihu.com/p/347743101RMSD单位是埃 RMSD,root-mean-square deviation,也就是均方根偏差。原子位置的均方根偏差是叠加蛋白质的原子(通常是骨架原子)之间的平均距离的量度。注意,RMSD计算可以应用于其他非蛋白质分子,如小的有机分子。在球状蛋白质构象的研究中,通常在刚体进行完叠加后通过计算Cα原子坐标之间的RMSD来表征三维结构的相似性。

weixin_42357472的博客 9539

PyMOL中常用的命令列表

以下是一个完整的PyMOL操作流程,包含加载文件、去除水分子、设置颜色、展示小分子和蛋白质的相互作用、标记名称、添加透明背景以及保存超清4K图像的所有步骤。这里假设蛋白质和小分子分别存储在不同的PDB文件中。:选择小分子与蛋白质之间的相互作用区域(例如,5 Å内的原子)。:标记小分子名称和关键残基,以便更好地了解相互作用。:标记小分子和蛋白质之间的距离,以量化相互作用强度。:可以用不同样式展示蛋白质和小分子,使其更易识别。:检测氢键和疏水作用,并自动添加连线。:对选定的分子区域应用不同的显示样式。

itwangyang520的博客 1万+

pdb文件两个原子距离计算代码;sdf rdkit计算原子距离Get3DDistanceMatrix

参考:https://www.qumuban.com/64233.html*** 直接方法可以通过pymol距离插件选择计算。

weixin_42357472的博客 1369

Pymol一些命令及使用小技巧

pymol 选择对接的分子5A 范围内的氨基酸残基 create pocket, byres 4dxd within 5 of resn 9pc (这条命令的目的就是以残基9pc为中心,在4dxd这个蛋白质里找出跟9pc距离在5 A的氨基酸,生成一个pocket, 9pc这个残基是4dxd这个蛋白质晶体中的一个配体) 或者下面的命令 select 5Alig, byres lig around 5 show sticks, 5Alig 选择残基100.102,108-111 select res, resi

xiaolan39的博客 2万+

[0352]基于JAVA的停车场收费智慧管理系统的设计与实现

其次,从经营管理层面考虑,本系统涵盖了丰富的月卡管理和财务结算功能,如月卡用户管理、缴费、注销、挂失、解挂、补办等全流程服务,以及临保和月保的结算汇总与欠费查询等功能,这不仅有助于规范停车场的日常运营管理,更能有效提高财务管理效率,降低运营成本,实现精细化、数字化的财务管控。综上所述,本课题计划研发的基于Java的停车场收费智慧管理系统将在现有研究成果的基础上,重点优化月卡用户全生命周期管理和财务统计分析功能,以满足现代停车场高效、精准、安全的管理需求,紧跟行业发展趋势,为推动智慧城市的建设贡献一份力量。

muyu2980的专栏 589

iSLIP算法实战:如何用Python模拟交换机优先级匹配(附完整代码)

本文详细介绍了如何使用Python实现iSLIP算法,模拟交换机优先级匹配过程。通过核心的指针滑动逻辑和迭代循环策略,构建了一个完整的iSLIP算法模拟器,并加入可视化模块以直观展示匹配过程。文章还提供了完整的代码框架和性能优化建议,适合网络工程师和Python开发者直接集成到测试环境中。

weixin_29313239的博客 251

【转载】pymol教程!

链接: lPyMOL入门基础--分子三维结构可视化教程(上篇) - 知乎 (zhihu.com)

请多多指教 239

以高通camera 申请ion内存看dma-buf

1 fd 与ion buffer, file绑定 简单总结就是申请一个buffer,再创建一个dmabuf 结构体然后将,然后将dmabuf中得指针指向buffer,dmabuf 再传递给一个匿名的inode,获取到一个file,这样file和dmabuf绑定起来,也就和buffer关联上。然后再从进程中分配一个空闲的fd,将fd 和file囊绑定。这样就能通过fd 快速查找到buffer。file 是个全系统的,他和进程无关,但是fd 是每个进程都是自己独立的,所以再跨进程传输时只需要保证fd ...

兔兔里个花兔的博客 6444

PyMOL开源版的安装教程

PyMOL是一款用于蛋白质结构可视化,可进行蛋白互作分析、蛋白与分子对接、及药物设计等。以下是开源PyMOL软件的安装流程。如果对你有帮助的话麻烦点个关注加收藏啊,谢谢!!!安装PyMOL之前必须安装python,另外需要注意PyMOL的开源版本必须同python保持抑制,否则无法正常使用PyMOL。我是用的是python 3.12 Download Python | Python.orgThe official home of the Python Programming Languagehttps://

weixin_50727264的博客 1万+

让 ABAP 内表真正释放内存:从 CLEAR、FREE 到打破 Table Sharing 的实战技巧

ABAP内表内存管理的关键在于理解其运行时结构:DELETE操作仅逻辑删除行而不会释放内存,CLEAR或FREE才能真正回收内存。常见的误区包括误判空表状态和忽视内表共享机制。实际应用中,大表筛选后应采用VALUE表达式或逐行插入方式重建表体以释放内存。典型案例显示,正确处理内表内存可显著降低SAP Gateway和批处理程序的内存消耗,提升系统稳定性。开发时需结合调试工具观察内存状态,避免因共享机制导致无效回收。

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 324

PMSM控制系列文章进阶-8.电流、角度采样及其同步

摘要:本文分析了高低压电机在电流和角度采样中的不同方案选择。高压电机采用霍尔传感器和旋变进行隔离采样,低压电机则使用shunt电阻和磁编码器以降低成本。重点讨论了采样时间补偿问题:电流采样需与PWM周期同步,角度采样需考虑传感器延迟;通过park变换和反park变换时需补偿采样与发波的时间差,提出了通过测试母线电流或Ud变化来验证补偿时间准确性的方法。文中还介绍了对传感器信号进行软解码处理的方法,包括消除直流偏置、增益误差和正交误差等参数的自学习过程。

weixin_41343701的博客 613

【PyMOL】使用PyMOL制作单分子MD模拟的轨迹动画

使用PyMOL制作GROMACS分子动力学模拟中粒子运动轨迹的动画。

m0_73776865的博客 5063

Qt5.14.2开发Mqtt应用程序

然后,你就做不下去了…很明显,大部分博主写的东西不是缺头就是缺尾,带偏了许多读者。,因此我们需要clone的是这个分支版本,而不是这个默认的。然后将编译产物中include里的所有.h文件复制到。下载完后直接默认安装即可,这一步没什么好说的。看到了没,这个才是正确的操作方式,而主线的。信号来判断,自行实现自己的槽函数。然后选择构建方式,这里我选择的是。信号来判断自行实现自己的槽函数。信号来判断自行实现自己的槽函数。源代码,如下图所示,双击打开。收到下行消息时,可以通过连接。

Bruce.yang的嵌入式之旅 2310

pymol安装

事情经常变化,首先参考 https://pymolwiki.org/index.php/Windows_Install Open-Source PyMOL is available free of charge. It also allows sponsors to create highly customized PyMOL installations which might not be ...

wlzhang123的博客 1万+

Modbus RTU 详解 + FreeMODBUS移植(附项目源码)

本文全面解析Modbus RTU通信协议,详细介绍其报文格式、功能码定义及典型应用场景,并手把手指导如何将FreeMODBUS协议栈移植到嵌入式平台。内容涵盖从底层硬件驱动配置、协议栈移植到主机/从机通信测试的全流程,重点讲解移植过程中的常见问题及解决方案。文章最后提供经过实测的完整项目源码,帮助开发者快速实现稳定的Modbus RTU通信功能。

Bit_Dong的博客 2930

一根同轴线,真的扛得住 4K 吗? ——从摄像头带宽算起,聊透车载 SerDes 接口选型

如果你记住这三句话,这篇文章就值了:🎯摄像头带宽 = 分辨率 × 位深 × fps × 开销4K RAW 摄像头 ≈ 3.7Gbps,是现实不是理论SerDes 选型,宁可多留 20%,不要刚刚好。

weixin_43199439的博客 193

PyMOL操作手册

虽然 PyMOL 中提供了多种颜色可供选择,有关 PyMOL 中的各种颜色,可在以下链接进行查看:很多时候我们需要设置自定义的颜色,只需要提供颜色的 RGB 代码即可。用法为:比如我们自定义一个“color1”,之后就可以直接使用该颜色进行着色:现在我们就可以直接应用自定义的颜色了,如:蛋白二级结构主要通过主链几何结构和氢键模式来确定的,PyMOL 默认使用 DSSP 算法分配二级结构类型。

itwangyang520的博客 1万+

Devexpress16.2.6破解工具

Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具

PyMOL小白安装教程

《PyMOL安装简明教程》摘要:本文提供PyMOL三维可视化软件的详细安装指南。首先介绍Python环境配置方法,包括版本检查、安装注意事项及PATH设置。重点讲解开源版PyMOL的安装流程:1)从GitHub下载与Python版本匹配的wheel文件;2)通过pip安装numpy依赖;3)安装PyMOL主程序及启动器。同时对比了官网付费版与开源版的区别,指出开源版安装需注意版本兼容性问题。最后说明安装完成后可执行文件的存放位置。适合初学者快速完成PyMOL环境搭建。

qq_42945935的博客 3880

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

VB摄像头监控

该VB模块可对摄像头捕获的画面进行录像等,可在创建的窗口进行控制

PyMOL | Pymol绘图教程(一)

PyMOL PyMOL软件以Py+MOL命名:“Py”表示它是由一种计算机语言Python所衍生出来的,“MOL”表示它是用于显示分子(英文为molecule)结构的软件。为什么选择Pymol,因为它是强大的分子可视化软件,具有诸多优点: 高质量科学论文发表图形 动画制作 文档文件和会话文件并存 鼠标操作与命令行操作 免费的开放源码 缺点: 缺乏足够的文件资料 没有UNDO功能 ...

DrugOne 1万+

怀旧版电脑GBC模拟器

再现原版GBC掌机的界面,电脑运行连游戏界面都一样大小,很怀旧,很真实,(英文版)强烈推荐,很小的文件,很难才找到的。

关于MacOS PyMol使用问题

由于目前PyMol程序已经被Schrödingerg公司给收购了。因此想要使用最新版本的PyMol基本上是需要付费的。但是PyMol最开始是由Warren Lyford DeLano 开发的,在其生前一直坚持开源。所以在PyMol 2.1版本之前的是可以从SourceForge下载到的。但是后面更新的版本都转移到了GitHub。GitHub - schrodinger/pymol-open-source: Open-source foundation of the user-sponsore...

weixin_45725149的博客 6055

PyMOL的开源版和商业版如何选择 PyMOL开源版安装 PyMOL商业版安装 PyMOL安装教程 远程安装PyMOL正式版 官网版

选择开源版:如果您主要进行日常的分子可视化和分析任务,并且希望使用免费的软件,开源版的 PyMOL 已经足够强大。它适合学术研究、教学以及个人项目,具有高度的可定制性。 选择商业版:如果您从事的是更复杂的生物分子研究,或者需要生成高质量的图像和动画,并且希望获得官方的技术支持和更频繁的更新,那么商业版的 PyMOL 将是更合适的选择。尤其是在工业界和商业科研环境中,商业版的高级功能和优化能够显著提升工作效率。

前端开发工程师 全栈工程师 熟悉前后端 熟悉基本的生物信息软件使用以及分子对接技术服务 6423
上一篇: Pymol加标签
下一篇: 1.二维数组中的查找-剑指offer-Python2.7
Qiankun Wang
博客等级 码龄10年 16粉丝 29原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值