Hi Blame,
I was talking about this pymol script (it can be downloaded directly
from the page below)
https://pymolwiki.org/index.php/Center_of_mass

I used all of the post-processing steps in bash scripts using AWK. Now
I would like to understand how it may work inside this python script.
Here is my shell solution :-)

#!/bin/bash
pymol='/Applications/PyMOL.app/Contents/MacOS/MacPyMOL'
home=$PWD
# this is multi-model pdb with the ligand
pdb=${home}/lig_1AllBoxes_7000_cne_998.pdb
# remove previous outputs
rm "${home}"/*.txt
#
#it has begun!
#calculate com using pymol, grep the important lines with the results
$pymol $pdb center_of_mass.py -d 'select all;com all' -c >
${home}/log.txt; grep '^State' ${home}/log.txt  > ${home}/out.txt

# convert output to python like list format
awk -F'[ :]' 'BEGIN{
                printf "["
              }
              NR>0{
                printf "[%.3f,%.3f,%.3f],",$3,$4,$5
              }
              END{
                printf "]\n"
              }' ${home}/out.txt | sed 's/,\]$/]/' > ${home}/COM_array.txt

echo "Well done!"

сб, 7 нояб. 2020 г. в 16:08, Mooers, Blaine H.M. (HSC)
<blaine-moo...@ouhsc.edu>:
>
> Hi Jeff,
>
> You can use Python commands to reformat the output.
> The Python commands can be included in your Python script or
> with the pml code that you pass with the -d keyword  in the terminal
> if the Python code is separated by semicolons from the pml code.
>
> My email security system mangled the link to your Python script.
> You can paste the Python code into the body of the email to avoid such issues.
>
> Best regards,
>
> Blaine
>
> Blaine Mooers, Ph.D.
> Associate Professor
> Department of Biochemistry and Molecular Biology
> College of Medicine
> University of Oklahoma Health Sciences Center
> S.L. Young Biomedical Research Center (BRC) Rm. 466
> 975 NE 10th Street, BRC 466
> Oklahoma City, OK 73104-5419
>
> ________________________________________
> From: Jeff Saxon [jmsstarli...@gmail.com]
> Sent: Saturday, November 07, 2020 7:34 AM
> To: pymol-users
> Subject: [EXTERNAL] Re: [PyMOL] Centre of mass pymol script
>
> P.S. sorry I ought to further precise my question:
> From what I have not I can execute pymol in batch mode together with
> the py script and pdb
> pymol my.pdb 
> https://urldefense.proofpoint.com/v2/url?u=http-3A__center-5Fof-5Fmass.py&d=DwIGaQ&c=VjzId-SM5S6aVB_cCGQ0d3uo9UfKByQ3sI6Audoy6dY&r=k0gMbcsdOcdbPUNV5tW66KQSZfXL0ewVDPVBp7tqbks&m=NjIje-z1Dq70jac-RIey36yonAOn8GSzwN-J8OEd9pQ&s=FZzhGIvdiSGI8pO9ZgK0Q0zMauIkq-qCa3HZwNxp_z8&e=
>   -d 'select all;com all' -c >> log.txt
> which gives me log.txt contained COM for each model in the following format:
>
> State 1:118.851979 120.668604 84.472229
> State 2:126.789728 149.506520 103.196917
> State 3:126.379687 149.382354 104.504792
> State 4:126.989312 149.372811 103.499396
> .....
> State 20:125.555854 133.653730 88.441501
> Obviously I can pipe this output to another program to convert it into
> the list format, but
> is it possible rather to modify the python script, automatically
> loading all pdbs located from the current directory and save the
> output automatically in the list format indicated in my first message?
>
> сб, 7 нояб. 2020 г. в 14:16, Jeff Saxon <jmsstarli...@gmail.com>:
> >
> > Dear Pymol Users,
> > I am using the Centre of mass python script found in PymolWIKI with
> > the aim to calculate the centre of mass of the loaded ligand
> > structure. Could you tell me if it would be possible to apply this
> > script on the multi_model pdb loaded in pymol in the similar way and
> > to obtain XYZ coordinates of COM for each conformation? Is it possible
> > to do it in some scripting manner using no-gui pymol and save output
> > in the list format like {[name the conformation_1],[x,y,z].... name of
> > the conformation_N,[x,y,z]}?
> > Thank you in advance
> > Cheers,
> > J.
>
>
> _______________________________________________
> PyMOL-users mailing list
> Archives: 
> https://urldefense.proofpoint.com/v2/url?u=http-3A__www.mail-2Darchive.com_pymol-2Dusers-40lists.sourceforge.net&d=DwIGaQ&c=VjzId-SM5S6aVB_cCGQ0d3uo9UfKByQ3sI6Audoy6dY&r=k0gMbcsdOcdbPUNV5tW66KQSZfXL0ewVDPVBp7tqbks&m=NjIje-z1Dq70jac-RIey36yonAOn8GSzwN-J8OEd9pQ&s=rHFOXfWCHk9XymS9CsAsCKjrHxeVNqjVZBQGphA-r0Y&e=
> Unsubscribe: 
> https://urldefense.proofpoint.com/v2/url?u=https-3A__sourceforge.net_projects_pymol_lists_pymol-2Dusers_unsubscribe&d=DwIGaQ&c=VjzId-SM5S6aVB_cCGQ0d3uo9UfKByQ3sI6Audoy6dY&r=k0gMbcsdOcdbPUNV5tW66KQSZfXL0ewVDPVBp7tqbks&m=NjIje-z1Dq70jac-RIey36yonAOn8GSzwN-J8OEd9pQ&s=pdU1DssN4zD2FhI_7dcRfdaksVEZvqe6WNN0-5_ygy0&e=


_______________________________________________
PyMOL-users mailing list
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net
Unsubscribe: 
https://sourceforge.net/projects/pymol/lists/pymol-users/unsubscribe

Reply via email to