Technical Documentation
Utilities for SCX and other density map files

The SwissCheese module provides two classes: Density for the conversion of density map file formats, and SCX for the analysis of density map files, and a function: checkspider to check a SPIDER format map file.

The SwissCheese module is located in Yup.Tools. Thus, the required import statement is: from Yup.Tools.SwissCheese import *.

The Density Class

The Density class is for the conversion of density map files into the internal format (SCX) used in YUP. At the moment only two external formats (SPIDER and XPLOR) are supported. This class can be easily extended to support additonal file formats. The SCX format contains only the data for voxels that have densities above a threshold value. Thus, SCX files are usually much smaller than the original. The densities are normalized to a scale between 0.0 and 1.0.

Density(): The constructor function takes no argument and it returns an empty Density object.

FromXplor(): The FromXplor method takes one to four arguments, reads the named XPLOR file and fills the Density object with normalized data:

Argument Type Preset Value Description
filename string
Name of the XPLOR format file to be read. Only the formatted variant is supported and only files that contain cubic voxels.
floor float or None None The density value that corresponds to 0.0 on the SCX scale
threshold float or None None Voxels with densities below this number will be ignored
ceiling float or None None The density value that corresponds to 1.0 on the SCX scale

FromSpider(): The FromSpider method takes two to five arguments, reads the named SPIDER file and fills the Density object with normalized data:

Argument Type Preset Value Description
filename string
Name of the SPIDER format file to be read
voxelwidth float
Width of a voxel (assumed cubical) in Angstroms
floor float or None None The density value that corresponds to 0.0 on the SCX scale
threshold float or None None Voxels with densities below this number will be ignored
ceiling float or None None The density value that corresponds to 1.0 on the SCX scale
When the last three arguments are not specified, the floor value is taken as the smallest positive density and the ceiling value is taken to be the maximum density. If the threshold has not been specified, it is set to be the minimum positive density. Whether specified or not, the value of threshold can be adjusted so that it corresponds to at least 0.01 on the SCX scale.

Note that only one external format file can be read into a Density object.

IntoSwiss(): The IntoSwiss method takes one argument, writes out the data in the Density object to a SCX format file. The argument is a string, the name of the SCX output file.
The SPIDER file is first read as a big-endian file. Failing that, little-endian is assumed. The first (slice) and second (row) dimensions are swapped and the third dimension (sample) is reversed. Since the data is filtered, each piece of density data has to be stored with a hash of the three location indices.
The SCX Class

Use the SCX class to examine the contents of a SCX format file.

This class reproduces the functionality of the mapinfo() method in the SwissCheeseX Energy object.

SCX(): The constructor function takes one argument, a string containing the name of the SCX file. The file is opened, read and the SCX object is returned.

center(): The center() method returns the density-weighted center as a tuple containing three floating point numbers.

limits(): The limits() method returns a tuple containing four numbers: the number of the voxel that is closest to the density center, the distance between this voxel and the center, the number of the voxel that is furthest from the density center and the distance between this voxel and the center.


The checkspider Function

The checkspider() function takes one to five arguments and it is used to analyze a SPIDER file:

Argument Type Preset Value Description
filename string
Name of the SPIDER format file to be analyzed
histogram integer 25 Number of bins in the histogram
floor float or None None The density value that corresponds to 0.0 on the SCX scale
threshold float or None None Voxels with densities below this number will be ignored
ceiling float or None None The density value that corresponds to 1.0 on the SCX scale

The last three arguments are set in the same way as for the FromSpider method of the Density class.

The function will calculate the limits, average and standard deviation and print those numbers alongside the numbers read from the file. The histogram is printed as a bar graph on 120 columns.

This function can be used to explore the floor, threshold and ceiling settings before applying them for the Density class.


Technical
Introduction
Directory
Vectors
Energy
Model
Assembly
Methods
FPF
FFF
AVF
TaroScript
YammpScript
Python
Utilities

Home
Information
News
User
Technical
Programmer
iYup
Download
Showcase
ETC