[cctbxbb] mean weighted phase error by resolution bin

Pavel Afonine pafonine at lbl.gov
Fri Dec 5 11:31:21 PST 2014


Hi Blaine,

hope this helps...

from cctbx.array_family import flex
from cctbx.sgtbx import space_group_info
from cctbx.development import random_structure

def run():
   xray_structure = random_structure.xray_structure(
     space_group_info = space_group_info("P 1"),
     elements = ('C', 'N', 'O', 'H')*10)
   f_calc = abs(xray_structure.structure_factors(d_min=1.5).f_calc())
   f_calc.setup_binner(reflections_per_bin = 50)
   for i_bin in f_calc.binner().range_used():
     d_range = f_calc.binner().bin_legend(
       i_bin=i_bin, show_bin_number=False, show_counts=False)
     selection = f_calc.binner().selection(i_bin)
     f_calc_data_bin = f_calc.data().select(selection)
     print d_range, f_calc_data_bin.min_max_mean().as_tuple(), \
       flex.mean(f_calc_data_bin)

if (__name__ == "__main__"):
   run()

...please let me know if not!

All the best,
Pavel


On 12/5/14 11:08 AM, Mooers, Blaine H.M. (HSC) wrote:
> Thanks to Pavel's suggestion,
> I was able to calculate the overall mean weighted phase error
> between to sets of phases in miller_arrays 2 and 5. I am stumped on how to
> retrieve the mean weighted phase error by resolution bin.
>
>
> #! /usr/bin/env cctbx.python
> import sys
> import iotbx
> mtz_filename = sys.argv[1]
> mtz_file = mtz.object(mtz_filename)
> miller_arrays = mtz_file.as_miller_arrays()
> binner=miller_array.setup_binner_d_star_sq_step(d_star_sq_step=0.01)
> mwpe = miller_arrays[2].mean_weighted_phase_error(miller_arrays[5])
>
>
>
>
>
>
>
> Best regards,
>
> Blaine
>
> Blaine Mooers, Ph.D.
> Assistant Professor
> Department of Biochemistry and Molecular Biology
> University of Oklahoma Health Sciences Center
> S.L. Young Biomedical Research Center Rm. 466
>
> Shipping address:
> 975 NE 10th Street, BRC 466
> Oklahoma City, OK 73104-5419
>
> Letter address:
> P.O. Box 26901, BRC 466
> Oklahoma City, OK 73190
>
> office: (405) 271-8300   lab: (405) 271-8313  fax:  (405) 271-3910
> e-mail:  blaine-mooers at ouhsc.edu
>
> Faculty webpage: http://www.oumedicine.com/department-of-biochemistry-and-molecular-biology/faculty/blaine-mooers-ph-d-
>
> Small Angle Scattering webpage: http://www.oumedicine.com/docs/default-source/ad-biochemistry-workfiles/small-angle-scattering-links-27aug2014.html?sfvrsn=0
>
> X-ray lab webpage: http://www.oumedicine.com/department-of-biochemistry-and-molecular-biology/department-facilities/macromolecular-crystallography-laboratory
>
>
>
> ________________________________________
> From: cctbxbb-bounces at phenix-online.org [cctbxbb-bounces at phenix-online.org] on behalf of cctbxbb-request at phenix-online.org [cctbxbb-request at phenix-online.org]
> Sent: Wednesday, December 03, 2014 2:00 PM
> To: cctbxbb at phenix-online.org
> Subject: cctbxbb Digest, Vol 69, Issue 3
>
> Send cctbxbb mailing list submissions to
>          cctbxbb at phenix-online.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
>          https://urldefense.proofpoint.com/v2/url?u=http-3A__phenix-2Donline.org_mailman_listinfo_cctbxbb&d=AAICAg&c=qRnFByZajCb3ogDwk-HidsbrxD-31vTsTBEIa6TCCEk&r=39ovrj_9gtbpqLqHj52qObHez22uGBx1oHrj21rIdII&m=AH0SlXaLUI5-mryljMKz190LejYrsOzJYHpylspfeLY&s=AL0biHjVX3JMJFY6TiJXpAGDDlIsjJ6HTPRxNidLa4g&e=
> or, via email, send a message with subject or body 'help' to
>          cctbxbb-request at phenix-online.org
>
> You can reach the person managing the list at
>          cctbxbb-owner at phenix-online.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of cctbxbb digest..."
>
>
> Today's Topics:
>
>     1. Re: computing mean phase error between final refined model
>        and experimental phases (Pavel Afonine)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Tue, 02 Dec 2014 12:06:08 -0800
> From: Pavel Afonine <pafonine at lbl.gov>
> To: cctbx mailing list <cctbxbb at phenix-online.org>,
>          Blaine-Mooers at ouhsc.edu
> Subject: Re: [cctbxbb] computing mean phase error between final
>          refined model and experimental phases
> Message-ID: <547E1BB0.3030103 at lbl.gov>
> Content-Type: text/plain; charset="windows-1252"; Format="flowed"
>
> Hi Blaine,
>
> key functionality for this is the method of Miller array class called
> mean_phase_error, see:
>
> cctbx/miller/__init__.py .
>
> Unit and regression tests are best usage examples most of the time. In
> this case see:
>
> cctbx/regression/tst_miller.py .
>
> Let me know if you have any questions.
>
> I don't have a good grasp of phase error value as a quality measure. For
> example, I do not know what number is good, what is poor, etc. I think
> to some extent what you are trying to do can be converted to Fourier map
> comparison: just compute two maps, each one using identical amplitudes
> and two different sets of phases, and then compare maps. To me at least
> the map CC is a more telling metric.
>
> However, map comparison is tricky too (usual map CC may be misleading!)
> and you need to use proper metrics, as explained in details here:
>
> Acta Cryst. (2014). D70, 2593-2606.
> Metrics for comparison of crystallographic maps
> A. Urzhumtsev, P. V. Afonine, V. Y. Lunin, T. C. Terwilliger and P. D. Adams
>
> Pavel
>
> On 12/2/14 9:20 AM, Mooers, Blaine H.M. (HSC) wrote:
>> Dear CCTBXBB,
>>
>> I want to compare the phases from the final refined model and a set of
>> experimental phases
>> to calculate the weighted mean phase error.
>>
>> How do I this using python?
>>
>> Best regards,
>>
>> Blaine
>>
>> Blaine Mooers, Ph.D.
>> Assistant Professor
>> Department of Biochemistry and Molecular Biology
>> University of Oklahoma Health Sciences Center
>> S.L. Young Biomedical Research Center Rm. 466
>>
>> Shipping address:
>>
>>
>> office: (405) 271-8300   lab: (405) 271-8313 fax:  (405) 271-3910
>> e-mail:  blaine-mooers at ouhsc.edu
>>
>> Faculty webpage:
>> https://urldefense.proofpoint.com/v2/url?u=http-3A__www.oumedicine.com_department-2Dof-2Dbiochemistry-2Dand-2Dmolecular-2Dbiology_faculty_blaine-2Dmooers-2Dph-2Dd-2D&d=AAICAg&c=qRnFByZajCb3ogDwk-HidsbrxD-31vTsTBEIa6TCCEk&r=39ovrj_9gtbpqLqHj52qObHez22uGBx1oHrj21rIdII&m=AH0SlXaLUI5-mryljMKz190LejYrsOzJYHpylspfeLY&s=rqaiZdx7q0FPgeqNSWoq7kwFM4tyeZxvBMfvxbRDYS4&e=
>>
>> Small Angle Scattering webpage:
>> https://urldefense.proofpoint.com/v2/url?u=http-3A__www.oumedicine.com_docs_default-2Dsource_ad-2Dbiochemistry-2Dworkfiles_small-2Dangle-2Dscattering-2Dlinks-2D27aug2014.html-3Fsfvrsn-3D0&d=AAICAg&c=qRnFByZajCb3ogDwk-HidsbrxD-31vTsTBEIa6TCCEk&r=39ovrj_9gtbpqLqHj52qObHez22uGBx1oHrj21rIdII&m=AH0SlXaLUI5-mryljMKz190LejYrsOzJYHpylspfeLY&s=9XhXoxi5obT0IniNxBJh78HKJwRFzYJTH1dt4u4KXOw&e=
>>
>> X-ray lab webpage:
>> https://urldefense.proofpoint.com/v2/url?u=http-3A__www.oumedicine.com_department-2Dof-2Dbiochemistry-2Dand-2Dmolecular-2Dbiology_department-2Dfacilities_macromolecular-2Dcrystallography-2Dlaboratory&d=AAICAg&c=qRnFByZajCb3ogDwk-HidsbrxD-31vTsTBEIa6TCCEk&r=39ovrj_9gtbpqLqHj52qObHez22uGBx1oHrj21rIdII&m=AH0SlXaLUI5-mryljMKz190LejYrsOzJYHpylspfeLY&s=EKobCa5YeL23c7JajiA5LYbpfBPGRSiMrp9pEX7ltr4&e=
>>
>>
>>
>>
>> _______________________________________________
>> cctbxbb mailing list
>> cctbxbb at phenix-online.org
>> https://urldefense.proofpoint.com/v2/url?u=http-3A__phenix-2Donline.org_mailman_listinfo_cctbxbb&d=AAICAg&c=qRnFByZajCb3ogDwk-HidsbrxD-31vTsTBEIa6TCCEk&r=39ovrj_9gtbpqLqHj52qObHez22uGBx1oHrj21rIdII&m=AH0SlXaLUI5-mryljMKz190LejYrsOzJYHpylspfeLY&s=AL0biHjVX3JMJFY6TiJXpAGDDlIsjJ6HTPRxNidLa4g&e=
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <https://urldefense.proofpoint.com/v2/url?u=http-3A__phenix-2Donline.org_pipermail_cctbxbb_attachments_20141202_1bc9d428_attachment.html&d=AAICAg&c=qRnFByZajCb3ogDwk-HidsbrxD-31vTsTBEIa6TCCEk&r=39ovrj_9gtbpqLqHj52qObHez22uGBx1oHrj21rIdII&m=AH0SlXaLUI5-mryljMKz190LejYrsOzJYHpylspfeLY&s=qe1u9KwHHg1wY0PXdIIjqRT_AyWbFkOiraB7wAfGpac&e= >
>
> ------------------------------
>
> _______________________________________________
> cctbxbb mailing list
> cctbxbb at phenix-online.org
> https://urldefense.proofpoint.com/v2/url?u=http-3A__phenix-2Donline.org_mailman_listinfo_cctbxbb&d=AAICAg&c=qRnFByZajCb3ogDwk-HidsbrxD-31vTsTBEIa6TCCEk&r=39ovrj_9gtbpqLqHj52qObHez22uGBx1oHrj21rIdII&m=AH0SlXaLUI5-mryljMKz190LejYrsOzJYHpylspfeLY&s=AL0biHjVX3JMJFY6TiJXpAGDDlIsjJ6HTPRxNidLa4g&e=
>
>
> End of cctbxbb Digest, Vol 69, Issue 3
> **************************************
>
> _______________________________________________
> cctbxbb mailing list
> cctbxbb at phenix-online.org
> http://phenix-online.org/mailman/listinfo/cctbxbb



More information about the cctbxbb mailing list