Xmipp
v3.23.11-Nereus
|
#include <filesystem>
#include <fstream>
#include <iomanip>
#include <sstream>
#include <string>
#include "cif++.hpp"
#include "pdb.h"
#include "core/matrix2d.h"
#include "core/multidim_array.h"
#include "core/transformations.h"
#include "core/xmipp_fftw.h"
#include "core/xmipp_strings.h"
#include "data/fourier_projection.h"
#include "data/integration.h"
#include "data/mask.h"
#include "data/numerical_tools.h"
Go to the source code of this file.
Classes | |
class | AtomValueFunc |
Macros | |
#define | IOTBX_PDB_HYBRID_36_C_H |
#define | HY36_WIDTH_4_MIN -999 |
#define | HY36_WIDTH_4_MAX 2436111 /* 10000 + 2*26*36*36*36 - 1 */ |
#define | HY36_WIDTH_5_MIN -9999 |
#define | HY36_WIDTH_5_MAX 87440031 /* 100000 + 2*26*36*36*36*36 - 1 */ |
#define | INTEGRATION 2 |
Functions | |
void | analyzePDBAtoms (const FileName &fn_pdb, const std::string &typeOfAtom, int &numberOfAtoms, pdbInfo &at_pos) |
int | atomCharge (const std::string &atom) |
double | atomRadius (const std::string &atom) |
double | atomCovalentRadius (const std::string &atom) |
void | computePDBgeometry (const std::string &fnPDB, Matrix1D< double > ¢erOfMass, Matrix1D< double > &limit0, Matrix1D< double > &limitF, const std::string &intensityColumn) |
void | applyGeometryToPDBFile (const std::string &fn_in, const std::string &fn_out, const Matrix2D< double > &A, bool centerPDB, const std::string &intensityColumn) |
bool | checkExtension (const std::filesystem::path &filePath, const std::list< std::string > &acceptedExtensions, const std::list< std::string > &acceptedCompressions) |
Checks if the file uses a supported extension type. More... | |
template<typename callable > | |
void | readPDB (const FileName &fnPDB, const callable &addAtom) |
Read phantom from PDB. More... | |
template<typename callable > | |
void | readCIF (const std::string &fnCIF, const callable &addAtom, cif::datablock &dataBlock) |
Read phantom from CIF. More... | |
template<typename callable > | |
void | readRichPDB (const FileName &fnPDB, const callable &addAtom, std::vector< double > &intensities, std::vector< std::string > &remarks, const bool pseudoatoms, const double threshold) |
Read rich phantom from either a PDB of CIF file. More... | |
template<typename callable > | |
void | readRichCIF (const std::string &fnCIF, const callable &addAtom, std::vector< double > &intensities, const bool pseudoatoms, const double threshold, cif::datablock &dataBlock) |
Read rich phantom from CIF. More... | |
template<typename callable > | |
void | writePDB (const FileName &fnPDB, bool renumber, const std::vector< std::string > &remarks, const callable &atomList) |
Write rich phantom to PDB file. More... | |
template<typename callable > | |
void | writeCIF (const std::string &fnCIF, const callable &atomList, cif::datablock &dataBlock) |
Write rich phantom to CIF file. More... | |
void | atomDescriptors (const std::string &atom, Matrix1D< double > &descriptors) |
double | electronFormFactorFourier (double f, const Matrix1D< double > &descriptors) |
double | electronFormFactorRealSpace (double r, const Matrix1D< double > &descriptors) |
void | hlpf (MultidimArray< double > &f, int M, const std::string &filterType, MultidimArray< double > &filter, double reductionFactor=0.8, double ripple=0.01, double deltaw=1.0/8.0) |
void | fhlpf (const MultidimArray< double > &f, const MultidimArray< double > &filter, int M, MultidimArray< double > &convolution) |
double | Hlpf_fitness (double *p, void *prm) |
void | optimizeHlpf (MultidimArray< double > &f, int M, double T, const std::string &atom, MultidimArray< double > &filter, Matrix1D< double > &bestPrm) |
void | atomRadialProfile (int M, double T, const std::string &atom, MultidimArray< double > &profile) |
void | atomProjectionRadialProfile (int M, const MultidimArray< double > &profileCoefficients, MultidimArray< double > &projectionProfile) |
void | projectAtom (const Atom &atom, Projection &P, const Matrix2D< double > &VP, const Matrix2D< double > &PV, const AtomInterpolator &interpolator) |
void | projectPDB (const PDBPhantom &phantomPDB, const AtomInterpolator &interpolator, Projection &proj, int Ydim, int Xdim, double rot, double tilt, double psi) |
void | distanceHistogramPDB (const PDBPhantom &phantomPDB, size_t Nnearest, double maxDistance, int Nbins, Histogram1D &hist) |
const char * | hy36encode (unsigned width, int value, char *result) |
const char * | hy36decode (unsigned width, const char *s, unsigned s_size, int *result) |
void | hy36decodeSafe (unsigned width, const char *s, unsigned s_size, int *result) |
void | hy36encodeSafe (unsigned width, int value, char *result) |
Variables | |
Matrix1D< double > | globalHlpfPrm (3) |
MultidimArray< double > | globalf |
int | globalM |
double | globalT |
std::string | globalAtom |
#define HY36_WIDTH_4_MAX 2436111 /* 10000 + 2*26*36*36*36 - 1 */ |
#define HY36_WIDTH_5_MAX 87440031 /* 100000 + 2*26*36*36*36*36 - 1 */ |
void atomProjectionRadialProfile | ( | int | M, |
const MultidimArray< double > & | profileCoefficients, | ||
MultidimArray< double > & | projectionProfile | ||
) |
Definition at line 1363 of file pdb.cpp.
void atomRadialProfile | ( | int | M, |
double | T, | ||
const std::string & | atom, | ||
MultidimArray< double > & | profile | ||
) |
Definition at line 1306 of file pdb.cpp.
bool checkExtension | ( | const std::filesystem::path & | filePath, |
const std::list< std::string > & | acceptedExtensions, | ||
const std::list< std::string > & | acceptedCompressions | ||
) |
Checks if the file uses a supported extension type.
This function checks if the given file path has one of the given supported extensions, with or without compression in any of the accepted compressions.
filePath | File including path. |
acceptedExtensions | List of accepted extensions. |
acceptedCompressions | List of accepted compressions. |
Definition at line 384 of file pdb.cpp.
void fhlpf | ( | const MultidimArray< double > & | f, |
const MultidimArray< double > & | filter, | ||
int | M, | ||
MultidimArray< double > & | convolution | ||
) |
Definition at line 1134 of file pdb.cpp.
void hlpf | ( | MultidimArray< double > & | f, |
int | M, | ||
const std::string & | filterType, | ||
MultidimArray< double > & | filter, | ||
double | reductionFactor = 0.8 , |
||
double | ripple = 0.01 , |
||
double | deltaw = 1.0/8.0 |
||
) |
Definition at line 1104 of file pdb.cpp.
double Hlpf_fitness | ( | double * | p, |
void * | prm | ||
) |
Definition at line 1181 of file pdb.cpp.
const char* hy36decode | ( | unsigned | width, |
const char * | s, | ||
unsigned | s_size, | ||
int * | result | ||
) |
hybrid-36 decoder: converts string s to integer result width: must be 4 (e.g. for residue sequence numbers) or 5 (e.g. for atom serial numbers) s: string to be converted does not have to be null-terminated s_size: size of s must be equal to width, or an error message is returned otherwise result: integer holding the conversion result return value: pointer to error message, if any, or 0 on success Example usage (from C++): int result; const char* errmsg = hy36decode(width, "A1T5", 4, &result); if (errmsg) throw std::runtime_error(errmsg);
Definition at line 1892 of file pdb.cpp.
void hy36decodeSafe | ( | unsigned | width, |
const char * | s, | ||
unsigned | s_size, | ||
int * | result | ||
) |
Definition at line 1968 of file pdb.cpp.
const char* hy36encode | ( | unsigned | width, |
int | value, | ||
char * | result | ||
) |
hybrid-36 encoder: converts integer value to string result width: must be 4 (e.g. for residue sequence numbers) or 5 (e.g. for atom serial numbers) value: integer value to be converted result: pointer to char array of size width+1 or greater on return result is null-terminated return value: pointer to error message, if any, or 0 on success Example usage (from C++): char result[4+1]; const char* errmsg = hy36encode(4, 12345, result); if (errmsg) throw std::runtime_error(errmsg);
Definition at line 1824 of file pdb.cpp.
void hy36encodeSafe | ( | unsigned | width, |
int | value, | ||
char * | result | ||
) |
void optimizeHlpf | ( | MultidimArray< double > & | f, |
int | M, | ||
double | T, | ||
const std::string & | atom, | ||
MultidimArray< double > & | filter, | ||
Matrix1D< double > & | bestPrm | ||
) |
Optimize the low pass filter. The optimization is so that the Fourier response of the coarsely downsampled and convolved atom profile resembles as much as possible the ideal atomic response up to the maximum frequency provided by the Nyquist frequency associated to M*T.
f is the electron scattering factor in real space sampled at a sampling rate T. M is the downsampling factor. atom is the name of the atom being optimized. filter is an output parameter with the optimal impulse response sampled at a sampling rate T. bestPrm(0)=reduction function of the cutoff frequency, bestPrm(1)=ripple of the Kaiser selfWindow, bestPrm(2)=deltaw of the Kaiser selfWindow.
Definition at line 1285 of file pdb.cpp.
void projectAtom | ( | const Atom & | atom, |
Projection & | P, | ||
const Matrix2D< double > & | VP, | ||
const Matrix2D< double > & | PV, | ||
const AtomInterpolator & | interpolator | ||
) |
PDB projection ------------------------------------------------------—
Definition at line 1446 of file pdb.cpp.
void readCIF | ( | const std::string & | fnCIF, |
const callable & | addAtom, | ||
cif::datablock & | dataBlock | ||
) |
Read phantom from CIF.
This function reads the given CIF file and inserts the found atoms inside in the class's atom list.
fnPDB | CIF file path. |
addAtom | Function to add atoms to class's atom list. |
dataBlock | Data block used to store all of CIF file's fields. |
Definition at line 463 of file pdb.cpp.
void readPDB | ( | const FileName & | fnPDB, |
const callable & | addAtom | ||
) |
void readRichCIF | ( | const std::string & | fnCIF, |
const callable & | addAtom, | ||
std::vector< double > & | intensities, | ||
const bool | pseudoatoms, | ||
const double | threshold, | ||
cif::datablock & | dataBlock | ||
) |
Read rich phantom from CIF.
This function reads the given CIF file and stores the found atoms, remarks, and intensities. Note: CIF files do not contain segment name, so that data won't be read.
fnPDB | CIF file path. |
addAtom | Function to add atoms to class's atom list. |
intensities | List of atom intensities. |
pseudoatoms | Flag for returning intensities (stored in B-factors) instead of atoms. false (default) is used when there are no pseudoatoms or when using a threshold. |
threshold | B factor threshold for filtering out for pdb_reduce_pseudoatoms. |
dataBlock | Data block used to store all of CIF file's fields. |
Definition at line 622 of file pdb.cpp.
void readRichPDB | ( | const FileName & | fnPDB, |
const callable & | addAtom, | ||
std::vector< double > & | intensities, | ||
std::vector< std::string > & | remarks, | ||
const bool | pseudoatoms, | ||
const double | threshold | ||
) |
Read rich phantom from either a PDB of CIF file.
This function reads the given PDB or CIF file and stores the found atoms, remarks, and intensities.
fnPDB | PDB/CIF file. |
addAtom | Function to add atoms to class's atom list. |
intensities | List of atom intensities. |
remarks | List of file remarks. |
pseudoatoms | Flag for returning intensities (stored in B-factors) instead of atoms. false (default) is used when there are no pseudoatoms or when using a threshold. |
threshold | B factor threshold for filtering out for pdb_reduce_pseudoatoms. |
Definition at line 538 of file pdb.cpp.
void writeCIF | ( | const std::string & | fnCIF, |
const callable & | atomList, | ||
cif::datablock & | dataBlock | ||
) |
void writePDB | ( | const FileName & | fnPDB, |
bool | renumber, | ||
const std::vector< std::string > & | remarks, | ||
const callable & | atomList | ||
) |
Write rich phantom to PDB file.
This function stores all the data of the rich phantom into a PDB file.
fnPDB | PDB file to write to. |
renumber | Flag for determining if atom's serial numbers must be renumbered or not. |
remarks | List of remarks. |
atomList | List of atoms to be stored. |
Definition at line 725 of file pdb.cpp.
MultidimArray<double> globalf |
Matrix1D<double> globalHlpfPrm(3) |