csv.cc 654 Bytes
Newer Older
1
#include "error.h"
Damien Leroux's avatar
Damien Leroux committed
2
3
4
5
#include "pedigree.h"


std::vector<pedigree_item>
6
read_csv(const std::string& pedigree_file, char field_sep)
Damien Leroux's avatar
Damien Leroux committed
7
8
{
    std::vector<pedigree_item> ret;
9
    ifile pef(pedigree_file);
Damien Leroux's avatar
Damien Leroux committed
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
    if (!pef.good()) {
        MSG_DEBUG("prout");
    }
    std::string col_name, col_id, col_p1, col_p2;
    read_csv_line(pef, field_sep, col_name, col_id, col_p1, col_p2);
    /*MSG_DEBUG("col_name=" << col_name << " col_id=" << col_id << " col_p1=" << col_p1 << " col_p2=" << col_p2);*/
    while (!pef.eof()) {
        ret.emplace_back(pef, field_sep);
        if (ret.back().id == 0) {
            ret.pop_back();
        }
    }
    return ret;
}