## Program Files

There are a series of scripts used to run DENSS. The core functions of DENSS are stored in the saxstats.py module. The main script to run a single reconstruction is denss.py. There are also scripts for performing multiple DENSS runs and aligning and averaging maps, as well as helper scripts that can perform some useful tasks. The following is a full list of the available scripts and a brief description of what they can do:

- denss.py – A tool for calculating an electron density map from solution scattering data.
- denss.fit_data.py – A tool for fitting solution scattering data with smooth function based on Moore’s algorithm for fitting a trigonometric series.
- denss.all.py – Generate, align, and average multiple electron density maps using DENSS.
- superdenss – Generate, align and average multiple electron density maps using EMAN2.
- denss.align.py – A tool for aligning electron density maps.
- denss.align2xyz.py – A tool for aligning an electron density map such that its principal axes of inertia are aligned with the x,y,z axes.
- denss.align_by_principal_axes.py – A tool for aligning an electron density map to another electron density map based only on alignment of principal axes (no minimization).
- denss.average.py – A tool for averaging multiple pre-aligned electron density maps.
- denss.align_and_average.py – A tool for aligning and averaging multiple electron density maps.
- denss.refine.py – A tool for refining an electron density map from solution scattering data.
- denss.calcfsc.py – A tool for calculating the Fourier Shell Correlation between two pre-aligned MRC formatted electron density maps.
- denss.get_info.py – Print some basic information about an MRC file.
- denss.pdb2mrc.py – A tool for calculating simple electron density maps from pdb files.
- denss.rho2dat.py – A tool for calculating simple scattering profiles from MRC formatted electron density maps.
- denss.mrcops.py – A tool for performing basic operations on MRC formatted electron density maps.
- best_enantiomers.sh – A tool for generating and selecting enantiomers using EMAN2.
- fsc2res.py – A tool for plotting Fourier Shell Correlation curves and estimating resolution.

## Input Data

Solution scattering data, in particular small angle X-ray scattering (SAXS) data, are typically highly oversampled, meaning that there are far more data points measured in an experiment than there are actual unique pieces of information available. SAXS data are often 20 to 50-fold oversampled, depending on the size of your particle and the geometry of your experiment.

However, running DENSS at such high oversampling ratios is computationally costly, as the size of the array grows as N^{3}. As DENSS typically runs at an oversampling ratio of 3 to 5 (see below for details), we need to first reduce the highly oversampled SAXS data to something more manageable, while still retaining all the useful precision brought about by the experimental oversampling.

To do this, we utilize well-known procedures for performing an indirect Fourier transform of the SAXS data. Usually this is used for extracting pair distribution functions, here we need it for providing a smooth fit to the experimental scattering data and for estimating I(0), which is an important parameter in the data.

Two file formats are currently acceptable: .dat files or .out files. Files with .dat extensions are expected to be the smoothed (i.e. fitted) curve.

**Using denss.fit_data.py**

A script called denss.fit_data.py is provided which can be used to fit experimental data with a smooth curve based on an extended version of Peter Moore’s approach (Moore 1979) using a trigonometric series. The denss.fit_data.py script includes a simple interactive GUI for selecting Dmax and the smoothing factor alpha and displays the experimental data, the smooth fit to the data, and the real space pair distribution function. denss.fit_data.py will save a .dat file containing the smooth fit to the data which can then be used as input to denss.py (see below). Additionally, useful parameters calculated from the fit, such as the radius of gyration and Porod volume, are displayed. The manuscript describing the mathematical derivation and the algorithm of this new approach is currently in preparation.

denss.fit_data.py can be run simply from the command line as:

$ denss.fit_data.py -f experimental_data.dat

where experimental_data.dat is the noisy scattering profile, given as a three-column ASCII text file with columns q, I, error. An interactive GUI will appear showing the experimental scattering profile on the left along with the fit to the data, and the associated pair distribution function (P(r)) on the right. Two interactive sliders on the bottom left can be adjusted for Dmax (the maximum particle dimension) and the alpha smoothing factor. See denss.fit_data.py -h for more options. When opened, denss.fit_data.py will attempt to estimate Dmax directly from the data.

When closing the GUI window, this will save a *_fit.dat file that can be used with denss.py for density reconstruction. Additional details such as the Dmax will be printed to the console (Dmax will be needed for denss.py also). The *_fit.dat file can be used directly in denss.py and the Dmax will then be read from the header. The P(r) function will also be saved to a *_pr.dat file.

**Using GNOM from ATSAS**

One of the most popular software routines for performing this calculation is called GNOM, from the ATSAS suite of SAXS programs.

DENSS can natively accept GNOM output files (with a .out extension) as input to the denss.py script. An example of such a file, 6lyz.out, is provided along with the DENSS download. This file is a GNOM formatted file calculated from simulated SAXS data from PDB entry 6LYZ (hen egg white lysozyme). The small, 14 kDa globular particle provides for convenient and quick testing.

However, any valid procedure you like may be used for calculating the smooth fit to the scattering data. These smoothed curves can be given to DENSS as simple ASCII text files with three columns: q (=4π sin(θ)/λ in Å^{-1}); intensity; and error on the intensity. DENSS will interpolate the given scattering profile to the necessary q values used in the reconstruction.

**Note**

It is not recommended to use the automated version of GNOM, called datgnom (or autognom). This version truncates the data to low resolution (something like q < 7/Rg) due to limitations of bead modeling algorithms (such as DAMMIF) that cannot utilize such higher resolution data. However DENSS is fully capable of using high resolution data (though due to information content may not improve the resolution of the final map). It is highly recommended to manually run GNOM (for example from within the Primus interface) and ensure that all high resolution data points are used. Even in cases where the high resolution data may not be the greatest quality, it is likely to be better than the simple Porod extrapolation that DENSS performs when the voxel sizes are smaller than the corresponding resolution of the data defined by q_{max}.