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

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


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 */
32
33
34
    std::string pop_name;
    std::string qtl_generation_name;
    std::string work_directory;
Damien Leroux's avatar
Damien Leroux committed
35
36
37
38
    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;
39
    double tolerance;
Damien Leroux's avatar
Damien Leroux committed
40
    /* Inputs */
41
    pedigree_type pedigree;
Damien Leroux's avatar
Damien Leroux committed
42
43
    std::string pedigree_filename;
    std::string design_filename;
44
    /* BN */
45
    /*pedigree_bayesian_network* bn;*/
46
    /* Management */
47
48
49
    std::vector<std::map<char, int>> alleles_per_marker;
    std::vector<size_t> unique_n_alleles;
    /*std::map<std::string, std::map<char, VectorXd>> compiled_obs_specs;*/
50
51
    std::vector<std::string> marker_names;
    std::map<std::string, size_t> marker_index;
Damien Leroux's avatar
Damien Leroux committed
52
53
54
55
56
57
58
59
60
61
62

    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()
63
64
65
        , pop_name()
        , qtl_generation_name()
        , work_directory(".")
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)
71
        , pedigree()
Damien Leroux's avatar
Damien Leroux committed
72
73
        , pedigree_filename()
        , design_filename()
74
75
        /*, bn(NULL)*/
        , alleles_per_marker()
76
77
78
        , marker_names()
        , marker_index()

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

    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