mapgd  0.4
A program for the Maximum-likelihood analysis of population genomic data.
 All Data Structures Functions Variables Friends Groups Pages
phenotype.h
1 #ifndef _PHENOTYPE_H_
2 #define _PHENOTYPE_H_
3 
4 #include <cstring>
5 
6 #include <iostream>
7 #include <cfloat>
8 #include <iomanip>
9 #include <vector>
10 #include <sstream>
11 
12 #ifdef EIGEN
13 //#include "Eigen/Core"
14 #endif
15 
16 #include "typedef.h"
17 #include "data.h"
18 #include "stream_tools.h"
19 
21 class Phenotype : public Data{
22 private:
23  void write (std::ostream&) const;
24  void read (std::istream&);
25  static const Registration registered;
26  static Data * create(const std::vector <std::string> & Columns){
27  return new Phenotype(Columns);
28  }
29  size_t n_samples_, n_traits_;
30 public:
31  char delim;
32 
33  std::vector <std::string> sample_name;
34  std::vector <std::string> trait;
35 
36 #ifdef EIGEN
37  //Eigen::MatrixXf value;
38 #else
39  std::vector <std::vector <real_t > > value;
40 #endif
41 
42  Phenotype();
43  Phenotype(const std::vector <std::string> &);
44  Phenotype(const size_t &);
45 
47  std::string header(void) const;
49  size_t size(void) const;
50 
51 
52  void add_sample(const uint32_t &, const real_t *);
54 // void clear(void);
56 // void zero(void);
57 
58  static const std::string file_name;
59  static const std::string table_name;
60 
61  const std::string get_file_name(void) const;
62  const std::string get_table_name(void) const;
63 
64  static const bool binary;
65 
66  const bool get_binary() const;
67 
68 // const size_t sample_size(void) const;
69 
70 };
71 
72 #endif
void read(std::istream &)
use to read Allele. Inherits >>
Definition: phenotype.cc:50
char delim
the delimiter used when reading/writing the class in text mode.
Definition: phenotype.h:31
size_t size(void) const
Size in bytes for binary read/write.
Definition: phenotype.cc:119
std::string header(void) const
The header line of plain text files.
Definition: phenotype.cc:105
static const std::string table_name
Destination table in Db.
Definition: phenotype.h:59
void write(std::ostream &) const
use to write Allele. Inherits <<
Definition: phenotype.cc:72
A class which registers a child of Data in Data::new_data_.
Definition: data.h:222
A class which can be written as flat text file or into an SQL database.
Definition: data.h:34
static const std::string file_name
zeros values and sets names to empty.
Definition: phenotype.h:58
Phenotype data.
Definition: phenotype.h:21