On Tue, Oct 06, 2015 at 02:48:22PM -0400, wtempel wrote:
> Hello Boaz,
> mtzdmp is what I currently use in conjunction with the unix utilities. But
> small improvements/changes to the dump’s format could break any derivative
> scripts. I was looking for a well-defined, stable interface for scripting
> in python or shell, analogous to the CMTZ library
I wouldn't worry. mtzdump output has been stable for many years and now so
many pipelines depend on it that the format can't be changed lightly.
I'd consider it almost as stable as the underlying library.
If your pipelines is a shell script, parsing mtzdump output with
grep/sed/awk is perfectly adequate.
From Python or other languages maybe using cmtz through FFI would be
better:
>>> from ctypes import cdll, c_float, byref
>>> c = cdll.LoadLibrary(os.path.join(os.getenv("CCP4"), "lib", "libccp4c.so"))
>>> mtz = c.MtzGet('thaumatin.mtz', 1)
>>> c.MtzNcol(mtz)
9
>>> minres, maxres = c_float(), c_float()
>>> c.MtzResLimits(mtz, byref(minres), byref(maxres))
>>> maxres.value
0.4874197840690613
>>> maxres.value**-0.5
1.43234759610213579
(I read that cffi is better than ctypes, but I haven't used it myself)
Of course if you already start Python via cctbx.python it makes sense to
use iotbx.
Marcin
--
This e-mail and any attachments may contain confidential, copyright and or privileged material, and are for the use of the intended addressee only. If you are not the intended addressee or an authorised recipient of the addressee please notify us of receipt by returning the e-mail and do not use, copy, retain, distribute or disclose the information in or attached to the e-mail.
Any opinions expressed within this e-mail are those of the individual and not necessarily of Diamond Light Source Ltd.
Diamond Light Source Ltd. cannot guarantee that this e-mail or any attachments are free from viruses and we cannot accept liability for any damage which you may sustain as a result of software viruses which may be transmitted in or with the message.
Diamond Light Source Limited (company no. 4375679). Registered in England and Wales with its registered office at Diamond House, Harwell Science and Innovation Campus, Didcot, Oxfordshire, OX11 0DE, United Kingdom
|