A template for a class that reads PED data.
More...
#include <jade.ped_reader.hpp>
|
| basic_ped_reader (std::istream &in) |
| Initializes a new instance of the class. More...
|
|
std::string | str () const |
|
void | write (std::ostream &out) const |
| Writes the PED data to the specified output stream. More...
|
|
void | write (char const *const path) |
| Writes the PED data to the specified output file. More...
|
|
void | write (const std::string &path) |
| Writes the PED data to the specified output file. More...
|
|
template<typename TValue>
class jade::basic_ped_reader< TValue >
A template for a class that reads PED data.
Definition at line 18 of file jade.ped_reader.hpp.
◆ value_type
template<typename TValue >
◆ basic_ped_reader()
template<typename TValue >
Initializes a new instance of the class.
- Parameters
-
Definition at line 27 of file jade.ped_reader.hpp.
37 const auto ch = in.get();
42 throw error(
"unexpected end of data");
49 throw error() <<
"premature end of line " << line;
63 const auto ch1 = _read(in, line);
65 _require(in, line,
' ');
67 const auto ch2 = _read(in, line);
70 ch1 ==
'0' || ch2 ==
'0' ?
'3' :
75 _buf.push_back(symbol);
77 if (in.peek() < 0 || in.peek() ==
'\n')
80 _require(in, line,
'\t');
82 if (_rows > 0 && col == _cols)
84 <<
"expected " << _cols <<
" pairs but encountered "
85 <<
"at least " << col + 1 <<
" on line " << line;
93 else if (col != _cols)
95 <<
"expected " << _cols <<
" genotype pairs but "
96 <<
"encountered " << col <<
" on line " << line;
◆ str()
template<typename TValue >
- Returns
- A string representation of this instance.
Definition at line 109 of file jade.ped_reader.hpp.
111 std::ostringstream out;
◆ write() [1/3]
template<typename TValue >
Writes the PED data to the specified output file.
- Parameters
-
Definition at line 136 of file jade.ped_reader.hpp.
139 assert(path !=
nullptr);
140 std::ofstream out (path);
142 throw error() <<
"error opening '" << path <<
"' for writing";
◆ write() [2/3]
template<typename TValue >
Writes the PED data to the specified output file.
- Parameters
-
Definition at line 149 of file jade.ped_reader.hpp.
◆ write() [3/3]
template<typename TValue >
Writes the PED data to the specified output stream.
- Parameters
-
Definition at line 119 of file jade.ped_reader.hpp.
123 out << _rows <<
' ' << _cols << std::endl;
129 for (
const auto ch : _buf)
130 out << ch << (++i % _cols == 0 ?
'\n' :
' ');
The documentation for this class was generated from the following file: