cli.h 2.41 KB
Newer Older
Damien Leroux's avatar
Damien Leroux committed
1
2
3
4
5
6
7
8
#ifndef _SPELL_BAYES_CLI_H_
#define _SPELL_BAYES_CLI_H_

#include "error.h"
#include <map>
#include <vector>
#include "generation_rs.h"
#include "commandline.h"
9
#include "bn.h"
Damien Leroux's avatar
Damien Leroux committed
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30


enum JobDispatchScheme { JDS_None, JDS_MT, JDS_SGE, JDS_SSH };

void read_format(std::map<std::string, marker_observation_spec>& settings, const std::string& filename, std::istream& is);

#define SPELL_CASTER ((size_t) -1)

struct bn_settings_t {
    /* Job control */
    JobDispatchScheme scheme;
    std::vector<std::string> command_line;
    std::vector<std::string> ssh_hosts;
    std::string qsub_opts;
    std::string prg_name;
    size_t n_threads;
    size_t job_start;
    size_t job_end;
    std::string job_name;
    std::string fifo_path;
    /* Configuration */
31
32
33
    std::string pop_name;
    std::string qtl_generation_name;
    std::string work_directory;
Damien Leroux's avatar
Damien Leroux committed
34
    std::vector<chromosome> map;
35
    std::string map_filename;
Damien Leroux's avatar
Damien Leroux committed
36
37
38
39
    std::map<std::string, marker_observation_spec> marker_observation_specs;
    std::vector<std::string> marker_observation_specs_filenames;
    std::map<std::string, population_marker_observation> observed_mark;
    double noise;
40
    double tolerance;
Damien Leroux's avatar
Damien Leroux committed
41
42
43
    /* Inputs */
    std::string pedigree_filename;
    std::string design_filename;
44
45
46
47
48
49
    /* BN */
    pedigree_bayesian_network* bn;
    /* Management */
    std::map<std::string, std::map<char, VectorXd>> compiled_obs_specs;
    std::vector<std::string> marker_names;
    std::map<std::string, size_t> marker_index;
Damien Leroux's avatar
Damien Leroux committed
50
51
52
53
54
55
56
57
58
59
60

    bn_settings_t()
        : scheme(JDS_None)
        , command_line()
        , ssh_hosts()
        , qsub_opts()
        , n_threads(0)
        , job_start(SPELL_CASTER)
        , job_end(SPELL_CASTER)
        , job_name()
        , fifo_path()
61
62
63
        , pop_name()
        , qtl_generation_name()
        , work_directory(".")
Damien Leroux's avatar
Damien Leroux committed
64
        , map()
65
        , map_filename()
Damien Leroux's avatar
Damien Leroux committed
66
67
68
69
        , marker_observation_specs()
        , marker_observation_specs_filenames()
        , observed_mark()
        , noise(0.)
70
        , tolerance(1.e-10)
Damien Leroux's avatar
Damien Leroux committed
71
72
        , pedigree_filename()
        , design_filename()
73
74
75
76
77
        , bn(NULL)
        , compiled_obs_specs()
        , marker_names()
        , marker_index()

Damien Leroux's avatar
Damien Leroux committed
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
    {}

    size_t count_markers() const
    {
        return observed_mark.begin()->second.observations.data.size();
    }

    void post_init();

    bool is_master() const { return job_start == SPELL_CASTER; }

    static bn_settings_t* from_args(int argc, const char** argv);
};

#endif