<div dir="ltr">Hi Wolfram,<div><br></div><div>The build_crystal_structures() method is aimed at extracting a cctbx xray.structure object from a small molecule cif file, and isn&#39;t aimed at mmcif-format files, so in your case it looks through all the data blocks in the provided CIF, can&#39;t find any suitable xray.structures, so returns an empty dictionary. If you simply want to access the raw CIF items from the file, then this code snippet shows how you can extract (e.g.) the Rwork from the 1NXC cif block:</div>

<div><br></div><div><div><font face="courier new, monospace">import iotbx.cif</font></div><div><font face="courier new, monospace">reader = iotbx.cif.reader(file_path=&quot;1NXC.cif&quot;)</font></div><div><font face="courier new, monospace">cif = reader.model()</font></div>

<div><font face="courier new, monospace">cif_block = cif[&quot;1NXC&quot;]</font></div><div><div><span style="font-family:&#39;courier new&#39;,monospace"># get a single item from cif_block</span><br></div><div><font face="courier new, monospace">print cif_block[&quot;_refine.ls_R_factor_R_work&quot;]</font></div>

<div><font face="courier new, monospace"># get a looped item from cif_block</font></div><div><font face="courier new, monospace">print list(cif_block[&quot;_<a href="http://citation_author.name">citation_author.name</a>&quot;])</font></div>

</div><div><br></div><div>If you want to extract the model for your crystal structure, then probably the most useful thing to do is extract a pdb.hierarchy object (the cctbx&#39;s internal representation of a PDB/mmCIF structure file). This functionality can accept both PDB and mmCIF files as input:</div>

<div><br></div><div><font face="courier new, monospace">import iotbx.pdb</font></div><div><font face="courier new, monospace"># this works exactly the same for pdb files</font></div><div><font face="courier new, monospace">pdb_input = iotbx.pdb.input(file_name=&quot;1NXC.cif&quot;)</font></div>

<div><font face="courier new, monospace">pdb_hierarchy = pdb_input.construct_hierarchy()</font></div><div><br></div><div>Alternatively, if you are only reading mmCIF files, need access to both the raw cif items and the pdb_hierarchy, and are concerned about overhead of reading mmCIF twice (only really relevant for extremely large files), then you can pass the <font face="courier new, monospace">cif</font> object created above to the <font face="courier new, monospace">iotbx.pdb.mmcif.cif_input�</font>function:</div>

<div><br></div><div><font face="courier new, monospace">import iotbx.pdb.mmcif</font></div><div><font face="courier new, monospace">pdb_input = iotbx.pdb.mmcif.cif_input(cif_object=cif)</font></div><div><font face="courier new, monospace">pdb_hierarchy = pdb_input.construct_hierarchy()</font></div>

</div><div><br></div><div>Please let me know if you have any more questions about using iotbx.cif!</div><div><br></div><div>Cheers,</div><div><br></div><div>Richard</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">

On 6 November 2013 11:38, wtempel <span dir="ltr">&lt;<a href="mailto:wtempel@gmail.com" target="_blank">wtempel@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div dir="ltr">Hello all,<div>please consider the scenario of a manuscript that, among other things, describes 20 crystal structures.</div><div>Suppose the journal editor requires a Table 1.</div><div>I now looking for a tool to prepare such table with high accuracy and little effort.</div>



<div>My PDB deposition workflow includes the preparation of mmcif coordinates with pdb_extract. The mmcif file is complete in the sense that after upload to RCSB-ADIT, virtually no additional information is required for deposition.</div>



<div>My intuition was to combine CSV and IOTBX python modules and produce the table via input of a list of mmcif files.</div><div>The current phenix table_1 tool provides some, but not all of that functionality, and I thought once familiar with the python modules, I would quickly write the script.</div>



<div>After confirming that the example at</div><div><a href="http://cctbx.sourceforge.net/iotbx_cif/" target="_blank">http://cctbx.sourceforge.net/iotbx_cif/</a><br></div><div>works with my cctbx installation,</div><div>

I attempted to transform that code to read in PDB mmcif coordinates:</div>

<div>&lt;code&gt;</div><div><div>test_structure = iotbx.cif.reader(</div><div>� file_path=&quot;/tmp/1NXC.cif&quot;).build_crystal_structures()[&quot;1NXC&quot;]</div></div><div>&lt;/code&gt;<br></div><div>which throws an exception:</div>



<div>&lt;output&gt;</div><div><div>Traceback (most recent call last):</div><div>� File &quot;1NXC.py&quot;, line 3, in &lt;module&gt;</div><div>� � test_structure = iotbx.cif.reader(file_path=&quot;/tmp/1NXC.cif&quot;).build_crystal_structures()[&quot;1NXC&quot;]</div>



<div>KeyError: &#39;1NXC&#39;</div></div><div>&lt;/output&gt;</div><div>How do I need to write the code so that it returns a python object with access to all the cif items?</div><div>Thank you,</div><div>Wolfram Tempel</div>



<div><br></div></div>
<br>_______________________________________________<br>
cctbxbb mailing list<br>
<a href="mailto:cctbxbb@phenix-online.org">cctbxbb@phenix-online.org</a><br>
<a href="http://phenix-online.org/mailman/listinfo/cctbxbb" target="_blank">http://phenix-online.org/mailman/listinfo/cctbxbb</a><br>
<br></blockquote></div><br></div>