Commit 98be4b2f authored by Damien Leroux's avatar Damien Leroux
Browse files

New features, bugfixes, itś a big mess, but it works.

parent 19488f00
......@@ -137,7 +137,7 @@ endif()
if (${BUILD_FOR_DEPLOYMENT})
add_executable(spell-pedigree ${SPELL_PEDIGREE_SRC} ${libstdcpp})
add_executable(spell-map ${SPELL_MAP_SRC} ${libstdcpp})
# add_executable(spell-map ${SPELL_MAP_SRC} ${libstdcpp})
add_executable(spell-marker ${SPELL_MARKER_SRC} ${libstdcpp})
add_executable(spell-qtl ${SPELL_QTL_SRC} ${libstdcpp})
add_custom_command(
......@@ -174,7 +174,7 @@ else()
add_executable(spell-marker ${SPELL_MARKER_SRC})
add_executable(spell-qtl ${SPELL_QTL_SRC})
# TODO add spell-map to BUILD_FOR_DEPLOYMENT
add_executable(spell-map ${SPELL_MAP_SRC})
# add_executable(spell-map ${SPELL_MAP_SRC})
SET_SOURCE_FILES_PROPERTIES(${SPELL_PEDIGREE_SRC} ${SPELL_MARKER_SRC} ${SPELL_QTL_SRC}
PROPERTIES
COMPILE_FLAGS "-Wno-int-in-bool-context -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0 ${SANITIZER_OPT}")
......
......@@ -3,12 +3,12 @@ INSTALL_DIR=/usr/local
ROOT_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
GCC_VERSION=-4.9
GCC_VERSION=
COMP=g++$(GCC_VERSION)
#COMP=clang++-3.6 -Wno-undefined-bool-conversion -Wno-tautological-undefined-compare
CXX=$(COMP) --std=c++11 -Wno-unused-local-typedefs -fPIC -pipe
CXX=$(COMP) --std=c++14 -Wno-unused-local-typedefs -fPIC -pipe -Wno-int-in-bool-context
#CXX=clang++ -std=c++11 -stdlib=libc++
INC=-I${ROOT_DIR}/include -I${ROOT_DIR}/include/input -I/home/daleroux/include/eigen3 -I/home/daleroux/include -I${ROOT_DIR}/include/bayes
......
......@@ -946,7 +946,7 @@ struct bayesian_network {
if (pending_messages.size()) {
if (m_exact) {
if (verbose >= 2) {
MSG_DEBUG("GOT " << pending_messages.size() << " PENDING MESSAGE(S)!");
MSG_DEBUG("GOT " << pending_messages.size() << " PENDING SPELL_STRING(S)!");
}
m_exact = false;
m_inexact_messages = pending_messages;
......
......@@ -938,7 +938,7 @@ struct factor_graph {
size_t
make_joint_factor_given(const pedigree_tree_type& T, const std::vector<size_t>& ind_vec, const std::vector<size_t>& given)
{
/*scoped_indent _(MESSAGE("[make_joint_factor_given {" << ind_vec << "} {" << given << "}] "));*/
/*scoped_indent _(SPELL_STRING("[make_joint_factor_given {" << ind_vec << "} {" << given << "}] "));*/
std::vector<std::vector<size_t>> given_per_ind;
std::vector<size_t> joint_parents;
......@@ -1026,7 +1026,7 @@ struct factor_graph {
void
add_ind(const pedigree_type& ped, size_t ind_node, size_t n_alleles)
{
/*scoped_indent _(MESSAGE("[add_ind(" << ind_node << ")] "));*/
/*scoped_indent _(SPELL_STRING("[add_ind(" << ind_node << ")] "));*/
if (ped.tree[ind_node].is_ancestor()) {
MSG_DEBUG("add_ind(" << ind_node << ") is ancestor");
/*MSG_DEBUG("... is ancestor");*/
......
......@@ -1336,7 +1336,7 @@ struct factor_graph {
size_t
make_joint_factor_given(const pedigree_tree_type& T, const std::vector<size_t>& ind_vec, const std::vector<size_t>& given)
{
/*scoped_indent _(MESSAGE("[make_joint_factor_given {" << ind_vec << "} {" << given << "}] "));*/
/*scoped_indent _(SPELL_STRING("[make_joint_factor_given {" << ind_vec << "} {" << given << "}] "));*/
std::vector<std::vector<size_t>> given_per_ind;
std::vector<size_t> joint_parents;
......@@ -1446,7 +1446,7 @@ struct factor_graph {
std::vector<size_t>
ensure_factor(const pedigree_tree_type& T, size_t p_node, const std::vector<size_t>& reent)
{
scoped_indent _(MESSAGE("[ensure_factor(" << p_node << ", " << reent << ")] "));
scoped_indent _(SPELL_STRING("[ensure_factor(" << p_node << ", " << reent << ")] "));
size_t p1 = (size_t) T.get_p1(T.get_p1(p_node));
size_t p2 = (size_t) T.get_p1(T.get_p2(p_node));
if (T[p_node].is_ancestor()) {
......@@ -1510,7 +1510,7 @@ struct factor_graph {
void
add_ind(const pedigree_type& ped, size_t ind_node, size_t n_alleles)
{
/*scoped_indent _(MESSAGE("[add_ind(" << ind_node << ")] "));*/
/*scoped_indent _(SPELL_STRING("[add_ind(" << ind_node << ")] "));*/
if (ped.tree[ind_node].is_ancestor()) {
/*MSG_DEBUG("add_ind(" << ind_node << ") is ancestor");*/
/*MSG_DEBUG("... is ancestor");*/
......
......@@ -540,6 +540,17 @@ struct joint_variable_product_type {
return true;
}
inline
void
add_table_impl(const genotype_comb_type& t, std::vector<int>& vars)
{
tables.emplace_back();
tables.back().data = &t;
tables.back().variable_names.swap(vars);
tables.back().exponent = 1.;
MSG_DEBUG("[joint_product] Added table " << (&t) << " " << t);
}
inline
void
add_table(const genotype_comb_type& t)
......@@ -561,11 +572,7 @@ struct joint_variable_product_type {
}
}
all_variable_names = all_variable_names + vars;
tables.emplace_back();
tables.back().data = &t;
tables.back().variable_names.swap(vars);
tables.back().exponent = 1.;
/*MSG_DEBUG("[joint_product] Added table " << (&t) << " " << t);*/
add_table_impl(t, vars);
}
inline
......@@ -574,15 +581,21 @@ struct joint_variable_product_type {
{
std::vector<table_descr> tmp_tables;
tmp_tables.swap(tables);
owned_tables.reserve(tmp_tables.size());
for (auto& t: tmp_tables) {
if (t.exponent != 1.) {
owned_tables.emplace_back(*t.data);
MSG_DEBUG("Have table with multiplicity " << t.exponent);
MSG_DEBUG((*t.data));
owned_tables.emplace_back();
owned_tables.back() = *t.data;
MSG_DEBUG(owned_tables.back());
for (auto& e: owned_tables.back()) {
e.coef = pow(e.coef, t.exponent);
}
add_table(owned_tables.back());
MSG_DEBUG(owned_tables.back());
add_table_impl(owned_tables.back(), t.variable_names);
} else {
add_table(*t.data);
add_table_impl(*t.data, t.variable_names);
}
}
}
......@@ -813,7 +826,7 @@ struct joint_variable_product_type {
merge_cursors(const table_descr& t, state_index_type global, state_index_type local)
{
/* merge cursors, and increment if smaller than global cursor. otherwise, zero to the right of the leftmost modified digit. */
/*scoped_indent _(MESSAGE("[merge_cursors " << dump(global) << " / " << dump(local, t) << "] "));*/
/*scoped_indent _(SPELL_STRING("[merge_cursors " << dump(global) << " / " << dump(local, t) << "] "));*/
state_index_type merged = t.merge(local, global);
/*MSG_DEBUG("merged " << dump(merged, t));*/
/*MSG_DEBUG("versus " << dump(global));*/
......@@ -1248,7 +1261,7 @@ template <typename Iterator>
genotype_comb_type
compute_product(Iterator tables_begin, Iterator tables_end, const std::vector<int>& output_variables, const std::map<std::vector<int>, genotype_comb_type>& domains)
{
/*scoped_indent _(MESSAGE("[compute product > " << output_variables << "] "));*/
/*scoped_indent _(SPELL_STRING("[compute product > " << output_variables << "] "));*/
joint_variable_product_type jvp;
__table_getter<typename std::iterator_traits<Iterator>::reference> getter;
for (; tables_begin != tables_end; ++tables_begin) {
......
......@@ -1224,7 +1224,7 @@ struct graph_type {
#define starting_point (uninitialized >> 1)
#define node_is_parent(_n) (from[_n] & starting_point)
#define node_is_initialized(_n) (!(from[_n] & uninitialized))
/*scoped_indent _(MESSAGE("[breadth-first " << between << "] "));*/
/*scoped_indent _(SPELL_STRING("[breadth-first " << between << "] "));*/
/*MSG_DEBUG("uninitialized " << uninitialized << " starting_point " << starting_point);*/
node_vec from(rank.size(), uninitialized);
std::deque<node_index_type> stack;
......@@ -1324,7 +1324,7 @@ struct graph_type {
std::list<node_index_type>
find_path(node_index_type p1, node_index_type p2) const
{
/*scoped_indent _(MESSAGE("[find_path " << p1 << ' ' << p2 << "] "));*/
/*scoped_indent _(SPELL_STRING("[find_path " << p1 << ' ' << p2 << "] "));*/
std::vector<bool> visited(rank.size(), false);
std::list<node_index_type> path;
if (recursive_path_finder(p1, p2, path, visited)) {
......@@ -1381,7 +1381,7 @@ struct graph_type {
std::list<node_index_type>
find_path1(node_index_type p1, node_index_type p2) const
{
/*scoped_indent _(MESSAGE("[find_path " << p1 << ' ' << p2 << "] "));*/
/*scoped_indent _(SPELL_STRING("[find_path " << p1 << ' ' << p2 << "] "));*/
std::vector<bool> anc_visited1(rank.size(), false), anc_visited2(rank.size(), false);
auto a1 = find_all_ancestors(p1, anc_visited2, anc_visited1);
auto a2 = find_all_ancestors(p2, anc_visited1, anc_visited2);
......@@ -1410,7 +1410,7 @@ struct graph_type {
std::list<node_index_type>
find_path2(node_index_type p1, node_index_type p2) const
{
/*scoped_indent _(MESSAGE("[find_path " << p1 << ' ' << p2 << "] "));*/
/*scoped_indent _(SPELL_STRING("[find_path " << p1 << ' ' << p2 << "] "));*/
std::vector<bool> visited(rank.size(), false);
std::list<node_index_type> path;
if (recursive_path_finder_a(p1, p2, path, visited) || recursive_path_finder_d(p1, p2, path, visited)) {
......@@ -2003,7 +2003,7 @@ struct graph_type {
get_joint_domain(const var_vec& varset)
{
MSG_QUEUE_FLUSH();
/*scoped_indent _(MESSAGE("[get_joint_domain " << varset << "] "));*/
/*scoped_indent _(SPELL_STRING("[get_joint_domain " << varset << "] "));*/
auto path = find_vpath(varset);
message_type ret;
for (const auto& cliq: path) {
......@@ -2067,7 +2067,7 @@ struct graph_type {
/*}*/
visited[this] = true;
domains[V] = dom;
/*MSG_DEBUG("Domains " << (parent ? MESSAGE(parent << "->" << index_in_parent) : std::string("top-level")) << ' ' << domains);*/
/*MSG_DEBUG("Domains " << (parent ? SPELL_STRING(parent << "->" << index_in_parent) : std::string("top-level")) << ' ' << domains);*/
if (parent && !visited[parent]) {
const_cast<graph_type*>(parent)->propagate_spawnling_domain(V, dom);
}
......
......@@ -28,7 +28,7 @@ struct graph_type : public graph_base_type {
void
add_variable(const var_vec& rule, variable_index_type new_variable)
{
/*scoped_indent _(MESSAGE("[add_variable " << rule << ' ' << new_variable << "] "));*/
/*scoped_indent _(SPELL_STRING("[add_variable " << rule << ' ' << new_variable << "] "));*/
if (rule.size() > 0) {
node_vec parents;
if (rule.size() == 2) {
......@@ -280,7 +280,7 @@ private:
std::shared_ptr<Derived>
make_subgraph(node_index_type n)
{
/*scoped_indent _(MESSAGE("[subgraph " << n << "] "));*/
/*scoped_indent _(SPELL_STRING("[subgraph " << n << "] "));*/
/*MSG_DEBUG("Creating subgraph...");*/
std::shared_ptr<Derived> ret = dynamic_cast<Derived*>(this)->create_subgraph(n);
foreach_in_if(inner_nodes(n),
......@@ -466,7 +466,7 @@ struct factor_graph_type : public recursive_graph_type<factor_graph_type> {
void
add_node_to_subgraph(std::shared_ptr<factor_graph_type> sub, node_index_type n)
{
/*scoped_indent _(MESSAGE("[add_node_to_subgraph " << n << "] "));*/
/*scoped_indent _(SPELL_STRING("[add_node_to_subgraph " << n << "] "));*/
variable_index_type v = own_variable_of(n);
sub->add_variable(rule(n), v);
sub->is_dh[v] = is_dh[v];
......@@ -903,7 +903,7 @@ struct factor_graph_type : public recursive_graph_type<factor_graph_type> {
get_joint_domain(const var_vec& varset)
{
/*MSG_QUEUE_FLUSH();*/
/*scoped_indent _(MESSAGE("[get_joint_domain " << varset << "] "));*/
/*scoped_indent _(SPELL_STRING("[get_joint_domain " << varset << "] "));*/
/*MSG_DEBUG("[get_joint_domain " << varset << "] ");*/
auto path = find_vpath(varset);
message_type ret;
......@@ -972,7 +972,7 @@ struct factor_graph_type : public recursive_graph_type<factor_graph_type> {
/*}*/
visited[this] = true;
domains[V] = dom;
/*MSG_DEBUG("Domains " << (parent() ? MESSAGE(parent() << "->" << index_in_parent()) : std::string("top-level")) << ' ' << domains);*/
/*MSG_DEBUG("Domains " << (parent() ? SPELL_STRING(parent() << "->" << index_in_parent()) : std::string("top-level")) << ' ' << domains);*/
if (parent() && !visited[parent()]) {
const_cast<factor_graph_type*>(parent())->propagate_spawnling_domain(V, dom);
}
......@@ -1004,7 +1004,7 @@ struct factor_graph_type : public recursive_graph_type<factor_graph_type> {
void
compute_node_domain(node_index_type n)
{
/*scoped_indent _(MESSAGE("[compute_node_domain #" << n << "] "));*/
/*scoped_indent _(SPELL_STRING("[compute_node_domain #" << n << "] "));*/
auto inputs = nei_in(n);
auto vv = variables_of(n);
if (node_is_interface(n)) {
......@@ -1104,7 +1104,7 @@ struct factor_graph_type : public recursive_graph_type<factor_graph_type> {
void
compute_domains_and_factors()
{
/*scoped_indent _(MESSAGE("[compute_domains_and_factors " << (parent() ? MESSAGE(parent() << "->" << index_in_parent()) : std::string("top-level")) << "] "));*/
/*scoped_indent _(SPELL_STRING("[compute_domains_and_factors " << (parent() ? SPELL_STRING(parent() << "->" << index_in_parent()) : std::string("top-level")) << "] "));*/
/*MSG_DEBUG("n_alleles = " << n_alleles);*/
if (parent()) {
domains = parent()->domains;
......@@ -1423,7 +1423,7 @@ struct instance_type {
: tables(g->node_domains.size()), evidence(g->node_domains.size()), sub_instances(g->node_domains.size()), parent(par)
{
var_vec varz; for (node_index_type n: g->nodes()) { varz = varz + g->variables_of(n); }
/*scoped_indent _(MESSAGE("[instance " << varz << "] "));*/
/*scoped_indent _(SPELL_STRING("[instance " << varz << "] "));*/
size_t mi = 0;
for (node_index_type n: g->nodes()) {
if (g->node_is_interface(n) || g->node_is_factor(n)) {
......@@ -1551,7 +1551,7 @@ struct instance_type {
compute(node_index_type n, const std::map<var_vec, genotype_comb_type>& domains) /* compute an external message (this -> external node #n) */
{
const auto& variant = variants[n];
/*scoped_indent _(MESSAGE("[compute " << n << "] "));*/
/*scoped_indent _(SPELL_STRING("[compute " << n << "] "));*/
/*MSG_DEBUG("" << variant);*/
clear_internal_evidence();
for (size_t i = 0; i < variant.outer_inputs.size(); ++i) {
......
......@@ -287,7 +287,7 @@ inline
message_type
product(const message_type& accum, const message_type& msg, const std::map<var_vec, genotype_comb_type>& domains)
{
/*scoped_indent _(MESSAGE("[product] "));*/
/*scoped_indent _(SPELL_STRING("[product] "));*/
/*MSG_DEBUG("" << accum);*/
/*MSG_DEBUG("" << msg);*/
multiple_product_type mp;
......@@ -611,7 +611,7 @@ struct graph_base_type {
node_index_type
add_interface(variable_index_type v)
{
/*scoped_indent _(MESSAGE("[+I " << v << "] "));*/
/*scoped_indent _(SPELL_STRING("[+I " << v << "] "));*/
node_index_type ret = create_node(Interface, v);
m_nodes[ret].all_variables.push_back(v);
/*MSG_DEBUG("new node " << m_nodes[ret]);*/
......@@ -631,7 +631,7 @@ struct graph_base_type {
node_index_type
add_factor(const var_vec& rule, variable_index_type v)
{
/*scoped_indent _(MESSAGE("[+F " << rule << ' ' << v << "] "));*/
/*scoped_indent _(SPELL_STRING("[+F " << rule << ' ' << v << "] "));*/
node_index_type ret = create_node(Factor, v);
auto sorted_rule = rule;
std::sort(sorted_rule.begin(), sorted_rule.end());
......@@ -680,7 +680,7 @@ struct graph_base_type {
node_index_type
aggregate(const node_vec& nodes)
{
/*scoped_indent _(MESSAGE("[+A " << nodes << "] "));*/
/*scoped_indent _(SPELL_STRING("[+A " << nodes << "] "));*/
node_index_type ret = create_node(Aggregate);
m_nodes[ret].inner_nodes.clear();
/*MSG_DEBUG("Creating aggregate " << ret);*/
......@@ -747,7 +747,7 @@ struct graph_base_type {
bool
add_edge(node_index_type from, node_index_type to, path_type& path)
{
/*scoped_indent _(MESSAGE("[add edge " << from << "->" << to << "] "));*/
/*scoped_indent _(SPELL_STRING("[add edge " << from << "->" << to << "] "));*/
bool have_cycle = colour_equal(m_nodes[from].colour, m_nodes[to].colour);
if (have_cycle) {
path = find_path(from, to);
......@@ -956,7 +956,7 @@ struct graph_base_type {
#define starting_point (uninitialized >> 1)
#define node_is_parent(_n) (from[_n] & starting_point)
#define node_is_initialized(_n) (!(from[_n] & uninitialized))
/*scoped_indent _(MESSAGE("[breadth-first " << between << "] "));*/
/*scoped_indent _(SPELL_STRING("[breadth-first " << between << "] "));*/
/*MSG_DEBUG("uninitialized " << uninitialized << " starting_point " << starting_point);*/
node_vec from(m_nodes.size(), uninitialized);
std::vector<bool> visited(m_nodes.size(), false);
......
This diff is collapsed.
......@@ -865,7 +865,7 @@ struct braille_histogram : public braille_plot {
haxis(-5 * m_yres, 0, bins.size(), 1);
vaxis(-w - 5 * m_xres, 0, 10, 1);
/*for (size_t x = 0; x < labels.size(); ++x) {*/
/*std::string lab = MESSAGE("\n" << labels[x]);*/
/*std::string lab = SPELL_STRING("\n" << labels[x]);*/
/*add_label(x, -3 * m_yres, lab);*/
/*}*/
return *this;
......@@ -964,7 +964,7 @@ struct braille_histogram<double> : public braille_plot {
haxis(-5 * m_yres, 0, bins.size(), 1);
vaxis(-w - 5 * m_xres, 0, 10, 1);
/*for (size_t x = 0; x < labels.size(); ++x) {*/
/*std::string lab = MESSAGE("\n" << labels[x]);*/
/*std::string lab = SPELL_STRING("\n" << labels[x]);*/
/*add_label(x, -3 * m_yres, lab);*/
/*}*/
return *this;
......
......@@ -120,7 +120,7 @@ template <typename Ret, typename... Args>
*/
std::string func_name = get_func_name(func);
chrono_trace _(func_name);
if (1) {
if (0) {
// msg_handler_t::cout() << "INVOKING " << func_name << "(…)" << std::endl;
std::stringstream ss;
ss << "INVOKING " << func_name << "(" << std::endl;
......@@ -196,7 +196,7 @@ template <typename Ret, typename... Args>
*/
std::string func_name = get_func_name(func);
chrono_trace _(func_name);
if (1) {
if (0) {
// msg_handler_t::cout() << "INVOKING " << func_name << "(…)" << std::endl;
std::stringstream ss;
ss << "INVOKING " << func_name << "(" << std::endl;
......
......@@ -944,7 +944,7 @@ struct model_manager {
ref.compute();
vMcurrent->add_block_with_interactions(model_block_key_struc::dominance(ins_rm_key.first), blocks.second, &ref);
}
debug_selection(MESSAGE("select(" << si.chrom->name << '[' << si.active_loci.front() << '-' << si.active_loci.back() << "]:" << pos << ')'));
debug_selection(SPELL_STRING("select(" << si.chrom->name << '[' << si.active_loci.front() << '-' << si.active_loci.back() << "]:" << pos << ')'));
}
void
......@@ -954,7 +954,7 @@ struct model_manager {
if (it != search_intervals.end()) {
select(it->second, pos);
}
debug_selection(MESSAGE("select(" << chr->name << ':' << pos << ')'));
debug_selection(SPELL_STRING("select(" << chr->name << ':' << pos << ')'));
}
void
......@@ -965,7 +965,7 @@ struct model_manager {
it->second.deselect(pos, all_pops, vMcurrent);
}
it->second.compute_blocks(all_pops);
debug_selection(MESSAGE("deselect(" << chr->name << ':' << pos << ')'));
debug_selection(SPELL_STRING("deselect(" << chr->name << ':' << pos << ')'));
}
void
......
......@@ -141,7 +141,7 @@ struct analysis_report : public analysis_report_computations {
m_stream.mode(ReportMode::AlgoPhase);
select_book("algo_trace").select_sheet("Computations");
// m_stream.line(MESSAGE("[ALGO] " << descr));
// m_stream.line(SPELL_STRING("[ALGO] " << descr));
m_stream.algo_phase(descr);
return *this;
}
......
......@@ -500,7 +500,7 @@ struct disk_hashtable<ValueType(AllArgs...)> {
disk_hashtable(const std::string& base_path)
: m_base_path()
, m_mutex()
/*: m_base_path(MESSAGE(active_settings->work_directory << '/' << base_name))*/
/*: m_base_path(SPELL_STRING(active_settings->work_directory << '/' << base_name))*/
{
writer_lock lock(m_mutex);
m_base_path = base_path;
......@@ -534,7 +534,7 @@ struct disk_hashtable<ValueType(AllArgs...)> {
/* print all the files and directories within directory */
while ((ent = readdir (dir)) != NULL) {
/*printf ("%s\n", ent->d_name);*/
/*ret.push_back(MESSAGE(path << '/' << ent->d_name));*/
/*ret.push_back(SPELL_STRING(path << '/' << ent->d_name));*/
if (check_file(SPELL_STRING(path << '/' << ent->d_name), false, true, false)) {
ret.push_back(ent->d_name);
}
......
......@@ -441,7 +441,7 @@ typedef std::shared_ptr<message_struc> message_handle;
/*#define CREATE_MESSAGE(_var_, _channel_, _expr_) message_handle _var_(new message_struc {_channel_, MESSAGE(_expr_)});*/
/*#define CREATE_MESSAGE(_var_, _channel_, _expr_) message_handle _var_(new message_struc {_channel_, SPELL_STRING(_expr_)});*/
#ifndef SPELL_UNSAFE_OUTPUT
//#define CREATE_MESSAGE(_channel_, _what_) if (!msg_handler_t::quiet()) msg_handler_t::enqueue(message_handle{new message_struc {_channel_, _what_}});
......@@ -588,19 +588,19 @@ void message_queue::run()
#define MSG_ERROR(_msg_expr_, _workaround_expr_) \
do {\
CREATE_MESSAGE(msg_channel::Err, MESSAGE(msg_handler_t::e() << "[ERR] " << _msg_expr_ << msg_handler_t::n() << std::endl));\
CREATE_MESSAGE(msg_channel::Err, SPELL_STRING(msg_handler_t::e() << "[ERR] " << _msg_expr_ << msg_handler_t::n() << std::endl));\
std::stringstream s; s << _workaround_expr_;\
if (s.str().size()) { msg_handler_t::instance().workarounds.insert(s.str()); }\
} while (0)
#define MSG_WARNING(_msg_expr_) \
do {\
CREATE_MESSAGE(msg_channel::Out, MESSAGE(msg_handler_t::w() << "[WRN] " << _msg_expr_ << msg_handler_t::n() << std::endl));\
CREATE_MESSAGE(msg_channel::Out, SPELL_STRING(msg_handler_t::w() << "[WRN] " << _msg_expr_ << msg_handler_t::n() << std::endl));\
} while (0)
#define MSG_INFO(_msg_expr_) \
do {\
CREATE_MESSAGE(msg_channel::Out, MESSAGE(msg_handler_t::i() << "[MSG] " << _msg_expr_ << msg_handler_t::n() << std::endl));\
CREATE_MESSAGE(msg_channel::Out, SPELL_STRING(msg_handler_t::i() << "[MSG] " << _msg_expr_ << msg_handler_t::n() << std::endl));\
} while (0)
#define MSG_QUEUE_FLUSH() do { \
......@@ -611,7 +611,7 @@ void message_queue::run()
#define MSG_DEBUG(_msg_expr_) \
do {\
if (msg_handler_t::debug_enabled()) {\
CREATE_MESSAGE(msg_channel::Log, MESSAGE(_msg_expr_ << std::endl));\
CREATE_MESSAGE(msg_channel::Log, SPELL_STRING(_msg_expr_ << std::endl));\
}\
} while (0);
......
......@@ -62,8 +62,16 @@ get_func_name(Ret (*f) (Args...))
dladdr(tmp.vptr, &info);
int status = 0;
char* buf = abi::__cxa_demangle(info.dli_sname, NULL, 0, &status);
ret.assign(buf, strchr(buf, '('));
free(buf);
if (buf) {
char* paren = strchr(buf, '(');
if (!paren) {
paren = buf + strlen(buf);
}
ret.assign(buf, paren);
free(buf);
} else {
ret.assign("<no name>");
}
/*std::cout << tmp.vptr << " => " << info.dli_sname << std::endl;*/
}
return ret;
......
......@@ -468,11 +468,11 @@ struct pedigree_type {
*/
pedigree_type()
: tree(), node_generations(), ancestor_letters(), ancestor_names(), generation_names(), m_id(),
with_LC(true),
cache_gamete(), cache_geno(),
max_states(NONE),
n_alleles(1),
filename("<none>"),
with_LC(true),
LC(),
factor_messages()
{
......@@ -1011,7 +1011,7 @@ struct pedigree_type {
VALUE_TYPE (&eval_reent)(size_t, const VALUE_TYPE&),
std::vector<VALUE_TYPE>& reent) const
{
/*scoped_indent _(MESSAGE("[eval #" << node << "] "));*/
/*scoped_indent _(SPELL_STRING("[eval #" << node << "] "));*/
if (visited[node]) {
auto ret = eval_reent(node, reent[node]);
/*ret = eval_reent(node, iterators[node_to_iterator[node]]);*/
......@@ -1050,7 +1050,7 @@ struct pedigree_type {
std::vector<VALUE_TYPE>& reent,
bool (&skip_predicate)(const VALUE_TYPE&)) const
{
/*scoped_indent _(MESSAGE("[eval #" << node << "] "));*/
/*scoped_indent _(SPELL_STRING("[eval #" << node << "] "));*/
if (visited[node]) {
auto ret = eval_reent(node, reent[node]);
/*ret = eval_reent(node, iterators[node_to_iterator[node]]);*/
......
......@@ -343,7 +343,7 @@ struct pedigree_tree_type {
MSG_DEBUG_DEDENT;
#else
/* Merci à Alexandre Heurteau pour l'idée de la recherche de cycle */
/*scoped_indent _(MESSAGE("[reentrants(" << node << ")] "));*/
/*scoped_indent _(SPELL_STRING("[reentrants(" << node << ")] "));*/
std::vector<bool> visited(m_nodes.size(), false);
std::vector<int> left_ancestors, right_ancestors;
......@@ -1382,10 +1382,10 @@ struct extreme_lozenge_generator {
int n = order[i];
/*MSG_DEBUG("iterator stack " << iterator_stack);*/
/*MSG_DEBUG("size stack " << size_stack);*/
/*MSG_DEBUG("--- " << std::setw(3) << i << " - [" << node_types[n] << "] ----------------- I " << std::setw(50) << MESSAGE("" << iterator_stack) << " S " << std::setw(50) << MESSAGE("" << size_stack) << " node #" << n << " L " << lumpers[i].bins << ',' << lumpers[i].input_size << ',' << lumpers[i].output_size);*/
/*MSG_DEBUG("--- " << std::setw(3) << i << " - [" << node_types[n] << "] ----------------- I " << std::setw(50) << SPELL_STRING("" << iterator_stack) << " S " << std::setw(50) << SPELL_STRING("" << size_stack) << " node #" << n << " L " << lumpers[i].bins << ',' << lumpers[i].input_size << ',' << lumpers[i].output_size);*/
/*MSG_QUEUE_FLUSH();*/
node_ops[n](lumpers[n]);
/*MSG_DEBUG(" " << std::setw(3) << i << " ----------------------- I " << std::setw(50) << MESSAGE("" << iterator_stack) << " S " << std::setw(50) << MESSAGE("" << size_stack));*/
/*MSG_DEBUG(" " << std::setw(3) << i << " ----------------------- I " << std::setw(50) << SPELL_STRING("" << iterator_stack) << " S " << std::setw(50) << SPELL_STRING("" << size_stack));*/
/*MSG_QUEUE_FLUSH();*/
}
/*MSG_DEBUG("------------------------------- I " << iterator_stack << " S " << size_stack);*/
......
......@@ -57,7 +57,7 @@ struct python_environment {
static std::string test_result_get_chrom_name(test_result* self) { return self->chrom->name; }
static std::string tr_str(test_result* self) { return MESSAGE("<test best @" << self->chrom->name << ':' << self->locus << ' ' << (self->over_threshold ? "GOOD" : "BAD") << '>'); }
static std::string tr_str(test_result* self) { return SPELL_STRING("<test best @" << self->chrom->name << ':' << self->locus << ' ' << (self->over_threshold ? "GOOD" : "BAD") << '>'); }
static void algo_phase(std::string str) { report_algo_phase(str); }
......@@ -86,7 +86,7 @@ struct python_environment {
return ret;
}
static std::string block_key_to_str(const model_block_key& mbk) { return MESSAGE((*mbk)); }
static std::string block_key_to_str(const model_block_key& mbk) { return SPELL_STRING((*mbk)); }
static py::list mm_get_selection(const model_manager& mm)
{
......@@ -123,7 +123,7 @@ struct python_environment {
if (chr_name != "") {
chr = active_settings->find_chromosome(chr_name);
if (!chr) {
throw std::runtime_error(MESSAGE("Invalid chromosome name '" << chr_name << '\''));
throw std::runtime_error(SPELL_STRING("Invalid chromosome name '" << chr_name << '\''));
}
}
for (const auto& kv: mm.search_new_best_per_chromosome(clear_chromosome, chr)) {
......@@ -138,7 +138,7 @@ struct python_environment {
py_release_scope pyre;
auto chr = active_settings->find_chromosome(chrom_name);
if (!chr) {
throw std::runtime_error(MESSAGE("Invalid chromosome name '" << chrom_name << '\''));
throw std::runtime_error(SPELL_STRING("Invalid chromosome name '" << chrom_name << '\''));
}
return mm.challenge_qtl(chr, locus);
}
......@@ -310,7 +310,7 @@ struct python_environment {
std::string algo_name_to_file_name(std::string algo_name)
{
return MESSAGE(algo_script_directory() << '/' << algo_name << ".py");
return SPELL_STRING(algo_script_directory() << '/' << algo_name << ".py");
}
// #include <node.h> // from python
......@@ -421,7 +421,7 @@ struct python_environment {
MSG_ERROR("Something went wrong trying to execute Python code", "Contact your local voodoo priest");
}
} else {
MSG_ERROR("Couldn't open file " << file_name, MESSAGE("Check the file " << file_name << " exists and is readable."));
MSG_ERROR("Couldn't open file " << file_name, SPELL_STRING("Check the file " << file_name << " exists and is readable."));
}
}
......