AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • Início
  • system&network
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • Início
  • system&network
    • Recentes
    • Highest score
    • tags
  • Ubuntu
    • Recentes
    • Highest score
    • tags
  • Unix
    • Recentes
    • tags
  • DBA
    • Recentes
    • tags
  • Computer
    • Recentes
    • tags
  • Coding
    • Recentes
    • tags
Início / user-17040989

Matteo's questions

Martin Hope
Matteo
Asked: 2025-04-14 16:30:41 +0800 CST

produzir gráficos de barras agradáveis ​​com python no PyCharm

  • 6

Estou trabalhando em um gráfico de barras muito básico, no Pythonqual preciso traçar uma série de ocorrências de comprimento mostrando quantas vezes uma determinada ocorrência aparece.

Estou armazenando tudo em uma matriz, mas quando tento plotar, ou coloco a escala y errada, ou coloco no eixo x todas as instâncias quando, na verdade, elas deveriam ser "adicionadas" umas sobre as outras para formar a contagem total.

Abaixo, o código que testei e uma saída ideal que desejo alcançar, que plotei com R:

print(l)

[408, 321, 522, 942, 462, 564, 765, 747, 465, 957, 993, 1056, 690, 1554, 1209, 246, 462, 3705, 1554, 507, 681, 1173, 408, 330, 1317, 240, 576, 2301, 1911, 1677, 1014, 756, 918, 864, 528, 882, 1131, 1440, 1167, 1146, 1002, 906, 1056, 1881, 396, 1278, 501, 1110, 303, 1176, 699, 747, 1971, 3318, 1875, 450, 354, 1218, 378, 303, 777, 915, 5481, 576, 1920, 2022, 1662, 519, 936, 423, 1149, 600, 1896, 648, 2238, 1419, 423, 552, 1299, 1071, 963, 471, 408, 729, 1896, 1068, 1254, 1179, 1188, 645, 978, 903, 1191, 1119, 747, 1005, 273, 1191, 519, 930, 1053, 2157, 933, 888, 591, 1287, 457, 294, 291, 669, 270, 556, 444, 483, 438, 452, 659, 372, 480, 464, 477, 256, 350, 357, 524, 477, 218, 192, 216, 587, 473, 525, 657, 241, 719, 383, 459, 855, 417, 283, 408, 678, 681, 1254, 879, 250, 857, 706, 456, 567, 190, 887, 287, 240, 960, 587, 361, 816, 297, 290, 253, 335, 609, 507, 294, 1475, 464, 780, 552, 555, 1605, 1127, 382, 579, 645, 273, 241, 552, 344, 890, 1346, 1067, 764, 431, 796, 569, 1386, 413, 401, 407, 252, 375, 378, 339, 457, 1779, 243, 701, 552, 708, 174, 300, 257, 378, 777, 729, 969, 603, 378, 436, 348, 399, 1662, 1511, 799, 715, 1400, 399, 516, 399, 355, 1291, 1286, 657, 374, 492, 334, 295, 210, 270, 858, 1487, 1020, 1641, 417, 396, 303, 553, 492, 1097, 612, 441, 654, 611, 532, 474, 864, 377, 465, 435, 1003, 608, 486, 748, 351, 245, 545, 627, 303, 457, 419, 449, 843, 312, 398, 704, 315, 330, 1054, 259, 507, 372, 468, 345, 1303, 408, 1031, 471, 653, 925, 397, 231, 684, 449, 336, 344, 619, 917, 417, 516, 359, 550, 222, 789, 608, 659, 853, 360, 657, 372, 305, 353, 650, 564, 547, 969, 505, 230, 953, 769, 307, 516, 408, 342, 267, 570, 572, 348, 1005, 981, 1586, 1302, 369, 1290, 1458, 572, 1122, 363, 879, 651, 466, 1203, 485, 440, 473, 810, 1320, 461, 455, 258, 660, 297, 285, 424, 273, 378, 432, 293, 410, 327, 483, 477, 551, 894, 638, 538, 678, 303, 478, 1046, 995, 360, 252, 480, 490, 475, 394, 1185, 357, 361, 387, 489, 450, 788, 366, 340, 829, 469, 404, 593, 498, 840, 601, 235, 452, 395, 504, 299, 662, 357, 686, 683, 248, 574, 1108, 587, 483, 1481, 1297, 1334, 579, 182, 456, 1335, 513, 967, 918, 607, 564, 727, 913, 743, 312, 480, 659, 939, 705, 1001, 553, 339, 286, 452, 744, 519, 521, 491, 565, 522, 377, 861, 812, 523, 332, 800, 1015, 1000, 513, 990, 1003, 733, 542, 940, 399, 399, 612, 1361, 399, 399, 318, 319, 510, 504, 841, 1529, 506, 1881, 500, 358, 240, 1261, 354, 519, 779, 656, 311, 635, 527, 759, 333, 648, 770, 330, 584, 453, 632, 513, 998, 343, 696, 1286, 391, 374, 893, 375, 426, 658, 455, 518, 466, 417, 614, 285, 480, 845, 344, 534, 572, 1727, 1085, 480, 468, 192, 348, 578, 2433, 390, 1031, 1129, 626, 735, 963, 439, 272, 806, 743, 560, 250, 679, 459, 207, 905, 616, 404, 489, 582, 340, 435, 1632, 417, 221, 279, 462, 357, 288, 248, 981, 1015, 935, 678, 279, 348, 470, 958, 867, 352, 735, 293, 911, 460, 767, 386, 531, 411, 192, 742, 373, 1454, 970, 285, 468, 273, 1527, 612, 983, 552, 998, 553, 812, 983, 403, 1706, 781, 183, 405, 891, 647, 1022, 946, 476, 270, 471, 888, 435, 354, 563, 526, 877, 1170, 351, 863, 1503, 562, 1174, 345, 385, 275, 374, 171, 474, 408, 1640, 345, 462, 722, 1645, 504, 840, 459, 783, 501, 473, 609, 684, 543, 353, 788, 684, 734, 242, 751, 478, 471, 365, 293, 380, 486, 617, 786, 436, 632, 624, 386, 925, 469, 405, 2406, 462, 435, 251, 1118, 349, 779, 343, 458, 264, 243, 935, 535, 576, 480, 406, 606, 495, 396, 456, 798, 404, 285, 375, 922, 1136, 330, 339, 559, 998, 239, 587, 468, 1237, 1722, 699, 436, 377, 306, 326, 1076, 385, 537, 315, 342, 386, 400, 340, 202, 266, 455, 435, 259, 317, 456, 249, 452, 1345, 699, 456, 456, 453, 275, 315, 693, 354, 475, 780, 415, 956, 554, 258, 418, 996, 552, 511, 1404, 469, 262, 398, 242, 350, 538, 379, 300, 460, 373, 276, 258, 740, 609, 753, 357, 495, 532, 551, 234, 633, 480, 312, 898, 350, 705, 265, 345, 334, 334, 582, 583, 582, 478, 465, 480, 408, 870, 624, 1107, 303, 384, 1165, 1456, 878, 297, 301, 276, 372, 551, 799, 496, 204, 552, 791, 330, 359, 480, 468, 414, 1102, 876, 1112, 850, 536, 500, 374, 825, 476, 499, 275, 345, 616, 360, 609, 310, 260, 376, 283, 390, 1529, 1310, 207, 1039, 661, 570, 1292, 914, 843, 658, 302, 1119, 609, 225, 317, 1091, 225, 403, 544, 495, 912, 744, 473, 985, 342, 630, 298, 392, 297, 933, 888, 666, 1023, 346, 310, 1134, 840, 1277, 387, 463, 435, 610, 492, 1107, 582, 582, 582, 1307, 647, 1280, 555, 645, 267, 952, 588, 348, 287, 507, 410, 737, 731, 354, 2192, 309, 388, 692, 389, 742, 766, 1228, 1640, 237, 495, 351, 285, 2443, 963, 296, 420, 482, 246, 553, 621, 405, 597, 459, 310, 300, 450, 471, 291, 610, 723, 380, 1439, 312, 900, 275, 396, 342, 309, 549, 355, 474, 417, 372, 384, 291, 987, 629, 407, 655, 357, 473, 348, 459, 599, 474, 430, 620, 584, 546, 435, 242, 1167, 627, 378, 945, 349, 255, 216, 530, 516, 606, 449, 1490, 401, 1070, 899, 452, 1304, 451, 723, 354, 229, 629, 639, 501, 465, 344, 1895, 288, 341, 2377, 542, 453, 291, 645, 494, 471, 612, 1294, 713, 1291, 467, 734, 300, 1432, 320, 753, 609, 1051, 231, 875, 704, 438, 742, 504, 1334, 738, 342, 435, 1133, 1229, 436, 310, 494, 273, 1228, 626, 470, 235, 1264, 465, 450, 350, 647, 541, 256, 231, 435, 485, 224, 555, 395, 300, 969, 237, 1717, 416, 538, 371, 326, 360, 1194, 397, 519, 645, 324, 465, 402, 477, 527, 831, 1179, 366, 889, 941, 374, 775, 581, 392, 1188, 797, 480, 418, 733, 857, 332, 255, 2847, 917, 478, 585, 591, 480, 1293, 273, 375, 489, 727, 316, 1451, 975, 762, 528, 408, 1104, 375, 265, 609, 317, 879, 542, 332, 462, 492, 284, 282, 394, 483, 493, 778, 291, 443, 350, 491, 374, 369, 862, 245, 269, 640, 282, 606, 393, 307, 488, 276, 611, 471, 1806, 1296, 336, 244, 1105, 444, 375, 1214, 294, 455, 353, 605, 669, 354, 692, 345, 643, 289, 460, 771, 351, 1635, 331, 465, 703, 352, 396, 269, 1142, 353, 552, 2790, 611, 606, 731, 447, 485, 420, 283, 744, 1265, 381, 1146, 589, 477, 309, 669, 389, 435, 558, 445, 1448, 333, 762, 1222, 779, 519, 465, 317, 375, 480, 371, 787, 305, 1276, 408, 304, 246, 791, 341, 330, 536, 278, 383, 417, 351, 323, 1068, 507, 741, 678, 613, 823, 1748, 411, 676, 287, 486, 433, 506, 194, 444, 860, 1212, 1005, 321, 462, 1158, 223, 625, 294, 294, 1598, 205, 764, 2649, 1226, 479, 543, 321, 1143, 648, 2409, 291, 1095, 651, 405, 294, 728, 267, 805, 294, 1010, 405, 368, 442, 363, 3117, 296, 466, 1621, 509, 219, 692, 453, 749, 828, 950, 683, 574, 438, 396, 461, 740, 350, 408, 1636, 746, 821, 912, 482, 532, 397, 582, 537, 761, 348, 354, 356, 978, 348, 441, 464, 1206, 576, 355, 446, 577, 1186, 396, 980, 213, 498, 597, 335, 419, 351, 617, 226, 609, 206, 762, 596, 999, 589, 585, 477, 558, 206, 806, 405, 356, 742, 881, 426, 434, 735, 494, 611, 308, 453, 426, 664, 384, 335, 612, 286, 463, 363, 460, 327, 1007, 1285, 1021, 464, 662, 1266, 1275, 205, 581, 351, 409, 387, 406, 296, 353, 447, 472, 667, 572, 682, 460, 941, 382, 477, 819, 340, 477, 716, 461, 302, 348, 291, 459, 567, 625, 216, 713, 394, 462, 620, 486, 1049, 1027, 761, 534, 348, 346, 313, 551, 522, 612, 303, 186, 288, 1054, 481, 1263, 530, 603, 491, 297, 1989, 598, 545, 291, 568, 201, 538, 267, 894, 2037, 456, 291, 367, 338, 782, 435, 570, 245, 371, 341, 478, 511, 348, 1019, 1315, 1007, 469, 711, 848, 1810, 807, 455, 607, 435, 270, 489, 408, 574, 444, 438, 495, 474, 675, 1024, 610, 464, 477, 549, 305, 366, 306, 222, 158, 893, 312, 348, 259, 261, 336, 495, 560, 452, 273, 357, 455, 195, 506, 1403, 345, 347, 462, 957, 224, 798, 487, 372, 798, 420, 316, 400, 399, 878, 618, 371, 369, 336, 474, 350, 1081, 1012, 649, 480, 430, 570, 341, 759, 456, 237, 466, 531, 455, 846, 280, 767, 758, 624, 724, 582, 1924, 270, 570, 1800, 530, 826, 1478, 345, 624, 498, 231, 686, 592, 1671, 413, 582, 302, 504, 666, 727, 613, 857, 270, 446, 483, 1781, 1308, 358, 1393, 453, 672, 264, 412, 281, 378, 476, 562, 792, 342, 495, 342, 392, 269, 1495, 668, 490, 272, 266, 270, 1080, 401, 405, 395, 588, 306, 604, 482, 301, 1439, 1605, 1833, 441, 1287, 1093, 1564, 1093, 624, 1925, 1287, 894, 428, 547, 1924, 1455, 938, 1369, 1794, 404, 605, 570, 447, 1171, 268, 626, 318, 406, 1471, 1069, 792, 657, 482, 420, 1121, 844, 522, 1560, 734, 1318, 723, 1335, 830, 825, 287, 440, 895, 323, 782, 479, 1397, 860, 297, 1002, 570, 603, 576, 269, 466, 758, 509, 552, 462, 493, 477, 431, 351, 757, 438, 1765, 1486, 480, 907, 620, 600, 438, 576, 576, 801, 515, 862, 337, 532, 385, 953, 719, 1223, 468, 486, 445, 231, 610, 474, 311, 738, 868, 453, 558, 409, 305, 827, 308, 614, 519, 380, 763, 472, 313, 447, 960, 741, 444, 520, 543, 531, 450, 413, 305, 492, 868, 207, 1285, 492, 802, 435, 303, 723, 705, 308, 417, 353, 347, 737, 380, 477, 343, 345, 409, 408, 276, 193, 270, 845, 792, 443, 1111, 256, 800, 549, 315, 274, 426, 470, 359, 473, 271, 576, 1293, 342, 761, 577, 671, 340, 276, 394, 467, 387, 336, 920, 350, 1400, 195, 336, 1282, 282, 773, 757, 566, 396, 880, 494, 661, 953, 480, 314, 468, 468, 339, 550, 1075, 334, 318, 365, 567, 286, 1560, 207, 1344, 584, 333, 387, 1164, 1074, 1324, 1080, 405, 264, 300, 582, 342, 427, 514, 576, 993, 208, 669, 993, 439, 219, 742, 890, 966, 520, 337, 488, 438, 561, 319, 476, 300, 465, 1056, 1044, 216, 198, 267, 327, 527, 746, 447, 288, 923, 268, 300, 262, 1015, 468, 289, 341, 345, 483, 482, 548, 255, 441, 229, 435, 453, 264, 369, 403, 333, 461, 446, 221, 405, 848, 616, 396, 405, 495, 476, 315, 351, 438, 495, 482, 456, 322, 666, 1031, 633, 306, 880, 2683, 774, 494, 993, 430, 1284, 1118, 1030, 219, 384, 2249, 301, 195, 689, 251, 302, 474, 732, 790, 435, 436, 270, 198, 435, 583, 800, 310, 576, 280, 363, 651, 743, 855, 485, 673, 1014, 345, 407, 351, 3668, 355, 396, 415, 361, 229, 269, 1094, 435, 327, 587, 299, 362, 375, 414, 440, 637, 732, 845, 432, 360, 572, 198, 934, 1480, 948, 976, 899, 372, 459, 997, 165, 734, 455, 479, 480, 514, 504, 446, 504, 1620, 552, 1118, 485, 509, 892, 1025, 546, 777, 455, 445, 985, 474, 864, 302, 712, 283, 307, 432, 1075, 478, 732, 685, 375, 507, 1209, 1097, 2480, 477, 343, 432, 496, 465, 457, 768, 561, 660, 915, 661, 255, 217, 960, 265, 526, 672, 798, 357, 1692, 622, 465, 612, 228, 1086, 444, 261, 345, 238, 706, 240, 444, 288, 632, 528, 318, 401, 378, 192, 461, 528, 393, 486, 409, 831, 1019, 745, 222, 216, 465, 839, 1399, 523, 461, 457, 388, 438, 1062, 351, 553, 814, 345, 494, 643, 307, 306, 252, 569, 534, 557, 372, 374, 344, 696, 351, 582, 903, 375, 432, 303, 743, 617, 459, 492, 495, 999, 284, 538, 291, 748, 742, 739, 449, 212, 261, 579, 1311, 1178, 330, 458, 276, 563, 467, 565, 578, 227, 178, 959, 642, 475, 1242, 325, 365, 360, 314, 523, 201, 569, 571, 351, 319, 298, 468, 1154, 351, 599, 574, 947, 480, 415, 770, 459, 263, 285, 281, 465, 1429, 498, 199, 345, 639, 261, 489, 314, 291, 692, 318, 351, 399, 275, 540, 542, 914, 492, 872, 231, 1324, 373, 270, 302, 479, 285, 381, 270, 410, 1366, 242, 698, 1044, 513, 1004, 951, 702, 796, 291, 282, 444, 734, 1669, 500, 350, 319, 1092, 239, 434, 266, 297, 323, 407, 252, 879, 893, 267, 222, 326, 311, 288, 680, 568, 477, 877, 408, 968, 888, 1497, 1312, 336, 279, 459, 876, 294, 324, 324, 801, 383, 225, 449, 609, 384, 738, 951, 312, 550, 810, 765, 377, 297, 179, 213, 320, 489, 797, 1637, 558, 616, 1907, 517, 556, 773, 669, 426, 432, 956, 336, 757, 353, 420, 462, 797, 475, 1124, 356, 579, 212, 472, 361, 408, 390, 470, 527, 637, 422, 474, 622, 533, 728, 985, 537, 606, 340, 754, 479, 851, 960, 453, 607, 518, 639, 495, 341, 411, 441, 609, 792, 287, 498, 458, 260, 195, 411, 1646, 375, 665, 243, 356, 426, 207, 362, 452, 339, 666, 852, 476, 312, 375, 284, 437, 673, 507, 332, 380, 747, 734, 431, 268, 243, 315, 221, 767, 894, 225, 362, 358, 919, 294, 396, 449, 179, 549, 435, 528, 479, 300, 436, 380, 523, 550, 255, 1043, 645, 402, 203, 479, 679, 478, 654, 769, 471, 418, 617, 342, 674, 993, 321, 615, 150, 204, 1033, 606, 759, 604, 828, 307, 273, 558, 234, 408, 548, 1238, 914, 978, 930, 269, 287, 390, 474, 248, 234, 714, 603, 471, 236, 383, 732, 356, 269, 461, 358, 197, 506, 465, 274, 618, 1309, 1638, 1154, 2222, 930, 1395, 1387, 765, 899, 291, 354, 872, 355, 273, 664, 426, 360, 683, 627, 609, 1230, 861, 6609, 549, 444, 240, 461, 234, 495, 571, 957, 342, 212, 1519, 396, 358, 1272, 1492, 615, 414, 472, 332, 335, 1060, 721, 477, 556, 654, 699, 654, 393, 921, 1651, 504, 710, 1083, 755, 246, 476, 270, 330, 618, 805, 571, 495, 391, 498, 1390, 444, 207, 615, 349, 548, 467, 301, 216, 473, 724, 744, 504, 673, 525, 670, 669, 1221, 288, 884, 462, 565, 434, 522, 455, 639, 1221, 301, 1223, 1029, 991, 491, 465, 434, 472, 392, 821, 719, 543, 246, 818, 913, 402, 535, 492, 492, 491, 534, 968, 886, 316, 541, 494, 409, 246, 435, 442, 989, 473, 790, 624, 398, 469, 273, 735, 328, 601, 627, 356, 344, 410, 1261, 495, 506, 518, 388, 624, 687, 237, 972, 476, 527, 1518, 479, 633, 675, 374, 573, 444, 357, 239, 581, 799, 308, 522, 758, 272, 171, 276, 879, 275, 455, 648, 252, 474, 303, 510, 348, 590, 1086, 504, 928, 530, 495, 1587, 239, 608, 326, 585, 373, 496, 482, 1158, 885, 333, 459, 370, 455, 893, 307, 468, 290, 604, 1198, 306, 1110, 922, 705, 418, 1441, 613, 401, 546, 354, 465, 1205, 328, 703, 570, 428, 232, 1292, 415, 1007, 1285, 1019, 968, 245, 606, 1284, 798, 1588, 1547, 606, 326, 506, 228, 1071, 429, 485, 1508, 625, 294, 330, 405, 343, 192, 452, 359, 222, 1282, 521, 461, 403, 735, 297, 1288, 606, 382, 339, 650, 918, 309, 724, 479, 439, 289, 364, 1683, 226, 1139, 372, 495, 741, 923, 464, 629, 266, 1186, 891, 429, 271, 224, 723, 408, 687, 763, 421, 398, 599, 918, 272, 610, 932, 247, 306, 1224, 594, 531, 349, 332, 405, 486, 406, 752, 441, 386, 368, 663, 350, 480, 1067, 368, 816, 468, 615, 976, 339, 332, 903, 357, 961, 970, 657, 942, 662, 400, 304, 858, 332, 238, 231, 327, 475, 1499, 432, 585, 392, 412, 594, 263, 381, 432, 1320, 269, 439, 465, 321, 718, 1059, 408, 1308, 392, 856, 1255, 536, 339, 2192, 455, 1390, 715, 522, 980, 432, 320, 2766, 531, 697, 378, 717, 246, 590, 731, 976, 733, 177, 345, 588, 348, 1187, 318, 724, 705, 1146, 284, 610, 354, 298, 331, 693, 1210, 1470, 540, 612, 419, 1039, 574, 739, 1213, 1332, 296, 292, 493, 1046, 567, 662, 708, 233, 1123, 933, 624, 159, 492, 210, 473, 1153, 1489, 974, 669, 1281, 737, 729, 545, 532, 357, 565, 844, 939, 468, 878, 772, 773, 355, 469, 2315, 171, 654, 1063, 432, 1938, 270, 866, 716, 1022, 323, 330, 226, 285, 300, 896, 300, 659, 246, 1493, 231, 906, 294, 465, 533, 525, 363, 524, 891, 788, 270, 240, 723, 734, 2027, 474, 1327, 547, 589, 240, 465, 339, 614, 492, 486, 398, 639, 345, 974, 156, 664, 1544, 1367, 776, 610, 465, 519, 478, 1524, 640, 1431, 1288, 419, 189, 275, 651, 852, 939, 672, 316, 489, 456, 360, 921, 939, 446, 366, 384, 366, 266, 332, 492, 1479, 825, 460, 351, 549, 475, 740, 313, 357, 556, 618, 1039, 411, 234, 378, 567, 269, 990, 270, 573, 629, 996, 1107, 393, 480, 624, 583, 485, 1770, 323, 374, 484, 1128, 609, 379, 1426, 551, 1182, 680, 607, 472, 467, 1312, 468, 342, 473, 1279, 832, 408, 802, 764, 290, 668, 440, 1085, 492, 1523, 189, 329, 1334, 403, 285, 427, 653, 346, 1385, 197, 1281, 465, 468, 414, 981, 473, 879, 552, 246, 522, 610, 609, 255, 915, 2142, 624, 236, 892, 480, 944, 847, 674, 739, 275, 1139, 291, 815, 357, 387, 613, 160, 341, 630, 794, 3061, 552, 167, 447, 300, 471, 1182, 867, 424, 1104, 417, 648, 708, 700, 405, 399, 231, 246, 1588, 766, 1127, 611, 892, 604, 995, 657, 2170, 336, 492, 273, 874, 303, 487, 500, 967, 1380, 345, 300, 1863, 408, 446, 1269, 351, 1448, 570, 336, 487, 270, 270, 804, 833, 1384, 1235, 404, 285, 1499, 708, 834, 584, 309, 492, 528, 762, 624, 380, 323, 916, 403, 384, 409, 530, 241, 724, 1950, 645, 301, 386, 704, 708, 1389, 588, 693, 484, 469, 299, 467, 1119, 696, 610, 824, 231, 531, 321, 663, 177, 635, 573, 268, 711, 892, 513, 707, 872, 619, 576, 476, 506, 285, 594, 495, 564, 399, 387, 638, 536, 594, 772, 955, 672, 312, 305, 627, 774, 575, 1178, 1647, 390, 879, 563, 931, 464, 440, 515, 201, 499, 703, 738, 1372, 794, 712, 503, 1034, 618, 753, 225, 736, 688, 395, 345, 531, 695, 467, 1009, 789, 1659, 532, 913, 261, 359, 611, 660, 480, 555, 551, 849, 743, 1224, 841, 442, 408, 372, 625, 437, 825, 297, 375, 647, 304, 992, 722, 451, 684, 155, 780, 543, 340, 477, 1659, 2790, 480, 445, 457, 968, 360, 306, 676, 498, 603, 318, 724, 600, 265, 718, 381, 343, 776, 600, 600, 600, 600, 600, 600, 600, 597, 600, 597, 584, 255, 1539, 672, 1726, 179, 589, 326, 629, 626, 789, 440, 954, 537, 262, 3015, 405, 374, 381, 743, 272, 479, 640, 293, 359, 412, 959, 550, 1088, 492, 615, 279, 480, 864, 369, 491, 467, 343, 537, 723, 254, 567, 1049, 1313, 591, 311, 477, 1617, 744, 251, 299, 159, 461, 464, 1042, 668, 301, 771, 533, 280, 713, 544, 608, 493, 644, 344, 456, 560, 1110, 307, 290, 1069, 606, 717, 1167, 653, 356, 495, 1012, 432, 297, 1618, 405, 449, 405, 573, 565, 962, 364, 369, 910, 223, 245, 398, 495, 577, 616, 468, 620, 316, 230, 633, 334, 808, 543, 744, 935, 1004, 863, 615, 592, 429, 333, 204, 484, 287, 642, 930, 866, 997, 299, 290, 520, 342, 959, 588, 851, 629, 522, 537, 569, 336, 391, 462, 824, 474, 959, 760, 353, 348, 462, 1420, 1386, 1275, 548, 408, 600, 600, 600, 600, 402, 242, 1391, 1215, 573, 470, 1168, 476, 1712, 376, 868, 495, 379, 300, 1359, 1053, 662, 465, 526, 427, 543, 667, 322, 778, 1327, 435, 360, 507, 1079, 1201, 477, 403, 261, 673, 499, 580, 446, 908, 1490, 552, 269, 576, 616, 933, 961, 384, 236, 479, 255, 495, 483, 602, 354, 435, 650, 826, 455, 704, 246, 636, 1267, 1201, 282, 567, 432, 2289, 666, 549, 162, 510, 748, 297, 372, 270, 699, 227, 412, 344, 470, 491, 1370, 403, 456, 246, 317, 335, 1379, 952, 456, 416, 519, 312, 656, 338, 863, 688, 340, 854, 666, 697, 742, 967, 587, 192, 462, 490, 337, 890, 1539, 244, 229, 536, 280, 264, 414, 438, 1311, 300, 884, 695, 1509, 798, 612, 611, 414, 533, 678, 426, 274, 466, 883, 864, 603, 873, 1398, 477, 495, 528, 767, 613, 304, 1419, 832, 488, 489, 1290, 648, 266, 1200, 957, 407, 507, 703, 715, 495, 305, 389, 949, 492, 1155, 693, 333, 464, 331, 769, 660, 1115, 403, 483, 899, 279, 371, 354, 361, 444, 552, 286, 248, 265, 662, 393, 2433, 766, 752, 326, 692, 1185, 1170, 678, 728, 432, 656, 1190, 510, 878, 366, 434, 297, 680, 735, 533, 935, 774, 692, 1162, 687, 540, 1417, 464, 339, 779, 471, 566, 281, 384, 271, 760, 698, 357, 513, 888, 475, 515, 216, 864, 303, 630, 425, 299, 562, 522, 1155, 457, 489, 812, 719, 405, 1313, 735, 255, 275, 384, 274, 1007, 289, 457, 1239, 368, 1148, 581, 351, 488, 712, 1097, 639, 478, 481, 630, 479, 493, 740, 1239, 366, 380, 1234, 358, 483, 824, 593, 994, 318, 465, 797, 715, 766, 333, 615, 693, 495, 366, 366, 420, 400, 381, 879, 431, 404, 645, 405, 451, 360, 263, 522, 315, 294, 610, 382, 1304, 417, 655, 824, 829, 463, 798, 453, 495, 264, 1122, 1476, 469, 285, 1098, 838, 430, 293, 418, 225, 260, 1004, 346, 552, 1383, 708, 1218, 348, 738, 358, 342, 303, 993, 597, 1048, 571, 448, 752, 581, 475, 803, 1209, 863, 385, 737, 435, 651, 982, 1286, 1175, 1172, 329, 582, 485, 1280, 338, 520, 308, 407, 330, 392, 420, 1595, 951, 454, 348, 482, 305, 1004, 498, 243, 768, 470, 1773, 770, 266, 543, 456, 622, 516, 773, 661, 368, 395, 364, 444, 506, 606, 1077, 429, 557, 478, 311, 1318, 2398, 724, 402, 435, 345, 511, 1004, 1119, 293, 365, 715, 360, 191, 955, 480, 954, 347, 421, 495, 416, 432, 457, 583, 484, 894, 918, 705, 471, 378, 499, 889, 1277, 624, 307, 1274, 405, 299, 430, 1449, 879, 374, 1078, 1326, 860, 586, 192, 1356, 815, 595, 817, 484, 476, 373, 416, 744, 526, 352, 207, 460, 542, 334, 332, 499, 702, 258, 951, 771, 1199, 372, 425, 459, 448, 542, 343, 270, 791, 969, 287, 316, 398, 460, 357, 270, 811, 741, 474, 374, 582, 869, 404, 409, 421, 581, 797, 1197, 225, 408, 366, 338, 1098, 474, 609, 1318, 568, 864, 813, 1560, 543, 312, 321, 305, 1125, 420, 771, 400, 302, 251, 476, 321, 1140, 405, 764, 390, 275, 317, 697, 447, 573, 348, 1829, 1062, 459, 361, 861, 1385, 1797, 1182, 477, 445, 552, 537, 359, 684, 1079, 342, 260, 519, 408, 827, 823, 456, 529, 1155, 291, 900, 730, 445, 564, 399, 1149, 488, 192, 658, 1520, 1024, 861, 1007, 455, 808, 750, 489, 411, 486, 382, 566, 354, 366, 542, 542, 413, 1056, 1056, 486, 793, 431, 790, 416, 610, 504, 491, 1393, 611, 392, 531, 588, 905, 820, 955, 1148, 782, 1104, 314, 744, 729, 428, 256, 680, 337, 372, 622, 289, 367, 676, 327, 465, 1311, 1101, 370, 401, 729, 302, 587, 378, 420, 1124, 450, 1387, 387, 240, 1232, 352, 589, 669, 1181, 405, 656, 1185, 946, 610, 1696, 610, 294, 537, 381, 646, 393, 325, 274, 300, 449, 669, 342, 551, 1329, 473, 398, 1222, 881, 651, 234, 467, 682, 457, 905, 292, 330, 726, 291, 312, 438, 393, 477, 1494, 188, 369, 491, 394, 539, 674, 569, 531, 342, 770, 347, 279, 510, 360, 346, 959, 661, 315, 406, 813, 527, 517, 568, 373, 417, 429, 330, 572, 638, 210, 266, 894, 746, 344, 459, 772, 261, 339, 876, 575, 317, 1534, 707, 1141, 405, 1104, 282, 954, 441, 573, 656, 255, 444, 610, 1696, 207, 610, 610, 648, 548, 948, 641, 344, 505, 397, 388, 1859, 488, 251, 320, 314, 408, 180, 956, 776, 823, 645, 585, 373, 338, 666, 354, 537, 462, 865, 303, 1098, 602, 501, 714, 766, 348, 534, 446, 534, 1176, 1158, 412, 989, 360, 2165, 971, 993, 240, 606, 1554, 216, 387, 749, 384, 467, 654, 685, 954, 608, 299, 2270, 1178, 460, 548, 753, 399, 310, 837, 709, 259, 456, 351, 299, 950, 759, 178, 1072, 824, 198, 354, 608, 484, 717, 154, 598, 300, 303, 252, 565, 526, 381, 520, 384, 339, 461, 353, 391, 438, 450, 474, 228, 477, 623, 1196, 269, 341, 559, 468, 492, 528, 254, 1341, 545, 1276, 483, 794, 990, 742, 258, 341, 521, 714, 1234, 437, 1169, 660, 409, 873, 317, 1230, 1029, 1243, 390, 463, 335, 405, 1166, 357, 495, 530, 732, 330, 1368, 330, 330, 1368, 331, 930, 903, 801, 901, 1443, 324, 1444, 1443, 905, 324, 927, 2911, 468, 295, 370, 744, 235, 453, 355, 809, 1494, 168, 480, 494, 1102, 374, 480, 262, 563, 1844, 893, 180, 445, 588, 662, 746, 1482, 1054, 4866, 1377, 560, 726, 292, 377, 315, 1836, 782, 357, 1171, 190, 648, 715, 582, 1386, 540, 336, 482, 607, 361, 542, 357, 276, 1278, 593, 1019, 548, 1390, 552, 465, 372, 1283, 1281, 895, 751, 301, 261, 771, 428, 1206, 441, 1546, 285, 479, 902, 459, 603, 1187, 855, 856, 1444, 903, 930, 334, 856, 334, 856, 334, 1369, 331, 1368, 928, 324, 903, 494, 355, 450, 747, 410, 659, 477, 657, 2609, 477, 991, 930, 944, 464, 645, 476, 347, 849, 327, 445, 729, 486, 198, 369, 232, 396, 480, 269, 426, 351, 249, 803, 475, 228, 266, 844, 393, 516, 779, 483, 374, 561, 368, 374, 203, 494, 1443, 334, 856, 494, 1045, 894, 593, 590, 1086, 504, 928, 265, 312, 465, 408, 493, 265, 1625, 968, 1234, 348, 459, 1098, 318, 621, 549, 785, 1218, 585, 438, 1476, 230, 688, 584, 812, 423, 525, 459, 324, 981, 509, 323, 530, 466, 553, 462, 285, 1275, 402, 756, 1586, 588, 1004, 1170, 555, 426, 288, 605, 699, 1493, 621, 1746, 1023, 502, 375, 1028, 855, 581, 327, 162, 200, 201, 399, 435, 482, 690, 1173, 409, 836, 1526, 1020, 1088, 330, 315, 480, 593, 522, 444, 210, 739, 1900, 778, 847, 711, 219, 300, 303, 1109, 1283, 461, 860, 834, 778, 944, 282, 523, 593, 833, 564, 595, 534, 530, 582, 315, 1236, 1307, 939, 496, 667, 378, 1205, 174, 1331, 443, 479, 648, 857, 1285, 1071, 372, 1116, 577, 646, 645, 759, 1137, 819, 1577, 201, 374, 314, 736, 463, 1179, 491, 588, 953, 528, 392, 1367, 747, 344, 1762, 1048, 1070, 563, 474, 374, 327, 621, 596, 536, 260, 452, 576, 1476, 675, 824, 603, 511, 2064, 405, 548, 388, 1227, 368, 504, 1002, 327, 1544, 728, 906, 880, 405, 477, 585, 1141, 544, 530, 704, 1583, 1006, 422, 657, 1140, 482, 879, 750, 408, 951, 870, 488, 850, 537, 561, 555, 444, 822, 662, 333, 1993, 420, 406, 674, 644, 1392, 1031, 616, 815, 1180, 677, 861, 855, 251, 213, 375, 890, 200, 162, 1195, 1035, 388, 1224, 3684, 1002, 2398, 311, 355, 1626, 674, 626, 663, 646, 528, 1217, 348, 2272, 966, 658, 981, 511, 1121, 760, 312, 566, 961, 1659, 374, 480, 782, 1190, 324, 1140, 1254, 1513, 414, 1015, 1151, 786, 1122, 1642, 316, 476, 393, 1264, 530, 757, 716, 1019, 447, 279, 576, 681, 661, 1827, 267, 852, 738, 992, 1106, 1284, 234, 859, 692, 738, 1263, 473, 1122, 590, 307, 444, 529, 1217, 435, 1910, 1234, 1122, 473, 216, 678]

