A toolkit for working with phylogenetic data.
v0.24.0
list_misc.cpp
Go to the documentation of this file.
1 /*
2  Genesis - A toolkit for working with phylogenetic data.
3  Copyright (C) 2014-2020 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@h-its.org>
20  Exelixis Lab, Heidelberg Institute for Theoretical Studies
21  Schloss-Wolfsbrunnenweg 35, D-69118 Heidelberg, Germany
22 */
23 
32 
36 
37 #include <cassert>
38 #include <map>
39 #include <stdexcept>
40 
41 namespace genesis {
42 namespace utils {
43 
44 // =================================================================================================
45 // Nextstrain Sequential Color Lists
46 // =================================================================================================
47 
48 /*
49  * These color palettes are adapted from the Nextstrain build for novel coronavirus (nCoV) at
50  * https://nextstrain.org/ncov, using their color scheme
51  * https://github.com/nextstrain/ncov/blob/master/config/color_schemes.tsv
52  * and converting parts of it to RGB `double` values.
53  * The repository at https://github.com/nextstrain/ncov is published under the
54  * [MIT license](https://opensource.org/licenses/MIT).
55  * See also our @link supplement_acknowledgements_code_reuse_nextstrain Acknowledgements@endlink.
56  */
57 
58 static const std::vector<std::vector<Color>> color_lists_nextstrain_1_16_ = {{
59  {
60  { 0.29687500, 0.56250000, 0.75000000 },
61  }, {
62  { 0.29687500, 0.56250000, 0.75000000 },
63  { 0.67968750, 0.73828125, 0.31250000 },
64  }, {
65  { 0.28515625, 0.53125000, 0.76953125 },
66  { 0.49218750, 0.71875000, 0.46093750 },
67  { 0.79296875, 0.71484375, 0.25781250 },
68  }, {
69  { 0.26953125, 0.50000000, 0.78906250 },
70  { 0.41796875, 0.69531250, 0.55078125 },
71  { 0.66406250, 0.73828125, 0.32031250 },
72  { 0.87109375, 0.64062500, 0.23046875 },
73  }, {
74  { 0.26171875, 0.46484375, 0.80078125 },
75  { 0.37890625, 0.66796875, 0.61328125 },
76  { 0.57812500, 0.73828125, 0.37890625 },
77  { 0.80078125, 0.71093750, 0.25781250 },
78  { 0.89843750, 0.50390625, 0.19921875 },
79  }, {
80  { 0.25390625, 0.42578125, 0.80468750 },
81  { 0.34765625, 0.63671875, 0.66406250 },
82  { 0.51562500, 0.72656250, 0.43359375 },
83  { 0.73046875, 0.73437500, 0.28515625 },
84  { 0.88281250, 0.61328125, 0.22265625 },
85  { 0.87890625, 0.31250000, 0.16406250 },
86  }, {
87  { 0.24609375, 0.38671875, 0.80859375 },
88  { 0.32031250, 0.60546875, 0.70703125 },
89  { 0.46093750, 0.71093750, 0.49609375 },
90  { 0.65625000, 0.73828125, 0.32812500 },
91  { 0.83593750, 0.68750000, 0.24609375 },
92  { 0.89843750, 0.48828125, 0.19921875 },
93  { 0.85546875, 0.15625000, 0.13671875 },
94  }, {
95  { 0.24218750, 0.34375000, 0.80859375 },
96  { 0.29296875, 0.55859375, 0.75390625 },
97  { 0.39843750, 0.67968750, 0.58203125 },
98  { 0.55078125, 0.73437500, 0.40234375 },
99  { 0.72656250, 0.73437500, 0.28515625 },
100  { 0.86718750, 0.65625000, 0.23437500 },
101  { 0.89843750, 0.45312500, 0.19140625 },
102  { 0.85546875, 0.15625000, 0.13671875 },
103  }, {
104  { 0.24609375, 0.30078125, 0.79296875 },
105  { 0.27343750, 0.50781250, 0.78515625 },
106  { 0.35156250, 0.64453125, 0.65625000 },
107  { 0.47265625, 0.71484375, 0.48437500 },
108  { 0.62500000, 0.74218750, 0.34375000 },
109  { 0.77734375, 0.72265625, 0.26562500 },
110  { 0.87890625, 0.62109375, 0.22656250 },
111  { 0.89453125, 0.42187500, 0.18750000 },
112  { 0.85546875, 0.15625000, 0.13671875 },
113  }, {
114  { 0.25000000, 0.25781250, 0.77734375 },
115  { 0.25781250, 0.45312500, 0.80468750 },
116  { 0.32031250, 0.60156250, 0.71093750 },
117  { 0.41406250, 0.68750000, 0.56250000 },
118  { 0.53906250, 0.73046875, 0.41406250 },
119  { 0.68359375, 0.73828125, 0.30859375 },
120  { 0.81250000, 0.70312500, 0.25390625 },
121  { 0.89062500, 0.59765625, 0.21875000 },
122  { 0.89062500, 0.39843750, 0.17968750 },
123  { 0.85546875, 0.15625000, 0.13671875 },
124  }, {
125  { 0.25390625, 0.21484375, 0.75781250 },
126  { 0.25000000, 0.39843750, 0.80859375 },
127  { 0.29296875, 0.55468750, 0.75390625 },
128  { 0.36718750, 0.65625000, 0.63281250 },
129  { 0.46875000, 0.71093750, 0.48828125 },
130  { 0.59375000, 0.73828125, 0.36718750 },
131  { 0.72656250, 0.73437500, 0.28906250 },
132  { 0.83593750, 0.68359375, 0.24218750 },
133  { 0.89843750, 0.57421875, 0.21484375 },
134  { 0.88671875, 0.37890625, 0.17578125 },
135  { 0.85546875, 0.15625000, 0.13671875 },
136  }, {
137  { 0.27343750, 0.17968750, 0.72265625 },
138  { 0.24218750, 0.34375000, 0.80859375 },
139  { 0.27343750, 0.50390625, 0.78906250 },
140  { 0.33203125, 0.61718750, 0.69140625 },
141  { 0.41406250, 0.68750000, 0.56250000 },
142  { 0.51953125, 0.72656250, 0.43359375 },
143  { 0.64062500, 0.74218750, 0.33593750 },
144  { 0.76171875, 0.72656250, 0.27343750 },
145  { 0.85546875, 0.67187500, 0.23828125 },
146  { 0.89843750, 0.54687500, 0.21093750 },
147  { 0.88671875, 0.36328125, 0.17578125 },
148  { 0.85546875, 0.15625000, 0.13671875 },
149  }, {
150  { 0.29296875, 0.14843750, 0.69140625 },
151  { 0.24609375, 0.29296875, 0.78906250 },
152  { 0.25781250, 0.44921875, 0.80468750 },
153  { 0.30078125, 0.57421875, 0.74218750 },
154  { 0.36718750, 0.66015625, 0.62890625 },
155  { 0.45703125, 0.70703125, 0.50390625 },
156  { 0.56250000, 0.73437500, 0.39453125 },
157  { 0.67968750, 0.73828125, 0.31250000 },
158  { 0.78906250, 0.71875000, 0.26171875 },
159  { 0.86718750, 0.65234375, 0.23046875 },
160  { 0.89843750, 0.52734375, 0.20703125 },
161  { 0.88281250, 0.35156250, 0.17187500 },
162  { 0.85546875, 0.15625000, 0.13671875 },
163  }, {
164  { 0.31640625, 0.11718750, 0.65625000 },
165  { 0.25000000, 0.23828125, 0.76953125 },
166  { 0.25000000, 0.39062500, 0.80859375 },
167  { 0.28125000, 0.52343750, 0.77343750 },
168  { 0.33593750, 0.62109375, 0.68750000 },
169  { 0.40625000, 0.68359375, 0.57031250 },
170  { 0.49609375, 0.72265625, 0.45703125 },
171  { 0.60156250, 0.74218750, 0.35937500 },
172  { 0.71093750, 0.73828125, 0.29296875 },
173  { 0.80859375, 0.70703125, 0.25390625 },
174  { 0.87500000, 0.63281250, 0.22656250 },
175  { 0.89843750, 0.51171875, 0.20312500 },
176  { 0.88281250, 0.33984375, 0.16796875 },
177  { 0.85546875, 0.15625000, 0.13671875 },
178  }, {
179  { 0.36718750, 0.11328125, 0.61328125 },
180  { 0.26562500, 0.19531250, 0.73828125 },
181  { 0.24609375, 0.33593750, 0.80468750 },
182  { 0.26171875, 0.47265625, 0.80078125 },
183  { 0.30468750, 0.58203125, 0.73828125 },
184  { 0.36328125, 0.65625000, 0.63671875 },
185  { 0.44140625, 0.70312500, 0.52343750 },
186  { 0.53515625, 0.73046875, 0.41796875 },
187  { 0.63671875, 0.74218750, 0.33984375 },
188  { 0.73828125, 0.73046875, 0.28125000 },
189  { 0.82421875, 0.69531250, 0.24609375 },
190  { 0.88281250, 0.61718750, 0.22265625 },
191  { 0.89843750, 0.49609375, 0.19921875 },
192  { 0.87890625, 0.33203125, 0.16796875 },
193  { 0.85546875, 0.15625000, 0.13671875 },
194  }
195 }};
196 
197 static const std::vector<Color> color_list_nextstrain_256_ = {{
198  { 0.36718750, 0.11328125, 0.61328125 },
199  { 0.35937500, 0.11328125, 0.62109375 },
200  { 0.34765625, 0.11328125, 0.62890625 },
201  { 0.33984375, 0.11718750, 0.63671875 },
202  { 0.32812500, 0.11718750, 0.64453125 },
203  { 0.32031250, 0.11718750, 0.65234375 },
204  { 0.30859375, 0.11718750, 0.66015625 },
205  { 0.30468750, 0.12500000, 0.66796875 },
206  { 0.30468750, 0.12890625, 0.67578125 },
207  { 0.30078125, 0.13671875, 0.67968750 },
208  { 0.29687500, 0.14062500, 0.68750000 },
209  { 0.29296875, 0.14843750, 0.69140625 },
210  { 0.28906250, 0.15625000, 0.69921875 },
211  { 0.28515625, 0.16015625, 0.70703125 },
212  { 0.28125000, 0.16796875, 0.71093750 },
213  { 0.27734375, 0.17578125, 0.71875000 },
214  { 0.27343750, 0.17968750, 0.72265625 },
215  { 0.26953125, 0.18750000, 0.73046875 },
216  { 0.26562500, 0.19531250, 0.73437500 },
217  { 0.26171875, 0.19921875, 0.74218750 },
218  { 0.26171875, 0.20703125, 0.75000000 },
219  { 0.25781250, 0.21093750, 0.75390625 },
220  { 0.25390625, 0.21875000, 0.76171875 },
221  { 0.25000000, 0.22656250, 0.76562500 },
222  { 0.25000000, 0.23437500, 0.76953125 },
223  { 0.25000000, 0.24218750, 0.77343750 },
224  { 0.25000000, 0.25000000, 0.77343750 },
225  { 0.25000000, 0.25781250, 0.77734375 },
226  { 0.24609375, 0.26562500, 0.78125000 },
227  { 0.24609375, 0.27343750, 0.78515625 },
228  { 0.24609375, 0.28125000, 0.78515625 },
229  { 0.24609375, 0.28906250, 0.78906250 },
230  { 0.24609375, 0.29687500, 0.79296875 },
231  { 0.24609375, 0.30859375, 0.79296875 },
232  { 0.24609375, 0.31640625, 0.79687500 },
233  { 0.24609375, 0.32421875, 0.80078125 },
234  { 0.24609375, 0.33203125, 0.80468750 },
235  { 0.24609375, 0.33984375, 0.80468750 },
236  { 0.24218750, 0.34765625, 0.80859375 },
237  { 0.24218750, 0.35546875, 0.81250000 },
238  { 0.24218750, 0.36328125, 0.81250000 },
239  { 0.24609375, 0.37109375, 0.81250000 },
240  { 0.24609375, 0.37890625, 0.81250000 },
241  { 0.24609375, 0.38671875, 0.80859375 },
242  { 0.25000000, 0.39453125, 0.80859375 },
243  { 0.25000000, 0.39843750, 0.80859375 },
244  { 0.25000000, 0.40625000, 0.80859375 },
245  { 0.25390625, 0.41406250, 0.80859375 },
246  { 0.25390625, 0.42187500, 0.80468750 },
247  { 0.25390625, 0.42968750, 0.80468750 },
248  { 0.25781250, 0.43750000, 0.80468750 },
249  { 0.25781250, 0.44531250, 0.80468750 },
250  { 0.25781250, 0.45312500, 0.80468750 },
251  { 0.26171875, 0.46093750, 0.80078125 },
252  { 0.26171875, 0.46875000, 0.80078125 },
253  { 0.26171875, 0.47265625, 0.80078125 },
254  { 0.26562500, 0.48046875, 0.80078125 },
255  { 0.26562500, 0.48828125, 0.79687500 },
256  { 0.26953125, 0.49609375, 0.79296875 },
257  { 0.26953125, 0.50000000, 0.78906250 },
258  { 0.27343750, 0.50781250, 0.78515625 },
259  { 0.27734375, 0.51171875, 0.78125000 },
260  { 0.27734375, 0.51953125, 0.77734375 },
261  { 0.28125000, 0.52343750, 0.77343750 },
262  { 0.28125000, 0.53125000, 0.76953125 },
263  { 0.28515625, 0.53515625, 0.76562500 },
264  { 0.28906250, 0.54296875, 0.76171875 },
265  { 0.28906250, 0.54687500, 0.75781250 },
266  { 0.29296875, 0.55468750, 0.75781250 },
267  { 0.29687500, 0.55859375, 0.75390625 },
268  { 0.29687500, 0.56640625, 0.75000000 },
269  { 0.30078125, 0.57031250, 0.74609375 },
270  { 0.30078125, 0.57812500, 0.74218750 },
271  { 0.30468750, 0.58203125, 0.73828125 },
272  { 0.30859375, 0.58593750, 0.73046875 },
273  { 0.31250000, 0.58984375, 0.72656250 },
274  { 0.31250000, 0.59375000, 0.72265625 },
275  { 0.31640625, 0.59765625, 0.71484375 },
276  { 0.32031250, 0.60546875, 0.71093750 },
277  { 0.32421875, 0.60937500, 0.70312500 },
278  { 0.32812500, 0.61328125, 0.69921875 },
279  { 0.33203125, 0.61718750, 0.69140625 },
280  { 0.33203125, 0.62109375, 0.68750000 },
281  { 0.33593750, 0.62500000, 0.68359375 },
282  { 0.33984375, 0.62890625, 0.67578125 },
283  { 0.34375000, 0.63281250, 0.67187500 },
284  { 0.34765625, 0.63671875, 0.66406250 },
285  { 0.34765625, 0.64062500, 0.66015625 },
286  { 0.35156250, 0.64453125, 0.65234375 },
287  { 0.35546875, 0.64843750, 0.64843750 },
288  { 0.35937500, 0.65234375, 0.64453125 },
289  { 0.36328125, 0.65625000, 0.63671875 },
290  { 0.36718750, 0.66015625, 0.62890625 },
291  { 0.37109375, 0.66015625, 0.62500000 },
292  { 0.37500000, 0.66406250, 0.61718750 },
293  { 0.37890625, 0.66796875, 0.61328125 },
294  { 0.38281250, 0.66796875, 0.60546875 },
295  { 0.38671875, 0.67187500, 0.59765625 },
296  { 0.39062500, 0.67578125, 0.59375000 },
297  { 0.39453125, 0.67968750, 0.58593750 },
298  { 0.40234375, 0.67968750, 0.58203125 },
299  { 0.40625000, 0.68359375, 0.57421875 },
300  { 0.41015625, 0.68750000, 0.56640625 },
301  { 0.41406250, 0.68750000, 0.56250000 },
302  { 0.41796875, 0.69140625, 0.55468750 },
303  { 0.42187500, 0.69531250, 0.55078125 },
304  { 0.42578125, 0.69531250, 0.54296875 },
305  { 0.42968750, 0.69921875, 0.53515625 },
306  { 0.43359375, 0.70312500, 0.53125000 },
307  { 0.44140625, 0.70312500, 0.52343750 },
308  { 0.44531250, 0.70312500, 0.51953125 },
309  { 0.44921875, 0.70703125, 0.51171875 },
310  { 0.45312500, 0.70703125, 0.50781250 },
311  { 0.46093750, 0.71093750, 0.50000000 },
312  { 0.46484375, 0.71093750, 0.49609375 },
313  { 0.46875000, 0.71484375, 0.48828125 },
314  { 0.47265625, 0.71484375, 0.48437500 },
315  { 0.48046875, 0.71484375, 0.47656250 },
316  { 0.48437500, 0.71875000, 0.47265625 },
317  { 0.48828125, 0.71875000, 0.46484375 },
318  { 0.49609375, 0.72265625, 0.46093750 },
319  { 0.50000000, 0.72265625, 0.45312500 },
320  { 0.50390625, 0.72656250, 0.44921875 },
321  { 0.50781250, 0.72656250, 0.44140625 },
322  { 0.51562500, 0.72656250, 0.43750000 },
323  { 0.51953125, 0.72656250, 0.42968750 },
324  { 0.52734375, 0.73046875, 0.42578125 },
325  { 0.53125000, 0.73046875, 0.42187500 },
326  { 0.53515625, 0.73046875, 0.41796875 },
327  { 0.54296875, 0.73046875, 0.41015625 },
328  { 0.54687500, 0.73046875, 0.40625000 },
329  { 0.55468750, 0.73437500, 0.40234375 },
330  { 0.55859375, 0.73437500, 0.39843750 },
331  { 0.56640625, 0.73437500, 0.39062500 },
332  { 0.57031250, 0.73437500, 0.38671875 },
333  { 0.57421875, 0.73828125, 0.38281250 },
334  { 0.58203125, 0.73828125, 0.37890625 },
335  { 0.58593750, 0.73828125, 0.37109375 },
336  { 0.59375000, 0.73828125, 0.36718750 },
337  { 0.59765625, 0.73828125, 0.36328125 },
338  { 0.60546875, 0.74218750, 0.35937500 },
339  { 0.60937500, 0.74218750, 0.35546875 },
340  { 0.61718750, 0.74218750, 0.35156250 },
341  { 0.62109375, 0.74218750, 0.34765625 },
342  { 0.62890625, 0.74218750, 0.34375000 },
343  { 0.63281250, 0.74218750, 0.33984375 },
344  { 0.63671875, 0.74218750, 0.33593750 },
345  { 0.64453125, 0.74218750, 0.33203125 },
346  { 0.64843750, 0.74218750, 0.32812500 },
347  { 0.65625000, 0.73828125, 0.32812500 },
348  { 0.66015625, 0.73828125, 0.32421875 },
349  { 0.66796875, 0.73828125, 0.32031250 },
350  { 0.67187500, 0.73828125, 0.31640625 },
351  { 0.67968750, 0.73828125, 0.31250000 },
352  { 0.68359375, 0.73828125, 0.30859375 },
353  { 0.69140625, 0.73828125, 0.30468750 },
354  { 0.69531250, 0.73828125, 0.30078125 },
355  { 0.70312500, 0.73828125, 0.29687500 },
356  { 0.70703125, 0.73828125, 0.29687500 },
357  { 0.71093750, 0.73828125, 0.29296875 },
358  { 0.71875000, 0.73437500, 0.29296875 },
359  { 0.72265625, 0.73437500, 0.28906250 },
360  { 0.73046875, 0.73437500, 0.28515625 },
361  { 0.73437500, 0.73046875, 0.28515625 },
362  { 0.73828125, 0.73046875, 0.28125000 },
363  { 0.74609375, 0.73046875, 0.28125000 },
364  { 0.75000000, 0.72656250, 0.27734375 },
365  { 0.75390625, 0.72656250, 0.27343750 },
366  { 0.76171875, 0.72656250, 0.27343750 },
367  { 0.76562500, 0.72265625, 0.26953125 },
368  { 0.76953125, 0.72265625, 0.26953125 },
369  { 0.77734375, 0.72265625, 0.26562500 },
370  { 0.78125000, 0.71875000, 0.26562500 },
371  { 0.78906250, 0.71875000, 0.26171875 },
372  { 0.79296875, 0.71875000, 0.25781250 },
373  { 0.79687500, 0.71484375, 0.25781250 },
374  { 0.80078125, 0.71093750, 0.25781250 },
375  { 0.80468750, 0.70703125, 0.25390625 },
376  { 0.80859375, 0.70703125, 0.25390625 },
377  { 0.81250000, 0.70312500, 0.25390625 },
378  { 0.81640625, 0.69921875, 0.25000000 },
379  { 0.82031250, 0.69531250, 0.25000000 },
380  { 0.82421875, 0.69531250, 0.24609375 },
381  { 0.82812500, 0.69140625, 0.24609375 },
382  { 0.83203125, 0.68750000, 0.24609375 },
383  { 0.83593750, 0.68359375, 0.24218750 },
384  { 0.83984375, 0.68359375, 0.24218750 },
385  { 0.84375000, 0.67968750, 0.24218750 },
386  { 0.84765625, 0.67578125, 0.23828125 },
387  { 0.85546875, 0.67187500, 0.23828125 },
388  { 0.85937500, 0.66796875, 0.23828125 },
389  { 0.85937500, 0.66406250, 0.23437500 },
390  { 0.86328125, 0.66015625, 0.23437500 },
391  { 0.86718750, 0.65625000, 0.23437500 },
392  { 0.86718750, 0.64843750, 0.23046875 },
393  { 0.87109375, 0.64453125, 0.23046875 },
394  { 0.87109375, 0.64062500, 0.23046875 },
395  { 0.87500000, 0.63281250, 0.22656250 },
396  { 0.87500000, 0.62890625, 0.22656250 },
397  { 0.87890625, 0.62500000, 0.22656250 },
398  { 0.88281250, 0.61718750, 0.22265625 },
399  { 0.88281250, 0.61328125, 0.22265625 },
400  { 0.88671875, 0.60937500, 0.22265625 },
401  { 0.88671875, 0.60156250, 0.22265625 },
402  { 0.89062500, 0.59765625, 0.21875000 },
403  { 0.89062500, 0.59375000, 0.21875000 },
404  { 0.89453125, 0.58593750, 0.21875000 },
405  { 0.89843750, 0.58203125, 0.21484375 },
406  { 0.89843750, 0.57421875, 0.21484375 },
407  { 0.89843750, 0.56640625, 0.21484375 },
408  { 0.89843750, 0.55859375, 0.21093750 },
409  { 0.89843750, 0.55078125, 0.21093750 },
410  { 0.89843750, 0.54687500, 0.20703125 },
411  { 0.89843750, 0.53906250, 0.20703125 },
412  { 0.89843750, 0.53125000, 0.20703125 },
413  { 0.89843750, 0.52343750, 0.20312500 },
414  { 0.89843750, 0.51562500, 0.20312500 },
415  { 0.89843750, 0.50781250, 0.20312500 },
416  { 0.89843750, 0.50000000, 0.19921875 },
417  { 0.89843750, 0.49218750, 0.19921875 },
418  { 0.89843750, 0.48437500, 0.19921875 },
419  { 0.89843750, 0.47656250, 0.19531250 },
420  { 0.89843750, 0.46875000, 0.19531250 },
421  { 0.89843750, 0.46093750, 0.19140625 },
422  { 0.89843750, 0.45312500, 0.19140625 },
423  { 0.89843750, 0.44531250, 0.19140625 },
424  { 0.89843750, 0.43359375, 0.18750000 },
425  { 0.89453125, 0.42578125, 0.18750000 },
426  { 0.89453125, 0.41406250, 0.18359375 },
427  { 0.89062500, 0.40625000, 0.18359375 },
428  { 0.89062500, 0.39453125, 0.17968750 },
429  { 0.89062500, 0.38671875, 0.17968750 },
430  { 0.88671875, 0.37890625, 0.17578125 },
431  { 0.88671875, 0.36718750, 0.17578125 },
432  { 0.88671875, 0.35937500, 0.17187500 },
433  { 0.88281250, 0.34765625, 0.17187500 },
434  { 0.88281250, 0.33984375, 0.16796875 },
435  { 0.87890625, 0.32812500, 0.16796875 },
436  { 0.87890625, 0.32031250, 0.16406250 },
437  { 0.87890625, 0.30859375, 0.16406250 },
438  { 0.87500000, 0.30078125, 0.16015625 },
439  { 0.87500000, 0.29296875, 0.16015625 },
440  { 0.87500000, 0.28125000, 0.15625000 },
441  { 0.87109375, 0.27343750, 0.15625000 },
442  { 0.87109375, 0.26171875, 0.15625000 },
443  { 0.87109375, 0.25390625, 0.15234375 },
444  { 0.86718750, 0.24218750, 0.15234375 },
445  { 0.86718750, 0.23437500, 0.14843750 },
446  { 0.86718750, 0.22265625, 0.14843750 },
447  { 0.86328125, 0.21484375, 0.14453125 },
448  { 0.86328125, 0.20312500, 0.14453125 },
449  { 0.86328125, 0.19531250, 0.14453125 },
450  { 0.85937500, 0.18359375, 0.14062500 },
451  { 0.85937500, 0.17578125, 0.14062500 },
452  { 0.85937500, 0.16796875, 0.13671875 },
453  { 0.85546875, 0.15625000, 0.13671875 },
454 }};
455 
456 // =================================================================================================
457 // Color Lists Functions
458 // =================================================================================================
459 
460 std::vector<Color> color_list_nextstrain( size_t n )
461 {
462  if( n == 0 ) {
463  return std::vector<Color>{};
464  } else if( n < color_lists_nextstrain_1_16_.size() ) {
465  return color_lists_nextstrain_1_16_[n];
466  } else {
467  return ColorMap( color_list_nextstrain_256_ ).color_list( n );
468  }
469 }
470 
471 std::vector<Color> const& color_list_nextstrain()
472 {
474 }
475 
476 // =================================================================================================
477 // Convenience Functions
478 // =================================================================================================
479 
480 std::vector<Color> const& color_list_misc( ColorListMisc palette )
481 {
482  if( palette == ColorListMisc::kNextstrain ) {
484  }
485 
486  throw std::invalid_argument( "Invalid ColorListMisc value." );
487 }
488 
489 std::vector<Color> const& color_list_misc( std::string const& palette )
490 {
491  auto const p = to_lower_ascii( palette );
492 
493  if( p == "nextstrain" ) {
495  }
496 
497  throw std::invalid_argument( "Invalid ColorListMisc name: '" + palette + "'." );
498 }
499 
500 std::vector<std::string> color_list_misc_names()
501 {
502  return {
503  "Nextstrain"
504  };
505 }
506 
507 } // namespace utils
508 } // namespace genesis
std::vector< Color > const & color_list_misc(ColorListMisc palette)
Definition: list_misc.cpp:480
Store a list of colors and offer them as a map for values in range [ 0.0, 1.0 ].
Definition: map.hpp:61
Container namespace for all symbols of genesis in order to keep them separate when used as a library...
static const std::vector< Color > color_list_nextstrain_256_
Definition: list_misc.cpp:197
Provides some commonly used string utility functions.
std::vector< std::string > color_list_misc_names()
Definition: list_misc.cpp:500
std::vector< Color > color_list_nextstrain(size_t n)
Color palette from the the Nextstrain build for novel coronavirus (nCoV) at https://nextstrain.org/ncov.
Definition: list_misc.cpp:460
static const std::vector< std::vector< Color > > color_lists_nextstrain_1_16_
Definition: list_misc.cpp:58
Color operators and functions.
std::vector< Color > color_list(size_t n=256) const
Get a color list based on the palette, containing n colors sampled at equal distance across the palet...
Definition: map.cpp:47
std::string to_lower_ascii(std::string const &str)
Return an all-lowercase copy of the given string, ASCII-only.
Definition: string.cpp:460