corybrunson / ggalluvial

ggplot2 extension for alluvial plots
http://corybrunson.github.io/ggalluvial/
GNU General Public License v3.0
497 stars 34 forks source link

Help with incomplete (NA) category mappings for alluvial plot #56

Closed b-tierney closed 4 years ago

b-tierney commented 4 years ago

Description of the issue

I'm trying to use ggalluvial to create plots for some hierarchical data, for example of the following form (example df also attached):

ID,L1,L2,FREQ A,1,1.1,4 A,1,1.2,5 B,1,1.1,2

However, in these data I sometimes have entries at the higher level (L1 in the above data frame) that are NA -- it's an unavoidable feature of the input data. The result looks like this:

ID,L1,L2,FREQ A,1,1.1,4 A,1,1.2,5 A,1,NA,2

In the example below, you'll see what happens when I try to plot this style of DF with ggalluvial -- the NA values are placed on a non-labeled portion of the L2 axis.

In short, is there anyway to have ggalluvial report the sum by group and category over each column, discounting NAs? Forgive me if that's not clear, it's difficult to explain well.

Thank you in advance.

Reproducible example (preferably using reprex::reprex())


library(tidyverse)
library(ggalluvial)
demo_data=read.csv('~/demo_alluv_data.txt',row.names=1,stringsAsFactors = FALSE)
demo_data=demo_data %>% group_by(ID) %>% arrange(FREQ)
demo_data$LEVEL1=fct_reorder(factor(demo_data$LEVEL1),demo_data$FREQ)
demo_data$LEVEL2=fct_reorder(factor(demo_data$LEVEL2),demo_data$FREQ)

ggplot(as.data.frame(demo_data),aes(y = log(FREQ), axis1 = LEVEL1,axis2 = LEVEL2)) +
  geom_alluvium(aes(fill = factor(ID)), width = 1/12) +
  geom_stratum(width = 1/32, fill = "black", color = "grey") +
  geom_label(stat = "stratum", infer.label = TRUE) +
  scale_fill_brewer(type = "qual", palette = "Set1")

Created on 2020-04-17 by the reprex package (v0.3.0) demo_alluv_data.txt

corybrunson commented 4 years ago

Hi @b-tierney, thanks for asking—this is an interesting question, and i don't think there's a natural answer to it yet.

First, is this more or less what you're after? You're right that it's not easy to describe. This is just a workaround; ggalluvial isn't contributing anything. And of course if the basic idea is right then the spacing, size, etc. can be improved.

library(tidyverse)
library(ggalluvial)
demo_data=read.csv('~/demo_alluv_data.txt',row.names=1,stringsAsFactors = FALSE)
demo_data=demo_data %>% group_by(ID) %>% arrange(FREQ)
demo_data$LEVEL1=fct_reorder(factor(demo_data$LEVEL1),demo_data$FREQ)
demo_data$LEVEL2=fct_reorder(factor(demo_data$LEVEL2),demo_data$FREQ)

SUM1 <- with(demo_data, sum(log(FREQ)[! is.na(LEVEL1)]))
SUM2 <- with(demo_data, sum(log(FREQ)[! is.na(LEVEL2)]))
sum_data <- data.frame(axis = 1:2, sum = c(SUM1, SUM2))
ggplot(as.data.frame(demo_data),aes(y = log(FREQ), axis1 = LEVEL1,axis2 = LEVEL2)) +
  geom_alluvium(aes(fill = factor(ID)), width = 1/12) +
  geom_stratum(width = 1/32, fill = "black", color = "grey") +
  geom_label(stat = "stratum", infer.label = TRUE) +
  geom_text(data = sum_data, vjust = 0,
            aes(x = axis, y = sum, label = round(sum, 2),
                axis1 = NULL, axis2 = NULL)) +
  scale_fill_brewer(type = "qual", palette = "Set1")

Created on 2020-04-17 by the reprex package (v0.3.0)

Second, do you know whether what you want can be done with geom_bar()? I've found a few similar questions and answers on StackOverflow, but they're also workarounds rather than elegant shortcuts:

The reason i ask is that i've tried to keep ggalluvial consistent with ggplot2 behavior, and in particular the stratum stat and geom similar to the behavior of geom_bar(). If there's a feature missing then i'll definitely want to add it.

b-tierney commented 4 years ago

Thank you so much for the quick response! I really appreciate your effort and interest.

That's much closer to what I'm looking for, thank you. I don't there are any features "missing" at all, I think it's more that my ontology is just kind of bad.

Geom_bar may be another option, however I'm not sure how it will scale in terms of interpretability when I try to work with my full ontology (I hesitate to even show you how many levels/categories I'm dealing with).

Really, thanks again.

b-tierney commented 4 years ago

Actually following up here -- I thought of another way to put it that might clear things up.

The issue is that there isn't a 1 to 1 mapping between axes because I'm working with a hierarchical annotation -- I basically have a bunch of biological pathway annotation data. So you can have really specific annotations (eg product XYZ biosynthesis) that fall into broader categories (eg general biosynthesis). Some things can only be annotated at these "broad" levels, however, resulting in the NAs for the low level annotations.

So the goal would be to visualize the mapping between levels in the hierarchy, but again the issue is that to remove those NA values on the top right while accounting for variable sample size, you would need the links to be slightly wider on the left than the right.

Does that make sense? As I write I'm realizing that implementing that particular feature is probably not feasible, so I'll have to root around for another method, maybe a barplot.

Thanks again for your help with this.

corybrunson commented 4 years ago

Glad to have helped!

Let me first clarify that i'm not suggesting that the solution might be to use geom_bar(). Rather, if this is something that geom_bar() can't do, then it's probably something that geom_stratum() also shouldn't be able to do. I try to make the functionality of the ggalluvial plot layers match those of ggplot2, which means that features that aren't specific to alluvial plots are not implemented.

When you refer to the "links", i think you mean what i've taken to calling the "flows". If that's right, then it is possible to have the flows vary in height from axis to axis; see this StackOverflow answer. The catch is that the data must be in "lodes" (long) format rather than "alluvia" (wide) format, but you should be able to use to_lodes_form() to convert your data set. But the heights will only change if the y value (FREQ) changes, whereas the conversion to lodes form will simply duplicate the existing frequencies across all axes. If this seems like the correct approach but you have trouble taking it, feel free to bring it back.

b-tierney commented 4 years ago

Ah I see what you're saying re: geom_bar -- thanks, that helps.

Will play around with converting to lodes form, I think that might be a step in the right direction...much thanks

b-tierney commented 4 years ago

Sorry to keep bugging you about this -- I keep thinking I'm about to get it then...alas. Getting very close though, see reprex output and attached df.

Now I'm able to get column heights correct, it's just missing the links between dfs. Been working off of the stack overflow link you sent above as well as this one: https://stackoverflow.com/questions/58962233/computation-failed-in-stat-alluvium-each-row-of-output-must-be-identified-b

Again, my apologies for the continued messages, and thank you so much for the help. I THINK this should be possible...just need to figure out a way to get rid of those NAs...

test_data_2.txt

library(tidyverse)
library(ggalluvial)
library(ggplot2)

annotation_data=read.table('~/test_data_2.txt',sep=',',header=TRUE,row.names=1)

ggplot(
  data = annotation_data,
  aes(
    x = as.factor(level),
    stratum = as.factor(id),
    alluvium = as.factor(NCBITAXONID),
    y = n
  )
) +
  geom_stratum(aes(fill = as.factor(NCBITAXONID))) +
  geom_flow()
#> Warning: Computation failed in `stat_flow()`:
#> Each row of output must be identified by a unique combination of keys.
#> Keys are shared for 6151 rows:
#> * 5, 9, 14, 16, 23, 29
#> * 1, 7, 12, 19, 21, 26
#> * 2, 8, 11, 18, 22, 28
#> * 3, 10, 13, 20, 24, 30
#> * 4, 6, 15, 17, 25, 27
#> * 33, 38, 42, 47, 53, 59, 62, 67, 72, 73, 79, 84, 88, 95, 98, 104, 108, 111, 116, 121, 122, 131, 136, 140, 143, 148, 153, 157, 160, 166, 171, 173, 180, 185, 186, 191, 197, 200, 207, 212, 216, 222, 224, 227, 229, 236, 242, 247, 256, 262, 267, 268, 276, 279, 283
#> * 31, 36, 43, 50, 54, 60, 63, 70, 71, 76, 81, 86, 94, 97, 102, 109, 114, 118, 124, 130, 133, 137, 144, 147, 152, 162, 165, 172, 174, 177, 181, 187, 192, 198, 201, 208, 209, 215, 221, 232, 235, 241, 248, 252, 253, 259, 265, 270, 273, 278
#> * 34, 37, 45, 48, 52, 57, 64, 66, 77, 82, 89, 93, 100, 103, 107, 115, 120, 126, 129, 132, 138, 146, 149, 154, 158, 164, 169, 179, 182, 188, 194, 195, 203, 206, 210, 214, 223, 226, 231, 237, 240, 246, 249, 254, 258, 266, 272, 274, 280, 284
#> * 32, 40, 44, 49, 51, 58, 61, 69, 74, 80, 85, 90, 91, 96, 101, 110, 112, 119, 123, 128, 135, 141, 145, 151, 155, 159, 163, 168, 176, 184, 189, 199, 204, 213, 217, 220, 225, 230, 238, 239, 245, 250, 255, 260, 263, 269, 277, 282
#> * 35, 39, 41, 46, 55, 56, 65, 68, 75, 78, 83, 87, 92, 99, 105, 106, 113, 117, 125, 127, 134, 139, 142, 150, 156, 161, 167, 170, 175, 178, 183, 190, 193, 196, 202, 205, 211, 218, 219, 228, 233, 234, 243, 244, 251, 257, 261, 264, 271, 275, 281
#> * 285, 290, 291, 293, 302, 307, 308, 317, 320, 322, 327, 330, 333, 334, 338, 341, 342, 349, 353, 358, 361, 367, 369, 372, 378, 380, 384, 388, 390, 392, 399, 403, 405, 411, 414, 419, 420, 422, 430, 435, 440, 443, 447, 454, 456, 459, 463, 466, 473, 477, 483, 484, 489, 497, 500, 501, 503, 508, 509, 514, 522, 524, 527, 530, 537, 542, 545, 552, 555, 561, 564, 568, 576, 581, 587, 591, 595, 598, 603, 606, 611, 616, 621, 625, 629, 633, 639, 641, 646, 651, 652, 657, 665, 671, 672, 678, 685, 688, 695, 696, 702, 707, 713, 716, 723, 727, 731, 736, 742, 744, 753, 758, 763, 768, 772, 776, 779, 782, 788, 794, 797, 800, 805, 810, 817, 824, 828, 829, 837, 838, 843, 849, 854, 862, 865, 872, 874, 880, 887, 889, 894, 901, 903, 907, 908, 914, 918, 923, 929, 931, 939, 945, 946, 951, 958, 967, 972, 975, 980, 986, 991, 997, 1001, 1004, 1009, 1014
#> * 286, 297, 298, 305, 309, 313, 319, 321, 326, 328, 335, 340, 345, 348, 354, 360, 365, 371, 375, 381, 385, 389, 395, 401, 407, 417, 425, 429, 436, 439, 442, 449, 455, 460, 461, 465, 471, 476, 480, 487, 492, 496, 499, 502, 506, 510, 517, 519, 529, 534, 539, 543, 548, 553, 559, 567, 570, 574, 578, 585, 589, 596, 601, 605, 613, 614, 623, 627, 634, 636, 642, 650, 655, 661, 662, 668, 675, 683, 689, 694, 697, 703, 706, 715, 717, 721, 726, 732, 734, 740, 745, 749, 760, 765, 771, 774, 781, 789, 792, 795, 802, 806, 814, 819, 820, 826, 831, 834, 842, 844, 848, 857, 858, 864, 869, 876, 882, 885, 888, 893, 902, 909, 913, 922, 925, 933, 938, 941, 948, 954, 959, 960, 968, 971, 977, 983, 985, 992, 996, 1002, 1008, 1010
#> * 288, 296, 301, 303, 312, 314, 318, 324, 329, 336, 346, 350, 352, 355, 362, 368, 373, 379, 386, 393, 397, 408, 413, 418, 424, 428, 432, 437, 445, 450, 453, 458, 462, 469, 470, 479, 482, 486, 491, 498, 504, 513, 516, 523, 528, 531, 536, 540, 546, 549, 557, 558, 566, 571, 577, 580, 586, 588, 597, 602, 604, 612, 615, 622, 628, 632, 638, 645, 648, 654, 659, 666, 667, 673, 677, 681, 687, 692, 700, 704, 708, 711, 718, 722, 733, 737, 741, 746, 752, 757, 761, 766, 770, 777, 784, 787, 793, 799, 804, 809, 813, 818, 822, 825, 830, 836, 840, 846, 850, 853, 860, 863, 868, 873, 879, 884, 890, 897, 900, 906, 910, 916, 924, 926, 932, 937, 944, 953, 957, 961, 966, 970, 978, 982, 987, 990, 998, 1003, 1007, 1013, 1015
#> * 287, 295, 300, 304, 310, 315, 325, 332, 339, 344, 351, 356, 363, 364, 370, 376, 383, 396, 398, 402, 406, 410, 416, 423, 427, 434, 438, 446, 448, 452, 464, 468, 472, 478, 488, 490, 494, 505, 512, 515, 520, 525, 533, 535, 541, 547, 551, 556, 562, 565, 572, 573, 579, 583, 592, 594, 600, 608, 610, 617, 620, 626, 630, 631, 637, 644, 649, 653, 658, 664, 670, 674, 679, 684, 686, 693, 699, 705, 710, 714, 719, 725, 730, 738, 739, 747, 750, 755, 759, 764, 769, 775, 780, 785, 790, 796, 801, 808, 811, 815, 823, 833, 841, 845, 852, 856, 861, 866, 871, 877, 881, 883, 891, 895, 899, 905, 912, 917, 919, 921, 927, 930, 935, 943, 947, 950, 955, 962, 964, 973, 976, 979, 988, 989, 994, 1000, 1005, 1011
#> * 289, 292, 294, 299, 306, 311, 316, 323, 331, 337, 343, 347, 357, 359, 366, 374, 377, 382, 387, 391, 394, 400, 404, 409, 412, 415, 421, 426, 431, 433, 441, 444, 451, 457, 467, 474, 475, 481, 485, 493, 495, 507, 511, 518, 521, 526, 532, 538, 544, 550, 554, 560, 563, 569, 575, 582, 584, 590, 593, 599, 607, 609, 618, 619, 624, 635, 640, 643, 647, 656, 660, 663, 669, 676, 680, 682, 690, 691, 698, 701, 709, 712, 720, 724, 728, 729, 735, 743, 748, 751, 754, 756, 762, 767, 773, 778, 783, 786, 791, 798, 803, 807, 812, 816, 821, 827, 832, 835, 839, 847, 851, 855, 859, 867, 870, 875, 878, 886, 892, 896, 898, 904, 911, 915, 920, 928, 934, 936, 940, 942, 949, 952, 956, 963, 965, 969, 974, 981, 984, 993, 995, 999, 1006, 1012
#> * 1018, 1023, 1027, 1032, 1038, 1044, 1047, 1052, 1057, 1058, 1064, 1069, 1073, 1080, 1083, 1089, 1093, 1096, 1101, 1106, 1107, 1116, 1121, 1125, 1128, 1133, 1138, 1142, 1145, 1151, 1156, 1158, 1165, 1170, 1171, 1176, 1182, 1185, 1192, 1197, 1201, 1207, 1209, 1212, 1214, 1221, 1227, 1232, 1241, 1247, 1252, 1253, 1261, 1264, 1268
#> * 1016, 1021, 1028, 1035, 1039, 1045, 1048, 1055, 1056, 1061, 1066, 1071, 1079, 1082, 1087, 1094, 1099, 1103, 1109, 1115, 1118, 1122, 1129, 1132, 1137, 1147, 1150, 1157, 1159, 1162, 1166, 1172, 1177, 1183, 1186, 1193, 1194, 1200, 1206, 1217, 1220, 1226, 1233, 1237, 1238, 1244, 1250, 1255, 1258, 1263
#> * 1019, 1022, 1030, 1033, 1037, 1042, 1049, 1051, 1062, 1067, 1074, 1078, 1085, 1088, 1092, 1100, 1105, 1111, 1114, 1117, 1123, 1131, 1134, 1139, 1143, 1149, 1154, 1164, 1167, 1173, 1179, 1180, 1188, 1191, 1195, 1199, 1208, 1211, 1216, 1222, 1225, 1231, 1234, 1239, 1243, 1251, 1257, 1259, 1265, 1269
#> * 1017, 1025, 1029, 1034, 1036, 1043, 1046, 1054, 1059, 1065, 1070, 1075, 1076, 1081, 1086, 1095, 1097, 1104, 1108, 1113, 1120, 1126, 1130, 1136, 1140, 1144, 1148, 1153, 1161, 1169, 1174, 1184, 1189, 1198, 1202, 1205, 1210, 1215, 1223, 1224, 1230, 1235, 1240, 1245, 1248, 1254, 1262, 1267
#> * 1020, 1024, 1026, 1031, 1040, 1041, 1050, 1053, 1060, 1063, 1068, 1072, 1077, 1084, 1090, 1091, 1098, 1102, 1110, 1112, 1119, 1124, 1127, 1135, 1141, 1146, 1152, 1155, 1160, 1163, 1168, 1175, 1178, 1181, 1187, 1190, 1196, 1203, 1204, 1213, 1218, 1219, 1228, 1229, 1236, 1242, 1246, 1249, 1256, 1260, 1266
#> * 1270, 1275, 1276, 1278, 1287, 1292, 1293, 1302, 1305, 1307, 1312, 1315, 1318, 1319, 1323, 1326, 1327, 1334, 1338, 1343, 1346, 1352, 1354, 1357, 1363, 1365, 1369, 1373, 1375, 1377, 1384, 1388, 1390, 1396, 1399, 1404, 1405, 1407, 1415, 1420, 1425, 1428, 1432, 1439, 1441, 1444, 1448, 1451, 1458, 1462, 1468, 1469, 1474, 1482, 1485, 1486, 1488, 1493, 1494, 1499, 1507, 1509, 1512, 1515, 1522, 1527, 1530, 1537, 1540, 1546, 1549, 1553, 1561, 1566, 1572, 1576, 1580, 1583, 1588, 1591, 1596, 1601, 1606, 1610, 1614, 1618, 1624, 1626, 1631, 1636, 1637, 1642, 1650, 1656, 1657, 1663, 1670, 1673, 1680, 1681, 1687, 1692, 1698, 1701, 1708, 1712, 1716, 1721, 1727, 1729, 1738, 1743, 1748, 1753, 1757, 1761, 1764, 1767, 1773, 1779, 1782, 1785, 1790, 1795, 1802, 1809, 1813, 1814, 1822, 1823, 1828, 1834, 1839, 1847, 1850, 1857, 1859, 1865, 1872, 1874, 1879, 1886, 1888, 1892, 1893, 1899, 1903, 1908, 1914, 1916, 1924, 1930, 1931, 1936, 1943, 1952, 1957, 1960, 1965, 1971, 1976, 1982, 1986, 1989, 1994, 1999
#> * 1271, 1282, 1283, 1290, 1294, 1298, 1304, 1306, 1311, 1313, 1320, 1325, 1330, 1333, 1339, 1345, 1350, 1356, 1360, 1366, 1370, 1374, 1380, 1386, 1392, 1402, 1410, 1414, 1421, 1424, 1427, 1434, 1440, 1445, 1446, 1450, 1456, 1461, 1465, 1472, 1477, 1481, 1484, 1487, 1491, 1495, 1502, 1504, 1514, 1519, 1524, 1528, 1533, 1538, 1544, 1552, 1555, 1559, 1563, 1570, 1574, 1581, 1586, 1590, 1598, 1599, 1608, 1612, 1619, 1621, 1627, 1635, 1640, 1646, 1647, 1653, 1660, 1668, 1674, 1679, 1682, 1688, 1691, 1700, 1702, 1706, 1711, 1717, 1719, 1725, 1730, 1734, 1745, 1750, 1756, 1759, 1766, 1774, 1777, 1780, 1787, 1791, 1799, 1804, 1805, 1811, 1816, 1819, 1827, 1829, 1833, 1842, 1843, 1849, 1854, 1861, 1867, 1870, 1873, 1878, 1887, 1894, 1898, 1907, 1910, 1918, 1923, 1926, 1933, 1939, 1944, 1945, 1953, 1956, 1962, 1968, 1970, 1977, 1981, 1987, 1993, 1995
#> * 1273, 1281, 1286, 1288, 1297, 1299, 1303, 1309, 1314, 1321, 1331, 1335, 1337, 1340, 1347, 1353, 1358, 1364, 1371, 1378, 1382, 1393, 1398, 1403, 1409, 1413, 1417, 1422, 1430, 1435, 1438, 1443, 1447, 1454, 1455, 1464, 1467, 1471, 1476, 1483, 1489, 1498, 1501, 1508, 1513, 1516, 1521, 1525, 1531, 1534, 1542, 1543, 1551, 1556, 1562, 1565, 1571, 1573, 1582, 1587, 1589, 1597, 1600, 1607, 1613, 1617, 1623, 1630, 1633, 1639, 1644, 1651, 1652, 1658, 1662, 1666, 1672, 1677, 1685, 1689, 1693, 1696, 1703, 1707, 1718, 1722, 1726, 1731, 1737, 1742, 1746, 1751, 1755, 1762, 1769, 1772, 1778, 1784, 1789, 1794, 1798, 1803, 1807, 1810, 1815, 1821, 1825, 1831, 1835, 1838, 1845, 1848, 1853, 1858, 1864, 1869, 1875, 1882, 1885, 1891, 1895, 1901, 1909, 1911, 1917, 1922, 1929, 1938, 1942, 1946, 1951, 1955, 1963, 1967, 1972, 1975, 1983, 1988, 1992, 1998, 2000
#> * 1272, 1280, 1285, 1289, 1295, 1300, 1310, 1317, 1324, 1329, 1336, 1341, 1348, 1349, 1355, 1361, 1368, 1381, 1383, 1387, 1391, 1395, 1401, 1408, 1412, 1419, 1423, 1431, 1433, 1437, 1449, 1453, 1457, 1463, 1473, 1475, 1479, 1490, 1497, 1500, 1505, 1510, 1518, 1520, 1526, 1532, 1536, 1541, 1547, 1550, 1557, 1558, 1564, 1568, 1577, 1579, 1585, 1593, 1595, 1602, 1605, 1611, 1615, 1616, 1622, 1629, 1634, 1638, 1643, 1649, 1655, 1659, 1664, 1669, 1671, 1678, 1684, 1690, 1695, 1699, 1704, 1710, 1715, 1723, 1724, 1732, 1735, 1740, 1744, 1749, 1754, 1760, 1765, 1770, 1775, 1781, 1786, 1793, 1796, 1800, 1808, 1818, 1826, 1830, 1837, 1841, 1846, 1851, 1856, 1862, 1866, 1868, 1876, 1880, 1884, 1890, 1897, 1902, 1904, 1906, 1912, 1915, 1920, 1928, 1932, 1935, 1940, 1947, 1949, 1958, 1961, 1964, 1973, 1974, 1979, 1985, 1990, 1996
#> * 1274, 1277, 1279, 1284, 1291, 1296, 1301, 1308, 1316, 1322, 1328, 1332, 1342, 1344, 1351, 1359, 1362, 1367, 1372, 1376, 1379, 1385, 1389, 1394, 1397, 1400, 1406, 1411, 1416, 1418, 1426, 1429, 1436, 1442, 1452, 1459, 1460, 1466, 1470, 1478, 1480, 1492, 1496, 1503, 1506, 1511, 1517, 1523, 1529, 1535, 1539, 1545, 1548, 1554, 1560, 1567, 1569, 1575, 1578, 1584, 1592, 1594, 1603, 1604, 1609, 1620, 1625, 1628, 1632, 1641, 1645, 1648, 1654, 1661, 1665, 1667, 1675, 1676, 1683, 1686, 1694, 1697, 1705, 1709, 1713, 1714, 1720, 1728, 1733, 1736, 1739, 1741, 1747, 1752, 1758, 1763, 1768, 1771, 1776, 1783, 1788, 1792, 1797, 1801, 1806, 1812, 1817, 1820, 1824, 1832, 1836, 1840, 1844, 1852, 1855, 1860, 1863, 1871, 1877, 1881, 1883, 1889, 1896, 1900, 1905, 1913, 1919, 1921, 1925, 1927, 1934, 1937, 1941, 1948, 1950, 1954, 1959, 1966, 1969, 1978, 1980, 1984, 1991, 1997
#> * 2003, 2006, 2015, 2019, 2024, 2026, 2031, 2037, 2040, 2042, 2043, 2045, 2046, 2049, 2053, 2059, 2060, 2068, 2069, 2074, 2078, 2081, 2086, 2088, 2089, 2091, 2094, 2101, 2103, 2108, 2110, 2113, 2116, 2121, 2122, 2123, 2126, 2132, 2137, 2139, 2144, 2146, 2151, 2155, 2159, 2161, 2163, 2165, 2168, 2175, 2180, 2181, 2183, 2184, 2189, 2191, 2198, 2200, 2203, 2207, 2213, 2215, 2218, 2220, 2228, 2233, 2236, 2241, 2243, 2244, 2249, 2254, 2255, 2258, 2261, 2264, 2267, 2272, 2273, 2275, 2276, 2277, 2279, 2283, 2285, 2287, 2289, 2295, 2299, 2303, 2308, 2309, 2311, 2315, 2319, 2322, 2327, 2331, 2332, 2334, 2338, 2344, 2346, 2347, 2348, 2349, 2351, 2352, 2355, 2358, 2362, 2364, 2365, 2367, 2371, 2372, 2374, 2378, 2383, 2385, 2386, 2391, 2399, 2400, 2406, 2407, 2408, 2412, 2416, 2419, 2420, 2424, 2431, 2432, 2433, 2435, 2438, 2439, 2442, 2443, 2447, 2448, 2450, 2452, 2457, 2460, 2465, 2468, 2472, 2474, 2478, 2483, 2487, 2491, 2492, 2499, 2504, 2506, 2507, 2509, 2511, 2515, 2521, 2523, 2524, 2526, 2528, 2533, 2538, 2542, 2550, 2551, 2554, 2559, 2562, 2567, 2572, 2575, 2581, 2588, 2592, 2595, 2598, 2606, 2608, 2612, 2614, 2618, 2620, 2623, 2629, 2630, 2632, 2635, 2639, 2645, 2647, 2652, 2653, 2657, 2658, 2660, 2665, 2666, 2671, 2673, 2678, 2686, 2690, 2691, 2695, 2702, 2703, 2704, 2706, 2707, 2712, 2713, 2716, 2719, 2723, 2724, 2726, 2728, 2738, 2742, 2743, 2744, 2749, 2750, 2751, 2752, 2755, 2761, 2764, 2767, 2771, 2779, 2781, 2782, 2788, 2792, 2795, 2801, 2805, 2808, 2814, 2817, 2825, 2828, 2836, 2839, 2842, 2845, 2846, 2850, 2852, 2859, 2866, 2869, 2873, 2879, 2886, 2890, 2892, 2893, 2894, 2899, 2900, 2905, 2913, 2918, 2923, 2928, 2929, 2934, 2937, 2941, 2943, 2945, 2952, 2957, 2959, 2965, 2969, 2973, 2974, 2977, 2980, 2982, 2989, 2993, 2996, 2997, 3001, 3006, 3008, 3017, 3019, 3022, 3025, 3027, 3029, 3031, 3036, 3039, 3041, 3043, 3045, 3051, 3055, 3056, 3058, 3060, 3066, 3072, 3077, 3083, 3086, 3088, 3093, 3096, 3099, 3106, 3107, 3110, 3113, 3121, 3122, 3129, 3130, 3135, 3136, 3138, 3145, 3147, 3148, 3153, 3154, 3159, 3160, 3165, 3172, 3177, 3183, 3190, 3193, 3196, 3198, 3204, 3213, 3217, 3222, 3226, 3231, 3233, 3239, 3244, 3247, 3250, 3256, 3258, 3266, 3269, 3273, 3275, 3276, 3279, 3282, 3286, 3290, 3295, 3297, 3299, 3302, 3306, 3311, 3317, 3325, 3327, 3332, 3337, 3341, 3345, 3346, 3348, 3351, 3354, 3357, 3361, 3365, 3372, 3379, 3380, 3384, 3390, 3397, 3399, 3401, 3408, 3410, 3413, 3417, 3426, 3430, 3432, 3434, 3437, 3445, 3448, 3452, 3458, 3465, 3469, 3474, 3479, 3481, 3484, 3486, 3494, 3496, 3498, 3503, 3506, 3507, 3512, 3513, 3518, 3519, 3524, 3528, 3532, 3534, 3537, 3542, 3544, 3548, 3552, 3553, 3555, 3561, 3567, 3568, 3572, 3576, 3579, 3584, 3590, 3591, 3600, 3601, 3602, 3606, 3608, 3615, 3621, 3624, 3630, 3634, 3637, 3642, 3648, 3650, 3657, 3658, 3662, 3663, 3664, 3665, 3666, 3669, 3672, 3673, 3674, 3675, 3680, 3682, 3685, 3690, 3695, 3700, 3704, 3709, 3712, 3716, 3718, 3722, 3728, 3731, 3739, 3742, 3745, 3747, 3748, 3749, 3752, 3754, 3760, 3763, 3764, 3769, 3770, 3771, 3773, 3782, 3784, 3786, 3792, 3798, 3803, 3808, 3811, 3812, 3813, 3818, 3826, 3830, 3833, 3838, 3843, 3846, 3849, 3854, 3855, 3856, 3864, 3865, 3870, 3874, 3876, 3882, 3888, 3894, 3896, 3897, 3902, 3911, 3913, 3917, 3923, 3926, 3929, 3933, 3935, 3940, 3947, 3948, 3953, 3954, 3955, 3958, 3962, 3968, 3973, 3974, 3975, 3976, 3977, 3978, 3983, 3988, 3995, 4001, 4003, 4006, 4010, 4015, 4016, 4018, 4021, 4025, 4034, 4038, 4042, 4045, 4048, 4051, 4052, 4053, 4058, 4059, 4060, 4064, 4068, 4076, 4077, 4078, 4080, 4086, 4091, 4096, 4097, 4098, 4100, 4105, 4107, 4113, 4116, 4117, 4125, 4130, 4133, 4135, 4139, 4140, 4141, 4145, 4148, 4154, 4156, 4158, 4163, 4167, 4173, 4178, 4180, 4184, 4190, 4191, 4193, 4197, 4201, 4208, 4213, 4216, 4221, 4222, 4231, 4234, 4240, 4243, 4246, 4251, 4256, 4257, 4259, 4260, 4266, 4270, 4275, 4281, 4284, 4289, 4293, 4299, 4302, 4310, 4312, 4318, 4323, 4324, 4325, 4331, 4333, 4334, 4338, 4342, 4345, 4347, 4349, 4353, 4357, 4361, 4368, 4372, 4379, 4381, 4386, 4392, 4393, 4397, 4402, 4408, 4416, 4423, 4425, 4432, 4438, 4445, 4447, 4453, 4457, 4463, 4467, 4468, 4469, 4470, 4475, 4483, 4488, 4491, 4498, 4504, 4509, 4511, 4519, 4523, 4527, 4535, 4538, 4543, 4549, 4555, 4560, 4565, 4566, 4571, 4574, 4576, 4583, 4585, 4587, 4591, 4593, 4598, 4600, 4604, 4609, 4611, 4613, 4617, 4619, 4622, 4623, 4626, 4632, 4639, 4641, 4644, 4649, 4653, 4656, 4662, 4663, 4669, 4674, 4678, 4680, 4683, 4687, 4694, 4695, 4698, 4703, 4704, 4707, 4710, 4717, 4728, 4730, 4732, 4733, 4734, 4739, 4741, 4744, 4746, 4750, 4757, 4762, 4763, 4769, 4773, 4777, 4780, 4784, 4791, 4793, 4799, 4802, 4809, 4815, 4817, 4818, 4819, 4820, 4821, 4823, 4827, 4830, 4835, 4838, 4841, 4846, 4847, 4851, 4852, 4853, 4859, 4863, 4867, 4872, 4873, 4874, 4881, 4882, 4887, 4892, 4896, 4900, 4904, 4910, 4914, 4917, 4920, 4926, 4930, 4933, 4937, 4940, 4945, 4948, 4950, 4954, 4955, 4958, 4959, 4962, 4966, 4971, 4973, 4977, 4980, 4988, 4990, 4994, 4996, 4999, 5000, 5001, 5002, 5010, 5012, 5018, 5023, 5025, 5026, 5029, 5031, 5033, 5037, 5043, 5047, 5051, 5058, 5061, 5062, 5064, 5069, 5074, 5077, 5082, 5083, 5085, 5090, 5095, 5100, 5103, 5106, 5111, 5112, 5114, 5117, 5121, 5127, 5130, 5134, 5138, 5140, 5143, 5145, 5153, 5155, 5158, 5161, 5162, 5167, 5172, 5177, 5179, 5183, 5189, 5193, 5194, 5195, 5200, 5205, 5208, 5212, 5217, 5219, 5223, 5226, 5230, 5231, 5237, 5244, 5245, 5248, 5251, 5256, 5259, 5264, 5269, 5273, 5277, 5281, 5284, 5289, 5292, 5293, 5295, 5297, 5301, 5304, 5310, 5314, 5316, 5318, 5322, 5324, 5329, 5332, 5335, 5339, 5345, 5351, 5354, 5358, 5359, 5361, 5366, 5367, 5368, 5372, 5375, 5376, 5377, 5382, 5389, 5390, 5394, 5400, 5404, 5408, 5412, 5420, 5421, 5430, 5435, 5440, 5443, 5446, 5448, 5452, 5454, 5456, 5461, 5463, 5471, 5473, 5477, 5480, 5483, 5491, 5493, 5497, 5501, 5505, 5508, 5511, 5514, 5517, 5521, 5523, 5524, 5525, 5527, 5530, 5538, 5542, 5547, 5553, 5559, 5560, 5561, 5569, 5574, 5576, 5580, 5583, 5586, 5589, 5595, 5603, 5606, 5612, 5619, 5624, 5629, 5630, 5636, 5639, 5644, 5648, 5655, 5659, 5664, 5667, 5670, 5677, 5678, 5685, 5686, 5687, 5689, 5692, 5698, 5704, 5707, 5713, 5718, 5720, 5721, 5723, 5726, 5734, 5739, 5741, 5747, 5748, 5753, 5754, 5757, 5764, 5768, 5770, 5775, 5779, 5781, 5782, 5783, 5790, 5796, 5798, 5802, 5804, 5809, 5817, 5820, 5824, 5833, 5838, 5842, 5845, 5849, 5852, 5857, 5864, 5867, 5873, 5878, 5882, 5887, 5893, 5899, 5902, 5908, 5913, 5919, 5920, 5927, 5932, 5937, 5943, 5946, 5951, 5959, 5960, 5962, 5965, 5969, 5972, 5976, 5981, 5985, 5987, 5992, 5996, 6000, 6002, 6005, 6006, 6010, 6012, 6018, 6020, 6024, 6029, 6036, 6041, 6042, 6050, 6053, 6057, 6062, 6066, 6071, 6078, 6080, 6084, 6090, 6096, 6102, 6104, 6108, 6116, 6119, 6127, 6130, 6131, 6134, 6138, 6145, 6149, 6150
#> * 2001, 2007, 2020, 2033, 2038, 2047, 2050, 2056, 2058, 2065, 2073, 2076, 2084, 2095, 2098, 2105, 2112, 2118, 2125, 2130, 2134, 2141, 2147, 2157, 2162, 2166, 2169, 2173, 2179, 2188, 2192, 2197, 2212, 2217, 2221, 2225, 2232, 2238, 2247, 2251, 2259, 2265, 2268, 2282, 2296, 2302, 2305, 2316, 2320, 2324, 2329, 2330, 2335, 2340, 2341, 2350, 2357, 2361, 2366, 2377, 2379, 2382, 2389, 2394, 2395, 2402, 2405, 2409, 2417, 2422, 2428, 2434, 2441, 2445, 2451, 2454, 2458, 2462, 2469, 2477, 2481, 2489, 2497, 2503, 2512, 2517, 2518, 2534, 2539, 2543, 2546, 2555, 2561, 2565, 2573, 2576, 2580, 2586, 2596, 2601, 2605, 2613, 2616, 2622, 2627, 2631, 2638, 2643, 2650, 2654, 2662, 2668, 2672, 2677, 2683, 2687, 2692, 2697, 2701, 2705, 2709, 2714, 2718, 2729, 2734, 2737, 2745, 2756, 2760, 2765, 2769, 2773, 2780, 2783, 2790, 2794, 2803, 2811, 2819, 2820, 2824, 2829, 2837, 2838, 2844, 2847, 2854, 2856, 2858, 2862, 2864, 2875, 2878, 2882, 2888, 2896, 2902, 2906, 2914, 2915, 2920, 2925, 2933, 2936, 2939, 2948, 2949, 2956, 2962, 2968, 2970, 2972, 2976, 2979, 2984, 2986, 2991, 2998, 3005, 3010, 3013, 3018, 3024, 3026, 3030, 3033, 3042, 3049, 3050, 3062, 3068, 3069, 3078, 3081, 3087, 3092, 3095, 3100, 3102, 3108, 3116, 3118, 3125, 3134, 3141, 3144, 3149, 3156, 3162, 3167, 3170, 3179, 3185, 3187, 3194, 3195, 3201, 3206, 3209, 3210, 3216, 3221, 3225, 3230, 3235, 3242, 3249, 3257, 3260, 3261, 3265, 3268, 3271, 3280, 3284, 3287, 3293, 3301, 3308, 3315, 3316, 3323, 3326, 3336, 3340, 3355, 3362, 3366, 3371, 3377, 3381, 3387, 3392, 3395, 3400, 3407, 3415, 3416, 3422, 3429, 3439, 3441, 3450, 3453, 3460, 3464, 3467, 3472, 3476, 3480, 3487, 3492, 3502, 3509, 3514, 3522, 3526, 3529, 3539, 3543, 3547, 3554, 3560, 3563, 3573, 3575, 3580, 3585, 3589, 3594, 3598, 3604, 3611, 3617, 3627, 3635, 3644, 3645, 3652, 3654, 3659, 3661, 3667, 3677, 3681, 3686, 3688, 3697, 3698, 3702, 3707, 3711, 3717, 3723, 3730, 3738, 3744, 3753, 3758, 3767, 3775, 3779, 3783, 3789, 3794, 3799, 3802, 3810, 3814, 3822, 3827, 3829, 3835, 3840, 3844, 3853, 3858, 3861, 3869, 3875, 3878, 3884, 3889, 3892, 3900, 3903, 3907, 3914, 3918, 3922, 3925, 3931, 3934, 3942, 3946, 3950, 3956, 3963, 3967, 3971, 3981, 3986, 3987, 3996, 4000, 4005, 4013, 4019, 4027, 4030, 4040, 4044, 4049, 4050, 4057, 4062, 4066, 4071, 4075, 4079, 4081, 4089, 4093, 4099, 4101, 4108, 4115, 4120, 4123, 4128, 4134, 4144, 4150, 4161, 4168, 4170, 4177, 4179, 4185, 4189, 4196, 4204, 4207, 4211, 4217, 4224, 4230, 4233, 4237, 4245, 4250, 4252, 4262, 4268, 4276, 4277, 4286, 4290, 4295, 4298, 4303, 4311, 4314, 4319, 4328, 4339, 4340, 4346, 4350, 4355, 4356, 4365, 4370, 4374, 4377, 4384, 4387, 4390, 4395, 4400, 4403, 4411, 4413, 4415, 4418, 4421, 4426, 4434, 4437, 4443, 4450, 4455, 4458, 4465, 4473, 4477, 4481, 4487, 4494, 4497, 4503, 4514, 4517, 4526, 4529, 4531, 4536, 4541, 4546, 4547, 4556, 4563, 4568, 4570, 4579, 4582, 4586, 4590, 4594, 4602, 4608, 4612, 4615, 4628, 4633, 4636, 4643, 4651, 4657, 4661, 4664, 4670, 4682, 4686, 4693, 4697, 4702, 4706, 4712, 4718, 4721, 4723, 4727, 4731, 4735, 4738, 4748, 4751, 4756, 4759, 4764, 4767, 4776, 4781, 4783, 4789, 4794, 4798, 4803, 4811, 4814, 4826, 4828, 4832, 4836, 4842, 4850, 4856, 4858, 4864, 4865, 4870, 4878, 4884, 4890, 4893, 4902, 4905, 4908, 4913, 4915, 4922, 4925, 4931, 4934, 4942, 4951, 4957, 4960, 4965, 4968, 4972, 4975, 4981, 4985, 4991, 4998, 5005, 5008, 5014, 5019, 5024, 5034, 5038, 5041, 5046, 5052, 5060, 5063, 5066, 5070, 5072, 5080, 5084, 5088, 5091, 5097, 5102, 5110, 5113, 5115, 5120, 5126, 5129, 5135, 5149, 5152, 5156, 5163, 5165, 5169, 5175, 5180, 5184, 5190, 5192, 5197, 5203, 5206, 5213, 5214, 5220, 5221, 5227, 5234, 5236, 5241, 5250, 5255, 5261, 5263, 5267, 5272, 5274, 5276, 5287, 5291, 5299, 5305, 5308, 5315, 5317, 5321, 5326, 5330, 5336, 5341, 5343, 5349, 5356, 5357, 5360, 5362, 5370, 5380, 5383, 5384, 5386, 5393, 5396, 5398, 5405, 5410, 5414, 5419, 5422, 5426, 5432, 5436, 5444, 5453, 5455, 5459, 5466, 5467, 5475, 5481, 5485, 5490, 5494, 5498, 5507, 5512, 5515, 5518, 5535, 5539, 5543, 5546, 5554, 5557, 5562, 5567, 5571, 5577, 5584, 5585, 5587, 5592, 5598, 5602, 5608, 5613, 5616, 5623, 5625, 5634, 5637, 5645, 5649, 5653, 5657, 5666, 5668, 5676, 5682, 5684, 5688, 5690, 5699, 5703, 5705, 5710, 5716, 5722, 5724, 5731, 5737, 5740, 5745, 5751, 5758, 5761, 5769, 5772, 5780, 5786, 5788, 5795, 5800, 5801, 5808, 5812, 5816, 5819, 5827, 5831, 5836, 5841, 5851, 5855, 5861, 5863, 5871, 5875, 5880, 5883, 5888, 5895, 5901, 5907, 5912, 5918, 5921, 5929, 5930, 5935, 5942, 5948, 5949, 5955, 5961, 5963, 5966, 5967, 5973, 5980, 5982, 5990, 5997, 6001, 6008, 6013, 6014, 6023, 6030, 6032, 6037, 6044, 6049, 6054, 6059, 6060, 6067, 6070, 6075, 6083, 6087, 6092, 6097, 6103, 6109, 6114, 6120, 6125, 6135, 6139, 6144
#> * 2005, 2010, 2013, 2014, 2017, 2023, 2025, 2032, 2034, 2035, 2044, 2052, 2057, 2062, 2064, 2071, 2079, 2085, 2092, 2096, 2100, 2104, 2109, 2117, 2124, 2131, 2135, 2140, 2142, 2145, 2154, 2160, 2171, 2172, 2178, 2182, 2185, 2194, 2199, 2205, 2208, 2211, 2214, 2223, 2224, 2230, 2234, 2237, 2245, 2250, 2256, 2263, 2271, 2281, 2290, 2293, 2298, 2304, 2314, 2318, 2323, 2328, 2337, 2342, 2354, 2359, 2370, 2373, 2384, 2388, 2390, 2396, 2403, 2411, 2418, 2426, 2429, 2436, 2446, 2455, 2461, 2466, 2476, 2480, 2486, 2490, 2496, 2502, 2514, 2522, 2529, 2531, 2537, 2541, 2549, 2558, 2560, 2566, 2571, 2579, 2584, 2589, 2591, 2594, 2600, 2604, 2610, 2619, 2624, 2628, 2637, 2640, 2644, 2649, 2655, 2664, 2670, 2674, 2679, 2682, 2689, 2693, 2698, 2710, 2717, 2722, 2731, 2736, 2741, 2748, 2754, 2762, 2766, 2774, 2776, 2785, 2789, 2797, 2800, 2807, 2809, 2812, 2818, 2823, 2831, 2833, 2841, 2849, 2853, 2857, 2865, 2868, 2874, 2877, 2883, 2889, 2895, 2903, 2909, 2910, 2919, 2921, 2931, 2938, 2947, 2950, 2955, 2961, 2964, 2983, 2987, 2992, 2995, 2999, 3007, 3009, 3015, 3023, 3032, 3037, 3038, 3044, 3046, 3053, 3063, 3067, 3070, 3074, 3079, 3091, 3101, 3105, 3111, 3114, 3117, 3123, 3126, 3132, 3139, 3142, 3150, 3157, 3164, 3166, 3173, 3176, 3180, 3181, 3188, 3191, 3199, 3202, 3203, 3212, 3218, 3223, 3228, 3234, 3248, 3251, 3267, 3270, 3281, 3283, 3288, 3294, 3300, 3304, 3309, 3314, 3318, 3321, 3328, 3333, 3338, 3344, 3349, 3353, 3358, 3360, 3368, 3374, 3378, 3383, 3388, 3393, 3396, 3403, 3405, 3412, 3419, 3421, 3423, 3427, 3433, 3435, 3436, 3444, 3447, 3455, 3456, 3461, 3470, 3475, 3482, 3485, 3488, 3493, 3499, 3501, 3504, 3508, 3516, 3520, 3523, 3533, 3535, 3538, 3545, 3549, 3556, 3562, 3565, 3570, 3577, 3581, 3583, 3586, 3595, 3597, 3603, 3612, 3616, 3619, 3623, 3629, 3631, 3636, 3647, 3651, 3656, 3670, 3676, 3687, 3691, 3696, 3699, 3706, 3714, 3721, 3725, 3729, 3734, 3736, 3743, 3746, 3750, 3755, 3759, 3761, 3765, 3772, 3777, 3778, 3787, 3791, 3797, 3805, 3806, 3816, 3820, 3824, 3828, 3834, 3839, 3847, 3851, 3857, 3866, 3872, 3880, 3890, 3891, 3898, 3904, 3910, 3916, 3920, 3927, 3936, 3945, 3952, 3960, 3961, 3969, 3980, 3985, 3991, 3994, 3997, 4007, 4009, 4014, 4022, 4026, 4033, 4036, 4039, 4043, 4055, 4063, 4067, 4072, 4082, 4087, 4092, 4103, 4109, 4112, 4119, 4129, 4138, 4142, 4151, 4152, 4157, 4162, 4165, 4169, 4176, 4183, 4186, 4192, 4200, 4210, 4214, 4219, 4226, 4227, 4235, 4238, 4242, 4249, 4253, 4258, 4263, 4269, 4274, 4280, 4285, 4291, 4296, 4297, 4305, 4308, 4315, 4320, 4326, 4332, 4335, 4344, 4351, 4360, 4364, 4369, 4373, 4378, 4383, 4388, 4401, 4404, 4410, 4412, 4417, 4424, 4427, 4431, 4435, 4442, 4449, 4451, 4459, 4461, 4472, 4478, 4482, 4486, 4495, 4496, 4505, 4508, 4512, 4515, 4516, 4522, 4525, 4534, 4540, 4542, 4550, 4554, 4561, 4567, 4575, 4581, 4588, 4595, 4603, 4607, 4616, 4620, 4625, 4630, 4634, 4637, 4645, 4647, 4654, 4659, 4665, 4668, 4676, 4685, 4690, 4701, 4705, 4711, 4719, 4722, 4726, 4736, 4742, 4747, 4753, 4761, 4768, 4772, 4782, 4786, 4790, 4795, 4804, 4805, 4810, 4816, 4822, 4824, 4831, 4837, 4844, 4857, 4862, 4876, 4880, 4885, 4891, 4895, 4899, 4907, 4919, 4923, 4929, 4935, 4943, 4949, 4956, 4963, 4969, 4974, 4983, 4984, 4993, 5006, 5011, 5017, 5021, 5030, 5044, 5048, 5053, 5059, 5065, 5067, 5076, 5081, 5089, 5092, 5099, 5104, 5107, 5118, 5123, 5131, 5133, 5139, 5144, 5148, 5154, 5160, 5166, 5170, 5173, 5181, 5186, 5198, 5202, 5207, 5216, 5224, 5229, 5233, 5238, 5242, 5249, 5254, 5257, 5266, 5278, 5282, 5286, 5288, 5294, 5298, 5309, 5313, 5319, 5323, 5327, 5331, 5334, 5338, 5346, 5348, 5353, 5364, 5371, 5381, 5385, 5387, 5399, 5402, 5407, 5415, 5418, 5423, 5429, 5431, 5438, 5442, 5450, 5460, 5465, 5470, 5476, 5479, 5484, 5488, 5500, 5502, 5506, 5513, 5519, 5522, 5529, 5533, 5534, 5544, 5545, 5551, 5555, 5565, 5566, 5573, 5578, 5588, 5593, 5599, 5601, 5609, 5611, 5622, 5626, 5633, 5641, 5646, 5651, 5652, 5660, 5662, 5669, 5674, 5680, 5694, 5696, 5700, 5708, 5711, 5719, 5727, 5733, 5735, 5743, 5746, 5759, 5760, 5766, 5773, 5777, 5784, 5789, 5793, 5799, 5806, 5810, 5818, 5821, 5828, 5829, 5834, 5839, 5848, 5853, 5859, 5866, 5868, 5876, 5877, 5884, 5891, 5896, 5897, 5904, 5905, 5914, 5917, 5923, 5928, 5933, 5938, 5941, 5947, 5952, 5956, 5971, 5974, 5983, 5991, 5994, 5998, 6003, 6011, 6015, 6021, 6026, 6027, 6035, 6038, 6043, 6047, 6052, 6058, 6063, 6068, 6074, 6079, 6081, 6088, 6093, 6094, 6099, 6107, 6110, 6115, 6121, 6126, 6128, 6133, 6141, 6147, 6151
#> * 2002, 2008, 2012, 2018, 2021, 2027, 2030, 2039, 2048, 2054, 2063, 2066, 2070, 2072, 2080, 2082, 2087, 2090, 2099, 2106, 2111, 2114, 2120, 2127, 2129, 2138, 2149, 2152, 2153, 2158, 2164, 2167, 2174, 2187, 2190, 2195, 2201, 2204, 2206, 2210, 2222, 2227, 2235, 2240, 2242, 2248, 2253, 2260, 2262, 2269, 2284, 2286, 2292, 2294, 2300, 2306, 2310, 2312, 2313, 2321, 2325, 2336, 2343, 2353, 2363, 2368, 2375, 2380, 2392, 2397, 2404, 2410, 2415, 2421, 2425, 2427, 2444, 2459, 2464, 2470, 2471, 2475, 2479, 2482, 2488, 2493, 2498, 2501, 2505, 2510, 2520, 2530, 2532, 2540, 2544, 2547, 2553, 2556, 2563, 2569, 2570, 2577, 2582, 2585, 2590, 2593, 2599, 2603, 2609, 2615, 2621, 2626, 2633, 2636, 2642, 2646, 2651, 2663, 2667, 2675, 2680, 2685, 2688, 2696, 2700, 2708, 2715, 2720, 2727, 2732, 2733, 2740, 2747, 2757, 2759, 2768, 2775, 2777, 2786, 2793, 2798, 2802, 2804, 2813, 2815, 2821, 2826, 2832, 2834, 2843, 2851, 2861, 2867, 2871, 2876, 2880, 2884, 2887, 2898, 2901, 2908, 2912, 2916, 2924, 2927, 2930, 2932, 2940, 2944, 2953, 2958, 2963, 2967, 2971, 2978, 2981, 2988, 2990, 3000, 3004, 3011, 3016, 3021, 3040, 3047, 3052, 3059, 3064, 3073, 3075, 3080, 3084, 3089, 3097, 3103, 3115, 3120, 3124, 3127, 3131, 3140, 3146, 3151, 3158, 3163, 3169, 3171, 3178, 3184, 3186, 3200, 3207, 3208, 3211, 3215, 3219, 3227, 3229, 3236, 3240, 3241, 3245, 3252, 3255, 3262, 3272, 3274, 3277, 3289, 3292, 3296, 3305, 3307, 3313, 3320, 3322, 3330, 3331, 3339, 3343, 3347, 3356, 3364, 3367, 3373, 3376, 3386, 3389, 3394, 3404, 3409, 3411, 3418, 3424, 3428, 3438, 3443, 3446, 3454, 3457, 3462, 3468, 3471, 3478, 3483, 3489, 3491, 3495, 3500, 3505, 3510, 3515, 3521, 3530, 3536, 3540, 3546, 3550, 3558, 3559, 3566, 3569, 3574, 3588, 3592, 3596, 3605, 3609, 3613, 3620, 3625, 3628, 3633, 3639, 3640, 3641, 3646, 3653, 3671, 3679, 3684, 3692, 3694, 3701, 3705, 3710, 3713, 3719, 3726, 3727, 3732, 3737, 3740, 3756, 3762, 3768, 3776, 3781, 3785, 3790, 3795, 3800, 3801, 3809, 3815, 3821, 3825, 3832, 3836, 3842, 3848, 3850, 3860, 3862, 3868, 3873, 3877, 3881, 3883, 3887, 3895, 3901, 3906, 3908, 3912, 3921, 3924, 3932, 3938, 3939, 3943, 3949, 3959, 3964, 3966, 3972, 3982, 3984, 3990, 3993, 3999, 4011, 4020, 4024, 4029, 4031, 4035, 4041, 4047, 4056, 4061, 4070, 4073, 4084, 4085, 4094, 4095, 4102, 4106, 4111, 4118, 4124, 4126, 4131, 4136, 4143, 4149, 4153, 4155, 4159, 4164, 4172, 4174, 4181, 4188, 4195, 4198, 4203, 4205, 4209, 4212, 4218, 4225, 4228, 4236, 4244, 4247, 4255, 4261, 4267, 4271, 4272, 4279, 4282, 4283, 4288, 4301, 4306, 4307, 4313, 4321, 4329, 4336, 4341, 4343, 4348, 4354, 4359, 4363, 4366, 4371, 4380, 4385, 4389, 4394, 4399, 4405, 4407, 4420, 4422, 4428, 4433, 4436, 4440, 4448, 4452, 4460, 4462, 4466, 4471, 4476, 4484, 4489, 4492, 4500, 4502, 4510, 4520, 4521, 4528, 4530, 4533, 4544, 4548, 4552, 4558, 4564, 4572, 4578, 4580, 4589, 4596, 4599, 4606, 4618, 4621, 4624, 4629, 4635, 4638, 4642, 4648, 4652, 4660, 4666, 4672, 4675, 4679, 4684, 4688, 4692, 4700, 4708, 4714, 4716, 4720, 4725, 4737, 4743, 4745, 4754, 4758, 4770, 4771, 4775, 4778, 4785, 4788, 4797, 4800, 4806, 4807, 4813, 4829, 4833, 4840, 4845, 4848, 4849, 4854, 4861, 4866, 4868, 4869, 4875, 4879, 4883, 4888, 4894, 4901, 4903, 4909, 4916, 4918, 4927, 4928, 4936, 4939, 4944, 4947, 4953, 4961, 4967, 4976, 4982, 4987, 4992, 5003, 5009, 5013, 5016, 5020, 5027, 5032, 5035, 5039, 5042, 5045, 5049, 5054, 5057, 5075, 5079, 5086, 5094, 5098, 5105, 5109, 5116, 5119, 5125, 5128, 5136, 5142, 5146, 5151, 5159, 5168, 5171, 5174, 5178, 5185, 5196, 5204, 5209, 5211, 5218, 5222, 5228, 5235, 5240, 5246, 5253, 5260, 5265, 5268, 5270, 5279, 5280, 5283, 5290, 5302, 5306, 5311, 5320, 5328, 5337, 5342, 5350, 5355, 5363, 5369, 5374, 5378, 5391, 5397, 5406, 5413, 5416, 5425, 5428, 5433, 5439, 5445, 5449, 5457, 5462, 5469, 5474, 5478, 5487, 5492, 5495, 5496, 5503, 5504, 5510, 5516, 5526, 5531, 5537, 5540, 5548, 5550, 5556, 5564, 5570, 5575, 5581, 5590, 5594, 5597, 5605, 5607, 5614, 5618, 5621, 5627, 5631, 5635, 5640, 5643, 5647, 5656, 5661, 5665, 5672, 5675, 5679, 5693, 5695, 5701, 5709, 5714, 5715, 5728, 5730, 5738, 5744, 5752, 5755, 5762, 5765, 5771, 5778, 5785, 5791, 5794, 5797, 5805, 5813, 5814, 5822, 5825, 5832, 5835, 5843, 5844, 5847, 5854, 5860, 5865, 5870, 5874, 5879, 5886, 5889, 5894, 5898, 5900, 5909, 5911, 5915, 5922, 5925, 5931, 5939, 5945, 5950, 5957, 5968, 5977, 5978, 5984, 5989, 5993, 5999, 6004, 6007, 6016, 6019, 6025, 6028, 6034, 6040, 6045, 6048, 6055, 6056, 6061, 6065, 6072, 6077, 6086, 6089, 6098, 6100, 6105, 6112, 6113, 6122, 6124, 6129, 6132, 6137, 6140, 6143, 6146
#> * 2004, 2009, 2011, 2016, 2022, 2028, 2029, 2036, 2041, 2051, 2055, 2061, 2067, 2075, 2077, 2083, 2093, 2097, 2102, 2107, 2115, 2119, 2128, 2133, 2136, 2143, 2148, 2150, 2156, 2170, 2176, 2177, 2186, 2193, 2196, 2202, 2209, 2216, 2219, 2226, 2229, 2231, 2239, 2246, 2252, 2257, 2266, 2270, 2274, 2278, 2280, 2288, 2291, 2297, 2301, 2307, 2317, 2326, 2333, 2339, 2345, 2356, 2360, 2369, 2376, 2381, 2387, 2393, 2398, 2401, 2413, 2414, 2423, 2430, 2437, 2440, 2449, 2453, 2456, 2463, 2467, 2473, 2484, 2485, 2494, 2495, 2500, 2508, 2513, 2516, 2519, 2525, 2527, 2535, 2536, 2545, 2548, 2552, 2557, 2564, 2568, 2574, 2578, 2583, 2587, 2597, 2602, 2607, 2611, 2617, 2625, 2634, 2641, 2648, 2656, 2659, 2661, 2669, 2676, 2681, 2684, 2694, 2699, 2711, 2721, 2725, 2730, 2735, 2739, 2746, 2753, 2758, 2763, 2770, 2772, 2778, 2784, 2787, 2791, 2796, 2799, 2806, 2810, 2816, 2822, 2827, 2830, 2835, 2840, 2848, 2855, 2860, 2863, 2870, 2872, 2881, 2885, 2891, 2897, 2904, 2907, 2911, 2917, 2922, 2926, 2935, 2942, 2946, 2951, 2954, 2960, 2966, 2975, 2985, 2994, 3002, 3003, 3012, 3014, 3020, 3028, 3034, 3035, 3048, 3054, 3057, 3061, 3065, 3071, 3076, 3082, 3085, 3090, 3094, 3098, 3104, 3109, 3112, 3119, 3128, 3133, 3137, 3143, 3152, 3155, 3161, 3168, 3174, 3175, 3182, 3189, 3192, 3197, 3205, 3214, 3220, 3224, 3232, 3237, 3238, 3243, 3246, 3253, 3254, 3259, 3263, 3264, 3278, 3285, 3291, 3298, 3303, 3310, 3312, 3319, 3324, 3329, 3334, 3335, 3342, 3350, 3352, 3359, 3363, 3369, 3370, 3375, 3382, 3385, 3391, 3398, 3402, 3406, 3414, 3420, 3425, 3431, 3440, 3442, 3449, 3451, 3459, 3463, 3466, 3473, 3477, 3490, 3497, 3511, 3517, 3525, 3527, 3531, 3541, 3551, 3557, 3564, 3571, 3578, 3582, 3587, 3593, 3599, 3607, 3610, 3614, 3618, 3622, 3626, 3632, 3638, 3643, 3649, 3655, 3660, 3668, 3678, 3683, 3689, 3693, 3703, 3708, 3715, 3720, 3724, 3733, 3735, 3741, 3751, 3757, 3766, 3774, 3780, 3788, 3793, 3796, 3804, 3807, 3817, 3819, 3823, 3831, 3837, 3841, 3845, 3852, 3859, 3863, 3867, 3871, 3879, 3885, 3886, 3893, 3899, 3905, 3909, 3915, 3919, 3928, 3930, 3937, 3941, 3944, 3951, 3957, 3965, 3970, 3979, 3989, 3992, 3998, 4002, 4004, 4008, 4012, 4017, 4023, 4028, 4032, 4037, 4046, 4054, 4065, 4069, 4074, 4083, 4088, 4090, 4104, 4110, 4114, 4121, 4122, 4127, 4132, 4137, 4146, 4147, 4160, 4166, 4171, 4175, 4182, 4187, 4194, 4199, 4202, 4206, 4215, 4220, 4223, 4229, 4232, 4239, 4241, 4248, 4254, 4264, 4265, 4273, 4278, 4287, 4292, 4294, 4300, 4304, 4309, 4316, 4317, 4322, 4327, 4330, 4337, 4352, 4358, 4362, 4367, 4375, 4376, 4382, 4391, 4396, 4398, 4406, 4409, 4414, 4419, 4429, 4430, 4439, 4441, 4444, 4446, 4454, 4456, 4464, 4474, 4479, 4480, 4485, 4490, 4493, 4499, 4501, 4506, 4507, 4513, 4518, 4524, 4532, 4537, 4539, 4545, 4551, 4553, 4557, 4559, 4562, 4569, 4573, 4577, 4584, 4592, 4597, 4601, 4605, 4610, 4614, 4627, 4631, 4640, 4646, 4650, 4655, 4658, 4667, 4671, 4673, 4677, 4681, 4689, 4691, 4696, 4699, 4709, 4713, 4715, 4724, 4729, 4740, 4749, 4752, 4755, 4760, 4765, 4766, 4774, 4779, 4787, 4792, 4796, 4801, 4808, 4812, 4825, 4834, 4839, 4843, 4855, 4860, 4871, 4877, 4886, 4889, 4897, 4898, 4906, 4911, 4912, 4921, 4924, 4932, 4938, 4941, 4946, 4952, 4964, 4970, 4978, 4979, 4986, 4989, 4995, 4997, 5004, 5007, 5015, 5022, 5028, 5036, 5040, 5050, 5055, 5056, 5068, 5071, 5073, 5078, 5087, 5093, 5096, 5101, 5108, 5122, 5124, 5132, 5137, 5141, 5147, 5150, 5157, 5164, 5176, 5182, 5187, 5188, 5191, 5199, 5201, 5210, 5215, 5225, 5232, 5239, 5243, 5247, 5252, 5258, 5262, 5271, 5275, 5285, 5296, 5300, 5303, 5307, 5312, 5325, 5333, 5340, 5344, 5347, 5352, 5365, 5373, 5379, 5388, 5392, 5395, 5401, 5403, 5409, 5411, 5417, 5424, 5427, 5434, 5437, 5441, 5447, 5451, 5458, 5464, 5468, 5472, 5482, 5486, 5489, 5499, 5509, 5520, 5528, 5532, 5536, 5541, 5549, 5552, 5558, 5563, 5568, 5572, 5579, 5582, 5591, 5596, 5600, 5604, 5610, 5615, 5617, 5620, 5628, 5632, 5638, 5642, 5650, 5654, 5658, 5663, 5671, 5673, 5681, 5683, 5691, 5697, 5702, 5706, 5712, 5717, 5725, 5729, 5732, 5736, 5742, 5749, 5750, 5756, 5763, 5767, 5774, 5776, 5787, 5792, 5803, 5807, 5811, 5815, 5823, 5826, 5830, 5837, 5840, 5846, 5850, 5856, 5858, 5862, 5869, 5872, 5881, 5885, 5890, 5892, 5903, 5906, 5910, 5916, 5924, 5926, 5934, 5936, 5940, 5944, 5953, 5954, 5958, 5964, 5970, 5975, 5979, 5986, 5988, 5995, 6009, 6017, 6022, 6031, 6033, 6039, 6046, 6051, 6064, 6069, 6073, 6076, 6082, 6085, 6091, 6095, 6101, 6106, 6111, 6117, 6118, 6123, 6136, 6142, 6148

Created on 2020-04-21 by the reprex package (v0.3.0)

b-tierney commented 4 years ago

To be really explicit the goal is to have:

1) the x axis correspond to the levels 2) the segments in each bar (strata?) correspond to the different id values (categories) but be colored by associated NCBITAXONID 3) the flows to be linked between the id values and also be colored by NCBITAXONID

corybrunson commented 4 years ago

I'm having a look at this data set, and the aesthetic specifications you want don't seem to be appropriate. Data in lodes form, with columns for axis, stratum, and alluvium, should have at most one stratum value for each axis–alluvium pair; but the data contains many sets of rows with the same values of level and NCBITAXONID. Even once these are resolved, other issues arise that i'm not sure how best to resolve.

Could you describe what the data represent? (For example, one prototypical data set for an alluvial plot is a panel survey with categorical response variables: each axis represents a round of data collection, each alluvium represents a respondent, and each stratum represents a response.)

b-tierney commented 4 years ago

Sure, thanks again for the help.

These data represent the total presence of different biological pathways across many observations of 6 different bacteria (6 taxon IDs). The, admittedly confusingly named, "id" column refers to the specific pathway. The data, however, are hierarchical -- there are 4 levels (represented by the "level" column), which I was hoping to place along the x axis in vertical bars. IDs with 3 periods are the "highest resolution," (eg all oxidoreductases) whereas those that are single integers are the lowest resolution (eg a very specific oxidoreductase). This is the specific ontology: https://en.wikipedia.org/wiki/Enzyme_Commission_number.

The goal is to be able to visualize variable pathway richness across these 6 organisms, with each bar mapping to a different level in the hierarchy and each section of the bar corresponding to the counts for a given pathway ID. The colors and flows would, ideally, communicate the difference in pathway enrichment at different levels across organisms.

It sounds like alluvial plots probably won't work for this -- visualization of hierarchical enrichment data is to date an unsolved problem in my field, so I'm trying everything I possibly can.

corybrunson commented 4 years ago

I think i understand what you want, but i think the error is in the conversion from the original data set to this new data set. Here's an idea, beginning with your original data set:

library(tidyverse)
library(ggplot2)
library(ggalluvial)
# read in original data
demo_data <- read.csv("~/demo_alluv_data.txt",
                      row.names = 1, stringsAsFactors = FALSE)
# convert to lodes format
lodes_data <- to_lodes_form(demo_data, axes = 2:3,
                           key = "level", value = "pathway", id = "entry")
# alluvial plot with missing entries
ggplot(lodes_data,
       aes(x = level, stratum = pathway, alluvium = entry, y = log(FREQ),
           fill = as.factor(ID))) +
  geom_stratum(alpha = 0) +
  geom_alluvium(aes.bind = "alluvia") +
  geom_label(stat = "stratum", aes(label = pathway))
#> Warning: Removed 1 rows containing missing values (geom_label).

# alluvial plot without missing entries
ggplot(drop_na(lodes_data),
       aes(x = level, stratum = pathway, alluvium = entry, y = log(FREQ),
           fill = as.factor(ID))) +
  geom_stratum(alpha = 0) +
  geom_alluvium(aes.bind = "alluvia") +
  geom_label(stat = "stratum", aes(label = pathway))

Created on 2020-04-21 by the reprex package (v0.3.0)

In the top plot, the level-1 pathways are linked to a blank stratum at the second axis. To prevent this, rows with missing values are removed, so the alluvia for these pathways stop at the first axis, resulting in a shorter second axis.

Is this more like what you're after?

b-tierney commented 4 years ago

Wow. Yep that's exactly it, I will finally close this and leave you alone.

Can't thank you enough, I don't think I've ever met such a responsive developer.

corybrunson commented 4 years ago

Excellent! Especially as a relatively new user, if you have any suggestions for the documentation, do let me know. Take care.