CÓDIGO

###library import
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
import numpy as np


###first attempt
sorted_len = sorted(l)
sorted_counted = Counter(sorted_len)

range_length = list(range(max(l)))
data_series = {}

for x in range_length:
    data_series[x] = 0

for key, value in sorted_counted.items():
    data_series[key] = value

data_series = pd.Series(data_series)
x_values = data_series.index


###second attemmpt
df = pd.DataFrame(l, columns=['len'])


###actual plots
#x-axis is correct, but y-axis don't display colors...
plt.bar(x_values, data_series.values)
plt.show()

#x-axis is correct, but y-axis don't display colors...
val, cnt = np.unique(l, return_counts=True)
sns.catplot(data=df, kind='count', x='len')

#correct number of instances, but wrong x-axis...
df.len.value_counts()[df.len.unique()].plot(kind='bar')

Rsaída comprimento_dist

PS: observe que estou usando PyCharmcom as Invert image outputs for dark themesopções para que a saída da célula para imagens seja exibida em um fundo branco para visibilidade

python
  • 1 respostas
  • 53 Views
Martin Hope
Matteo
Asked: 2025-04-11 16:22:05 +0800 CST

determinar a posição de uma string inserida dentro de outra

  • 6

Após esta postagem, consegui montar uma pequena função para colocar dentro de um corpo de texto maior (FASTA) strings mais curtas determinadas de outro arquivo com base em algumas condições ( por exemplo, 100 eventos de um subconjunto de apenas 400 a 500 caracteres de comprimento e selecionados aleatoriamente).

