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

#include <pdb_reduce_pseudoatoms.h>

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

Public Member Functions

 ProgPdbReduce ()
 
void defineParams ()
 
void readParams ()
 
void show ()
 
void run ()
 
void reduceNumberPseudoatoms ()
 
- 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 ()
 

Additional Inherited Members

- Public Attributes inherited from XmippProgram
bool doRun
 
bool runWithoutArgs
 
int verbose
 Verbosity level. More...
 
int debug
 
- 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

Definition at line 35 of file pdb_reduce_pseudoatoms.h.

Constructor & Destructor Documentation

◆ ProgPdbReduce()

ProgPdbReduce::ProgPdbReduce ( )

Definition at line 32 of file pdb_reduce_pseudoatoms.cpp.

33 {
34  thresh = 0.0;
35  num = -1.0;
36 }

Member Function Documentation

◆ defineParams()

void ProgPdbReduce::defineParams ( )
virtual

Params definitions

Reimplemented from XmippProgram.

Definition at line 38 of file pdb_reduce_pseudoatoms.cpp.

39 {
40  addUsageLine("Reduce the number of pseudoatoms in a volume.");
41  addExampleLine(" xmipp_pdb_reduce_pseudoatoms -i 1o7d.vol -o 1o7dreduced.vol --threshold 0.15");
42 
43  addParamsLine(" -i <pdb_file> : File to process");
44  addParamsLine(" [-o <fn_root>] : Root name for output");
45  addParamsLine(" [--number <num=-1.0>] : Number of pseudoatoms to keep based on intensity");
46  addParamsLine(" [--threshold <thresh=0.0>] : Intensity threshold for removing pseudoatoms");
47 }
void addExampleLine(const char *example, bool verbatim=true)
void addUsageLine(const char *line, bool verbatim=false)
void addParamsLine(const String &line)

◆ readParams()

void ProgPdbReduce::readParams ( )
virtual

Read from a command line. An exception might be thrown by any of the internal conversions, this would mean that there is an error in the command line and you might show a usage message.

Reimplemented from XmippProgram.

Definition at line 49 of file pdb_reduce_pseudoatoms.cpp.

50 {
51  fn_volume = getParam("-i");
52  fn_out = checkParam("-o") ? getParam("-o") : fn_volume.withoutExtension();
53  num = getDoubleParam("--number");
54  thresh = getDoubleParam("--threshold");
55 
56 }
double getDoubleParam(const char *param, int arg=0)
const char * getParam(const char *param, int arg=0)
bool checkParam(const char *param)

◆ reduceNumberPseudoatoms()

void ProgPdbReduce::reduceNumberPseudoatoms ( )

Definition at line 66 of file pdb_reduce_pseudoatoms.cpp.

67 {
68  PDBRichPhantom pdb;
69  if(thresh != 0.0)
70  pdb.read(fn_volume, false, thresh);
71  else
72  {
73  pdb.read(fn_volume, true);
74  std::sort(pdb.intensities.rbegin(), pdb.intensities.rend());
75  thresh = pdb.intensities.at(num);
76  pdb.atomList.clear();
77  pdb.remarks.clear();
78  pdb.read(fn_volume, false, thresh);
79  }
80  pdb.write(fn_out, true); // keep renumbering
81 }
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 write(const FileName &fnPDB, const bool renumber=false)
Write rich phantom to PDB or CIF file.
Definition: pdb.cpp:872
std::vector< double > intensities
Definition: pdb.h:258
void sort(struct DCEL_T *dcel)
Definition: sorting.cpp:18
std::vector< RichAtom > atomList
List of atoms.
Definition: pdb.h:257
std::vector< std::string > remarks
List of remarks.
Definition: pdb.h:254

◆ run()

void ProgPdbReduce::run ( )
virtual

Run.

Reimplemented from XmippProgram.

Definition at line 83 of file pdb_reduce_pseudoatoms.cpp.

84 {
86 }

◆ show()

void ProgPdbReduce::show ( )

Show parameters.

Definition at line 59 of file pdb_reduce_pseudoatoms.cpp.

60 {
61  std::cout << "PDB file: " << fn_volume << std::endl
62  << "Number: " << num << std::endl
63  << "Threshold: " << thresh << std::endl;
64 }

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