[Chimera-users] [EXTERNAL] Help please: extracting distances from each frame of a short MD

Anne-Frances Miller afmill3r at gmail.com
Sat Dec 11 00:47:07 PST 2021


This would be incredibly helpful Vinod,
I can see that what I need to do is learn Python for the future, but your kind offer can help me get started. 
My understanding is that the python script can even run within Chimera under the MD/movie module’s ‘Per-Frame’ tab. Is that correct?

Thank you very much in advance,
Anne-Frances
- • - • - • - • - • - • - • - • -
A.-F. Miller, Ph. D.  (she/elle/sie)
University Research Professor
Professor of Chemistry
University of Kentucky
https://www.uky.edu/~afm/

Visiting Fellow, 
        Einstein Foundation of Berlin








> On Dec 10, 2021, at 6:21 PM, Batra, Vinod (NIH/NIEHS) [C] <batra1 at niehs.nih.gov> wrote:
> 
> Hi Anne-Frances
> I can provide you a python script to do that if you can write each trajectory as pdb file. 
> In the image attached, I have measured 12 distance pairs in 10 different pdb files. The plot shows that if the distance between atom pairs are similar to some reference structure they are colored black, and green if shorter, and red if longer with a predefined and customizable cutoff value eg. 0.2 or 0.3 å. The script writes these distances to a csv file also at the same time  so that you can plot it in any graphic program.
> 
> My script does not measure angles, but can be added to the script easily.
> Vinod
> 
> On 12/10/21, 11:48 AM, "Elaine Meng via Chimera-users" <chimera-users at cgl.ucsf.edu> wrote:
> 
>    CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and are confident the content is safe.
> 
> 
>    Hi Anne-Frances,
>    There is no way to populate the MD plots from a command script, sorry.  You would just use the GUI (MD Movie menu: Analysis... Plot), select the two atoms (for a distance) or 3-4 atoms (for an angle) and then it will be plotted across the whole trajectory:
>    <https://www.rbvi.ucsf.edu/chimera/docs/ContributedSoftware/movie/movie.html#plotting>
> 
>    Once you create a distance monitor it is persistent across trajectory frames and will continue to display the updated distance while the trajectory plays.  If you really wanted to do it in a per-frame command script and measure distance at each trajectory frame (each value reported in the Reply Log) you could use ~distance command at each frame to remove all the distance monitors after they are added.  E.g.
> 
>    distance :1058 at O2 :741 at ND1
>    distance :730 at OH :741 at NE2
>    distance :721 at OG1 :1058 at N5
>    distance :718 at O :1058 at N3
>    distance :721 at N :1058 at O4
>    distance :722 at N :1058 at O4
>    distance :720 at N :1058 at O4
>    distance :740 at O :720 at N
>    ~distance
> 
>    But then you would need to save Reply Log and process its contents and then put it into some other graphing program if you wanted a plot.   This would be a pain since you have lots of different distances.  If you want a plot, or even the values in some convenient form for plotting with another program, then probably the way to go is using the GUI from the MD Movie menu.
> 
>    I hope this helps,
>    Elaine
>    -----
>    Elaine C. Meng, Ph.D.
>    UCSF Chimera(X) team
>    Department of Pharmaceutical Chemistry
>    University of California, San Francisco
> 
> 
> 
> 
>> On Dec 10, 2021, at 12:06 AM, Anne-Frances Miller via Chimera-users <chimera-users at cgl.ucsf.edu> wrote:
>> 
>> Dear Chimera support,
>> 
>> I want to extract a set of distances and one angle from each snapshot of an MD trajectory (there are 11 of them).
>> My plan was to have all my distances appear in one of the MD-movie analysis>plot distances windows and use ‘Dump Values’ to get my numbers out in a way I could use for other plots.
>> I realize angles cannot appear in the same plot, but hope I can measure an angle in the same script.
>> 
>> I have a ‘per-frame’ script that runs fine on the first frame, however it returns ‘Problem in per-frame script: Distance monitor already exists’ when I step forward to a second frame.
>> 
>> Nothing appears in a 'MD plots' window (such a window does not open on its own either).
>> Reply Log shows the correct distances for the first frame but then only repeats the error after that.
>> Problem in per-frame script:
>> Distance monitor already exists
>> 
>> My work-flow:
>> Open MD/movie, load my trajectory
>> open analysis, Per-Frame
>> copy my script into the window (chimera commands)
>> click ‘apply' in the script window, click ‘play’ or step forward one frame in the MD GUI (looping disabled)
>> 
>> My script:
>> ~disp
>> ~ribbon
>> disp :718,720,721,722,730,740,741,1058
>> distance :1058 at O2 :741 at ND1
>> distance :730 at OH :741 at NE2
>> distance :721 at OG1 :1058 at N5
>> distance :718 at O :1058 at N3
>> distance :721 at N :1058 at O4
>> distance :722 at N :1058 at O4
>> distance :720 at N :1058 at O4
>> distance :740 at O :720 at N
>> angle :1058 at C2 :1058 at O2 :741 at HD1 :741 at ND1
>> 
>> Reply Log output:
>> Distance between FDM 1058 O2 and HID 741 ND1: 2.8
>> Distance between TYR 730 OH and HID 741 NE2: 2.8
>> Distance between THR 721 OG1 and FDM 1058 N5: 3.4
>> Distance between ILE 718 O and FDM 1058 N3: 3.2
>> Distance between THR 721 N and FDM 1058 O4: 2.9
>> Distance between GLY 722 N and FDM 1058 O4: 3.2
>> Distance between GLN 720 N and FDM 1058 O4: 3.2
>> Distance between GLN 740 O and GLN 720 N: 3.0
>> Dihedral #0:1058 at C2 #0:1058 at O2 #0:741 at HD1 #0:741 at ND1: -51.0515
>> Problem in per-frame script:
>> Distance monitor already exists
>> 
>> Thank you for any assistance,
>> Anne-Frances
> 
> 
>    _______________________________________________
>    Chimera-users mailing list: Chimera-users at cgl.ucsf.edu
>    Manage subscription: https://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users
> 
> <Distances_figures.jpg>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-users/attachments/20211211/a643dc0b/attachment.html>


More information about the Chimera-users mailing list