Xmipp  v3.23.11-Nereus
Public Member Functions | Public Attributes | List of all members
ProgPdbNmaDeform Class Reference

#include <pdb_nma_deform.h>

Inheritance diagram for ProgPdbNmaDeform:
Inheritance graph
[legend]
Collaboration diagram for ProgPdbNmaDeform:
Collaboration graph
[legend]

Public Member Functions

void defineParams ()
 
void readParams ()
 
void show ()
 
void run ()
 
- Public Member Functions inherited from XmippProgram
const char * getParam (const char *param, int arg=0)
 
const char * getParam (const char *param, const char *subparam, int arg=0)
 
int getIntParam (const char *param, int arg=0)
 
int getIntParam (const char *param, const char *subparam, int arg=0)
 
double getDoubleParam (const char *param, int arg=0)
 
double getDoubleParam (const char *param, const char *subparam, int arg=0)
 
float getFloatParam (const char *param, int arg=0)
 
float getFloatParam (const char *param, const char *subparam, int arg=0)
 
void getListParam (const char *param, StringVector &list)
 
int getCountParam (const char *param)
 
bool checkParam (const char *param)
 
bool existsParam (const char *param)
 
void addParamsLine (const String &line)
 
void addParamsLine (const char *line)
 
ParamDefgetParamDef (const char *param) const
 
virtual void quit (int exit_code=0) const
 
virtual int tryRun ()
 
void initProgress (size_t total, size_t stepBin=60)
 
void setProgress (size_t value=0)
 
void endProgress ()
 
void processDefaultComment (const char *param, const char *left)
 
void setDefaultComment (const char *param, const char *comment)
 
virtual void initComments ()
 
void setProgramName (const char *name)
 
void addUsageLine (const char *line, bool verbatim=false)
 
void clearUsage ()
 
void addExampleLine (const char *example, bool verbatim=true)
 
void addSeeAlsoLine (const char *seeAlso)
 
void addKeywords (const char *keywords)
 
const char * name () const
 
virtual void usage (int verb=0) const
 
virtual void usage (const String &param, int verb=2)
 
int version () const
 
virtual void show () const
 
virtual void read (int argc, const char **argv, bool reportErrors=true)
 
virtual void read (int argc, char **argv, bool reportErrors=true)
 
void read (const String &argumentsLine)
 
 XmippProgram ()
 
 XmippProgram (int argc, const char **argv)
 
virtual ~XmippProgram ()
 

Public Attributes

FileName fn_pdb
 
FileName fn_nma
 
FileName fn_out
 
MultidimArray< double > deformations
 
- Public Attributes inherited from XmippProgram
bool doRun
 
bool runWithoutArgs
 
int verbose
 Verbosity level. More...
 
int debug
 

Additional Inherited Members

- Protected Member Functions inherited from XmippProgram
void defineCommons ()
 
- Protected Attributes inherited from XmippProgram
int errorCode
 
ProgramDefprogDef
 Program definition and arguments parser. More...
 
std::map< String, CommentListdefaultComments
 
int argc
 Original command line arguments. More...
 
const char ** argv
 

Detailed Description

Parameter class for the PDB Phantom program

Definition at line 37 of file pdb_nma_deform.h.

Member Function Documentation

◆ defineParams()

void ProgPdbNmaDeform::defineParams ( )
virtual

Params definitions

Reimplemented from XmippProgram.

Definition at line 32 of file pdb_nma_deform.cpp.

33 {
34  addUsageLine("Deform a PDB according to a list of NMA modes");
35  addUsageLine("+It is assumed that there is a deformation value per mode, and that the number of vectors in the mode is the same as the number of atoms in the PDB");
36  addParamsLine("--pdb <file> : PDB to deform");
37  addParamsLine("--nma <metadata_file> : List of modes, the metadata must use the label NMAModefile");
38  addParamsLine("--deformations <...> : Deformation amplitudes in each direction");
39  addParamsLine("-o <file> : Deformed PDB");
40  addExampleLine("xmipp_pdb_nma_deform --pdb 2tbv.pdb -o 2tbv_deformed.pdb --nma modelist.xmd --deformations 15");
41 }
void addExampleLine(const char *example, bool verbatim=true)
void addUsageLine(const char *line, bool verbatim=false)
void addParamsLine(const String &line)

◆ readParams()

void ProgPdbNmaDeform::readParams ( )
virtual

Read from a command line.

Reimplemented from XmippProgram.

Definition at line 43 of file pdb_nma_deform.cpp.

