bpp-popgen  3.0.0
GeneMapperCsvExport.h
Go to the documentation of this file.
1 //
2 // File: GeneMapperCsvExport.h
3 // Author: Sylvain Gaillard
4 // Created: April 2, 2008
5 //
6 
7 /*
8  Copyright or © or Copr. Bio++ Development Team, (April 2, 2008)
9 
10  This software is a computer program whose purpose is to provide classes
11  for population genetics analysis.
12 
13  This software is governed by the CeCILL license under French law and
14  abiding by the rules of distribution of free software. You can use,
15  modify and/ or redistribute the software under the terms of the CeCILL
16  license as circulated by CEA, CNRS and INRIA at the following URL
17  "http://www.cecill.info".
18 
19  As a counterpart to the access to the source code and rights to copy,
20  modify and redistribute granted by the license, users are provided only
21  with a limited warranty and the software's author, the holder of the
22  economic rights, and the successive licensors have only limited
23  liability.
24 
25  In this respect, the user's attention is drawn to the risks associated
26  with loading, using, modifying and/or developing or reproducing the
27  software by the user in light of its specific status of free software,
28  that may mean that it is complicated to manipulate, and that also
29  therefore means that it is reserved for developers and experienced
30  professionals having in-depth computer knowledge. Users are therefore
31  encouraged to load and test the software's suitability as regards their
32  requirements in conditions enabling the security of their systems and/or
33  data to be ensured and, more generally, to use and operate it in the
34  same conditions as regards security.
35 
36  The fact that you are presently reading this means that you have had
37  knowledge of the CeCILL license and that you accept its terms.
38  */
39 
40 #ifndef _BPP_POPGEN_GENEMAPPERCSVEXPORT_H_
41 #define _BPP_POPGEN_GENEMAPPERCSVEXPORT_H_
42 
43 #include <Bpp/Exceptions.h>
44 #include <Bpp/Io/FileTools.h>
45 #include <Bpp/Text/TextTools.h>
47 #include <Bpp/Numeric/DataTable.h>
48 
49 // From local Pop
50 #include "../AbstractIDataSet.h"
51 #include "../../../BasicAlleleInfo.h"
52 #include "../../../MultiAlleleMonolocusGenotype.h"
53 
54 namespace bpp
55 {
64 {
65 public:
66  static const std::string SAMPLE_FILE_H;
67  static const std::string SAMPLE_NAME_H;
68  static const std::string PANEL_H;
69  static const std::string MARKER_H;
70  static const std::string DYE_H;
71  static const std::string ALLELE_H;
72  static const std::string SIZE_H;
73  static const std::string HEIGHT_H;
74  static const std::string PEAK_AREA_H;
75  static const std::string DAC_H;
76  static const std::string AN_H;
77 
78 private:
79  //bool IndependentAlleles_; //jdutheilon 19/09/14: this does not seem to be used anywhere!
80 
81 public:
82  // Constructor and destructor
83  //GeneMapperCsvExport(bool ia = false);
86 
87  // public:
92  // SetAllelsAsIndependent(bool flag);
93 
94 public:
99  void read(std::istream& is, DataSet& data_set);
100  void read(const std::string& path, DataSet& data_set);
101  DataSet* read(std::istream& is);
102  DataSet* read(const std::string& path);
111  virtual const std::string getFormatName() const
112  {
113  return "GeneMapper® cvs export";
114  }
115  virtual const std::string getFormatDescription() const
116  {
117  return "GeneMapper® is a flexible genotyping software package that provides DNA sizing and quality allele calls for all Applied Biosystems electrophoresis-based genotyping systems.";
118  }
126  class Allele
127  {
128 private:
129  std::string name_;
130  double size_;
131  unsigned int height_;
132  double peakArea_;
133 
134 public:
135  Allele(const std::string& name, double size, unsigned int height, double peakArea) : name_(name),
136  size_(size),
137  height_(height),
138  peakArea_(peakArea) {}
139 
140  const std::string& getName() const
141  {
142  return name_;
143  }
144  const double& getSize() const
145  {
146  return size_;
147  }
148  const unsigned int& getHeight() const
149  {
150  return height_;
151  }
152  const double& getPeakArea() const
153  {
154  return peakArea_;
155  }
156  };
157 
161  class Record
162  {
163 private:
164  std::string sampleFile_;
165  std::string sampleName_;
166  std::string panel_;
167  std::string markerName_;
168  std::string dye_;
169  std::vector< GeneMapperCsvExport::Allele > alleles_;
170  std::string dac_;
171  double an_;
172 
173 public:
179  Record(const std::string& row);
180 
181  const std::string& getSampleFileName() const
182  {
183  return sampleFile_;
184  }
185  const std::string& getSampleName() const
186  {
187  return sampleName_;
188  }
189  const std::string& getPanel() const
190  {
191  return panel_;
192  }
193  const std::string& getMarkerName() const
194  {
195  return markerName_;
196  }
197  const std::string& getDye() const
198  {
199  return dye_;
200  }
201  const size_t getNumberOfAllele() const
202  {
203  return alleles_.size();
204  }
205  const GeneMapperCsvExport::Allele& getAllele(size_t allelePos) const
206  {
207  return alleles_[allelePos];
208  }
209  };
210 };
211 } // end of namespace bpp;
212 
213 #endif // _BPP_POPGEN_GENEMAPPERCSVEXPORT_H_
214 
Partial implementation of the DataSet Input interface.
The DataSet class.
Definition: DataSet.h:73
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