Going from a pdb file to an x_ray_structure object
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 ([email protected]) Institut de Biologia Molecular de Barcelona (IBMB-CSIC) Barcelona, Spain
Hi again, i really missed something very simple found at the
example pdb_to_map_simple.py, so now i got what i wanted.
Thanks again and sorry!
Claudia Millán ([email protected])
Institut de Biologia Molecular de Barcelona (IBMB-CSIC)
Barcelona, Spain
2012/10/9 Claudia Millán Nebot
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 ([email protected])
Institut de Biologia Molecular de Barcelona (IBMB-CSIC)
Barcelona, Spain
On Tue, Oct 9, 2012 at 1:08 AM, Claudia Millán Nebot
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.
I'm glad you were able to figure this out from the examples, but I have one caveat about your goal: if you're working with macromolecules, the Fcalc you get from an xray.structure object is going to be suboptimal because it won't contain any contribution from bulk solvent - only the point scatterers in the PDB file will be included. It may be necessary to use the (much messier) mmtbx.f_model API, which incorporates the bulk solvent (and also scales Fobs and Fcalc, although this isn't actually necessary for simple CCs). This isn't as well documented but I can give you some template code if you need it. -Nat
Hi Nat, thanks for pointing it out. Actually, i'm preparing this for a
small example script in order to include it in a practical seminar about
the features and tools of the cctbx, so it is not that critical, but I
would be glad to get some example code of how to use it properly, because
my plans are to deepen into the use of these tools.
Thanks again :)
Claudia Millán ([email protected])
Institut de Biologia Molecular de Barcelona (IBMB-CSIC)
Barcelona, Spain
2012/10/9 Nathaniel Echols
On Tue, Oct 9, 2012 at 1:08 AM, Claudia Millán Nebot
wrote: 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.
I'm glad you were able to figure this out from the examples, but I have one caveat about your goal: if you're working with macromolecules, the Fcalc you get from an xray.structure object is going to be suboptimal because it won't contain any contribution from bulk solvent - only the point scatterers in the PDB file will be included. It may be necessary to use the (much messier) mmtbx.f_model API, which incorporates the bulk solvent (and also scales Fobs and Fcalc, although this isn't actually necessary for simple CCs). This isn't as well documented but I can give you some template code if you need it.
-Nat _______________________________________________ cctbxbb mailing list [email protected] http://phenix-online.org/mailman/listinfo/cctbxbb
On Tue, Oct 9, 2012 at 5:35 AM, Claudia Millán Nebot
Hi Nat, thanks for pointing it out. Actually, i'm preparing this for a small example script in order to include it in a practical seminar about the features and tools of the cctbx, so it is not that critical, but I would be glad to get some example code of how to use it properly, because my plans are to deepen into the use of these tools.
I've attached a template which reads in the model and data, creates the fmodel object, and calculates CC(obs-calc). This is also in SVN now under mmtbx/examples/simple_command_line_cc.py, but I'll probably go back and modify it later to add more examples like calculating the model-map CC for an atom selection. There are of course other ways to write this, but it makes maximal use of Pavel's and my code for the really common, boring tasks like processing reflection files consistently, so it's a good place to start for writing programs with similar inputs. -Nat
Claudia Millán ([email protected])
Institut de Biologia Molecular de Barcelona (IBMB-CSIC)
Barcelona, Spain
Hi again :)
Thanks for the piece of code. I was looking at it rigth now and getting it
to work, but i got this error:
Traceback (most recent call last):
File "simple_command_line_cc.py", line 47, in <module>
run(sys.argv[1:])
File "simple_command_line_cc.py", line 31, in run
prefer_anomalous=False)
TypeError: __init__() got an unexpected keyword argument 'prefer_anomalous'
I went to my cctbx_sources files, and look for the mmtbx/utils.py, and then
realise that on there, the class cmdline_load_pdb_and_data, in is __init__,
doesn't expect a prefer_anomalous keyword but a scattering_table one:
def __init__ (self, args, master_phil, out=sys.stdout,
process_pdb_file=True, create_fmodel=True, scattering_table="wk1995")
Guess it maybe something related to the version of the cctbx i'm using?
2012/10/9 Nathaniel Echols
On Tue, Oct 9, 2012 at 5:35 AM, Claudia Millán Nebot
wrote: Hi Nat, thanks for pointing it out. Actually, i'm preparing this for a small example script in order to include it in a practical seminar about the features and tools of the cctbx, so it is not that critical, but I would be glad to get some example code of how to use it properly, because my plans are to deepen into the use of these tools.
I've attached a template which reads in the model and data, creates the fmodel object, and calculates CC(obs-calc). This is also in SVN now under mmtbx/examples/simple_command_line_cc.py, but I'll probably go back and modify it later to add more examples like calculating the model-map CC for an atom selection. There are of course other ways to write this, but it makes maximal use of Pavel's and my code for the really common, boring tasks like processing reflection files consistently, so it's a good place to start for writing programs with similar inputs.
-Nat
_______________________________________________ cctbxbb mailing list [email protected] http://phenix-online.org/mailman/listinfo/cctbxbb
On Tue, Oct 9, 2012 at 6:24 AM, Claudia Millán Nebot
I went to my cctbx_sources files, and look for the mmtbx/utils.py, and then realise that on there, the class cmdline_load_pdb_and_data, in is __init__, doesn't expect a prefer_anomalous keyword but a scattering_table one:
def __init__ (self, args, master_phil, out=sys.stdout, process_pdb_file=True, create_fmodel=True, scattering_table="wk1995")
Guess it maybe something related to the version of the cctbx i'm using?
Yes, I added the prefer_anomalous keyword a few weeks ago, so you need to update to a more recent version. -Nat
Hi again :)
Thanks for the piece of code. I was looking at it rigth now and getting it
to work, but i got this error:
Traceback (most recent call last):
File "simple_command_line_cc.py", line 47, in <module>
run(sys.argv[1:])
File "simple_command_line_cc.py", line 31, in run
prefer_anomalous=False)
TypeError: __init__() got an unexpected keyword argument 'prefer_anomalous'
I went to my cctbx_sources files, and look for the mmtbx/utils.py, and then
realise that on there, the class cmdline_load_pdb_and_data, in is __init__,
doesn't expect a prefer_anomalous keyword but a scattering_table one:
def __init__ (self, args, master_phil, out=sys.stdout,
process_pdb_file=True, create_fmodel=True, scattering_table="wk1995")
Guess it maybe something related to the version of the cctbx i'm using?
Claudia Millán ([email protected])
Institut de Biologia Molecular de Barcelona (IBMB-CSIC)
Barcelona, Spain
2012/10/9 Nathaniel Echols
On Tue, Oct 9, 2012 at 5:35 AM, Claudia Millán Nebot
wrote: Hi Nat, thanks for pointing it out. Actually, i'm preparing this for a small example script in order to include it in a practical seminar about the features and tools of the cctbx, so it is not that critical, but I would be glad to get some example code of how to use it properly, because my plans are to deepen into the use of these tools.
I've attached a template which reads in the model and data, creates the fmodel object, and calculates CC(obs-calc). This is also in SVN now under mmtbx/examples/simple_command_line_cc.py, but I'll probably go back and modify it later to add more examples like calculating the model-map CC for an atom selection. There are of course other ways to write this, but it makes maximal use of Pavel's and my code for the really common, boring tasks like processing reflection files consistently, so it's a good place to start for writing programs with similar inputs.
-Nat
_______________________________________________ cctbxbb mailing list [email protected] http://phenix-online.org/mailman/listinfo/cctbxbb
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 ([email protected] mailto:[email protected])
Institut de Biologia Molecular de Barcelona (IBMB-CSIC)
Barcelona, Spain
participants (3)
-
Claudia Millán Nebot
-
Nathaniel Echols
-
Pavel Afonine