Agora, estou satisfeito com o resultado; no entanto, desejo imprimir exatamente onde esses 100 eventos foram adicionados no corpo de texto maior — idealmente, posição inicial-final, se não for muito difícil.

Acho que isso poderia ser integrado get_retro_text()ou, se for mais fácil, criado como uma função externa, mas não consigo descobrir por onde começar... qualquer ajuda é muito apreciada, obrigado antecipadamente!

###library import
from Bio import SeqIO
import random

###string import and wrangling
input_file = open("homo_sapiens_strings.fasta.txt")
my_dict = SeqIO.to_dict(SeqIO.parse(input_file, "fasta"))

s = []
for j in my_dict.values():
   s.append(j)

###import FASTA --> some already made function I found to import and print whole FASTA genomes but testing on a part of it
def fasta_reader(filename):
  from Bio.SeqIO.FastaIO import FastaIterator
  with open(filename) as handle:
    for record in FastaIterator(handle):
      yield record

head = ""
body = ""
for entry in fasta_reader("hg37_chr1.fna"):
  head = str(entry.id)
  body = str(entry.seq)

###randomly selects 100 sequences and adds them to the FASTA
def insert (source_str, insert_str, pos):
    return source_str[:pos] + insert_str + source_str[pos:]

def get_retro_text(genome, all_strings):
    string_of_choice = [string for string in all_strings if 400 < len(string) < 500]
    hundred_strings = random.sample(string_of_choice, k=100)

    text_of_strings = []
    for k in range(len(hundred_strings)):
        text_of_strings.append(str(hundred_strings[k].seq))

    single_string = ",".join(text_of_strings)
    new_genome = insert(genome, single_string, random.randint(0, len(genome)))
    
    return new_genome

big_genome = get_retro_text(body, s)

EDIT exemplo de estrutura de bodyes

body


NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNtaaccctaaccctaacccta
accctaaccctaaccctaaccctaaccctaaccctaaccctaaccctaaccctaacccta
accctaaccctaaccctaaccctaacccaaccctaaccctaaccctaaccctaaccctaa
ccctaacccctaaccctaaccctaaccctaaccctaacctaaccctaaccctaaccctaa
ccctaaccctaaccctaaccctaaccctaacccctaaccctaaccctaaaccctaaaccc
taaccctaaccctaaccctaaccctaaccccaaccccaaccccaaccccaaccccaaccc
caaccctaacccctaaccctaaccctaaccctaccctaaccctaaccctaaccctaaccc
taaccctaacccctaacccctaaccctaaccctaaccctaaccctaaccctaaccctaac
ccctaaccctaaccctaaccctaaccctcgCGGTACCCTCAGCCGGCCCGCCCGCCCGGG
TCTGACCTGAGGAGAACTGTGCTCCGCCTTCAGAGTACCACCGAAATCTGTGCAGAGGAc
aacgcagctccgccctcgcggtGCTCtccgggtctgtgctgaggagaacgCAACTCCGCC
GTTGCAAAGGCGcgccgcgccggcgcaggcgcagagaggcgcgccgcgccggcgcaggcg
cagagaggcgcgccgcgccggcgcaggcgcagagaggcgcgccgcgccggcgcaggcgca
gagaggcgcgccgcgccggcgcaggcgcagagaggcgcgccgcgccggcgcaggcgcaga
caCATGCTAGCGCGTCGGGGTGGAGGCgtggcgcaggcgcagagaggcgcgccgcgccgg
cgcaggcgcagagacaCATGCTACCGCGTCCAGGGGTGGAGGCgtggcgcaggcgcagag
aggcgcaccgcgccggcgcaggcgcagagacaCATGCTAGCGCGTCCAGGGGTGGAGGCG
TggcgcaggcgcagagacgcAAGCCTAcgggcgggggttgggggggcgTGTGTTGCAGGA
GCAAAGTCGCACGGCGCCGGGCTGGGGCGGGGGGAGGGTGGCGCCGTGCACGCGCAGAAA
CTCACGTCACGGTGGCGCGGCGCAGAGACGGGTAGAACCTCAGTAATCCGAAAAGCCGGG
ATCGACCGCCCCTTGCTTGCAGCCGGGCACTACAGGACCCGCTTGCTCACGGTGCTGTGC
CAGGGCGCCCCCTGCTGGCGACTAGGGCAACTGCAGGGCTCTCTTGCTTAGAGTGGTGGC
CAGCGCCCCCTGCTGGCGCCGGGGCACTGCAGGGCCCTCTTGCTTACTGTATAGTGGTGG
CACGCCGCCTGCTGGCAGCTAGGGACATTGCAGGGTCCTCTTGCTCAAGGTGTAGTGGCA
GCACGCCCACCTGCTGGCAGCTGGGGACACTGCCGGGCCCTCTTGCTCCAACAGTACTGG
CGGATTATAGGGAAACACCCGGAGCATATGCTGTTTGGTCTCAGTAGACTCCTAAATATG
GGATTCCTgggtttaaaagtaaaaaataaatatgtttaatttgtGAACTGATTACCATCA
GAATTGTACTGTTCTGTATCCCACCAGCAATGTCTAGGAATGCCTGTTTCTCCACAAAGT
GTTtacttttggatttttgccagTCTAACAGGTGAAGCCCTGGAGATTCTTATTAGTGAT
TTGGGCTGGGGCCTGgccatgtgtatttttttaaatttccactgaTGATTTTGCTGCATG
GCCGGTGTTGAGAATGACTGCGCAAATTTGCCGGATTTCCTTTGCTGTTCCTGCATGTAG
TTTAAACGAGATTGCCAGCACCGGGTATCATTCACCATTTTTCTTTTCGTTAACTTGCCG
TCAGCCTTTTCTTTGACCTCTTCTTTCTGTTCATGTGTATTTGCTGTCTCTTAGCCCAGA
CTTCCCGTGTCCTTTCCACCGGGCCTTTGAGAGGTCACAGGGTCTTGATGCTGTGGTCTT
CATCTGCAGGTGTCTGACTTCCAGCAACTGCTGGCCTGTGCCAGGGTGCAAGCTGAGCAC
TGGAGTGGAGTTTTCCTGTGGAGAGGAGCCATGCCTAGAGTGGGATGGGCCATTGTTCAT

s

[[SeqRecord(seq=Seq('ATGGCGGGACACCCGAAAGAGAGGGTGGTCACAGATGAGGTCCATCAGAACCAG...TAG'), id='retro_hsap_1', name='retro_hsap_1', description='retro_hsap_1', dbxrefs=[]), SeqRecord(seq=Seq('ATGGTCAACGTACCTAAAACCCGAAGAACCTTCTGTAAGAAGTGTGGCAAGCAT...TAA'), id='retro_hsap_2', name='retro_hsap_2', description='retro_hsap_2', dbxrefs=[]), SeqRecord(seq=Seq('ATGTCCACAATGGGAAACGAGGCCAGTTACCCGGCGGAGATGTGCTCCCACTTT...TGA'), id='retro_hsap_3', name='retro_hsap_3', description='retro_hsap_3', dbxrefs=[])]]
python
  • 1 respostas
  • 55 Views
Martin Hope
Matteo
Asked: 2025-04-05 07:14:11 +0800 CST

adicione geom_label e geom_density à distribuição do gráfico de barras

  • 5

Estou trabalhando em um gráfico mostrando a distribuição de comprimento de alguns eventos no genoma humano. Estou bem com o resultado final, mas gostaria de adicionar um geom_labelpara a contagem mais alta relatando o comprimento correspondente no eixo x , bem como uma geom_densitydistribuição — se possível.

Sobre o rótulo, a cor pode refletir a mesma correspondente à barra associada, a menos que não seja o caso por padrão? Obrigado antecipadamente!

Abaixo o código que estou usando e uma dput()parte da entrada junto com a saída final que estou obtendo do gráfico.

library(scico)
library(readr)
library(stringr)
library(ggplot2)

retros <- read_delim("/path/to/homo_sapiens_Retrogenes.fasta.txt", delim = "\n", col_names = FALSE) #import the data

#wrangle
single_retro <- str_split(retros, ">retro_hsap_[0-9]+")

a=list()
for (i in seq_along(single_retro)){
  for (j in seq_along(single_retro[[i]])) {
    a <- c(a, single_retro[[i]][[j]])
  }
}; a[[1]] <- NULL

len=vector()
for (s in 1:length(a)) {
  len <- c(len, str_count(a[[s]], "[A-Z]"))
}

#plot
ggplot(as.data.frame(len), aes(len)) +
  geom_bar(color=scico(1229, palette='acton')) + 
  scale_x_continuous(breaks=seq(0,6500,250), expand=c(0, 0)) + 
  scale_y_continuous(limits=c(0,30), expand=c(0, 0)) + theme_bw()

dput(len)– somente os primeiros 1000

c(408L, 321L, 522L, 942L, 462L, 564L, 765L, 747L, 465L, 957L, 
993L, 1056L, 690L, 1554L, 1209L, 246L, 462L, 3705L, 1554L, 507L, 
681L, 1173L, 408L, 330L, 1317L, 240L, 576L, 2301L, 1911L, 1677L, 
1014L, 756L, 918L, 864L, 528L, 882L, 1131L, 1440L, 1167L, 1146L, 
1002L, 906L, 1056L, 1881L, 396L, 1278L, 501L, 1110L, 303L, 1176L, 
699L, 747L, 1971L, 3318L, 1875L, 450L, 354L, 1218L, 378L, 303L, 
777L, 915L, 5481L, 576L, 1920L, 2022L, 1662L, 519L, 936L, 423L, 
1149L, 600L, 1896L, 648L, 2238L, 1419L, 423L, 552L, 1299L, 1071L, 
963L, 471L, 408L, 729L, 1896L, 1068L, 1254L, 1179L, 1188L, 645L, 
978L, 903L, 1191L, 1119L, 747L, 1005L, 273L, 1191L, 519L, 930L, 
1053L, 2157L, 933L, 888L, 591L, 1287L, 457L, 294L, 291L, 669L, 
270L, 556L, 444L, 483L, 438L, 452L, 659L, 372L, 480L, 464L, 477L, 
256L, 350L, 357L, 524L, 477L, 218L, 192L, 216L, 587L, 473L, 525L, 
657L, 241L, 719L, 383L, 459L, 855L, 417L, 283L, 408L, 678L, 681L, 
1254L, 879L, 250L, 857L, 706L, 456L, 567L, 190L, 887L, 287L, 
240L, 960L, 587L, 361L, 816L, 297L, 290L, 253L, 335L, 609L, 507L, 
294L, 1475L, 464L, 780L, 552L, 555L, 1605L, 1127L, 382L, 579L, 
645L, 273L, 241L, 552L, 344L, 890L, 1346L, 1067L, 764L, 431L, 
796L, 569L, 1386L, 413L, 401L, 407L, 252L, 375L, 378L, 339L, 
457L, 1779L, 243L, 701L, 552L, 708L, 174L, 300L, 257L, 378L, 
777L, 729L, 969L, 603L, 378L, 436L, 348L, 399L, 1662L, 1511L, 
799L, 715L, 1400L, 399L, 516L, 399L, 355L, 1291L, 1286L, 657L, 
374L, 492L, 334L, 295L, 210L, 270L, 858L, 1487L, 1020L, 1641L, 
417L, 396L, 303L, 553L, 492L, 1097L, 612L, 441L, 654L, 611L, 
532L, 474L, 864L, 377L, 465L, 435L, 1003L, 608L, 486L, 748L, 
351L, 245L, 545L, 627L, 303L, 457L, 419L, 449L, 843L, 312L, 398L, 
704L, 315L, 330L, 1054L, 259L, 507L, 372L, 468L, 345L, 1303L, 
408L, 1031L, 471L, 653L, 925L, 397L, 231L, 684L, 449L, 336L, 
344L, 619L, 917L, 417L, 516L, 359L, 550L, 222L, 789L, 608L, 659L, 
853L, 360L, 657L, 372L, 305L, 353L, 650L, 564L, 547L, 969L, 505L, 
230L, 953L, 769L, 307L, 516L, 408L, 342L, 267L, 570L, 572L, 348L, 
1005L, 981L, 1586L, 1302L, 369L, 1290L, 1458L, 572L, 1122L, 363L, 
879L, 651L, 466L, 1203L, 485L, 440L, 473L, 810L, 1320L, 461L, 
455L, 258L, 660L, 297L, 285L, 424L, 273L, 378L, 432L, 293L, 410L, 
327L, 483L, 477L, 551L, 894L, 638L, 538L, 678L, 303L, 478L, 1046L, 
995L, 360L, 252L, 480L, 490L, 475L, 394L, 1185L, 357L, 361L, 
387L, 489L, 450L, 788L, 366L, 340L, 829L, 469L, 404L, 593L, 498L, 
840L, 601L, 235L, 452L, 395L, 504L, 299L, 662L, 357L, 686L, 683L, 
248L, 574L, 1108L, 587L, 483L, 1481L, 1297L, 1334L, 579L, 182L, 
456L, 1335L, 513L, 967L, 918L, 607L, 564L, 727L, 913L, 743L, 
312L, 480L, 659L, 939L, 705L, 1001L, 553L, 339L, 286L, 452L, 
744L, 519L, 521L, 491L, 565L, 522L, 377L, 861L, 812L, 523L, 332L, 
800L, 1015L, 1000L, 513L, 990L, 1003L, 733L, 542L, 940L, 399L, 
399L, 612L, 1361L, 399L, 399L, 318L, 319L, 510L, 504L, 841L, 
1529L, 506L, 1881L, 500L, 358L, 240L, 1261L, 354L, 519L, 779L, 
656L, 311L, 635L, 527L, 759L, 333L, 648L, 770L, 330L, 584L, 453L, 
632L, 513L, 998L, 343L, 696L, 1286L, 391L, 374L, 893L, 375L, 
426L, 658L, 455L, 518L, 466L, 417L, 614L, 285L, 480L, 845L, 344L, 
534L, 572L, 1727L, 1085L, 480L, 468L, 192L, 348L, 578L, 2433L, 
390L, 1031L, 1129L, 626L, 735L, 963L, 439L, 272L, 806L, 743L, 
560L, 250L, 679L, 459L, 207L, 905L, 616L, 404L, 489L, 582L, 340L, 
435L, 1632L, 417L, 221L, 279L, 462L, 357L, 288L, 248L, 981L, 
1015L, 935L, 678L, 279L, 348L, 470L, 958L, 867L, 352L, 735L, 
293L, 911L, 460L, 767L, 386L, 531L, 411L, 192L, 742L, 373L, 1454L, 
970L, 285L, 468L, 273L, 1527L, 612L, 983L, 552L, 998L, 553L, 
812L, 983L, 403L, 1706L, 781L, 183L, 405L, 891L, 647L, 1022L, 
946L, 476L, 270L, 471L, 888L, 435L, 354L, 563L, 526L, 877L, 1170L, 
351L, 863L, 1503L, 562L, 1174L, 345L, 385L, 275L, 374L, 171L, 
474L, 408L, 1640L, 345L, 462L, 722L, 1645L, 504L, 840L, 459L, 
783L, 501L, 473L, 609L, 684L, 543L, 353L, 788L, 684L, 734L, 242L, 
751L, 478L, 471L, 365L, 293L, 380L, 486L, 617L, 786L, 436L, 632L, 
624L, 386L, 925L, 469L, 405L, 2406L, 462L, 435L, 251L, 1118L, 
349L, 779L, 343L, 458L, 264L, 243L, 935L, 535L, 576L, 480L, 406L, 
606L, 495L, 396L, 456L, 798L, 404L, 285L, 375L, 922L, 1136L, 
330L, 339L, 559L, 998L, 239L, 587L, 468L, 1237L, 1722L, 699L, 
436L, 377L, 306L, 326L, 1076L, 385L, 537L, 315L, 342L, 386L, 
400L, 340L, 202L, 266L, 455L, 435L, 259L, 317L, 456L, 249L, 452L, 
1345L, 699L, 456L, 456L, 453L, 275L, 315L, 693L, 354L, 475L, 
780L, 415L, 956L, 554L, 258L, 418L, 996L, 552L, 511L, 1404L, 
469L, 262L, 398L, 242L, 350L, 538L, 379L, 300L, 460L, 373L, 276L, 
258L, 740L, 609L, 753L, 357L, 495L, 532L, 551L, 234L, 633L, 480L, 
312L, 898L, 350L, 705L, 265L, 345L, 334L, 334L, 582L, 583L, 582L, 
478L, 465L, 480L, 408L, 870L, 624L, 1107L, 303L, 384L, 1165L, 
1456L, 878L, 297L, 301L, 276L, 372L, 551L, 799L, 496L, 204L, 
552L, 791L, 330L, 359L, 480L, 468L, 414L, 1102L, 876L, 1112L, 
850L, 536L, 500L, 374L, 825L, 476L, 499L, 275L, 345L, 616L, 360L, 
609L, 310L, 260L, 376L, 283L, 390L, 1529L, 1310L, 207L, 1039L, 
661L, 570L, 1292L, 914L, 843L, 658L, 302L, 1119L, 609L, 225L, 
317L, 1091L, 225L, 403L, 544L, 495L, 912L, 744L, 473L, 985L, 
342L, 630L, 298L, 392L, 297L, 933L, 888L, 666L, 1023L, 346L, 
310L, 1134L, 840L, 1277L, 387L, 463L, 435L, 610L, 492L, 1107L, 
582L, 582L, 582L, 1307L, 647L, 1280L, 555L, 645L, 267L, 952L, 
588L, 348L, 287L, 507L, 410L, 737L, 731L, 354L, 2192L, 309L, 
388L, 692L, 389L, 742L, 766L, 1228L, 1640L, 237L, 495L, 351L, 
285L, 2443L, 963L, 296L, 420L, 482L, 246L, 553L, 621L, 405L, 
597L, 459L, 310L, 300L, 450L, 471L, 291L, 610L, 723L, 380L, 1439L, 
312L, 900L, 275L, 396L, 342L, 309L, 549L, 355L, 474L, 417L, 372L, 
384L, 291L, 987L, 629L, 407L, 655L, 357L, 473L, 348L, 459L, 599L, 
474L, 430L, 620L, 584L, 546L, 435L, 242L, 1167L, 627L, 378L, 
945L, 349L, 255L, 216L, 530L, 516L, 606L, 449L, 1490L, 401L, 
1070L, 899L, 452L, 1304L, 451L, 723L, 354L, 229L, 629L, 639L, 
501L, 465L, 344L, 1895L, 288L, 341L, 2377L, 542L, 453L, 291L, 
645L, 494L, 471L, 612L, 1294L, 713L, 1291L, 467L, 734L, 300L, 
1432L, 320L, 753L, 609L, 1051L, 231L, 875L, 704L, 438L, 742L, 
504L, 1334L, 738L, 342L, 435L, 1133L, 1229L, 436L, 310L, 494L, 
273L, 1228L, 626L, 470L, 235L, 1264L, 465L, 450L, 350L, 647L, 
541L, 256L, 231L, 435L, 485L, 224L, 555L, 395L, 300L, 969L, 237L
)

