I want to read a mmCIF file and extract some info, for example the Rfree,
then I want do some analysis on the structure, for example, rotate the coordinates
or compute the average B value.
Is there a simple way to do this while loading the mmcif file only once?
Right now I see no easy way to build a structure from a loaded mmCIF file object,
the mLib.FileLoader.LoadStructure gets the structure, but then I cannot
access the mmCIF data anymore.
Here is some sample code, as you see I have to read the mmcif file twice.
any suggestions how to improve this?
Thanks
Francisco
====================================
import mmLib.mmCIF
import mmLib.FileLoader
file_name = '1eq2.cif'
# get mmcif data
mmcif_obj = mmLib.mmCIF.mmCIFFile()
mmcif_obj.load_file(fil = file_name)
mmcif_data = mmcif_obj[0]
print "Rfree: %s" % mmcif_data.get_tag('_refine.ls_R_factor_R_free')
I want to read a mmCIF file and extract some info, for example the Rfree,
then I want do some analysis on the structure, for example, rotate the coordinates
or compute the average B value.
Is there a simple way to do this while loading the mmcif file only once?
Right now I see no easy way to build a structure from a loaded mmCIF file object,
the mLib.FileLoader.LoadStructure gets the structure, but then I cannot
access the mmCIF data anymore.
Here is some sample code, as you see I have to read the mmcif file twice.
any suggestions how to improve this?
Thanks
Francisco
====================================
import mmLib.mmCIF
import mmLib.FileLoader
file_name = '1eq2.cif'
# get mmcif data
mmcif_obj = mmLib.mmCIF.mmCIFFile()
mmcif_obj.load_file(fil = file_name)
mmcif_data = mmcif_obj[0]
print "Rfree: %s" % mmcif_data.get_tag('_refine.ls_R_factor_R_free')
# generate structure
str_obj = mmLib.FileLoader.LoadStructure(fil = file_name)
mean_B = 0.0
nr_atoms = 0
for atm in str_obj.iter_all_atoms():
nr_atoms += 1
mean_B += atm.temp_factor
if nr_atoms>0:
mean_B = mean_B / nr_atoms
print "Nr atoms: %d mean B: %f" % (nr_atoms, mean_B)