[phenixbb] validating ~100 structures
Tristan Croll
tic20 at cam.ac.uk
Tue Jun 26 07:35:17 PDT 2018
That's a little more complicated. The below simple Python script should
do what you want, assuming all your MolProbity outputs are e.g.
xxxx.pdb.log, are all in the same directory, and are the *only* files
with the .log extension in the directory. Just copy the script into a
file (e.g. mp_parse.py), put it in your working directory and run:
python mp_parse.py
You should end up with a file called results.csv with the stats
tabulated and readable by your favourite spreadsheet program.
Cheers,
Tristan
#!/bin/python
import glob
from os import path
results = {}
files = glob.glob('*.log')
for file in files:
name = path.basename(file).split('.')[0]
props = {}
results[name] = props
with open(file, 'rt') as f:
# Bypass details
lines = f.read().split('\n')
i = 0
for line in lines:
i += 1
if 'Summary' in line:
break
lines = lines[i+1:]
for line in lines:
#Skip blanks
if not line or '=' not in line:
continue
line = line.strip().split('=')
# Throw away whitespace and percent signs
props[line[0].strip()] = line[1].strip().split()[0]
keys = (
'Ramachandran outliers',
'favored',
'Rotamer outliers',
'C-beta deviations',
'Clashscore',
'RMS(bonds)',
'RMS(angles)',
'MolProbity score'
)
with open('results.csv', 'wt') as out:
out.write('Name,')
out.write(','.join(keys)+'\n')
for name, data in results.items():
out.write(name+',')
out.write(','.join([data[key] for key in keys])+'\n')
On 2018-06-26 14:42, CPMAS Chen wrote:
> Thanks!
>
> I used the bash scripts you two provided. It works great.
>
> A further question, how do I extract the output summary of the
> molprobity results from all 100 files into a single file. Ideally, I
> would like to make the data into a table.
>
> Appreciate your help!
>
> =================================== Summary
> ===================================
>
> Ramachandran outliers = 0.38 %
> favored = 95.27 %
> Rotamer outliers = 0.00 %
> C-beta deviations = 10
> Clashscore = 184.98
> RMS(bonds) = 0.0193
> RMS(angles) = 2.77
> MolProbity score = 3.06
>
> On Mon, Jun 25, 2018 at 5:32 PM Oleg Sobolev <osobolev at lbl.gov> wrote:
>
>> Hi Charles,
>>
>> I would use any scripting language you are familiar with - python,
>> bash, csh. Here is a bash script adapted from
>>
> https://stackoverflow.com/questions/10523415/bash-script-to-execute-command-on-all-files-in-a-directory
>> [2]
>>
>> for file in *.pdb
>> do
>> echo $file
>> phenix.molprobity "$file" > "$file"_results.txt
>> done
>>
>> On mac - make a file mpscript put it in a directory with your .pdb,
>> then run
>> chmod a+x mpscript
>> ./mpscript
>>
>> Hope it helps.
>>
>> Best regards,
>> Oleg Sobolev.
>>
>> On Mon, Jun 25, 2018 at 1:39 PM, CPMAS Chen <cpmasmit at gmail.com>
>> wrote:
>>
>>> Hi, All,
>>>
>>> I have about 100 structures needs be validated and optimized. what
>>> will be a fast way to do so? Can I somehow put phenix.molprobity
>>> in a circle?
>>>
>>> Thanks!
>>>
>>> --
>>>
>>> ***************************************************
>>>
>>> Charles Chen
>>>
>>> Research Instructor
>>>
>>> University of Pittsburgh School of Medicine
>>>
>>> Department of Anesthesiology
>>>
>>> ******************************************************
>>>
>>> _______________________________________________
>>> phenixbb mailing list
>>> phenixbb at phenix-online.org
>>> http://phenix-online.org/mailman/listinfo/phenixbb [1]
>>> Unsubscribe: phenixbb-leave at phenix-online.org
>
> --
>
> ***************************************************
>
> Charles Chen
>
> Research Instructor
>
> University of Pittsburgh School of Medicine
>
> Department of Anesthesiology
>
> ******************************************************
>
>
>
> Links:
> ------
> [1] http://phenix-online.org/mailman/listinfo/phenixbb
> [2]
> https://stackoverflow.com/questions/10523415/bash-script-to-execute-command-on-all-files-in-a-directory
>
> _______________________________________________
> phenixbb mailing list
> phenixbb at phenix-online.org
> http://phenix-online.org/mailman/listinfo/phenixbb
> Unsubscribe: phenixbb-leave at phenix-online.org
More information about the phenixbb
mailing list