[cctbxbb] Going from a pdb file to an x_ray_structure object
Pavel Afonine
pafonine at lbl.gov
Tue Oct 9 08:27:51 PDT 2012
Hi Claudia,
why don't you have a look at phenix.real_space_correlation which answers
exactly your question?
Anyway, here is the script that does what you want. Let me know if you
have any questions or need any help with this.
*****
import iotbx.pdb
from iotbx import reflection_file_reader
import mmtbx.f_model
from scitbx.array_family import flex
def exercise(pdb_file_name="1akg.pdb", reflection_file_name="1akg.mtz"):
# get xray_strucute from PDB file
pdb_inp = iotbx.pdb.input(file_name = pdb_file_name)
xray_structure = pdb_inp.xray_structure_simple()
print "Input model:"
xray_structure.show_summary(prefix=" ")
# read in Fobs and free-R flags
miller_arrays = reflection_file_reader.any_reflection_file(file_name =
reflection_file_name).as_miller_arrays()
for ma in miller_arrays:
if(ma.info().labels == ['FOBS', 'SIGFOBS']):
f_obs = ma
if(ma.info().labels == ['R-free-flags']):
r_free_flags = ma.customized_copy(data=ma.data()==1)
print "Input data:"
f_obs.show_comprehensive_summary(prefix=" ")
print "Percentage of free-R flags:",
r_free_flags.data().count(True)*100./\
r_free_flags.data().size()
# get fmodel and do scaling and bulk-solvent modeling
fmodel = mmtbx.f_model.manager(
xray_structure = xray_structure,
f_obs = f_obs,
r_free_flags = r_free_flags)
fmodel.update_all_scales()
print "r_work=%6.4f r_free=%6.4f"%(fmodel.r_work(), fmodel.r_free())
# calculate CC between Fobs and Fmodel
cc = flex.linear_correlation(x=fmodel.f_obs().data(),
y=abs(fmodel.f_model()).data())
if(not cc.is_well_defined()):
print "Cannot compute CC"
print "CC(Fobs, Fmodel): %6.4f"%cc.coefficient()
if(__name__ == "__main__"):
exercise()
*****
Pavel
On 10/9/12 1:08 AM, Claudia Millán Nebot wrote:
>
> Hi everyone,
>
> i'm trying to get an xray.structure object from a pdb file, as i'm
> interested on using both this and a Miller array coming from a
> reflection file to calculate correlation coefficients between Fobs and
> Fcalc. For this purpose, i was searching for something that will do
> the same as the iotbx.pdb.xray_structure.as_pdb_file but the other way
> around. Is there such a tool? I've look for a while but as i'm new to
> all that maybe i missed something.
>
> Thanks in advance and my excuses if is a too evident question,
>
> Claudia Millán (cmncri at ibmb.csic.es <mailto:cmncri at ibmb.csic.es>)
>
> Institut de Biologia Molecular de Barcelona (IBMB-CSIC)
>
> Barcelona, Spain
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://phenix-online.org/pipermail/cctbxbb/attachments/20121009/9605f214/attachment.htm>
More information about the cctbxbb
mailing list