teste_len

  • 1 respostas
  • 33 Views
Martin Hope
Matteo
Asked: 2024-08-22 20:32:41 +0800 CST

Snakemake: MissingOutputException em regra hifiasm no arquivo /home/usr/path/to/Snakefile, linha 13

  • 6

Olá, eu estava trabalhando em um arquivo Snakemake muito básico para ser executado hifiasm; parece funcionar bem, mas, por algum motivo, no final da execução fui solicitado o seguinte:

Aguardando no máximo 5 segundos por arquivos perdidos. MissingOutputException na regra hifiasm no arquivo /home/usr/path/to/Snakefile, linha 13: Trabalho 1 concluído com sucesso, mas alguns arquivos de saída estão faltando. Arquivos ausentes após 5 segundos. Isso pode ser devido à latência do sistema de arquivos. Se for esse o caso, considere aumentar o tempo de espera com --latency-wait: INLUP00233.asm (ausente localmente, diretório pai não presente) Desligando, isso pode levar algum tempo. Saindo porque a execução de um trabalho falhou. Procure acima a mensagem de erro Log completo: .snakemake/log/2024-08-21T144851.077767.snakemake.log WorkflowError: Pelo menos um trabalho não foi concluído com êxito.

Este é o código que estou executando; alguém tem uma explicação sobre por que isso está acontecendo? Desde já, obrigado!

#####################################
#   SNAKEMAKE PIPELINE — assembly   #
#####################################

SAMPLES = ['INLUP00233']

rule all:
    input:
        expand("{sample}.asm", sample=SAMPLES)

rule hifiasm:
    input:
        hifi="{sample}.fastq.gz",
        hic1="{sample}_1.fq.gz",
        hic2="{sample}_2.fq.gz"

    output:
        "{sample}.asm"

    threads: 16

    shell: 
        "hifiasm -o {output} --h1 {input.hic1} --h2 {input.hic2} {input.hifi} -t {threads}"
python
  • 1 respostas
  • 18 Views
Martin Hope
Matteo
Asked: 2024-04-18 02:36:35 +0800 CST

adicione uma linha suavizada ao barplot com ggplot

  • 5

Eu queria saber se é possível adicionar uma geom_smooth(ou qualquer linha de tendência) a um geom_colgráfico de barras no formato ggplot2. Aqui está o código que estou usando:

library(dplyr)
library(readxl)
library(ggplot2)
library(RColorBrewer)

mapQ_prop <- read_excel("/path/to.file.xlsm", 16)

mapQ_prop <- mapQ_prop %>% arrange(value)
mapQ_prop$sample <- as.vector(mapQ_prop$sample)
mapQ_prop$sample = factor(mapQ_prop$sample,mapQ_prop$sample)

plot_mapQ <- 
  ggplot(data=mapQ_prop, aes(x=sample, y=value, fill=brewer.pal(9, "Blues")[5])) + geom_col(color="black", alpha=.75) + theme_bw() + 
  
  theme(legend.title=element_text(face='italic'), legend.position='bottom', legend.direction='horizontal') +
  
  scale_fill_manual(values=brewer.pal(9, "Blues")[5], labels="value") +
  
  guides(
    fill=guide_legend(title="proportion over Q20", title.position="top", title.hjust=.5)
  ) +
  
  xlab("")

plot_mapQ + theme(axis.text.x=element_text(angle=90, vjust=0.5, hjust=1, size=6)) +
  scale_y_continuous(expand=c(0,0), limits=c(0,1))

e um dputdos dados para recriar o conjunto de dados:

