1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112
|
/**
* This programm calculates the variance/OC and/or the sensitivity of a set of pattern with the same weight.
* It is possible to improve your patternset and read patterns from a file.
*
* variance object header
*
* For theory please have a look at:
*
* B. Morgenstern, B. Zhu, S. Horwege, C.-A Leimeister (2015)
* Estimating evolutionary distances between genomic sequences from spaced-word matches
* Algorithms for Molecular Biology 10, 5. (http://www.almob.org/content/10/1/5/abstract)
*
*
* @author: Lars Hahn - 26.10.2015, Georg-August-Universitaet Goettingen
* @version: 1.0.2 11/2015
*/
#ifndef VARIANCE_H_
#define VARIANCE_H_
#include <iostream>
#include <fstream>
#include <random>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <inttypes.h>
#include "patternset.h"
#include "extkey.h"
class variance {
public:
variance();
variance(char* pattern_file);
variance(int size, int *length, int weight);
variance(char* pattern_file, int size, int *length, int weight, int l_hom, int l1, int l2, double p, double q, int H);
~variance();
void ReInitVariance();
void RandPatLength();
void Improve(int limit);
void ImproveOC();
std::vector<std::string> GetPattern();
std::string GetPattern(int number);
int GetWorstPat(int number);
int GetWeight();
int GetSize();
int* GetLength();
void PrintPattern();
std::string GetFormat();
double GetVariance();
double GetNormVariance();
double GetP();
double GetQ();
int GetLHom();
int GetL1();
int GetL2();
int GetH();
void LoopOpt(int n);
void Quiet();
void Silent();
protected:
void Ctor(char* pattern_file, int size, int *length, int weight, int l_hom, int l1, int l2, double p, double q, int H);
void InitVariance(char* pattern_file, int size, int *length, int weight);
void InitVarMatrix();
void InitVar();
void SetPatOrder();
void Clear();
double Variance();
void UpdateVariance(int pat);
int ShiftPos(int number, int number2, int s);
int WorstPattern(int number);
void ResetPatternOrder();
double Gauss();
void SecureMessage(std::string errmsg);
private:
std::vector<std::vector<double> > var_sum;
patternset* pattern_set;
std::vector<double> pattern_order;
std::vector<extkey*> pattern_order_sort;
std::string outvar;
double variance_val;
double p;
double q;
int size;
int weight;
int length_mean;
int *length;
int l_hom;
int l1;
int l2;
int H;
int loop_opt;
bool oc;
bool improve;
bool quiet;
bool silent;
bool update;
};
#endif
|