44 {
45  fn_pdb=getParam("--pdb");
46  fn_nma=getParam("--nma");
47  fn_out=getParam("-o");
48  StringVector listDeformations;
49  getListParam("--deformations",listDeformations);
50  deformations.resizeNoCopy(listDeformations.size());
52  deformations(i)=textToFloat(listDeformations[i]);
53 }
void resizeNoCopy(const MultidimArray< T1 > &v)
void getListParam(const char *param, StringVector &list)
std::vector< String > StringVector
Definition: xmipp_strings.h:35
#define i
const char * getParam(const char *param, int arg=0)
float textToFloat(const char *str)
#define FOR_ALL_ELEMENTS_IN_ARRAY1D(v)
MultidimArray< double > deformations

◆ run()

void ProgPdbNmaDeform::run ( )
virtual

Run.

Reimplemented from XmippProgram.

Definition at line 70 of file pdb_nma_deform.cpp.

71 {
72  PDBRichPhantom pdb;
73  MetaDataVec modes;
74  pdb.read(fn_pdb);
75  modes.read(fn_nma);
76  modes.removeDisabled();
77  int j=0;
78  FileName fnMode;
80  mode.resizeNoCopy(pdb.getNumberOfAtoms(),3);
81 
82  for (size_t objId : modes.ids())
83  {
84  // Read mode
85  modes.getValue(MDL_NMA_MODEFILE,fnMode,objId);
86  std::ifstream fhMode;
87  fhMode.open(fnMode.c_str());
88  if (!fhMode)
90  fhMode >> mode;
91  fhMode.close();
92 
93  // Apply mode
94  double lambda=A1D_ELEM(deformations,j);
95  for (size_t i=0; i<YSIZE(mode); ++i)
96  {
97  RichAtom& atom_i=pdb.atomList[i];
98  atom_i.x+=lambda*DIRECT_A2D_ELEM(mode,i,0);
99  atom_i.y+=lambda*DIRECT_A2D_ELEM(mode,i,1);
100  atom_i.z+=lambda*DIRECT_A2D_ELEM(mode,i,2);
101  }
102  j++;
103  }
104  pdb.write(fn_out);
105 }
#define YSIZE(v)
void read(const FileName &fnPDB, const bool pseudoatoms=false, const double threshold=0.0)
Read rich phantom from either a PDB of CIF file.
Definition: pdb.cpp:704
void read(const FileName &inFile, const std::vector< MDLabel > *desiredLabels=nullptr, bool decomposeStack=true) override
#define REPORT_ERROR(nerr, ErrormMsg)
Definition: xmipp_error.h:211
void write(const FileName &fnPDB, const bool renumber=false)
Write rich phantom to PDB or CIF file.
Definition: pdb.cpp:872
void resizeNoCopy(const MultidimArray< T1 > &v)
#define DIRECT_A2D_ELEM(v, i, j)
#define A1D_ELEM(v, i)
Definition: pdb.h:174
virtual IdIteratorProxy< false > ids()
#define i
double y
Position Y.
Definition: pdb.h:187
double * lambda
Couldn&#39;t read from file.
Definition: xmipp_error.h:139
void mode
double x
Position X.
Definition: pdb.h:184
#define j
bool getValue(MDObject &mdValueOut, size_t id) const override
std::vector< RichAtom > atomList
List of atoms.
Definition: pdb.h:257
size_t getNumberOfAtoms() const
Get number of atoms.
Definition: pdb.h:270
virtual void removeDisabled()
MultidimArray< double > deformations
File with an NMA mode.
double z
Position Z.
Definition: pdb.h:190

◆ show()

void ProgPdbNmaDeform::show ( )

Show parameters.

Definition at line 55 of file pdb_nma_deform.cpp.

56 {
57  if (verbose==0)
58  return;
59  std::cout
60  << "PDB: " << fn_pdb << std::endl
61  << "NMA list: " << fn_nma << std::endl
62  << "Output: " << fn_out << std::endl
63  << "Deformations: "
64  ;
66  std::cout << deformations(i) << " ";
67  std::cout << std::endl;
68 }
#define i
int verbose
Verbosity level.
#define FOR_ALL_ELEMENTS_IN_ARRAY1D(v)
MultidimArray< double > deformations

Member Data Documentation

◆ deformations

MultidimArray<double> ProgPdbNmaDeform::deformations

Set of deformations

Definition at line 50 of file pdb_nma_deform.h.

◆ fn_nma

FileName ProgPdbNmaDeform::fn_nma

NMA mode list

Definition at line 44 of file pdb_nma_deform.h.

◆ fn_out

FileName ProgPdbNmaDeform::fn_out

Output fileroot

Definition at line 47 of file pdb_nma_deform.h.

◆ fn_pdb

FileName ProgPdbNmaDeform::fn_pdb

PDB file

Definition at line 41 of file pdb_nma_deform.h.


The documentation for this class was generated from the following files: