bpp-popgen3  3.0.0
GeneMapperCsvExport.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: The Bio++ Development Group
2 //
3 // SPDX-License-Identifier: CECILL-2.1
4 
5 #ifndef _BPP_POPGEN_GENEMAPPERCSVEXPORT_H_
6 #define _BPP_POPGEN_GENEMAPPERCSVEXPORT_H_
7 
8 #include <Bpp/Exceptions.h>
9 #include <Bpp/Io/FileTools.h>
10 #include <Bpp/Text/TextTools.h>
12 #include <Bpp/Numeric/DataTable.h>
13 
14 // From local Pop
15 #include "../AbstractIDataSet.h"
16 #include "../../../BasicAlleleInfo.h"
17 #include "../../../MultiAlleleMonolocusGenotype.h"
18 
19 namespace bpp
20 {
29 {
30 public:
31  static const std::string SAMPLE_FILE_H;
32  static const std::string SAMPLE_NAME_H;
33  static const std::string PANEL_H;
34  static const std::string MARKER_H;
35  static const std::string DYE_H;
36  static const std::string ALLELE_H;
37  static const std::string SIZE_H;
38  static const std::string HEIGHT_H;
39  static const std::string PEAK_AREA_H;
40  static const std::string DAC_H;
41  static const std::string AN_H;
42 
43 private:
44  // bool IndependentAlleles_; //jdutheilon 19/09/14: this does not seem to be used anywhere!
45 
46 public:
47  // Constructor and destructor
48  // GeneMapperCsvExport(bool ia = false);
51 
52  // public:
57  // SetAllelsAsIndependent(bool flag);
58 
59 public:
64  void read(std::istream& is, DataSet& data_set);
65  void read(const std::string& path, DataSet& data_set);
66  DataSet* read(std::istream& is);
67  DataSet* read(const std::string& path);
76  virtual const std::string getFormatName() const
77  {
78  return "GeneMapperĀ® cvs export";
79  }
80  virtual const std::string getFormatDescription() const
81  {
82  return "GeneMapperĀ® is a flexible genotyping software package that provides DNA sizing and quality allele calls for all Applied Biosystems electrophoresis-based genotyping systems.";
83  }
91  class Allele
92  {
93 private:
94  std::string name_;
95  double size_;
96  unsigned int height_;
97  double peakArea_;
98 
99 public:
100  Allele(const std::string& name, double size, unsigned int height, double peakArea) : name_(name),
101  size_(size),
102  height_(height),
103  peakArea_(peakArea) {}
104 
105  const std::string& getName() const
106  {
107  return name_;
108  }
109  const double& getSize() const
110  {
111  return size_;
112  }
113  const unsigned int& getHeight() const
114  {
115  return height_;
116  }
117  const double& getPeakArea() const
118  {
119  return peakArea_;
120  }
121  };
122 
126  class Record
127  {
128 private:
129  std::string sampleFile_;
130  std::string sampleName_;
131  std::string panel_;
132  std::string markerName_;
133  std::string dye_;
134  std::vector< GeneMapperCsvExport::Allele > alleles_;
135  std::string dac_;
136  double an_;
137 
138 public:
144  Record(const std::string& row);
145 
146  const std::string& getSampleFileName() const
147  {
148  return sampleFile_;
149  }
150  const std::string& getSampleName() const
151  {
152  return sampleName_;
153  }
154  const std::string& getPanel() const
155  {
156  return panel_;
157  }
158  const std::string& getMarkerName() const
159  {
160  return markerName_;
161  }
162  const std::string& getDye() const
163  {
164  return dye_;
165  }
166  const size_t getNumberOfAllele() const
167  {
168  return alleles_.size();
169  }
170  const GeneMapperCsvExport::Allele& getAllele(size_t allelePos) const
171  {
172  return alleles_[allelePos];
173  }
174  };
175 };
176 } // end of namespace bpp;
177 
178 #endif // _BPP_POPGEN_GENEMAPPERCSVEXPORT_H_
Partial implementation of the DataSet Input interface.
The DataSet class.
Definition: DataSet.h:37
Store data for one allele.
Allele(const std::string &name, double size, unsigned int height, double peakArea)
const unsigned int & getHeight() const
const std::string & getName() const
Store one line of the GeneMapper file.
const GeneMapperCsvExport::Allele & getAllele(size_t allelePos) const
Record(const std::string &row)
Constructor.
std::vector< GeneMapperCsvExport::Allele > alleles_
const std::string & getMarkerName() const
const std::string & getPanel() const
const std::string & getSampleName() const
const std::string & getSampleFileName() const
const std::string & getDye() const
The GeneMapperCsvExport input format for popgenlib.
virtual const std::string getFormatDescription() const
virtual const std::string getFormatName() const
static const std::string PEAK_AREA_H
static const std::string SAMPLE_NAME_H
static const std::string SIZE_H
static const std::string MARKER_H
static const std::string ALLELE_H
static const std::string HEIGHT_H
static const std::string AN_H
static const std::string DYE_H
void read(std::istream &is, DataSet &data_set)
Read a DataSet on istream.
static const std::string SAMPLE_FILE_H
static const std::string PANEL_H
static const std::string DAC_H