Commit eb3c5581 authored by Damien Leroux's avatar Damien Leroux
Browse files

Switched to eigen-3.3 and fixed behaviour when with_traits is empty.

parent 8a86e99b
......@@ -1230,6 +1230,7 @@ struct pop_data_type {
ret[ti].P = traits[ti].P;
ret[ti].raw = reduce_with_good_indices(traits[ti].raw, traits[ti].good_indices, ret[ti].good_indices);
ret[ti].values = reduce_with_good_indices(traits[ti].values, traits[ti].good_indices, ret[ti].good_indices);
ret[ti].dim_names = traits[ti].dim_names;
}
return ret;
};
......
......@@ -2386,9 +2386,9 @@ void analysis_report::report_final_model(model_manager& mm)
report_file << std::string("* There are not enough observations to compute a variance/covariance matrix. Results not displayed.") << std::endl;
} else {
MatrixXd Pt = TM.P.transpose();
if (Pt.size() == 0) {
Pt = MatrixXd::Ones(1, 1);
}
// if (Pt.size() == 0) {
// Pt = MatrixXd::Ones(1, 1);
// }
// MSG_DEBUG(TM.P);
// MSG_DEBUG(MATRIX_SIZE(Pt));
// MSG_DEBUG(MATRIX_SIZE(mm.vMcurrent->coefficients()));
......
......@@ -43,27 +43,27 @@ template <typename X> using SelfAdjointEigenSolver = Eigen::SelfAdjointEigenSolv
#endif
namespace Eigen {
template<>
struct NumTraits<std::string> {
typedef std::string Real;
typedef std::string NonInteger;
typedef std::string Nested;
enum {
IsComplex = 0,
IsInteger = 1,
ReadCost = 100,
WriteCost = 100,
MulCost = 1000,
IsSigned = 0,
RequireInitialization = 1
};
static Real epsilon() { return { std::string() }; }
static Real dummy_precision() { return { std::string() }; }
static std::string highest() { return std::string(); }
static std::string lowest() { return std::string(); }
};
}
// namespace Eigen {
// template<>
// struct NumTraits<std::string> {
// typedef std::string Real;
// typedef std::string NonInteger;
// typedef std::string Nested;
// enum {
// IsComplex = 0,
// IsInteger = 1,
// ReadCost = 100,
// WriteCost = 100,
// MulCost = 1000,
// IsSigned = 0,
// RequireInitialization = 1
// };
// static Real epsilon() { return { std::string() }; }
// static Real dummy_precision() { return { std::string() }; }
// static std::string highest() { return std::string(); }
// static std::string lowest() { return std::string(); }
// };
// }
......
......@@ -215,7 +215,7 @@ namespace read_data {
inline std::ostream& operator << (std::ostream& os, const trait& t)
{
os << "<single_trait:" << t.name << ' ' << t.values.cols() << " dimensions, " << t.values.rows() << " values, ";
os << "<single_trait:" << t.name << ' ' << t.values.cols() << " dimensions, " << t.dim_names << ", " << t.values.rows() << " values, ";
// for (double v: t.values) {
// os << ' ' << v;
// }
......
......@@ -931,6 +931,7 @@ namespace Eigen {
typedef combination_type<PARENT_TYPE> Real;
typedef combination_type<PARENT_TYPE> NonInteger;
typedef combination_type<PARENT_TYPE> Nested;
typedef combination_type<PARENT_TYPE> Literal;
enum {
IsComplex = 0,
IsInteger = 1,
......
......@@ -598,10 +598,16 @@ settings_t::finalize()
MSG_ERROR("Some single traits are already used in pleiotropic traits: " << removed_traits, "Specify single trait names that are different from the trait names used in pleiotropic traits.");
return;
}
std::set<std::string> actual_single_traits;
for (const auto& gt: datasets) {
ifile ifs(gt.second);
auto all_traits = read_data::read_trait(ifs, all_variables);
auto observed_traits = assemble_traits(all_traits, with_traits, pleiotropic_traits_descr);
for (const auto& t: observed_traits) {
if (t.dim_names.size() == 1) {
actual_single_traits.insert(t.name);
}
}
pop_data->set_qtl_generation(gt.first);
MSG_DEBUG("with_covariables " << with_covariables);
MSG_DEBUG("Creating covariables " << " from traits " << with_covariables << " in list " << observed_traits);
......@@ -630,7 +636,7 @@ settings_t::finalize()
trait_metadata[pleio.name].P = P;
trait_metadata[pleio.name].dim_names = pleio.traits;
}
for (const auto& t: with_traits) {
for (const auto& t: actual_single_traits) {
trait_metadata[t].P = MatrixXd::Ones(1, 1);
trait_metadata[t].dim_names = {t};
}
......
......@@ -70,9 +70,9 @@ std::vector<trait> read_trait(file& is, const std::vector<std::string>& filter_n
ret.back().raw = ret.back().values;
ret.back().P = MatrixXd::Ones(1, 1);
}
// MSG_DEBUG("... read " << counter << " values (" << (counter - ret.back()->values.size()) << " missing)");
MSG_DEBUG("... read " << counter << " values (" << (counter - ret.back().values.size()) << " missing)");
}
/*MSG_DEBUG("all traits " << ret);*/
MSG_DEBUG("all traits " << ret);
return ret;
}
} /* namespace read_data */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment