<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Hi Claudia,<br>
      <br>
      why don't you have a look at phenix.real_space_correlation which
      answers exactly your question?<br>
      <br>
      Anyway, here is the script that does what you want. Let me know if
      you have any questions or need any help with this.<br>
      <br>
      *****<br>
      import iotbx.pdb<br>
      from iotbx import reflection_file_reader<br>
      import mmtbx.f_model<br>
      from scitbx.array_family import flex<br>
      <br>
      def exercise(pdb_file_name="1akg.pdb",
      reflection_file_name="1akg.mtz"):<br>
      &nbsp; # get xray_strucute from PDB file<br>
      &nbsp; pdb_inp = iotbx.pdb.input(file_name = pdb_file_name)<br>
      &nbsp; xray_structure = pdb_inp.xray_structure_simple()<br>
      &nbsp; print "Input model:"<br>
      &nbsp; xray_structure.show_summary(prefix="&nbsp; ")<br>
      &nbsp; # read in Fobs and free-R flags<br>
      &nbsp; miller_arrays =
      reflection_file_reader.any_reflection_file(file_name =<br>
      &nbsp;&nbsp;&nbsp; reflection_file_name).as_miller_arrays()<br>
      &nbsp; for ma in miller_arrays:<br>
      &nbsp;&nbsp;&nbsp; if(ma.info().labels == ['FOBS', 'SIGFOBS']):<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; f_obs = ma<br>
      &nbsp;&nbsp;&nbsp; if(ma.info().labels == ['R-free-flags']):<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; r_free_flags = ma.customized_copy(data=ma.data()==1)<br>
      &nbsp; print "Input data:"<br>
      &nbsp; f_obs.show_comprehensive_summary(prefix="&nbsp; ")<br>
      &nbsp; print "Percentage of free-R flags:",
      r_free_flags.data().count(True)*100./\<br>
      &nbsp;&nbsp;&nbsp; r_free_flags.data().size()<br>
      &nbsp; # get fmodel and do scaling and bulk-solvent modeling<br>
      &nbsp; fmodel = mmtbx.f_model.manager(<br>
      &nbsp;&nbsp;&nbsp; xray_structure = xray_structure,<br>
      &nbsp;&nbsp;&nbsp; f_obs = f_obs,<br>
      &nbsp;&nbsp;&nbsp; r_free_flags = r_free_flags)<br>
      &nbsp; fmodel.update_all_scales()<br>
      &nbsp; print "r_work=%6.4f r_free=%6.4f"%(fmodel.r_work(),
      fmodel.r_free())<br>
      &nbsp; # calculate CC between Fobs and Fmodel<br>
      &nbsp; cc = flex.linear_correlation(x=fmodel.f_obs().data(), <br>
      &nbsp;&nbsp;&nbsp; y=abs(fmodel.f_model()).data())<br>
      &nbsp; if(not cc.is_well_defined()):<br>
      &nbsp;&nbsp;&nbsp; print "Cannot compute CC"<br>
      &nbsp; print "CC(Fobs, Fmodel): %6.4f"%cc.coefficient()<br>
      &nbsp; <br>
      if(__name__ == "__main__"):<br>
      &nbsp; exercise()<br>
      *****<br>
      <br>
      Pavel<br>
      <br>
      <br>
      On 10/9/12 1:08 AM, Claudia Mill&aacute;n Nebot wrote:<br>
    </div>
    <blockquote
cite="mid:CAPBAO+DVNtXhdjPyH1J9E3fJihLubE4G5_4MADp7LrsdDR_A0w@mail.gmail.com"
      type="cite"><br>
      Hi everyone,
      <div><br>
      </div>
      <div>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.</div>
      <div><br>
      </div>
      <div>Thanks in advance and my excuses if is a too evident
        question,</div>
      <div><br>
      </div>
      <div>
        <p
          style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px"><font
            face="arial, helvetica, sans-serif">Claudia Mill&aacute;n (<a
              moz-do-not-send="true" href="mailto:cmncri@ibmb.csic.es"
              target="_blank" style="color:rgb(17,85,204)">cmncri@ibmb.csic.es</a>)</font></p>
        <p
          style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px"><font
            face="arial, helvetica, sans-serif">Institut de Biologia
            Molecular de Barcelona (IBMB-CSIC)</font></p>
        <p
          style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px">
          <font face="arial, helvetica, sans-serif">Barcelona, Spain</font><br>
        </p>
      </div>
    </blockquote>
    <br>
  </body>
</html>