PROFASI  Version 1.5
Classes | Functions
prf_utils Namespace Reference

The namespace containing auxiliary useful classes used inside PROFASI. More...


class  AdaptiveHis
 A histogram that can adjust its own range according to the data. More...
class  His1D
 The default histogram utility in ProFASi is based on His1D. More...
class  His2D
 A histogram with 2 independent variables. More...
class  Permutation
 Permutation class originally developed by SM for ALFS. More...
class  prf_time
 Abstraction for some system time function. More...
class  OptBase
 Base class for program switches and options. More...
class  ProgSwitch
 A program switch. More...
class  ProgOpt
 One option that a program may handle. More...
class  ProgArgs
 A utility to help manage program parameters. More...
class  CorrelationEvaluator
class  MeanFinder
 Simple utility to find the mean of a vector. More...
class  StatBox
class  RangeBox
 Small utility class RangeBox. More...
class  CorrelationBox
 CorrelationBox finds the correlation coefficient between two data streams. More...
class  Timer
 ProFASi's own timer for managing time limited runs. More...


void CreateDir (const char *dirname)
 Check if directory exists, if not create it.
int TestFile (const char *filename)
 Check if file exists and the user has permissions to read it.
int STestFile (const char *filename)
 Same as above, but without any error messages.
int get_file_contents (std::string filename, std::string &buf)
 Get the contents of a file as a string.
double deg_to_rad (double d)
 Convert from degrees to radians.
double rad_to_deg (double r)
 Convert from radians to degrees.
void analyze_filename (std::string inputnm, std::string &filename, std::string &extn, std::string &sel)
 Break down a filename:selection string into its components.
std::string trim_str (std::string somestr)
 Get rid of leading and trailing white space characters in a string.
template<class T >
int split_str (std::string st, char spl, T &lst, unsigned int ign=1000000)
 Split a string into an array of strings based on a given character.
template<class T >
void split (std::string lin, T &con)
 Split a string into components based on white space.
template<class T >
int get_lines (std::string filename, T &lines)
 Get the contents of a file in a container of strings.
template<class T >
void random_permutation (std::vector< T > &res, std::vector< double > &ran)
 Create a random permutation of objects in a given vector.
template<class T >
void random_permutation (std::vector< T > &res, prf::RandomNumberBase *ran)
 Create a random permutation of objects in a given vector.

Detailed Description

Classes in this namespace are of more generic nature and usefulness. They have little to do with the protein folding model implemented here, but they have been found as very useful tools. Two examples would be the Vector3, to represent vectors in 3-space, and the Histogram class for a variety of possible applications in connection with gathering statistics.

Function Documentation

void prf_utils::analyze_filename ( std::string  inputnm,
std::string &  filename,
std::string &  extn,
std::string &  sel 

Given a compound name like 1GB1.pdb::A,41,56 this function will create a file name ("1GB1"), identify its file extension ("pdb") and the selections (":A,41,56")

template<class T >
int prf_utils::get_lines ( std::string  filename,
T &  lines 

The file is read line by line, and non-empty lines are added to the back of a standard library container.

template<class T >
void prf_utils::random_permutation ( std::vector< T > &  res,
std::vector< double > &  ran 

This function uses random numbers given in a separate vector (ran) to permute the contents of a given vector of arbitrary type (res).

template<class T >
void prf_utils::random_permutation ( std::vector< T > &  res,
prf::RandomNumberBase ran 

This function uses random numbers generated by a given random number generator to permute the contents of a given vector of arbitrary type.

template<class T >
int prf_utils::split_str ( std::string  st,
char  spl,
T &  lst,
unsigned int  ign = 1000000 

Splits string into an array containing at most the first ign tokens which would result because of such a spliting. The return value is the number of tokens in the list of split parts.

std::string prf_utils::trim_str ( std::string  somestr)

This is not really a "file" utility. But the name of this file just happens to be fileutils.hh. In the future it will be probably changed to misc_utils when more miscellaneous small functions accumulate here.

PROFASI: Protein Folding and Aggregation Simulator, Version 1.5
© (2005-2016) Anders Irbäck and Sandipan Mohanty
Documentation generated on Mon Jul 18 2016 using Doxygen version 1.8.2