Skip to content

Commit

Permalink
changed variable names
Browse files Browse the repository at this point in the history
  • Loading branch information
rscherrer committed Jun 4, 2021
1 parent c47d62d commit 29cce68
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 86 deletions.
168 changes: 84 additions & 84 deletions src/Printer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,56 +45,56 @@ void Printer::print(const int &t, const Collector &c, const MetaPop &m)

if (filenames[f] == "time")
stf::write(utl::int2dbl(t), files[f]);
else if (filenames[f] == "population_size")
else if (filenames[f] == "population_sizes")
stf::write(utl::size2dbl(c.counts[2u][2u]), files[f]);
else if (filenames[f] == "ecotype_size")
else if (filenames[f] == "ecotype_population_sizes")
for (size_t eco = 0u; eco < 2u; ++eco)
stf::write(utl::size2dbl(c.counts[2u][eco]), files[f]);
else if (filenames[f] == "resources")
else if (filenames[f] == "habitat_resources")
for (size_t hab = 0u; hab < 2u; ++hab)
for (size_t res = 0u; res < 2u; ++res)
stf::write(m.resources[hab][res], files[f]);
else if (filenames[f] == "means")
else if (filenames[f] == "trait_means")
for (size_t trait = 0u; trait < 3u; ++trait)
stf::write(c.means[trait][2u][2u], files[f]);
else if (filenames[f] == "ecotype_means")
else if (filenames[f] == "ecotype_trait_means")
for (size_t trait = 0u; trait < 3u; ++trait)
for (size_t eco = 0u; eco < 2u; ++eco)
stf::write(c.means[trait][2u][eco], files[f]);
else if (filenames[f] == "varP")
else if (filenames[f] == "trait_varP")
for (size_t trait = 0u; trait < 3u; ++trait)
stf::write(c.varP[trait][2u], files[f]);
else if (filenames[f] == "varG")
else if (filenames[f] == "trait_varG")
for (size_t trait = 0u; trait < 3u; ++trait)
stf::write(c.varG[trait][2u], files[f]);
else if (filenames[f] == "varA")
else if (filenames[f] == "trait_varA")
for (size_t trait = 0u; trait < 3u; ++trait)
stf::write(c.varA[trait][2u], files[f]);
else if (filenames[f] == "varD")
else if (filenames[f] == "trait_varD")
for (size_t trait = 0u; trait < 3u; ++trait)
stf::write(c.varD[trait], files[f]);
else if (filenames[f] == "varI")
else if (filenames[f] == "trait_varI")
for (size_t trait = 0u; trait < 3u; ++trait)
stf::write(c.varI[trait], files[f]);
else if (filenames[f] == "varN")
else if (filenames[f] == "trait_varN")
for (size_t trait = 0u; trait < 3u; ++trait)
stf::write(c.varN[trait][2u], files[f]);
else if (filenames[f] == "varT")
else if (filenames[f] == "trait_varT")
for (size_t trait = 0u; trait < 3u; ++trait)
stf::write(c.varT[trait], files[f]);
else if (filenames[f] == "Pst")
else if (filenames[f] == "trait_Pst")
for (size_t trait = 0u; trait < 3u; ++trait)
stf::write(c.Pst[trait], files[f]);
else if (filenames[f] == "Gst")
else if (filenames[f] == "trait_Gst")
for (size_t trait = 0u; trait < 3u; ++trait)
stf::write(c.Gst[trait], files[f]);
else if (filenames[f] == "Qst")
else if (filenames[f] == "trait_Qst")
for (size_t trait = 0u; trait < 3u; ++trait)
stf::write(c.Qst[trait], files[f]);
else if (filenames[f] == "Cst")
else if (filenames[f] == "trait_Cst")
for (size_t trait = 0u; trait < 3u; ++trait)
stf::write(c.Cst[trait], files[f]);
else if (filenames[f] == "Fst")
else if (filenames[f] == "trait_Fst")
for (size_t trait = 0u; trait < 3u; ++trait)
stf::write(c.Fst[trait], files[f]);
else if (filenames[f] == "EI")
Expand All @@ -103,82 +103,82 @@ void Printer::print(const int &t, const Collector &c, const MetaPop &m)
stf::write(c.SI, files[f]);
else if (filenames[f] == "RI")
stf::write(c.RI, files[f]);
else if (filenames[f] == "genome_varP")
else if (filenames[f] == "locus_varP")
for (size_t l = 0u; l < c.genomescan.size(); ++l)
stf::write(c.genomescan[l].varP[2u], files[f]);
else if (filenames[f] == "genome_varG")
else if (filenames[f] == "locus_varG")
for (size_t l = 0u; l < c.genomescan.size(); ++l)
stf::write(c.genomescan[l].varG[2u], files[f]);
else if (filenames[f] == "genome_varA")
else if (filenames[f] == "locus_varA")
for (size_t l = 0u; l < c.genomescan.size(); ++l)
stf::write(c.genomescan[l].varA[2u], files[f]);
else if (filenames[f] == "genome_varD")
else if (filenames[f] == "locus_varD")
for (size_t l = 0u; l < c.genomescan.size(); ++l)
stf::write(c.genomescan[l].varD, files[f]);
else if (filenames[f] == "genome_varI")
else if (filenames[f] == "locus_varI")
for (size_t l = 0u; l < c.genomescan.size(); ++l)
stf::write(c.genomescan[l].varI, files[f]);
else if (filenames[f] == "genome_varN")
else if (filenames[f] == "locus_varN")
for (size_t l = 0u; l < c.genomescan.size(); ++l)
stf::write(c.genomescan[l].varN[2u], files[f]);
else if (filenames[f] == "genome_Pst")
else if (filenames[f] == "locus_Pst")
for (size_t l = 0u; l < c.genomescan.size(); ++l)
stf::write(c.genomescan[l].Pst, files[f]);
else if (filenames[f] == "genome_Gst")
else if (filenames[f] == "locus_Gst")
for (size_t l = 0u; l < c.genomescan.size(); ++l)
stf::write(c.genomescan[l].Gst, files[f]);
else if (filenames[f] == "genome_Qst")
else if (filenames[f] == "locus_Qst")
for (size_t l = 0u; l < c.genomescan.size(); ++l)
stf::write(c.genomescan[l].Qst, files[f]);
else if (filenames[f] == "genome_Cst")
else if (filenames[f] == "locus_Cst")
for (size_t l = 0u; l < c.genomescan.size(); ++l)
stf::write(c.genomescan[l].Cst, files[f]);
else if (filenames[f] == "genome_Fst")
else if (filenames[f] == "locus_Fst")
for (size_t l = 0u; l < c.genomescan.size(); ++l)
stf::write(c.genomescan[l].Fst, files[f]);
else if (filenames[f] == "genome_alpha")
else if (filenames[f] == "locus_alpha")
for (size_t l = 0u; l < c.genomescan.size(); ++l)
stf::write(c.genomescan[l].alpha, files[f]);
else if (filenames[f] == "genome_meang")
else if (filenames[f] == "locus_meang")
for (size_t l = 0u; l < c.genomescan.size(); ++l)
stf::write(c.genomescan[l].meanG, files[f]);
else if (filenames[f] == "genome_freq")
else if (filenames[f] == "locus_freq")
for (size_t l = 0u; l < c.genomescan.size(); ++l)
stf::write(c.genomescan[l].freqs[2u], files[f]);
else if (filenames[f] == "genome_freqs")
else if (filenames[f] == "ecotype_locus_freq")
for (size_t l = 0u; l < c.genomescan.size(); ++l)
for (size_t e = 0u; e < 2u; ++e)
stf::write(c.genomescan[l].freqs[e], files[f]);
else if (filenames[f] == "genome_hobs")
else if (filenames[f] == "ecotype_locus_hobs")
for (size_t l = 0u; l < c.genomescan.size(); ++l)
for (size_t e = 0u; e < 2u; ++e)
stf::write(c.genomescan[l].hobs[e], files[f]);
else if (filenames[f] == "network_corgen")
else if (filenames[f] == "edge_corgen")
for (size_t e = 0u; e < c.networkscan.size(); ++e)
stf::write(c.networkscan[e].corgen, files[f]);
else if (filenames[f] == "network_corbreed")
else if (filenames[f] == "edge_corbreed")
for (size_t e = 0u; e < c.networkscan.size(); ++e)
stf::write(c.networkscan[e].corbreed, files[f]);
else if (filenames[f] == "network_corfreq")
else if (filenames[f] == "edge_corfreq")
for (size_t e = 0u; e < c.networkscan.size(); ++e)
stf::write(c.networkscan[e].corfreq, files[f]);
else if (filenames[f] == "network_avgi")
else if (filenames[f] == "edge_avgi")
for (size_t e = 0u; e < c.networkscan.size(); ++e)
stf::write(c.networkscan[e].avgi, files[f]);
else if (filenames[f] == "network_avgj")
else if (filenames[f] == "edge_avgj")
for (size_t e = 0u; e < c.networkscan.size(); ++e)
stf::write(c.networkscan[e].avgj, files[f]);
else if (filenames[f] == "individual_ecotype")
else if (filenames[f] == "individual_ecotypes")
for (size_t i = 0u; i < m.getSize(); ++i)
stf::write(utl::size2dbl(m.getEcotype(i)), files[f]);
else if (filenames[f] == "individual_habitat")
else if (filenames[f] == "individual_habitats")
for (size_t i = 0u; i < m.getSize(); ++i)
stf::write(utl::size2dbl(m.getHabitat(i)), files[f]);
else if (filenames[f] == "individual_trait")
else if (filenames[f] == "individual_traits")
for (size_t i = 0u; i < m.getSize(); ++i)
for (size_t trait = 0u; trait < 3u; ++trait)
stf::write(m.getTrait(i, trait), files[f]);
else if (filenames[f] == "individual_midparent")
else if (filenames[f] == "individual_midparents")
for (size_t i = 0u; i < m.getSize(); ++i)
for (size_t trait = 0u; trait < 3u; ++trait)
stf::write(m.getMidparent(i, trait), files[f]);
Expand All @@ -194,51 +194,51 @@ std::vector<std::string> Printer::whattosave(const std::string &filename) const
return {

"time",
"population_size",
"ecotype_size", // per ecotype
"resources", // per habitat per resource
"means", // per trait per ecotype
"ecotype_means", // per trait per ecotype
"varP", // per trait
"varG", // per trait
"varA", // per trait
"varD", // per trait
"varI", // per trait
"varN", // per trait
"varT", // per trait
"Pst", // per trait
"Gst", // per trait
"Qst", // per trait
"Cst", // per trait
"Fst", // per trait
"population_sizes",
"ecotype_population_sizes", // per ecotype
"habitat_resources", // per habitat per resource
"trait_means", // per trait
"ecotype_trait_means", // per trait per ecotype
"trait_varP", // per trait
"trait_varG", // per trait
"trait_varA", // per trait
"trait_varD", // per trait
"trait_varI", // per trait
"trait_varN", // per trait
"trait_varT", // per trait
"trait_Pst", // per trait
"trait_Gst", // per trait
"trait_Qst", // per trait
"trait_Cst", // per trait
"trait_Fst", // per trait
"EI",
"SI",
"RI",
"genome_varP", // per locus
"genome_varG", // per locus
"genome_varA", // per locus
"genome_varD", // per locus
"genome_varI", // per locus
"genome_varN", // per locus
"genome_Pst", // per locus
"genome_Gst", // per locus
"genome_Qst", // per locus
"genome_Cst", // per locus
"genome_Fst", // per locus
"genome_alpha", // per locus
"genome_meang", // per locus
"genome_freq", // per locus
"genome_freqs", // per locus per ecotype
"genome_hobs", // per locus per ecotype
"network_corgen", // per edge
"network_corbreed", // per edge
"network_corfreq", // per edge
"network_avgi", // per edge
"network_avgj", // per edge
"individual_ecotype", // per individual
"individual_habitat", // per individual
"individual_trait", // per individual per trait
"individual_midparent" // per individual per trait
"locus_varP", // per locus
"locus_varG", // per locus
"locus_varA", // per locus
"locus_varD", // per locus
"locus_varI", // per locus
"locus_varN", // per locus
"locus_Pst", // per locus
"locus_Gst", // per locus
"locus_Qst", // per locus
"locus_Cst", // per locus
"locus_Fst", // per locus
"locus_alpha", // per locus
"locus_meang", // per locus
"locus_freq", // per locus
"ecotype_locus_freq", // per locus per ecotype
"ecotype_locus_hobs", // per locus per ecotype
"edge_corgen", // per edge
"edge_corbreed", // per edge
"edge_corfreq", // per edge
"edge_avgi", // per edge
"edge_avgj", // per edge
"individual_ecotypes", // per individual
"individual_habitats", // per individual
"individual_traits", // per individual per trait
"individual_midparents" // per individual per trait

};

Expand Down
4 changes: 2 additions & 2 deletions tests/OutputTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ BOOST_AUTO_TEST_CASE(OutputFilesAreCorrectlyWritten)
BOOST_CHECK_EQUAL(ri.size(), 10u);

// Read individual trait values and ecotypes
std::vector<double> popx = tst::readfile("individual_trait.dat");
std::vector<double> ecotypes = tst::readfile("individual_ecotype.dat");
std::vector<double> popx = tst::readfile("individual_traits.dat");
std::vector<double> ecotypes = tst::readfile("individual_ecotypes.dat");

BOOST_CHECK_EQUAL(popx.size() / 3u, cumulsize);

Expand Down

0 comments on commit 29cce68

Please sign in to comment.