conversion_utilsΒΆ
Auxiliary functions for the conversion module.
FunctionsΒΆ
|
Move a .pdb file from origin to destination directory, to act as a topology file. |
|
Join a randomly sampled number of .pdb files in a directory into a single multimodel .pdb |
|
Back-calculate a SAXS profile for a frame of a Universe object using Pepsi-SAXS. |
|
Apply a chi-square goodness-of-fit test between experimental and calculated data profiles. |
Module ContentsΒΆ
- ensemblify.conversion.conversion_utils.move_topology_pdb(topology_name, origin_dir, destination_dir)ΒΆ
Move a .pdb file from origin to destination directory, to act as a topology file.
Given a path to a directory containing .pdb files, moves a single .pdb from that directory to a destination directory, to serve as a topology file for future trajectory analysis.
- Parameters:
topology_name (
str) β Prefix identifier for moved .pdb file.origin_dir (
str) β Directory where file of interest is located.destination_dir (
str) β Directory where file will be moved to.
- Returns:
Path to the moved topology file.
- Return type:
str
- ensemblify.conversion.conversion_utils.join_pdbs(pdbs_dir, multimodel_name, multimodel_dir, n_models=None, topology_path=None)ΒΆ
Join a randomly sampled number of .pdb files in a directory into a single multimodel .pdb file.
- Parameters:
pdbs_dir (
str) β Path to directory where numbered .pdb files are stored.multimodel_name (
str) β Prefix identifier for created multimodel .pdb file.multimodel_dir (
str) β Path to directory where ensemble .pdb file will be created.n_models (
int, optional) β Number of .pdb files to randomly sample from the specified directory. If None, all .pdb files in the directory will be used.topology_path (
str, optional) β Path to a topology .pdb file to be ignored when sampling .pdb files from multimodel_dir. Required if pdbs_dir matches multimodel_dir. Defaults to None.
- Returns:
Path to created multimodel ensemble .pdb file.
- Return type:
str
- ensemblify.conversion.conversion_utils.calc_saxs_data(trajectory_id, universe, frame_index, exp_saxs_file, calc_saxs_log, pepsi_saxs_opt=None)ΒΆ
Back-calculate a SAXS profile for a frame of a Universe object using Pepsi-SAXS.
Calculation is done for a single temporary .pdb file created from the current frame of the MDAnalysis Universe object.
- Parameters:
trajectory_id (
str) β Prefix identifier for created files.universe (
mda.Universe) β Universe object containing the trajectory being analyzed.frame_index (
int) β Current frame being calculated.exp_saxs_file (
str) β Path to .dat file with experimental SAXS data for the current protein to be used by Pepsi-SAXS.calc_saxs_log (
str) β Path to .log file for the SAXS profile calculation of each frame.pepsi_saxs_opt (
str, optional) β This string will be passed onto Pepsi-SAXS as additional command line options. If None, default Pepsi-SAXS options are used instead.
- Returns:
Array with the values for the SAXS profile calculated from this frame of the trajectory in the Universe object.
- Return type:
np.ndarray
- ensemblify.conversion.conversion_utils.calc_chi2_fit(exp, calc, sample_weights=None)ΒΆ
Apply a chi-square goodness-of-fit test between experimental and calculated data profiles.
- Parameters:
exp (
np.ndarray) β Experimental data in the format {value, error}.calc (
np.ndarray) β Calculated samples for each data point, in the format {value}. Will be averaged across samples before fitting.sample_weights (
np.ndarray, optional) β Weights for each sample in the calculated data. If None, all samples are assumed to have equal weight. Defaults to None.
- Returns:
- float:
Reduced chi2 value of fit.
- np.ndarray:
Residuals of the fit.
- Return type:
tuple[float, np.ndarray]