Loading...
Searching...
No Matches
QSARData.h
Go to the documentation of this file.
// -*- Mode: C++; tab-width: 2; -*-
// vi: set ts=2:
//
//
#ifndef QSARH
#define QSARH
#include <iostream>
#include <BALL/KERNEL/system.h>
#include <BALL/FORMAT/SDFile.h>
#include <BALL/FORMAT/PDBFile.h>
#include <BALL/FORMAT/HINFile.h>
#include <BALL/FORMAT/MOLFile.h>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <cmath>
#include <sstream>
#include <fstream>
#include <limits>
#include <fstream>
#include <BALL/QSAR/simpleDescriptors.h>
#include <BALL/QSAR/connectivityDescriptors.h>
#include <BALL/QSAR/partialChargeDescriptors.h>
#include <BALL/QSAR/surfaceDescriptors.h>
#include <BALL/COMMON/exception.h>
#include <cstring>
#ifndef STATISTICS
#include <BALL/QSAR/statistics.h>
#endif
#ifndef QSAR_EXCEPTION
#include <BALL/QSAR/exception.h>
#endif
#include <BALL/CONCEPT/timeStamp.h>
// #ifndef MODEL
// #include "Model.h"
// #endif
namespace BALL
{
class MolecularSimilarity;
namespace QSAR
{
typedef vector<double> Column;
typedef vector<Column> VMatrix;
class BALL_EXPORT QSARData
{
public:
QSARData();
~QSARData();
bool isDataCentered() const;
bool isResponseCentered() const;
vector<String>* readPropertyNames(String sd_file);
void readSDFile(const char* file);
void readSDFile(const char* file, std::multiset<int>& act, bool useExDesc=1, bool append=0, bool translate_class_labels=0);
void readSDFile(const char* file, std::set<String>& activity_names, bool useExDesc=1, bool append=0, bool translate_class_labels=0, bool calc_phychem_properties=1, bool calc_topological_properties=1);
void displayMatrix();
void centerData(bool center_Y=0);
void scaleAllDescriptors();
unsigned int getNoSubstances() const;
unsigned int getNoDescriptors() const;
void readCSVFile(const char* file, int no_y, bool xlabels, bool ylabels, const char* sep=",", bool appendDescriptors=0, bool translate_class_labels=0);
void manipulateY(std::vector<String> v);
void manipulateY(String v);
void discretizeY(std::vector<double> thresholds);
void transformX(std::vector<String> v);
std::vector<QSARData*> partitionInputData(int p);
void saveToFile(string filename) const;
void readFromFile(string filename);
std::vector<QSARData*> generateExternalSet(double fraction) const;
std::vector<QSARData*> evenSplit(int no_test_splits, int current_test_split_id, int response_id=0) const;
std::vector<double>* getSubstance(int s) const;
std::vector<double>* getActivity(int s) const;
unsigned int getNoResponseVariables() const;
const std::vector<string>* getSubstanceNames() const;
bool checkforDiscreteY() const;
bool checkforDiscreteY(const char* file, std::multiset<int>& activity_IDs) const;
void setDataFolder(const char* folder);
void removeHighlyCorrelatedCompounds(double& compound_cor_threshold, double& feature_cor_threshold);
void getSimilarDescriptors(int descriptor_ID, double correlation, std::list<std::pair<uint,String> >& similar_descriptor_IDs) const;
protected:
void calculateBALLDescriptors(Molecule& m);
void calculateTopologicalDescriptors(Molecule& mol, MolecularSimilarity& molsim, const std::map<String,int>& descriptor_map);
void setDescriptorNames(const Molecule& m, std::multiset<int>& activity_IDs, bool useExDesc=1, bool resize=1);
void removeInvalidDescriptors(std::multiset<int>& invalidDescriptors);
void removeInvalidSubstances(std::multiset<int>& inv);
void readMatrix(VMatrix& mat, std::ifstream& in, char seperator, unsigned int lines, unsigned int col);
void checkActivityIDs(std::multiset<int>& act, int no_properties);
void insertSubstance(const QSARData* source, int s, bool backtransformation=0);
void printMatrix(const VMatrix& mat, std::ostream& out) const;
VMatrix descriptor_matrix_;
VMatrix Y_;
VMatrix descriptor_transformations_;
VMatrix y_transformations_;
vector<string> column_names_;
vector<string> substance_names_;
std::multiset<int> invalidDescriptors_;
std::multiset<int> invalidSubstances_;
String data_folder_;
std::map<String,int> class_names_;
friend class ClassificationValidation;
friend class RegressionValidation;
friend class Validation;
friend class Model;
friend class FitModel;
friend class FeatureSelection;
};
}
}
#endif // QSARH
exception.h
BALL_EXPORT
#define BALL_EXPORT
Definition COMMON/global.h:50
HINFile.h
system.h
MOLFile.h
PDBFile.h
exception.h
SDFile.h
BALL::MolecularSimilarity
Definition molecularSimilarity.h:32
BALL::Molecule
Definition molecule.h:31
BALL::QSAR::QSARData::calculateBALLDescriptors
void calculateBALLDescriptors(Molecule &m)
BALL::QSAR::QSARData::column_names_
vector< string > column_names_
Definition QSARData.h:236
BALL::QSAR::QSARData::checkActivityIDs
void checkActivityIDs(std::multiset< int > &act, int no_properties)
BALL::QSAR::QSARData::discretizeY
void discretizeY(std::vector< double > thresholds)
BALL::QSAR::QSARData::getActivity
std::vector< double > * getActivity(int s) const
BALL::QSAR::QSARData::invalidSubstances_
std::multiset< int > invalidSubstances_
Definition QSARData.h:244
BALL::QSAR::QSARData::removeHighlyCorrelatedCompounds
void removeHighlyCorrelatedCompounds(double &compound_cor_threshold, double &feature_cor_threshold)
BALL::QSAR::QSARData::getNoResponseVariables
unsigned int getNoResponseVariables() const
BALL::QSAR::QSARData::setDataFolder
void setDataFolder(const char *folder)
BALL::QSAR::QSARData::readPropertyNames
vector< String > * readPropertyNames(String sd_file)
BALL::QSAR::QSARData::manipulateY
void manipulateY(String v)
BALL::QSAR::QSARData::QSARData
QSARData()
BALL::QSAR::QSARData::removeInvalidDescriptors
void removeInvalidDescriptors(std::multiset< int > &invalidDescriptors)
BALL::QSAR::QSARData::class_names_
std::map< String, int > class_names_
Definition QSARData.h:249
BALL::QSAR::QSARData::printMatrix
void printMatrix(const VMatrix &mat, std::ostream &out) const
BALL::QSAR::QSARData::Model
friend class Model
Definition QSARData.h:257
BALL::QSAR::QSARData::readSDFile
void readSDFile(const char *file, std::set< String > &activity_names, bool useExDesc=1, bool append=0, bool translate_class_labels=0, bool calc_phychem_properties=1, bool calc_topological_properties=1)
BALL::QSAR::QSARData::checkforDiscreteY
bool checkforDiscreteY() const
BALL::QSAR::QSARData::readCSVFile
void readCSVFile(const char *file, int no_y, bool xlabels, bool ylabels, const char *sep=",", bool appendDescriptors=0, bool translate_class_labels=0)
BALL::QSAR::QSARData::readSDFile
void readSDFile(const char *file, std::multiset< int > &act, bool useExDesc=1, bool append=0, bool translate_class_labels=0)
BALL::QSAR::QSARData::transformX
void transformX(std::vector< String > v)
BALL::QSAR::QSARData::FitModel
friend class FitModel
Definition QSARData.h:258
BALL::QSAR::QSARData::FeatureSelection
friend class FeatureSelection
Definition QSARData.h:259
BALL::QSAR::QSARData::generateExternalSet
std::vector< QSARData * > generateExternalSet(double fraction) const
BALL::QSAR::QSARData::setDescriptorNames
void setDescriptorNames(const Molecule &m, std::multiset< int > &activity_IDs, bool useExDesc=1, bool resize=1)
BALL::QSAR::QSARData::ClassificationValidation
friend class ClassificationValidation
Definition QSARData.h:254
BALL::QSAR::QSARData::evenSplit
std::vector< QSARData * > evenSplit(int no_test_splits, int current_test_split_id, int response_id=0) const
BALL::QSAR::QSARData::getSubstance
std::vector< double > * getSubstance(int s) const
BALL::QSAR::QSARData::descriptor_matrix_
VMatrix descriptor_matrix_
Definition QSARData.h:224
BALL::QSAR::QSARData::readMatrix
void readMatrix(VMatrix &mat, std::ifstream &in, char seperator, unsigned int lines, unsigned int col)
BALL::QSAR::QSARData::isResponseCentered
bool isResponseCentered() const
BALL::QSAR::QSARData::insertSubstance
void insertSubstance(const QSARData *source, int s, bool backtransformation=0)
BALL::QSAR::QSARData::readSDFile
void readSDFile(const char *file)
BALL::QSAR::QSARData::y_transformations_
VMatrix y_transformations_
Definition QSARData.h:233
BALL::QSAR::QSARData::displayMatrix
void displayMatrix()
BALL::QSAR::QSARData::readFromFile
void readFromFile(string filename)
BALL::QSAR::QSARData::invalidDescriptors_
std::multiset< int > invalidDescriptors_
Definition QSARData.h:242
BALL::QSAR::QSARData::removeInvalidSubstances
void removeInvalidSubstances(std::multiset< int > &inv)
BALL::QSAR::QSARData::checkforDiscreteY
bool checkforDiscreteY(const char *file, std::multiset< int > &activity_IDs) const
BALL::QSAR::QSARData::calculateTopologicalDescriptors
void calculateTopologicalDescriptors(Molecule &mol, MolecularSimilarity &molsim, const std::map< String, int > &descriptor_map)
BALL::QSAR::QSARData::getSimilarDescriptors
void getSimilarDescriptors(int descriptor_ID, double correlation, std::list< std::pair< uint, String > > &similar_descriptor_IDs) const
BALL::QSAR::QSARData::RegressionValidation
friend class RegressionValidation
Definition QSARData.h:255
BALL::QSAR::QSARData::saveToFile
void saveToFile(string filename) const
BALL::QSAR::QSARData::substance_names_
vector< string > substance_names_
Definition QSARData.h:239
BALL::QSAR::QSARData::Y_
VMatrix Y_
Definition QSARData.h:227
BALL::QSAR::QSARData::Validation
friend class Validation
Definition QSARData.h:256
BALL::QSAR::QSARData::getNoDescriptors
unsigned int getNoDescriptors() const
BALL::QSAR::QSARData::data_folder_
String data_folder_
Definition QSARData.h:246
BALL::QSAR::QSARData::centerData
void centerData(bool center_Y=0)
BALL::QSAR::QSARData::~QSARData
~QSARData()
BALL::QSAR::QSARData::getNoSubstances
unsigned int getNoSubstances() const
BALL::QSAR::QSARData::partitionInputData
std::vector< QSARData * > partitionInputData(int p)
BALL::QSAR::QSARData::descriptor_transformations_
VMatrix descriptor_transformations_
Definition QSARData.h:230
BALL::QSAR::QSARData::getSubstanceNames
const std::vector< string > * getSubstanceNames() const
BALL::QSAR::QSARData::isDataCentered
bool isDataCentered() const
BALL::QSAR::QSARData::scaleAllDescriptors
void scaleAllDescriptors()
BALL::QSAR::QSARData::manipulateY
void manipulateY(std::vector< String > v)
BALL::String
Definition string.h:57
connectivityDescriptors.h
BALL::QSAR
Definition allModel.h:17
BALL::QSAR::VMatrix
vector< Column > VMatrix
Definition QSARData.h:52
BALL::QSAR::Column
vector< double > Column
Definition QSARData.h:51
BALL
Definition constants.h:13
partialChargeDescriptors.h
simpleDescriptors.h
statistics.h
surfaceDescriptors.h
timeStamp.h