From: Thomas H. <tho...@sc...> - 2014-09-25 11:26:21
|
Hi Lei, those tunnel atoms all have the same name, thus the selection is not unique (not a *single* atom but multiple). For a script like that, it's best to select by atom index. cmd.iterate("tunnel", 'stored.centers.append("(%s`%d)" % (model, index))') Cheers, Thomas On 24 Sep 2014, at 23:27, Lei Chen <rai...@gm...> wrote: > Hi, > I still have trouble. I am not sure if it is because the tunnel pdb is > not standard. (it's an output file from another software called > CAVER.) > My tunnel pdb looks like: > ATOM 1 H FIL T 537 -44.636 -88.973 27.394 5.02 > ATOM 2 H FIL T 537 -44.620 -88.474 27.363 4.90 > CONECT 1 2 > ATOM 3 H FIL T 537 -44.574 -87.982 27.350 4.82 > CONECT 2 3 > ATOM 4 H FIL T 537 -44.568 -87.484 27.315 4.78 > CONECT 3 4 > ATOM 5 H FIL T 537 -44.561 -86.985 27.279 4.78 > CONECT 4 5 > ATOM 6 H FIL T 537 -44.554 -86.486 27.243 4.82 > CONECT 5 6 > My codes: > from pymol import cmd, stored > def vertical_distance( start_point, end_point, tunnel ): > stored.centers = [] > cmd.iterate("tunnel", 'stored.centers.append("/%s/%s/%s/%s`%s/%s" % > (model, segi, chain, resn, resi, name))') > for s in stored.centers: > print s > angle = cmd.get_angle(start_point, end_point, s) > print "%s: %3.2f" % (s, angle) > cmd.extend( "vertical_distance", vertical_distance ); > > output: > /tunnel//T/FIL`537/H > GetAngle-Error: Selection 3 doesn't contain a single atom/vertex. > > If I use cmd.angle, I get: > cmd-Error: The 'pk3' selection is undefined. > > > On Wed, Sep 24, 2014 at 4:44 PM, Sampson, Jared <Jar...@ny...> wrote: >> Hi Lei - >> >> The `get_angle` command needs an atom selection for your “tunnel" atoms, >> which, like the B-factor as Matt mentioned, you can also get using >> `iterate`: >> >> ### >> >> # create a list >> stored.centers = [] >> >> # get the macro selection string for each atom in tunnel >> cmd.iterate("tunnel", 'stored.centers.append("/%s/%s/%s/%s`%s/%s" % (model, >> segi, chain, resn, resi, name))') >> >> # loop through the list of centers and print each angle >> for s in stored.centers: >> angle = cmd.get_angle('start_point', 'end_point', s) >> print "%s: %3.2f" % (s, angle) >> >> ### >> >> Hope that helps. >> >> Cheers, >> Jared >> >> -- >> Jared Sampson >> Xiangpeng Kong Lab >> NYU Langone Medical Center >> http://kong.med.nyu.edu/ >> >> >> >> >> >> >> On Sep 24, 2014, at 6:52 PM, Matthew Baumgartner <mp...@pi...> wrote: >> >> Hi, >> you can just use the 'angle' command. >> >> cmd.angle('angle1', 'start_point', 'end_point', a) >> >> To print the b-factor you can use the iterate command >> (http://www.pymolwiki.org/index.php/Iterate) >> cmd.iterate('(a)', 'print b') >> >> HTH, >> Matt Baumgartner >> >> >> On 09/24/2014 06:35 PM, rainfieldcn wrote: >> >> Hi all, >> I generate two pseudoatoms "start_point" and "end_point" by >> center_of_mass.py. I load an object "tunnel" which has a sets of atoms >> in one chain. >> I want to measure the angle from each atoms in "tunnel" to "end_point" >> to "start_point". at the same time, I want to print the B-factor of >> atoms in "tunnel". >> To measure the angle, I programmed like this,but it doesn't work. >> I guess it's because get_angle function needs some particular variable >> format. >> By the way, how can I print the b factor of atom? >> Thanks, >> Lei >> >> from pymol import cmd, stored >> def vertical_distance( start_point, end_point, tunnel ): >> centers = cmd.get_model(tunnel,1) >> for a in centers.atom: >> angle= cmd.get_angle(start_point, end_point,a) >> print angle >> return (start_point, end_point, tunnel) >> cmd.extend( "vertical_distance", vertical_distance ); -- Thomas Holder PyMOL Developer Schrödinger, Inc. |