A library for working with phylogenetic and population genetic data.
v0.32.0
cathedral_plot.cpp
Go to the documentation of this file.
1 /*
2  Genesis - A toolkit for working with phylogenetic data.
3  Copyright (C) 2014-2024 Lucas Czech
4 
5  This program is free software: you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation, either version 3 of the License, or
8  (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>.
17 
18  Contact:
19  Lucas Czech <lucas.czech@sund.ku.dk>
20  University of Copenhagen, Globe Institute, Section for GeoGenetics
21  Oster Voldgade 5-7, 1350 Copenhagen K, Denmark
22 */
23 
32 
46 
47 #include <cassert>
48 #include <cmath>
49 #include <memory>
50 #include <stdexcept>
51 
52 namespace genesis {
53 namespace population {
54 
55 // =================================================================================================
56 // Cathedral Plot Parameters
57 // =================================================================================================
58 
60 {
61  if( record.value_matrix.empty() ) {
62  return;
63  }
64  auto const cols_good = ( record.value_matrix.cols() == record.parameters.width );
65  auto const rows_good = ( record.value_matrix.rows() == record.parameters.height );
66  if( !cols_good || !rows_good ) {
67  throw std::domain_error(
68  "Invalid Cathedral Plot Record, where the parameters specify a width and height of " +
69  std::to_string( record.parameters.width ) + "x" +
70  std::to_string( record.parameters.height ) +
71  " pixels, but the contained value matrix has dimensions " +
72  std::to_string( record.value_matrix.cols() ) + "x" +
73  std::to_string( record.value_matrix.rows() )
74  );
75  }
76  if( record.value_matrix.rows() != record.window_widths.size() ) {
77  throw std::domain_error(
78  "Invalid Cathedral Plot Record, where the value matrix has " +
79  std::to_string( record.value_matrix.rows() ) +
80  " rows, but the window widths list contains " +
81  std::to_string( record.window_widths.size() ) + " entries"
82  );
83  }
84 }
85 
87  CathedralPlotRecord const& record, size_t row
88 ) {
89  if( record.parameters.width < 2 || record.parameters.height < 2 ) {
90  throw std::invalid_argument( "cathedral_window_width invalid: width < 2 || height < 2" );
91  }
92  if( row >= record.parameters.height ) {
93  throw std::invalid_argument( "cathedral_window_width invalid: row >= height" );
94  }
95 
96  // We need the values as doubles. Do this once here, for conciseness.
97  double const chr_len = static_cast<double>( record.chromosome_length );
98  double const width_d = static_cast<double>( record.parameters.width );
99  double const height_d = static_cast<double>( record.parameters.height );
100  double const row_d = static_cast<double>( row );
101 
102  double window_width = 0.0;
103  switch( record.parameters.window_width_method ) {
105  auto const decay = - std::log( 1.0 / width_d ) / ( height_d - 1.0 );
106  window_width = chr_len * std::exp( -decay * row_d);
107  break;
108  }
110  // We use a scaler based on the image dimensions so that the first window
111  // is the whole chromosome, and the last is window width = single pixel.
112  auto const scaler = width_d / height_d;
113  auto const denom = scaler * row_d + 1.0;
114  window_width = chr_len / denom;
115  break;
116  }
118  // minimum width of windows, where each window corresponds to one pixel of width,
119  // and max width, corresponding to whole genome as one window.
120  auto const min_win_width = chr_len / width_d;
121  auto const max_win_width = chr_len;
122 
123  // How far are we in the rows, as a fraction?
124  // Use that to interplate linearly between min and max window width.
125  auto const row_frac = row_d / height_d;
126  window_width = ( max_win_width - min_win_width ) * ( 1.0 - row_frac ) + min_win_width;
127  break;
128  }
129  default: {
130  throw std::invalid_argument( "cathedral_window_width requested with invalid method" );
131  }
132  }
133  return window_width;
134 }
135 
137 {
138  switch( method ) {
140  return "exponential";
141  }
143  return "geometric";
144  }
146  return "linear";
147  }
148  }
149  throw std::runtime_error( "Invalid CathedralWindowWidthMethod" );
150 }
151 
153 {
154  auto const lower = utils::to_lower( method );
155  if( lower == "exponential" ) {
157  }
158  if( lower == "geometric" ) {
160  }
161  if( lower == "linear" ) {
163  }
164  throw std::invalid_argument(
165  "cathedral_window_width_method_from_string(): Invalid method name \"" + method + "\""
166  );
167 }
168 
169 // =================================================================================================
170 // Storage Functions
171 // =================================================================================================
172 
174  CathedralPlotParameters const& parameters
175 ) {
176  using namespace genesis::utils;
177 
178  // Create a top-level object Json document.
179  auto document = JsonDocument::object();
180  auto& obj = document.get_object();
181 
182  // For simplicity, we just write (or overwrite) the entries that we are interested in here.
183  // We could add a check for their existence, but for now we declare that as a user error.
184  // Not a use case that we will have within the library for now.
185  // We use camelCase for the parameters, as recommended by https://jsonapi.org/recommendations/
186  // as well as the Google JSON Style Guide.
187  obj["width"] = JsonDocument::number_unsigned( parameters.width );
188  obj["height"] = JsonDocument::number_unsigned( parameters.height );
189  obj["windowWidthMethod"] = JsonDocument::string(
191  );
192 
193  return document;
194 }
195 
197  CathedralPlotRecord const& record
198 ) {
199  using namespace genesis::utils;
201 
202  // First we add the parameters, so that those are also part of the document.
203  // This also sets up the document to be a Json object, in case it was null (default constructed).
204  auto document = cathedral_plot_parameters_to_json_document( record.parameters );
205 
206  // Now fill the object with our data.
207  auto& obj = document.get_object();
208  obj["title"] = JsonDocument::string( record.title );
209  obj["plotName"] = JsonDocument::string( record.plot_name );
210  obj["chromosomeName"] = JsonDocument::string( record.chromosome_name );
211  obj["chromosomeLength"] = JsonDocument::number_unsigned( record.chromosome_length );
212  obj["windowWidths"] = JsonDocument( record.window_widths );
213 
214  // For user convenience, we also store the min and max values,
215  // so that downstream plots can be adjusted more easily.
216  auto const min_max = finite_minimum_maximum(
217  record.value_matrix.begin(), record.value_matrix.end()
218  );
219  obj["minValue"] = JsonDocument::number_float( min_max.min );
220  obj["maxValue"] = JsonDocument::number_float( min_max.max );
221 
222  return document;
223 }
224 
226  genesis::utils::JsonDocument const& record_document,
227  genesis::utils::Matrix<double> const& record_value_matrix,
228  std::shared_ptr<genesis::utils::BaseOutputTarget> json_target,
229  std::shared_ptr<genesis::utils::BaseOutputTarget> csv_target
230 ) {
231  using namespace genesis::utils;
232 
233  // Error checking, to avoid user error. Would be better to have that also coded into
234  // the functions, but well, refactor later...
235  if( record_document.empty() ) {
236  throw std::invalid_argument(
237  "save_cathedral_plot_record_to_files(): Empty JSON document provided. "
238  "Call cathedral_plot_record_to_json_document() or related functions first."
239  );
240  }
241  if( record_value_matrix.empty() ) {
242  throw std::invalid_argument(
243  "save_cathedral_plot_record_to_files(): Empty value matrix provided. "
244  "Call compute_cathedral_matrix() or related functions first."
245  );
246  }
247 
248  // Write both files, using their respective readers.
249  JsonWriter().write( record_document, json_target );
250  MatrixWriter<double>( "," ).write( record_value_matrix, csv_target );
251 }
252 
254  genesis::utils::JsonDocument const& record_document,
255  genesis::utils::Matrix<double> const& record_value_matrix,
256  std::string const& base_path
257 ) {
258  using namespace genesis::utils;
260  record_document,
261  record_value_matrix,
262  to_file( base_path + ".json" ),
263  to_file( base_path + ".csv" )
264  );
265 }
266 
268  CathedralPlotRecord const& record,
269  std::string const& base_path
270 ) {
271  auto const document = cathedral_plot_record_to_json_document( record );
272  save_cathedral_plot_record_to_files( document, record.value_matrix, base_path );
273 }
274 
275 std::pair<genesis::utils::JsonDocument, genesis::utils::Matrix<double>>
277  std::string const& base_path
278 ) {
279  using namespace genesis::utils;
280 
281  // We want to be lenient here, and allow to either specify the base path,
282  // or either of the two actual files that we want to read.
283  // Init with just the base path. If this works, we are good.
284  auto json_file = base_path + ".json";
285  auto csv_file = base_path + ".csv";
286 
287  // If either file does not exist, we examine further.
288  if( !file_exists( json_file ) || !file_exists( csv_file )) {
289  if( ends_with( base_path, ".json" )) {
290  json_file = base_path;
291  csv_file = file_filename( base_path ) + ".csv";
292  } else if( ends_with( base_path, ".csv" )) {
293  json_file = file_filename( base_path ) + ".json";
294  csv_file = base_path;
295  }
296  if( !file_exists( json_file ) || !file_exists( csv_file )) {
297  throw std::invalid_argument(
298  "load_cathedral_plot_record_components_from_files(): Cannot find json/csv files "
299  "for base path \"" + base_path + "\""
300  );
301  }
302  }
303 
304  // Now we have two files that exist. Read them, and return their contents.
305  return std::make_pair(
306  JsonReader().read( from_file( json_file )),
307  MatrixReader<double>( "," ).read( from_file( csv_file ))
308  );
309 }
310 
312  std::string const& base_path
313 ) {
314  // Read the data.
315  auto components = load_cathedral_plot_record_components_from_files( base_path );
316  auto const& json = components.first;
317 
318  // Fill the record. We currently only read the fields that we are actually using downstream.
319  // Might need amendment if we make use of other fields as well, such as the window widths vec.
320  CathedralPlotRecord result;
321  result.title = json[ "title" ].get_string();
322  result.plot_name = json[ "plotName" ].get_string();
323  result.chromosome_name = json[ "chromosomeName" ].get_string();
324  result.chromosome_length = json[ "chromosomeLength" ].get_number_unsigned();
325  result.parameters.width = json[ "width" ].get_number_unsigned();
326  result.parameters.height = json[ "height" ].get_number_unsigned();
328  json[ "windowWidthMethod" ].get_string()
329  );
330  for( auto const& elem : json[ "windowWidths" ].get_array() ) {
331  result.window_widths.push_back( elem.get_number_float() );
332  }
333 
334  // Also get the value data.
335  result.value_matrix = std::move( components.second );
336 
337  // Now check internal consistency, and return the result.
339  return result;
340 }
341 
342 // =================================================================================================
343 // Plotting Functions
344 // =================================================================================================
345 
347  CathedralPlotRecord const& record,
348  genesis::utils::HeatmapParameters const& heatmap_parameters
349 ) {
351  return utils::make_heatmap_matrix( record.value_matrix, heatmap_parameters );
352 }
353 
355  CathedralPlotRecord const& record,
356  genesis::utils::HeatmapParameters const& heatmap_parameters,
358 ) {
359  using namespace genesis::utils;
360 
361  // Error and boundary checks
363  if( record.value_matrix.rows() != image.rows() || record.value_matrix.cols() != image.cols() ) {
364  throw std::invalid_argument(
365  "Invalid call to make_cathedral_plot_svg() with image dimensions not fitting "
366  "with the data dimensions of the plot record."
367  );
368  }
369  if( record.window_widths.empty() ) {
370  throw std::invalid_argument(
371  "Invalid call to make_cathedral_plot_svg() with empty window widths list."
372  );
373  }
374 
375  // Recompute window widths.
376  // auto const max_win_width = static_cast<double>( record.chromosome_length );
377  // auto const min_win_width = max_win_width / static_cast<double>( record.parameters.width );
378  // Nope, future proof, we just use the actual entries from the list.
379  assert( record.window_widths.size() > 0 );
380  auto const min_win_width = record.window_widths.back();
381  auto const max_win_width = record.window_widths.front();
382 
383  // Make the x-axis.
384  auto x_axis_settings = SvgAxisSettings();
385  x_axis_settings.position = SvgAxisSettings::Position::kBottom;
386  x_axis_settings.length = record.parameters.width;
387  auto const x_ticks = Tickmarks().linear_labels( 1, record.chromosome_length, 5 );
388  auto const x_axis = make_svg_axis( x_axis_settings, x_ticks, "Genome position" );
389 
390  // Make the y-axis ticks, depending on the type of window scaling.
391  std::vector<utils::Tickmarks::LabeledTick> y_ticks;
392  switch( record.parameters.window_width_method ) {
394  y_ticks = Tickmarks().logarithmic_labels( min_win_width, max_win_width );
395  break;
396  }
398  // Not implemented in Tickmarks, so we just do the max and min window size instead.
399  y_ticks.emplace_back( 0.0, min_win_width );
400  y_ticks.emplace_back( 1.0, max_win_width );
401  break;
402  }
404  y_ticks = Tickmarks().linear_labels( min_win_width, max_win_width, 5 );
405  break;
406  }
407  default: {
408  throw std::invalid_argument(
409  "make_cathedral_plot_svg(): Invalid CathedralWindowWidthMethod"
410  );
411  }
412  }
413 
414  // Make the y-axis.
415  auto y_axis_settings = SvgAxisSettings();
416  y_axis_settings.position = SvgAxisSettings::Position::kLeft;
417  y_axis_settings.length = record.parameters.height;
418  auto const y_axis = make_svg_axis( y_axis_settings, y_ticks, "Window size" );
419 
420  // Make a color bar, using the color params.
421  auto color_norm = make_heatmap_color_norm( record.value_matrix, heatmap_parameters );
422  assert( color_norm );
423  auto color_bar_settings = SvgColorBarSettings();
424  color_bar_settings.height = record.parameters.height;
425  auto const color_bar = make_svg_color_bar(
426  color_bar_settings, heatmap_parameters.color_map, *color_norm
427  );
428 
429  // Make an svg doc from the above elements, and return it.
430  auto svg = GenomeHeatmap();
431  svg.add( record.title, image, x_axis, y_axis, color_bar );
432  return svg.document();
433 }
434 
436  CathedralPlotRecord const& record,
437  genesis::utils::HeatmapParameters const& heatmap_parameters
438 ) {
439  auto const image = make_cathedral_plot_heatmap( record, heatmap_parameters );
440  return make_cathedral_plot_svg( record, heatmap_parameters, image );
441 }
442 
443 } // namespace population
444 } // namespace genesis
genesis::utils::Matrix::empty
bool empty() const
Definition: containers/matrix.hpp:191
genesis::utils::Matrix::cols
size_t cols() const
Definition: containers/matrix.hpp:181
genesis::utils::make_svg_color_bar
std::pair< SvgGradientLinear, SvgGroup > make_svg_color_bar(SvgColorBarSettings const &settings, ColorMap const &map, ColorNormalization const &norm, std::string const &id)
Definition: color_bar.cpp:325
heat_map.hpp
fs.hpp
Provides functions for accessing the file system.
genesis::population::cathedral_plot_parameters_to_json_document
genesis::utils::JsonDocument cathedral_plot_parameters_to_json_document(CathedralPlotParameters const &parameters)
Get a user-readable description of a CathedralPlotParameters as a JsonDocument.
Definition: cathedral_plot.cpp:173
genesis::utils::HeatmapParameters::color_map
ColorMap color_map
Set the ColorMap with all its properties to use for the heatmap.
Definition: heat_map.hpp:111
genesis::utils::from_file
std::shared_ptr< BaseInputSource > from_file(std::string const &file_name, bool detect_compression=true)
Obtain an input source for reading from a file.
Definition: input_source.hpp:68
genesis::population::GenomeHeatmap
Definition: genome_heatmap.hpp:49
genesis::utils::Tickmarks::linear_labels
std::vector< LabeledTick > linear_labels(double min, double max, size_t target_steps)
Return a set of labels with relative positions between min and max, where the labels correspond to th...
Definition: tickmarks.cpp:147
genesis::utils::JsonWriter::write
void write(JsonDocument const &document, std::shared_ptr< utils::BaseOutputTarget > target) const
Write a JsonDocument to an output target, using the JSON format.
Definition: utils/formats/json/writer.cpp:51
genesis::utils::Matrix::end
iterator end()
Definition: containers/matrix.hpp:304
genesis::population::CathedralPlotRecord::parameters
CathedralPlotParameters parameters
Definition: cathedral_plot.hpp:129
genesis::population::CathedralWindowWidthMethod::kExponential
@ kExponential
genesis::utils::JsonDocument
Store a Json value of any kind.
Definition: json/document.hpp:114
genesis::population::CathedralWindowWidthMethod::kLinear
@ kLinear
genesis::population::cathedral_window_width_method_from_string
CathedralWindowWidthMethod cathedral_window_width_method_from_string(std::string const &method)
Helper function to return a CathedralWindowWidthMethod from its textual representation.
Definition: cathedral_plot.cpp:152
genesis::utils::ends_with
bool ends_with(std::string const &text, std::string const &suffix)
Return whether a string ends with another string, i.e., check for a suffix.
Definition: string.cpp:230
genesis::utils::Tickmarks
Helper class to find "nice" tickmark intervals for creating scales and axes.
Definition: tickmarks.hpp:48
genesis::population::make_cathedral_plot_svg
genesis::utils::SvgDocument make_cathedral_plot_svg(CathedralPlotRecord const &record, genesis::utils::HeatmapParameters const &heatmap_parameters, genesis::utils::Matrix< genesis::utils::Color > const &image)
Make a cathedral plot heat map and add it into an SVG document with legend and axes.
Definition: cathedral_plot.cpp:354
genesis::utils::MatrixWriter::write
void write(Matrix< T > const &matrix, std::shared_ptr< utils::BaseOutputTarget > target, std::vector< std::string > row_names={}, std::vector< std::string > col_names={}, std::string corner="") const
Write a Matrix to an output target, using a specific MatrixWriter::Format and separator string.
Definition: utils/containers/matrix/writer.hpp:102
genesis::utils::SvgAxisSettings
Definition: axis.hpp:49
genesis::population::CathedralWindowWidthMethod::kGeometric
@ kGeometric
genome_heatmap.hpp
genesis::utils
Definition: placement/formats/edge_color.hpp:42
genesis::utils::Matrix< double >
genesis::population::to_string
std::string to_string(GenomeLocus const &locus)
Definition: function/genome_locus.hpp:52
genesis::utils::file_filename
std::string file_filename(std::string const &filename)
Remove extension if present.
Definition: fs.cpp:811
genesis::utils::HeatmapParameters
Definition: heat_map.hpp:50
genesis::population::load_cathedral_plot_record_components_from_files
std::pair< genesis::utils::JsonDocument, genesis::utils::Matrix< double > > load_cathedral_plot_record_components_from_files(std::string const &base_path)
Load the parts of a cathedral plot from a set of files.
Definition: cathedral_plot.cpp:276
string.hpp
Provides some commonly used string utility functions.
genesis::population::CathedralPlotParameters::window_width_method
CathedralWindowWidthMethod window_width_method
Definition: cathedral_plot.hpp:99
genesis::population::CathedralPlotRecord
Collection of the data used for making for a cathedral plot.
Definition: cathedral_plot.hpp:116
genesis::population::CathedralPlotRecord::title
std::string title
Definition: cathedral_plot.hpp:123
document.hpp
genesis::utils::Tickmarks::logarithmic_labels
std::vector< LabeledTick > logarithmic_labels(double min, double max, double base=10.0)
Return a set of labels with relative positions between min and max, where the labels correspond to lo...
Definition: tickmarks.cpp:162
genesis::population::CathedralPlotRecord::plot_name
std::string plot_name
Definition: cathedral_plot.hpp:124
genesis::population::cathedral_window_width
double cathedral_window_width(CathedralPlotRecord const &record, size_t row)
Compute the window width for a row in a cathedral plot.
Definition: cathedral_plot.cpp:86
genesis::population::CathedralPlotRecord::value_matrix
genesis::utils::Matrix< double > value_matrix
Definition: cathedral_plot.hpp:132
genesis::utils::JsonReader
Read Json data into a JsonDocument.
Definition: utils/formats/json/reader.hpp:62
genesis::utils::JsonWriter
Write Json data from a JsonDocument.
Definition: utils/formats/json/writer.hpp:55
genesis::utils::make_heatmap_color_norm
std::unique_ptr< ColorNormalization > make_heatmap_color_norm(Matrix< double > const &values, HeatmapParameters const &parameters)
Definition: heat_map.cpp:158
genesis::population::save_cathedral_plot_record_to_targets
void save_cathedral_plot_record_to_targets(genesis::utils::JsonDocument const &record_document, genesis::utils::Matrix< double > const &record_value_matrix, std::shared_ptr< genesis::utils::BaseOutputTarget > json_target, std::shared_ptr< genesis::utils::BaseOutputTarget > csv_target)
Save the record of a cathedral plot in a set of output targets.
Definition: cathedral_plot.cpp:225
genesis::utils::MatrixReader
Definition: utils/containers/matrix/reader.hpp:57
reader.hpp
genesis::population::CathedralPlotParameters::height
size_t height
Definition: cathedral_plot.hpp:98
genesis::population::make_cathedral_plot_heatmap
genesis::utils::Matrix< genesis::utils::Color > make_cathedral_plot_heatmap(CathedralPlotRecord const &record, genesis::utils::HeatmapParameters const &heatmap_parameters)
Make a cathedral plot heat map as a color matrix.
Definition: cathedral_plot.cpp:346
genesis::population::CathedralPlotRecord::chromosome_name
std::string chromosome_name
Definition: cathedral_plot.hpp:125
genesis
Container namespace for all symbols of genesis in order to keep them separate when used as a library.
Definition: placement/formats/edge_color.cpp:42
genesis::population::CathedralWindowWidthMethod
CathedralWindowWidthMethod
Interpolation algorithm for window sizes across the rows of a cathedral plot.
Definition: cathedral_plot.hpp:80
genesis::utils::MatrixWriter
Definition: utils/containers/matrix/writer.hpp:53
statistics.hpp
genesis::utils::SvgColorBarSettings
Definition: color_bar.hpp:59
genesis::utils::to_file
std::shared_ptr< BaseOutputTarget > to_file(std::string const &file_name, GzipCompressionLevel compression_level, bool auto_adjust_filename=true)
Obtain an output target for writing to a file.
Definition: output_target.hpp:81
genesis::utils::SvgDocument
Definition: svg/document.hpp:50
genesis::population::CathedralPlotRecord::chromosome_length
size_t chromosome_length
Definition: cathedral_plot.hpp:126
writer.hpp
genesis::population::validate_cathedral_plot_record
void validate_cathedral_plot_record(CathedralPlotRecord const &record)
Check a Cathedral Plot record for internal consistency.
Definition: cathedral_plot.cpp:59
genesis::utils::make_svg_axis
SvgGroup make_svg_axis(SvgAxisSettings const &settings, std::map< double, std::string > const &labels, std::string const &name)
Simple helper to make an axis.
Definition: axis.cpp:52
genesis::utils::file_exists
bool file_exists(std::string const &filename)
Return true iff the file exists (and is in fact a file, and not, e.g., a directory).
Definition: fs.cpp:95
svg.hpp
writer.hpp
genesis::utils::JsonDocument::empty
bool empty() const
Definition: json/document.cpp:251
reader.hpp
genesis::population::cathedral_window_width_method_to_string
std::string cathedral_window_width_method_to_string(CathedralWindowWidthMethod method)
Helper function to return a textual representation of the method.
Definition: cathedral_plot.cpp:136
genesis::utils::Matrix::begin
iterator begin()
Definition: containers/matrix.hpp:299
genesis::population::save_cathedral_plot_record_to_files
void save_cathedral_plot_record_to_files(genesis::utils::JsonDocument const &record_document, genesis::utils::Matrix< double > const &record_value_matrix, std::string const &base_path)
Save the record of a cathedral plot in a set of files.
Definition: cathedral_plot.cpp:253
genesis::population::cathedral_plot_record_to_json_document
genesis::utils::JsonDocument cathedral_plot_record_to_json_document(CathedralPlotRecord const &record)
Get a user-readable description of the data of a CathedralPlotRecord as a JsonDocument.
Definition: cathedral_plot.cpp:196
genesis::utils::to_lower
constexpr char to_lower(char c) noexcept
Return the lower case version of a letter, ASCII-only.
Definition: char.hpp:221
genesis::population::CathedralPlotRecord::window_widths
std::vector< double > window_widths
Definition: cathedral_plot.hpp:133
genesis::utils::Matrix::rows
size_t rows() const
Definition: containers/matrix.hpp:176
normalization.hpp
genesis::utils::finite_minimum_maximum
MinMaxPair< double > finite_minimum_maximum(ForwardIterator first, ForwardIterator last)
Return the minimum and the maximum of a range of double values.
Definition: statistics.hpp:239
genesis::utils::make_heatmap_matrix
Matrix< Color > make_heatmap_matrix(Matrix< double > const &values, HeatmapParameters const &parameters)
Definition: heat_map.cpp:189
genesis::population::CathedralPlotParameters::width
size_t width
Definition: cathedral_plot.hpp:97
genesis::population::CathedralPlotParameters
Plot parameters to make a cathedral plot.
Definition: cathedral_plot.hpp:94
genesis::population::load_cathedral_plot_record_from_files
CathedralPlotRecord load_cathedral_plot_record_from_files(std::string const &base_path)
Load the record of a cathedral plot from a set of files.
Definition: cathedral_plot.cpp:311
cathedral_plot.hpp
writer.hpp