structure(list(sample = structure(1:279, levels = c("HGDP00749", 
"HGDP01172", "HGDP00936", "HGDP00533", "TZ-11", "AV-21", "HGDP01286", 
"HGDP01036", "HGDP00982", "mixe0007", "HGDP01076", "IHW9118", 
"HGDP00546", "HGDP01308", "IHW9193", "HGDP00775", "HGDP01015", 
"HGDP01153", "HGDP00783", "HGDP00125", "Peru60", "HGDP01344", 
"HGDP00124", "Jordan445", "TGBS21", "Bu16", "NA17385", "HGDP00887", 
"HGDP01320", "I3", "Y4", "HG02494", "NA00726", "HGDP01163", "HGDP01228", 
"HGDP00543", "HGDP00555", "IraqiJew4291", "YemeniteJew5433", 
"NA17386", "HGDP01198", "HGDP01032", "HGDP01179", "CHI-034", 
"HGDP01098", "HGDP01335", "HGDP00541", "HGDP00956", "HGDP01250", 
"M13", "HGDP01044", "HGDP01306", "HGDP01191", "tdj409_shugnan", 
"ND15865", "KD4", "SAH41", "CHI-007", "DNK07", "HGDP00550", "K4", 
"NA15728", "Bu5", "HGDP01333", "HGDP00987", "NA13607", "HGDP00737", 
"M4", "B11", "Sir19", "NA13604", "NA15763", "Nesk_22", "NorthOssetia5", 
"HGDP01188", "IraqiJew1771", "Bishkek28440", "HGDP01350", "HGDP00058", 
"Y8", "HGDP00545", "ML2", "NA15761", "HGDP00090", "K1", "I1", 
"HG00360", "NA11200", "HGDP01355", "Igor21", "R6", "HGDP01168", 
"Dus22", "HGDP00660", "Dus16", "ML3", "Esk29", "HGDP01079", "HGDP00476", 
"ND19394", "HGDP01297", "HGDP00706", "Sir40", "YemeniteJew4695", 
"R3", "HGDP00852", "NA13616", "HGDP00725", "HG00174", "HGDP01223", 
"HGDP00449", "HGDP01401", "HGDP01246", "Nlk3", "SAH31", "altai363p", 
"HGDP00526", "B17", "HGDP00547", "HGDP01211", "HGDP00195", "SA0722", 
"NA17374", "HGDP01240", "Ale14", "tdj430_shugnan", "HG00190", 
"NA21490", "Nlk1", "HGDP00569", "HG01503", "HGDP00216", "HGDP01095", 
"HGDP00702", "HGDP00857", "mixa0105", "Ale32", "HGDP00846", "HGDP00785", 
"HGDP01315", "HGDP00540", "HG03007", "HGDP00552", "HG00126", 
"NA17377", "Tuba19", "HGDP01314", "NA11201", "HG02724", "Nesk_25", 
"zapo0098", "HGDP01203", "Bishkek28439", "NA18940", "Est400", 
"HGDP00554", "mg31", "HGDP00798", "HGDP00722", "HGDP01018", "HG00128", 
"HG02783", "Ul5", "Kor82", "HGDP00548", "HGDP00855", "HGDP01078", 
"NOR111", "Mansi41", "DNK11", "Mansi79", "HGDP00019", "HGDP00796", 
"Utsa21", "mixe0002", "Armenian222", "HGDP01345", "HGDP01417", 
"Kayseri24424", "Kusunda02", "HGDP00656", "Kayseri23827", "Igor20", 
"mg27", "HG02574", "mixe0042", "HG02790", "HG03006", "HGDP00286", 
"NA19044", "NA21581", "SA0342", "NorthOssetia12", "HGDP01242", 
"HG03100", "HGDP00530", "HGDP00428", "HGDP01312", "HGDP00027", 
"Est375", "HGDP00208", "HGDP00549", "HGDP00328", "abh107", "zapo0099", 
"HGDP00553", "HGDP00951", "HG01846", "HGDP01402", "HGDP01253", 
"Ale20", "Ayodo_81S", "BulgarianB4", "Nlk18", "HG02464", "HGDP00932", 
"HGDP00773", "Kusunda15", "BulgarianC1", "armenia293", "HGDP00616", 
"HG01504", "DNK05", "HGDP01365", "mixa0099", "HG01600", "HGDP01274", 
"HGDP00551", "NA19023", "iran11", "ALB212", "Ale22", "HGDP00160", 
"HGDP01364", "HGDP01012", "HG02943", "HGDP01323", "abh100", "Tuba9", 
"Sam02", "HGDP01215", "Ul31", "HG03078", "Ayodo_430C", "HGDP00597", 
"lez49", "HGDP00474", "Ayodo_502C", "lez42", "ch113", "HGDP00157", 
"HGDP01338", "HGDP00650", "HGDP00556", "HGDP01199", "NA15203", 
"HGDP01047", "HGDP00903", "Sir26", "Jordan603", "NA15202", "iran17", 
"HGDP00232", "Utsa22", "HG03085", "HGDP01035", "Jordan214", "HGDP01034", 
"HGDP00991", "HGDP00713", "HGDP00928", "HGDP00338", "HGDP00457", 
"HGDP00717", "HGDP01414", "HGDP00461", "HGDP01030", "HGDP01028", 
"HGDP00915"), class = "factor"), value = c(0.568026, 0.586163, 
0.611686, 0.615131, 0.617185, 0.622274, 0.626596, 0.634903, 0.638516, 
0.642894, 0.645012, 0.646246, 0.646643, 0.651504, 0.659362, 0.66035, 
0.693463, 0.748575, 0.775585, 0.799904, 0.809495, 0.810797, 0.813196, 
0.815898, 0.828594, 0.830746, 0.831749, 0.839394, 0.851589, 0.854254, 
0.855906, 0.856021, 0.85647, 0.857044, 0.857156, 0.857976, 0.858112, 
0.858384, 0.858926, 0.860694, 0.860702, 0.860986, 0.861457, 0.861628, 
0.862806, 0.863012, 0.863729, 0.864315, 0.864371, 0.864374, 0.865234, 
0.865495, 0.86583, 0.866675, 0.866983, 0.868242, 0.869689, 0.869762, 
0.869845, 0.870519, 0.870821, 0.871134, 0.871593, 0.871753, 0.871931, 
0.873242, 0.87332, 0.873374, 0.87366, 0.87414, 0.874163, 0.874369, 
0.87446, 0.874509, 0.874528, 0.874643, 0.874838, 0.87535, 0.875595, 
0.875707, 0.876403, 0.876409, 0.876425, 0.876552, 0.876586, 0.876844, 
0.87685, 0.876926, 0.876986, 0.877308, 0.877446, 0.877482, 0.877994, 
0.878208, 0.878836, 0.878899, 0.87894, 0.879029, 0.879148, 0.879171, 
0.879554, 0.879579, 0.879708, 0.879831, 0.880295, 0.880383, 0.880435, 
0.880438, 0.880496, 0.880511, 0.880531, 0.880572, 0.880714, 0.880739, 
0.880881, 0.881043, 0.881261, 0.881282, 0.881284, 0.881339, 0.881367, 
0.881484, 0.881486, 0.88157, 0.881974, 0.881982, 0.882005, 0.882182, 
0.882322, 0.882348, 0.882413, 0.882549, 0.882566, 0.88257, 0.882615, 
0.88282, 0.88289, 0.88296, 0.882994, 0.883129, 0.883145, 0.883264, 
0.883329, 0.883363, 0.883431, 0.883586, 0.883737, 0.88375, 0.883824, 
0.884139, 0.884221, 0.884251, 0.88438, 0.88438, 0.884433, 0.884435, 
0.884652, 0.884653, 0.884655, 0.884817, 0.884844, 0.885007, 0.885098, 
0.885134, 0.885139, 0.885225, 0.885253, 0.885263, 0.885312, 0.885339, 
0.885368, 0.885419, 0.885469, 0.885578, 0.885686, 0.885717, 0.885723, 
0.885762, 0.885836, 0.885843, 0.885872, 0.88603, 0.886063, 0.886112, 
0.886188, 0.886225, 0.886261, 0.886298, 0.886304, 0.88641, 0.886415, 
0.886488, 0.88649, 0.886531, 0.886567, 0.886641, 0.886672, 0.886673, 
0.886703, 0.886772, 0.886801, 0.886898, 0.886928, 0.886931, 0.887006, 
0.887128, 0.887154, 0.887189, 0.887366, 0.887373, 0.887508, 0.887675, 
0.887703, 0.887736, 0.887782, 0.887811, 0.88784, 0.887906, 0.888032, 
0.888162, 0.888187, 0.888203, 0.888264, 0.888264, 0.888365, 0.888382, 
0.888386, 0.888428, 0.888446, 0.888484, 0.888519, 0.888545, 0.888584, 
0.888627, 0.888649, 0.888734, 0.888886, 0.888915, 0.888999, 0.889029, 
0.889035, 0.889068, 0.889124, 0.889333, 0.889496, 0.889727, 0.889898, 
0.890081, 0.890192, 0.890197, 0.89028, 0.890416, 0.890417, 0.890432, 
0.890526, 0.890692, 0.890903, 0.890929, 0.890992, 0.891027, 0.891045, 
0.891088, 0.891198, 0.891241, 0.891266, 0.891418, 0.891555, 0.891697, 
0.891863, 0.891935, 0.892073, 0.892172, 0.892176, 0.892227, 0.892872, 
0.892909, 0.892915, 0.893008, 0.893234)), row.names = c(NA, -279L
), class = c("tbl_df", "tbl", "data.frame"))

Agora, uma coisa pode estar na raiz deste problema é não ter dados numéricos no eixo x ; se sim, ainda é viável de alguma forma?
Além disso, adicionei as três linhas antes do gráfico real, olhando um pouco para cima, parece ser uma solução para classificar os valores categóricos no eixo x em ordem crescente com base em seus valores no eixo y . Se alguém tiver alguma ideia, qualquer ajuda será muito apreciada, obrigado!

  • 1 respostas
  • 15 Views

Sidebar

Stats

  • Perguntas 205573
  • respostas 270741
  • best respostas 135370
  • utilizador 68524
  • Highest score
  • respostas
  • Marko Smith

    Reformatar números, inserindo separadores em posições fixas

    • 6 respostas
  • Marko Smith

    Por que os conceitos do C++20 causam erros de restrição cíclica, enquanto o SFINAE antigo não?

    • 2 respostas
  • Marko Smith

    Problema com extensão desinstalada automaticamente do VScode (tema Material)

    • 2 respostas
  • Marko Smith

    Vue 3: Erro na criação "Identificador esperado, mas encontrado 'import'" [duplicado]

    • 1 respostas
  • Marko Smith

    Qual é o propósito de `enum class` com um tipo subjacente especificado, mas sem enumeradores?

    • 1 respostas
  • Marko Smith

    Como faço para corrigir um erro MODULE_NOT_FOUND para um módulo que não importei manualmente?

    • 6 respostas
  • Marko Smith

    `(expression, lvalue) = rvalue` é uma atribuição válida em C ou C++? Por que alguns compiladores aceitam/rejeitam isso?

    • 3 respostas
  • Marko Smith

    Um programa vazio que não faz nada em C++ precisa de um heap de 204 KB, mas não em C

    • 1 respostas
  • Marko Smith

    PowerBI atualmente quebrado com BigQuery: problema de driver Simba com atualização do Windows

    • 2 respostas
  • Marko Smith

    AdMob: MobileAds.initialize() - "java.lang.Integer não pode ser convertido em java.lang.String" para alguns dispositivos

    • 1 respostas
  • Martin Hope
    Fantastic Mr Fox Somente o tipo copiável não é aceito na implementação std::vector do MSVC 2025-04-23 06:40:49 +0800 CST
  • Martin Hope
    Howard Hinnant Encontre o próximo dia da semana usando o cronógrafo 2025-04-21 08:30:25 +0800 CST
  • Martin Hope
    Fedor O inicializador de membro do construtor pode incluir a inicialização de outro membro? 2025-04-15 01:01:44 +0800 CST
  • Martin Hope
    Petr Filipský Por que os conceitos do C++20 causam erros de restrição cíclica, enquanto o SFINAE antigo não? 2025-03-23 21:39:40 +0800 CST
  • Martin Hope
    Catskul O C++20 mudou para permitir a conversão de `type(&)[N]` de matriz de limites conhecidos para `type(&)[]` de matriz de limites desconhecidos? 2025-03-04 06:57:53 +0800 CST
  • Martin Hope
    Stefan Pochmann Como/por que {2,3,10} e {x,3,10} com x=2 são ordenados de forma diferente? 2025-01-13 23:24:07 +0800 CST
  • Martin Hope
    Chad Feller O ponto e vírgula agora é opcional em condicionais bash com [[ .. ]] na versão 5.2? 2024-10-21 05:50:33 +0800 CST
  • Martin Hope
    Wrench Por que um traço duplo (--) faz com que esta cláusula MariaDB seja avaliada como verdadeira? 2024-05-05 13:37:20 +0800 CST
  • Martin Hope
    Waket Zheng Por que `dict(id=1, **{'id': 2})` às vezes gera `KeyError: 'id'` em vez de um TypeError? 2024-05-04 14:19:19 +0800 CST
  • Martin Hope
    user924 AdMob: MobileAds.initialize() - "java.lang.Integer não pode ser convertido em java.lang.String" para alguns dispositivos 2024-03-20 03:12:31 +0800 CST

Hot tag

python javascript c++ c# java typescript sql reactjs html

Explore

  • Início
  • Perguntas
    • Recentes
    • Highest score
  • tag
  • help

Footer

AskOverflow.Dev

About Us

  • About Us
  • Contact Us

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve