00001 /* configIO.h 00002 * 00003 * Copyright (C) 2009 Marcel Schumann 00004 * 00005 * This file is part of QuEasy -- A Toolbox for Automated QSAR Model 00006 * Construction and Validation. 00007 * QuEasy is free software; you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published by 00009 * the Free Software Foundation; either version 3 of the License, or (at 00010 * your option) any later version. 00011 * 00012 * QuEasy is distributed in the hope that it will be useful, but 00013 * WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 * General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with this program; if not, see <http://www.gnu.org/licenses/>. 00019 */ 00020 00021 #ifndef CONFIG_IO_H 00022 #define CONFIG_IO_H 00023 00024 #include <istream> 00025 #include <BALL/DATATYPE/string.h> 00026 #include <istream> 00027 #include <set> 00028 00029 namespace BALL 00030 { 00031 namespace QSAR 00032 { 00033 struct BALL_EXPORT InputConfiguration 00034 { 00035 InputConfiguration(); 00036 00037 String sd_file; 00038 std::multiset<int> activities; 00039 bool read_sd_descriptors; 00040 bool center_data; 00041 bool center_y; 00042 String output; 00043 double validation_fraction; 00044 bool separate_activity_file; 00045 bool within_section; 00046 vector<String> csv_file; 00047 vector<int> csv_no_response; 00048 vector<bool> csv_desc_labels; 00049 vector<bool> csv_compound_labels; 00050 vector<String> csv_separator; 00051 bool nonnumeric_class_names; 00052 bool done; 00053 }; 00054 00055 struct BALL_EXPORT InputPartitioningConfiguration 00056 { 00057 InputPartitioningConfiguration(); 00058 00059 String input_file; 00060 double validation_fraction; 00061 int no_folds; 00062 int ID; 00063 bool done; 00064 }; 00065 00066 struct BALL_EXPORT ModelConfiguration 00067 { 00068 ModelConfiguration(); 00069 00070 bool done; 00071 String data_file; 00072 String output; 00073 String descriptor_source_model; 00074 vector<double> model_parameters; 00075 int model_no; 00076 int kernel_type; 00077 double kernel_par1; 00078 double kernel_par2; 00079 int k_fold; 00080 bool optimize_model_parameters; 00081 double grid_search_stepwidth; 00082 int grid_search_steps; 00083 int grid_search_recursions; 00084 bool within_section; 00085 bool no_training; 00086 }; 00087 00088 struct BALL_EXPORT FeatureSelectionConfiguration 00089 { 00090 FeatureSelectionConfiguration(); 00091 00092 String model; 00093 String data_file; 00094 int feat_type; 00095 String output; 00096 int k_fold; 00097 bool within_section; 00098 String statistic_name; 00099 String selection_name; 00100 int statistic; 00101 bool remove_correlated; 00102 double cor_threshold; 00103 bool opt_model_after_fs; 00104 bool opt_kernel_after_fs; 00105 double quality_increase_cutoff; 00106 bool opt; 00107 bool done; 00108 int grid_search_steps; 00109 int grid_search_recursions; 00110 double grid_search_stepwidth; 00111 int opt_k_fold; 00112 }; 00113 00114 struct BALL_EXPORT ValidationConfiguration 00115 { 00116 ValidationConfiguration(); 00117 00118 String model; 00119 String data; 00120 String validation_data; 00121 int val_type; 00122 String output; 00123 int k_folds; 00124 int bootstrap_samples; 00125 int no_of_permutation_tests; 00126 int statistic; 00127 String statistic_name; 00128 vector<String> external_predictions; 00129 bool for_visualization_only; 00130 bool done; 00131 }; 00132 00133 struct BALL_EXPORT PredictionConfiguration 00134 { 00135 PredictionConfiguration(); 00136 00137 String model; 00138 String data; 00139 String output; 00140 int statistic; 00141 String statistic_name; 00142 bool print_expected; 00143 bool done; 00144 }; 00145 00146 00147 class BALL_EXPORT ConfigIO 00148 { 00149 public: 00150 00151 static void putbackLine(std::istream* input,String& line); 00152 00153 static ModelConfiguration readModelConfiguration(std::istream* input); 00154 00155 static FeatureSelectionConfiguration readFeatureSelectionConfiguration(std::istream* input); 00156 00157 static InputConfiguration readInputConfiguration(std::istream* input); 00158 00159 static InputPartitioningConfiguration readInputPartitioningConfiguration(std::istream* input); 00160 00161 static ValidationConfiguration readValidationConfiguration(std::istream* input); 00162 00163 static PredictionConfiguration readPredictionConfiguration(std::istream* input); 00164 }; 00165 } 00166 } 00167 00168 00169 #endif // CONFIG_IO_H