eXpress “1.5”
|
00001 00010 #ifndef BIASCORRECTION_H 00011 #define BIASCORRECTION_H 00012 00013 #include <string> 00014 #include <vector> 00015 00016 #include "lengthdistribution.h" 00017 #include "frequencymatrix.h" 00018 #include "markovmodel.h" 00019 00020 class BiasBoss; 00021 class FragHit; 00022 class Target; 00023 00033 class SeqWeightTable { 00038 size_t _order; 00043 MarkovModel _observed; 00049 MarkovModel _expected; 00050 public: 00060 SeqWeightTable(size_t window_size, size_t order, double alpha); 00072 SeqWeightTable(size_t window_size, size_t order, std::string param_file_name, 00073 std::string identifier); 00079 void copy_observed(const SeqWeightTable& other); 00085 void copy_expected(const SeqWeightTable& other); 00093 void increment_expected(const Sequence& seq, double mass, 00094 const std::vector<double>& fl_cdf); 00099 void normalize_expected(); 00109 void increment_observed(const Sequence& seq, size_t i, double mass); 00118 double get_weight(const Sequence& seq, size_t i) const; 00125 void append_output(std::ofstream& outfile) const; 00126 }; 00127 00138 class BiasBoss 00139 { 00144 size_t _order; 00149 SeqWeightTable _5_seq_bias; 00154 SeqWeightTable _3_seq_bias; 00155 00156 public: 00164 BiasBoss(size_t order, double alpha); //TODO: Detect order from file. 00172 BiasBoss(size_t order, std::string param_file_name); 00177 size_t order() const { return _order; } 00183 void copy_observations(const BiasBoss& other); 00189 void copy_expectations(const BiasBoss& other); 00195 void update_expectations(const Target& targ, 00196 double mass = 0, 00197 const std::vector<double>& fl_cdf = std::vector<double>()); 00202 void normalize_expectations(); 00210 void update_observed(const FragHit& hit, double mass); 00221 double get_target_bias(std::vector<float>& start_bias, 00222 std::vector<float>& end_bias, 00223 const Target& targ) const; 00229 void append_output(std::ofstream& outfile) const; 00230 }; 00231 00232 #endif