pwem.convert.headers module

This module contains converter functions that will serve to: 1. define ccp4 environ TODO: 2. Read/Write CCP4 specific files

class pwem.convert.headers.Ccp4Header(fileName, readHeader=False)[source]

Bases: object

ORIGIN = 0
START = 1

In spite of the name this is the MRC2014 format no the CCP4. In an MRC EM file the origin is typically in header fields called xorigin, yorigin, zorigin which are specific to EM data (MRC 2000 format) and are not part of the nearly identical CCP4 format used for x-ray maps that Coot is expecting.

The header is organised as 56 words followed by space for ten 80

character text labels as follows::

1 NC # of Columns (fastest changing in map) 2 NR # of Rows 3 NS # of Sections (slowest changing in map) 4 MODE Data type

0 = envelope stored as signed bytes (from

-128 lowest to 127 highest)

1 = Image stored as Integer*2 2 = Image stored as Reals 3 = Transform stored as Complex Integer*2 4 = Transform stored as Complex Reals 5 == 0 Note: Mode 2 is the normal mode used in the CCP4 programs. Other modes than 2 and 0 may NOT WORK

5 NCSTART Number of first COLUMN in map 6 NRSTART Number of first ROW in map 7 NSSTART Number of first SECTION in map 8 NX Number of intervals along X 9 NY Number of intervals along Y

10 NZ Number of intervals along Z 11 X length Cell Dimensions (Angstroms) 12 Y length ” 13 Z length ” 14 Alpha Cell Angles (Degrees) 15 Beta ” 16 Gamma ” 17 MAPC Which axis corresponds to Cols. (1,2,3 for X,Y,Z) 18 MAPR Which axis corresponds to Rows. (1,2,3 for X,Y,Z) 19 MAPS Which axis corresponds to Sects.

(1,2,3 for X,Y,Z)

20 AMIN Minimum density value 21 AMAX Maximum density value 22 AMEAN Mean density value (Average) 23 ISPG Space group number 24 NSYMBT Number of bytes used for storing symmetry

operators

25 LSKFLG Flag for skew transformation, =0 none, =1 if foll 26-34 SKWMAT Skew matrix S (in order S11, S12, S13, S21 etc)

if LSKFLG .ne. 0.

35-37 SKWTRN Skew translation t if LSKFLG .ne. 0.

Skew transformation is from standard orthogonal coordinate frame (as used for atoms) to orthogonal map frame, as Xo(map) = S * (Xo(atoms) - t)

38 future use (some of these are used by the MSUBSX routines

. ” in MAPBRICK, MAPCONT and FRODO) . ” (all set to zero by default) . “

50-52 ORIGIN origin in X,Y,Z (pixel units) used for Fourier transforms (modes 3 and 4) 53 MAP Character string ‘MAP ‘ to identify file type 54 MACHST Machine stamp indicating the machine type

which wrote file

55 ARMS Rms deviation of map from mean density 56 NLABL Number of labels being used 57-256 LABEL(20,10) 10 80 character text labels (ie. A4 format)

Symmetry records follow - if any - stored as text as in International Tables, operators separated by * and grouped into ‘lines’ of 80 characters (i.e. symmetry operators do not cross the ends of the 80-character ‘lines’ and the ‘lines’ do not terminate in a *).

cleanFileNameAnnotation(fileName)[source]
computeSampling()[source]
copyCCP4Header(scipionOriginShifts, sampling, originField=1)[source]

This function updates the values of sampling and origin in the header and save the header to disk. It has been designed for Volumes, it will NOT work for sets of volumes or images.

classmethod fixFile(inFileName, outFileName, scipionOriginShifts, sampling=1.0, originField=1)[source]

Create new CCP4 binary file and fix its header.

getCellDimensions()[source]

Returns dimensions in Angstroms

getDims()[source]
getGridSampling()[source]
getHeader()[source]
getISPG()[source]
getNumberOfObjects()[source]
getOrigin(changeSign=False)[source]

Return in Angstroms

getSampling()[source]
getStartAngstrom(sampling)[source]

Returns Angstroms

getStartPixel()[source]

Returns pixels

getXYZN()[source]
classmethod isCompatible(file)[source]
readHeader()[source]
setCellDimensions(x, y, z)[source]
setDims(col, row, sec)[source]
setGridSampling(x, y, z)[source]
setHeader(newHeader)[source]
setISPG(value)[source]
setMode(mode)[source]
setOrigin(originTransformShift)[source]
setSampling(sampling)[source]
setStartAngstrom(originTransformShift, sampling)[source]

input Angstroms

setStartPixel(originTransformShift)[source]

input pixels

writeHeader()[source]
pwem.convert.headers.fixVolume(paths)[source]

Fixes mrc (any extension) files that are defined as stacks but are meant to be volumes as defined in the mrc 2014 specs. Setting ISPG to 1. :param paths: accept a string or a list of strings :return: nothing, but mrc files header end up being updated.

pwem.convert.headers.getFileFormat(fileName)[source]
pwem.convert.headers.setMRCSamplingRate(paths, samplingRate)[source]

Sets the mrc file sampling rate value :param paths: accept a string or a list of strings :return: nothing, but mrc files header end up being updated with the right sampling rate