/usr/bin/perlprimer is in perlprimer 1.1.21-2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 5367 5368 5369 5370 5371 5372 5373 5374 5375 5376 5377 5378 5379 5380 5381 5382 5383 5384 5385 5386 5387 5388 5389 5390 5391 5392 5393 5394 5395 5396 5397 5398 5399 5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416 5417 5418 5419 5420 5421 5422 5423 5424 5425 5426 5427 5428 5429 5430 5431 5432 5433 5434 5435 5436 5437 5438 5439 5440 5441 5442 5443 5444 5445 5446 5447 5448 5449 5450 5451 5452 5453 5454 5455 5456 5457 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 5468 5469 5470 5471 5472 5473 5474 5475 5476 5477 5478 5479 5480 5481 5482 5483 5484 5485 5486 5487 5488 5489 5490 5491 5492 5493 5494 5495 5496 5497 5498 5499 5500 5501 5502 5503 5504 5505 5506 5507 5508 5509 5510 5511 5512 5513 5514 5515 5516 5517 5518 5519 5520 5521 5522 5523 5524 5525 5526 5527 5528 5529 5530 5531 5532 5533 5534 5535 5536 5537 5538 5539 5540 5541 5542 5543 5544 5545 5546 5547 5548 5549 5550 5551 5552 5553 5554 5555 5556 5557 5558 5559 5560 5561 5562 5563 5564 5565 5566 5567 5568 5569 5570 5571 5572 5573 5574 5575 5576 5577 5578 5579 5580 5581 5582 5583 5584 5585 5586 5587 5588 5589 5590 5591 5592 5593 5594 5595 5596 5597 5598 5599 5600 5601 5602 5603 5604 5605 5606 5607 5608 5609 5610 5611 5612 5613 5614 5615 5616 5617 5618 5619 5620 5621 5622 5623 5624 5625 5626 5627 5628 5629 5630 5631 5632 5633 5634 5635 5636 5637 5638 5639 5640 5641 5642 5643 5644 5645 5646 5647 5648 5649 5650 5651 5652 5653 5654 5655 5656 5657 5658 5659 5660 5661 5662 5663 5664 5665 5666 5667 5668 5669 5670 5671 5672 5673 5674 5675 5676 5677 5678 5679 5680 5681 5682 5683 5684 5685 5686 5687 5688 5689 5690 5691 5692 5693 5694 5695 5696 5697 5698 5699 5700 5701 5702 5703 5704 5705 5706 5707 5708 5709 5710 5711 5712 5713 5714 5715 5716 5717 5718 5719 5720 5721 5722 5723 5724 5725 5726 5727 5728 5729 5730 5731 5732 5733 5734 5735 5736 5737 5738 5739 5740 5741 5742 5743 5744 5745 5746 5747 5748 5749 5750 5751 5752 5753 5754 5755 5756 5757 5758 5759 5760 5761 5762 5763 5764 5765 5766 5767 5768 5769 5770 5771 5772 5773 5774 5775 5776 5777 5778 5779 5780 5781 5782 5783 5784 5785 5786 5787 5788 5789 5790 5791 5792 5793 5794 5795 5796 5797 5798 5799 5800 5801 5802 5803 5804 5805 5806 5807 5808 5809 5810 5811 5812 5813 5814 5815 5816 5817 5818 5819 5820 5821 5822 5823 5824 5825 5826 5827 5828 5829 5830 5831 5832 5833 5834 5835 5836 5837 5838 5839 5840 5841 5842 5843 5844 5845 5846 5847 5848 5849 5850 5851 5852 5853 5854 5855 5856 5857 5858 5859 5860 5861 5862 5863 5864 5865 5866 5867 5868 5869 5870 5871 5872 5873 5874 5875 5876 5877 5878 5879 5880 5881 5882 5883 5884 5885 5886 5887 5888 5889 5890 5891 5892 5893 5894 5895 5896 5897 5898 5899 5900 5901 5902 5903 5904 5905 5906 5907 5908 5909 5910 5911 5912 5913 5914 5915 5916 5917 5918 5919 5920 5921 5922 5923 5924 5925 5926 5927 5928 5929 5930 5931 5932 5933 5934 5935 5936 5937 5938 5939 5940 5941 5942 5943 5944 5945 5946 5947 5948 5949 5950 5951 5952 5953 5954 5955 5956 5957 5958 5959 5960 5961 5962 5963 5964 5965 5966 5967 5968 5969 5970 5971 5972 5973 5974 5975 5976 5977 5978 5979 5980 5981 5982 5983 5984 5985 5986 5987 5988 5989 5990 5991 5992 5993 5994 5995 5996 5997 5998 5999 6000 6001 6002 6003 6004 6005 6006 6007 6008 6009 6010 6011 6012 6013 6014 6015 6016 6017 6018 6019 6020 6021 6022 6023 6024 6025 6026 6027 6028 6029 6030 6031 6032 6033 6034 6035 6036 6037 6038 6039 6040 6041 6042 6043 6044 6045 6046 6047 6048 6049 6050 6051 6052 6053 6054 6055 6056 6057 6058 6059 6060 6061 6062 6063 6064 6065 6066 6067 6068 6069 6070 6071 6072 6073 6074 6075 6076 6077 6078 6079 6080 6081 6082 6083 6084 6085 6086 6087 6088 6089 6090 6091 6092 6093 6094 6095 6096 6097 6098 6099 6100 6101 6102 6103 6104 6105 6106 6107 6108 6109 6110 6111 6112 6113 6114 6115 6116 6117 6118 6119 6120 6121 6122 6123 6124 6125 6126 6127 6128 6129 6130 6131 6132 6133 6134 6135 6136 6137 6138 6139 6140 6141 6142 6143 6144 6145 6146 6147 6148 6149 6150 6151 6152 6153 6154 6155 6156 6157 6158 6159 6160 6161 6162 6163 6164 6165 6166 6167 6168 6169 6170 6171 6172 6173 6174 6175 6176 6177 6178 6179 6180 6181 6182 6183 6184 6185 6186 6187 6188 6189 6190 6191 6192 6193 6194 6195 6196 6197 6198 6199 6200 6201 6202 6203 6204 6205 6206 6207 6208 6209 6210 6211 6212 6213 6214 6215 6216 6217 6218 6219 6220 6221 6222 6223 6224 6225 6226 6227 6228 6229 6230 6231 6232 6233 6234 6235 6236 6237 6238 6239 6240 6241 6242 6243 6244 6245 6246 6247 6248 6249 6250 6251 6252 6253 6254 6255 6256 6257 6258 6259 6260 6261 6262 6263 6264 6265 6266 6267 6268 6269 6270 6271 6272 6273 6274 6275 6276 6277 6278 6279 6280 6281 6282 6283 6284 6285 6286 6287 6288 6289 6290 6291 6292 6293 6294 6295 6296 6297 6298 6299 6300 6301 6302 6303 6304 6305 6306 6307 6308 6309 6310 6311 6312 6313 6314 6315 6316 6317 6318 6319 6320 6321 6322 6323 6324 6325 6326 6327 6328 6329 6330 6331 6332 6333 6334 6335 6336 6337 6338 6339 6340 6341 6342 6343 6344 6345 6346 6347 6348 6349 6350 6351 6352 6353 6354 6355 6356 6357 6358 6359 6360 6361 6362 6363 6364 6365 6366 6367 6368 6369 6370 6371 6372 6373 6374 6375 6376 6377 6378 6379 6380 6381 6382 6383 6384 6385 6386 6387 6388 6389 6390 6391 6392 6393 6394 6395 6396 6397 6398 6399 6400 6401 6402 6403 6404 6405 6406 6407 6408 6409 6410 6411 6412 6413 6414 6415 6416 6417 6418 6419 6420 6421 6422 6423 6424 6425 6426 6427 6428 6429 6430 6431 6432 6433 6434 6435 6436 6437 6438 6439 6440 6441 6442 6443 6444 6445 6446 6447 6448 6449 6450 6451 6452 6453 6454 6455 6456 6457 6458 6459 6460 6461 6462 6463 6464 6465 6466 6467 6468 6469 6470 6471 6472 6473 6474 6475 6476 6477 6478 6479 6480 6481 6482 6483 6484 6485 6486 6487 6488 6489 6490 6491 6492 6493 6494 6495 6496 6497 6498 6499 6500 6501 6502 6503 6504 6505 6506 6507 6508 6509 6510 6511 6512 6513 6514 6515 6516 6517 6518 6519 6520 6521 6522 6523 6524 6525 6526 6527 6528 6529 6530 6531 6532 6533 6534 6535 6536 6537 6538 6539 6540 6541 6542 6543 6544 6545 6546 6547 6548 6549 6550 6551 6552 6553 6554 6555 6556 6557 6558 6559 6560 6561 6562 6563 6564 6565 6566 6567 6568 6569 6570 6571 6572 6573 6574 6575 6576 6577 6578 6579 6580 6581 6582 6583 6584 6585 6586 6587 6588 6589 6590 6591 6592 6593 6594 6595 6596 6597 6598 6599 6600 6601 6602 6603 6604 6605 6606 6607 6608 6609 6610 6611 6612 6613 6614 6615 6616 6617 6618 6619 6620 6621 6622 6623 6624 6625 6626 6627 6628 6629 6630 6631 6632 6633 6634 6635 6636 6637 6638 6639 6640 6641 6642 6643 6644 6645 6646 6647 6648 6649 6650 6651 6652 6653 6654 6655 6656 6657 6658 6659 6660 6661 6662 6663 6664 6665 6666 6667 6668 6669 6670 6671 6672 6673 6674 6675 6676 6677 6678 6679 6680 6681 6682 6683 6684 6685 6686 6687 6688 6689 6690 6691 6692 6693 6694 6695 6696 6697 6698 6699 6700 6701 6702 6703 6704 6705 6706 6707 6708 6709 6710 6711 6712 6713 6714 6715 6716 6717 6718 6719 6720 6721 6722 6723 6724 6725 6726 6727 6728 6729 6730 6731 6732 6733 6734 6735 6736 6737 6738 6739 6740 6741 6742 6743 6744 6745 6746 6747 6748 6749 6750 6751 6752 6753 6754 6755 6756 6757 6758 6759 6760 6761 6762 6763 6764 6765 6766 6767 6768 6769 6770 6771 6772 6773 6774 6775 6776 6777 6778 6779 6780 6781 6782 6783 6784 6785 6786 6787 6788 6789 6790 6791 6792 6793 6794 6795 6796 6797 6798 6799 6800 6801 6802 6803 6804 6805 6806 6807 6808 6809 6810 6811 6812 6813 6814 6815 6816 6817 6818 6819 6820 6821 6822 6823 6824 6825 6826 6827 6828 6829 6830 6831 6832 6833 6834 6835 6836 6837 6838 6839 6840 6841 6842 6843 6844 6845 6846 6847 6848 6849 6850 6851 6852 6853 6854 6855 6856 6857 6858 6859 6860 6861 6862 6863 6864 6865 6866 6867 6868 6869 6870 6871 6872 6873 6874 6875 6876 6877 6878 6879 6880 6881 6882 6883 6884 6885 6886 6887 6888 6889 6890 6891 6892 6893 6894 6895 6896 6897 6898 6899 6900 6901 6902 6903 6904 6905 6906 6907 6908 6909 6910 6911 6912 6913 6914 6915 6916 6917 6918 6919 6920 6921 6922 6923 6924 6925 6926 6927 6928 6929 6930 6931 6932 6933 6934 6935 6936 6937 6938 6939 6940 6941 6942 6943 6944 6945 6946 6947 6948 6949 6950 6951 6952 6953 6954 6955 6956 6957 6958 6959 6960 6961 6962 6963 6964 6965 6966 6967 6968 6969 6970 6971 6972 6973 6974 6975 6976 6977 6978 6979 6980 6981 6982 6983 6984 6985 6986 6987 6988 6989 6990 6991 6992 6993 6994 6995 6996 6997 6998 6999 7000 7001 7002 7003 7004 7005 7006 7007 7008 7009 7010 7011 7012 7013 7014 7015 7016 7017 7018 7019 7020 7021 7022 7023 7024 7025 7026 7027 7028 7029 7030 7031 7032 7033 7034 7035 7036 7037 7038 7039 7040 7041 7042 7043 7044 7045 7046 7047 7048 7049 7050 7051 7052 7053 7054 7055 7056 7057 7058 7059 7060 7061 7062 7063 7064 7065 7066 7067 7068 7069 7070 7071 7072 7073 7074 7075 7076 7077 7078 7079 7080 7081 7082 7083 7084 7085 7086 7087 7088 7089 7090 7091 7092 7093 7094 7095 7096 7097 7098 7099 7100 7101 7102 7103 7104 7105 7106 7107 7108 7109 7110 7111 7112 7113 7114 7115 7116 7117 7118 7119 7120 7121 7122 7123 7124 7125 7126 7127 7128 7129 7130 7131 7132 7133 7134 7135 7136 7137 7138 7139 7140 7141 7142 7143 7144 7145 7146 7147 7148 7149 7150 7151 7152 7153 7154 7155 7156 7157 7158 7159 7160 7161 7162 7163 7164 7165 7166 7167 7168 7169 7170 7171 7172 7173 7174 7175 7176 7177 7178 7179 7180 7181 7182 7183 7184 7185 7186 7187 7188 7189 7190 7191 7192 7193 7194 7195 7196 7197 7198 7199 7200 7201 7202 7203 7204 7205 7206 7207 7208 7209 7210 7211 7212 7213 7214 7215 7216 7217 7218 7219 7220 7221 7222 7223 7224 7225 7226 7227 7228 7229 7230 7231 7232 7233 7234 7235 7236 7237 7238 7239 7240 7241 7242 7243 7244 7245 7246 7247 7248 7249 7250 7251 7252 7253 7254 7255 7256 7257 7258 7259 7260 7261 7262 7263 7264 7265 7266 7267 7268 7269 7270 7271 7272 7273 7274 7275 7276 7277 7278 7279 7280 7281 7282 7283 7284 7285 7286 7287 7288 7289 7290 7291 7292 7293 7294 7295 7296 7297 7298 7299 7300 7301 7302 7303 7304 7305 7306 7307 7308 7309 7310 7311 7312 7313 7314 7315 7316 7317 7318 7319 7320 7321 7322 7323 7324 7325 7326 7327 7328 7329 7330 7331 7332 7333 7334 7335 7336 7337 7338 7339 7340 7341 7342 7343 7344 7345 7346 7347 7348 7349 7350 7351 7352 7353 7354 7355 7356 7357 7358 7359 7360 7361 7362 7363 7364 7365 7366 7367 7368 7369 7370 7371 7372 7373 7374 7375 7376 7377 7378 7379 7380 7381 7382 7383 7384 7385 7386 7387 7388 7389 7390 7391 7392 7393 7394 7395 7396 7397 7398 7399 7400 7401 7402 7403 7404 7405 7406 7407 7408 7409 7410 7411 7412 7413 7414 7415 7416 7417 7418 7419 7420 7421 7422 7423 7424 7425 7426 7427 7428 7429 7430 7431 7432 7433 7434 7435 7436 7437 7438 7439 7440 7441 7442 7443 7444 7445 7446 7447 7448 7449 7450 7451 7452 7453 7454 7455 7456 7457 7458 7459 7460 7461 7462 7463 7464 7465 7466 7467 7468 7469 7470 7471 7472 7473 7474 7475 7476 7477 7478 7479 7480 7481 7482 7483 7484 7485 7486 7487 7488 7489 7490 7491 7492 7493 7494 7495 7496 7497 7498 7499 7500 7501 7502 7503 7504 7505 7506 7507 7508 7509 7510 7511 7512 7513 7514 7515 7516 7517 7518 7519 7520 7521 7522 7523 7524 7525 7526 7527 7528 7529 7530 7531 7532 7533 7534 7535 7536 7537 7538 7539 7540 7541 7542 7543 7544 7545 7546 7547 7548 7549 7550 7551 7552 7553 7554 7555 7556 7557 7558 7559 7560 7561 7562 7563 7564 7565 7566 7567 7568 7569 7570 7571 7572 7573 7574 7575 7576 7577 7578 7579 7580 7581 7582 7583 7584 7585 7586 7587 7588 7589 7590 7591 7592 7593 7594 7595 7596 7597 7598 7599 7600 7601 7602 7603 7604 7605 7606 7607 7608 7609 7610 7611 7612 7613 7614 7615 7616 7617 7618 7619 7620 7621 7622 7623 7624 7625 7626 7627 7628 7629 7630 7631 7632 7633 7634 7635 7636 7637 7638 7639 7640 7641 7642 7643 7644 7645 7646 7647 7648 7649 7650 7651 7652 7653 7654 7655 7656 7657 7658 7659 7660 7661 7662 7663 7664 7665 7666 7667 7668 7669 7670 7671 7672 7673 7674 7675 7676 7677 7678 7679 7680 7681 7682 7683 7684 7685 7686 7687 7688 7689 7690 7691 7692 7693 7694 7695 7696 7697 7698 7699 7700 7701 7702 7703 7704 7705 7706 7707 7708 7709 7710 7711 7712 7713 7714 7715 7716 7717 7718 7719 7720 7721 7722 7723 7724 7725 7726 7727 7728 7729 7730 7731 7732 7733 7734 7735 7736 7737 7738 7739 7740 7741 7742 7743 7744 7745 7746 7747 7748 7749 7750 7751 7752 7753 7754 7755 7756 7757 7758 7759 7760 7761 7762 7763 7764 7765 7766 7767 7768 7769 7770 7771 7772 7773 7774 7775 7776 7777 7778 7779 7780 7781 7782 7783 7784 7785 7786 7787 7788 7789 7790 7791 7792 7793 7794 7795 7796 7797 7798 7799 7800 7801 7802 7803 7804 7805 7806 7807 7808 7809 7810 7811 7812 7813 7814 7815 7816 7817 7818 7819 7820 7821 7822 7823 7824 7825 7826 7827 7828 7829 7830 7831 7832 7833 7834 7835 7836 7837 7838 7839 7840 7841 7842 7843 7844 7845 7846 7847 7848 7849 7850 7851 7852 7853 7854 7855 7856 7857 7858 7859 7860 7861 7862 7863 7864 7865 7866 7867 7868 7869 7870 7871 7872 7873 7874 7875 7876 7877 7878 7879 7880 7881 7882 7883 7884 7885 7886 7887 7888 7889 7890 7891 7892 7893 7894 7895 7896 7897 7898 7899 7900 7901 7902 7903 7904 7905 7906 7907 7908 7909 7910 7911 7912 7913 7914 7915 7916 7917 7918 7919 7920 7921 7922 7923 7924 7925 7926 7927 7928 7929 7930 7931 7932 7933 7934 7935 7936 7937 7938 7939 7940 7941 7942 7943 7944 7945 7946 7947 7948 7949 7950 7951 7952 7953 7954 7955 7956 7957 7958 7959 7960 7961 7962 7963 7964 7965 7966 7967 7968 7969 7970 7971 7972 7973 7974 7975 7976 7977 7978 7979 7980 7981 7982 7983 7984 7985 7986 7987 7988 7989 7990 7991 7992 7993 7994 7995 7996 7997 7998 7999 8000 8001 8002 8003 8004 8005 8006 8007 8008 8009 8010 8011 8012 8013 8014 8015 8016 8017 8018 8019 8020 8021 8022 8023 8024 8025 8026 8027 8028 8029 8030 8031 8032 8033 8034 8035 8036 8037 8038 8039 8040 8041 8042 8043 8044 8045 8046 8047 8048 8049 8050 8051 8052 8053 8054 8055 8056 8057 8058 8059 8060 8061 8062 8063 8064 8065 8066 8067 8068 8069 8070 8071 8072 8073 8074 8075 8076 8077 8078 8079 8080 8081 8082 8083 8084 8085 8086 8087 8088 8089 8090 8091 8092 8093 8094 8095 8096 8097 8098 8099 8100 8101 8102 8103 8104 8105 8106 8107 8108 8109 8110 8111 8112 8113 8114 8115 8116 8117 8118 8119 8120 8121 8122 8123 8124 8125 8126 8127 8128 8129 8130 8131 8132 8133 8134 8135 8136 8137 8138 8139 8140 8141 8142 8143 8144 8145 8146 8147 8148 8149 8150 8151 8152 8153 8154 8155 8156 8157 8158 8159 8160 8161 8162 8163 8164 8165 8166 8167 8168 8169 8170 8171 8172 8173 8174 8175 8176 8177 8178 8179 8180 8181 8182 8183 8184 8185 8186 8187 8188 8189 8190 8191 8192 8193 8194 8195 8196 8197 8198 8199 8200 8201 8202 8203 8204 8205 8206 8207 8208 8209 8210 8211 8212 8213 8214 8215 8216 8217 8218 8219 8220 8221 8222 8223 8224 8225 8226 8227 8228 8229 8230 8231 8232 8233 8234 8235 8236 8237 8238 8239 8240 8241 8242 8243 8244 8245 8246 8247 8248 8249 8250 8251 8252 8253 8254 8255 8256 8257 8258 8259 8260 8261 8262 8263 8264 8265 8266 8267 8268 8269 8270 8271 8272 8273 8274 8275 8276 8277 8278 8279 8280 8281 8282 8283 8284 8285 8286 8287 8288 8289 8290 8291 8292 8293 8294 8295 8296 8297 8298 8299 8300 8301 8302 8303 8304 8305 8306 8307 8308 8309 8310 8311 8312 8313 8314 8315 8316 8317 8318 8319 8320 8321 8322 8323 8324 8325 8326 8327 8328 8329 8330 8331 8332 8333 8334 8335 8336 8337 8338 8339 8340 8341 8342 8343 8344 8345 8346 8347 8348 8349 8350 8351 8352 8353 8354 8355 8356 8357 8358 8359 8360 8361 8362 8363 8364 8365 8366 8367 8368 8369 8370 8371 8372 8373 8374 8375 8376 8377 8378 8379 8380 8381 8382 8383 8384 8385 8386 8387 8388 8389 8390 8391 8392 8393 8394 8395 8396 8397 8398 8399 8400 8401 8402 8403 8404 8405 8406 8407 8408 8409 8410 8411 8412 8413 8414 8415 8416 8417 8418 8419 8420 8421 8422 8423 8424 8425 8426 8427 8428 8429 8430 8431 8432 8433 8434 8435 8436 8437 8438 8439 8440 8441 8442 8443 8444 8445 8446 8447 8448 8449 8450 8451 8452 8453 8454 8455 8456 8457 8458 8459 8460 8461 8462 8463 8464 8465 8466 8467 8468 8469 8470 8471 8472 8473 8474 8475 8476 8477 8478 8479 8480 8481 8482 8483 8484 8485 8486 8487 8488 8489 8490 8491 8492 8493 8494 8495 8496 8497 8498 8499 8500 8501 8502 8503 8504 8505 8506 8507 8508 8509 8510 8511 8512 8513 8514 8515 8516 8517 8518 8519 8520 8521 8522 8523 8524 8525 8526 8527 8528 8529 8530 8531 8532 8533 8534 8535 8536 8537 8538 8539 8540 8541 8542 8543 8544 8545 8546 8547 8548 8549 8550 8551 8552 8553 8554 8555 8556 8557 8558 8559 8560 8561 8562 8563 8564 8565 8566 8567 8568 8569 8570 8571 8572 8573 8574 8575 8576 8577 8578 8579 8580 8581 8582 8583 8584 8585 8586 8587 8588 8589 8590 8591 8592 8593 8594 8595 8596 8597 8598 8599 8600 8601 8602 8603 8604 8605 8606 8607 8608 8609 8610 8611 8612 8613 8614 8615 8616 8617 8618 8619 8620 8621 8622 8623 8624 8625 8626 8627 8628 8629 8630 8631 8632 8633 8634 8635 8636 8637 8638 8639 8640 8641 8642 8643 8644 8645 8646 8647 8648 8649 8650 8651 8652 8653 8654 8655 8656 8657 8658 8659 8660 8661 8662 8663 8664 8665 8666 8667 8668 8669 8670 8671 8672 8673 8674 8675 8676 8677 8678 8679 8680 8681 8682 8683 8684 8685 8686 8687 8688 8689 8690 8691 8692 8693 8694 8695 8696 8697 8698 8699 8700 8701 8702 8703 8704 8705 8706 8707 8708 8709 8710 8711 8712 8713 8714 8715 8716 8717 8718 8719 8720 8721 8722 8723 8724 8725 8726 8727 8728 8729 8730 8731 8732 8733 8734 8735 8736 8737 8738 8739 8740 8741 8742 8743 8744 8745 8746 8747 8748 8749 8750 8751 8752 8753 8754 8755 8756 8757 8758 8759 8760 8761 8762 8763 8764 8765 8766 8767 8768 8769 8770 8771 8772 8773 8774 8775 8776 8777 8778 8779 8780 8781 8782 8783 8784 8785 8786 8787 8788 8789 8790 8791 8792 8793 8794 8795 8796 8797 8798 8799 8800 8801 8802 8803 8804 8805 8806 8807 8808 8809 8810 8811 8812 8813 8814 8815 8816 8817 8818 8819 8820 8821 8822 8823 8824 8825 8826 8827 8828 8829 8830 8831 8832 8833 8834 8835 8836 8837 8838 8839 8840 8841 8842 8843 8844 8845 8846 8847 8848 8849 8850 8851 8852 8853 8854 8855 8856 8857 8858 8859 8860 8861 8862 8863 8864 8865 8866 8867 8868 8869 8870 8871 8872 8873 8874 8875 8876 8877 8878 8879 8880 8881 8882 8883 8884 8885 8886 8887 8888 8889 8890 8891 8892 8893 8894 8895 8896 8897 8898 8899 8900 8901 8902 8903 8904 8905 8906 8907 8908 8909 8910 8911 8912 8913 8914 8915 8916 8917 8918 8919 8920 8921 8922 8923 8924 8925 8926 8927 8928 8929 8930 8931 8932 8933 8934 8935 8936 8937 8938 8939 8940 8941 8942 8943 8944 8945 8946 8947 8948 8949 8950 8951 8952 8953 8954 8955 8956 8957 8958 8959 8960 8961 8962 8963 8964 8965 8966 8967 8968 8969 8970 8971 8972 8973 8974 8975 8976 8977 8978 8979 8980 8981 8982 8983 8984 8985 8986 8987 8988 8989 8990 8991 8992 8993 8994 8995 8996 8997 8998 8999 9000 9001 9002 9003 9004 9005 9006 9007 9008 9009 9010 9011 9012 9013 9014 9015 9016 9017 9018 9019 9020 9021 9022 9023 9024 9025 9026 9027 9028 9029 9030 9031 9032 9033 9034 9035 9036 9037 9038 9039 9040 9041 9042 9043 9044 9045 9046 9047 9048 9049 9050 9051 9052 9053 9054 9055 9056 9057 9058 9059 9060 9061 9062 9063 9064 9065 9066 9067 9068 9069 9070 9071 9072 9073 9074 9075 9076 9077 9078 9079 9080 9081 9082 9083 9084 9085 9086 9087 9088 9089 9090 9091 9092 9093 9094 9095 9096 9097 9098 9099 9100 9101 9102 9103 9104 9105 9106 9107 9108 9109 9110 9111 9112 9113 9114 9115 9116 9117 9118 9119 9120 9121 9122 9123 9124 9125 9126 9127 9128 9129 9130 9131 9132 9133 9134 9135 9136 9137 9138 9139 9140 9141 9142 9143 9144 9145 9146 9147 9148 9149 9150 9151 9152 9153 9154 9155 9156 9157 9158 9159 9160 9161 9162 9163 9164 9165 9166 9167 9168 9169 9170 9171 9172 9173 9174 9175 9176 9177 9178 9179 9180 9181 9182 9183 9184 9185 9186 9187 9188 9189 9190 9191 9192 9193 9194 9195 9196 9197 9198 9199 9200 9201 9202 9203 9204 9205 9206 9207 9208 9209 9210 9211 9212 9213 9214 9215 9216 9217 9218 9219 9220 9221 9222 9223 9224 9225 9226 9227 9228 9229 9230 9231 9232 9233 9234 9235 9236 9237 9238 9239 9240 9241 9242 9243 9244 9245 9246 9247 9248 9249 9250 9251 9252 9253 9254 9255 9256 9257 9258 9259 9260 9261 9262 9263 9264 9265 9266 9267 9268 9269 9270 9271 9272 9273 9274 9275 9276 9277 9278 9279 9280 9281 9282 9283 9284 9285 9286 9287 9288 9289 9290 9291 9292 9293 9294 9295 9296 9297 9298 9299 9300 9301 9302 9303 9304 9305 9306 9307 9308 9309 9310 9311 9312 9313 9314 9315 9316 9317 9318 9319 9320 9321 9322 9323 9324 9325 9326 9327 9328 9329 9330 9331 9332 9333 9334 9335 9336 9337 9338 9339 9340 9341 9342 9343 9344 9345 9346 9347 9348 9349 9350 9351 9352 9353 9354 9355 9356 9357 9358 9359 9360 9361 9362 9363 9364 9365 9366 9367 9368 9369 9370 9371 9372 9373 9374 9375 9376 9377 9378 9379 9380 9381 9382 9383 9384 9385 9386 9387 9388 9389 9390 9391 9392 9393 9394 9395 9396 9397 9398 9399 9400 9401 9402 9403 9404 9405 9406 9407 9408 9409 9410 9411 9412 9413 9414 9415 9416 9417 9418 9419 9420 9421 9422 9423 9424 9425 9426 9427 9428 9429 9430 9431 9432 9433 9434 9435 9436 9437 9438 9439 9440 9441 9442 9443 9444 9445 9446 9447 9448 9449 9450 9451 9452 9453 9454 9455 9456 9457 9458 9459 9460 9461 9462 9463 9464 9465 9466 9467 9468 9469 9470 9471 9472 9473 9474 9475 9476 9477 9478 9479 9480 9481 9482 9483 9484 9485 9486 9487 9488 9489 9490 9491 9492 9493 9494 9495 9496 9497 9498 9499 9500 9501 9502 9503 9504 9505 9506 9507 9508 9509 9510 9511 9512 9513 9514 9515 9516 9517 9518 9519 9520 9521 9522 9523 9524 9525 9526 9527 9528 9529 9530 9531 9532 9533 9534 9535 9536 9537 9538 9539 9540 9541 9542 9543 9544 9545 9546 9547 9548 9549 9550 9551 9552 9553 9554 9555 9556 9557 9558 9559 9560 9561 9562 9563 9564 9565 9566 9567 9568 9569 9570 9571 9572 9573 9574 9575 9576 9577 9578 9579 9580 9581 9582 9583 9584 9585 9586 9587 9588 9589 9590 9591 9592 9593 9594 9595 9596 9597 9598 9599 9600 9601 9602 9603 9604 9605 9606 9607 9608 9609 9610 9611 9612 9613 9614 9615 9616 9617 9618 9619 9620 9621 9622 9623 9624 9625 9626 9627 9628 9629 9630 9631 9632 9633 9634 9635 9636 9637 9638 9639 9640 9641 9642 9643 9644 9645 9646 9647 9648 9649 9650 9651 9652 9653 9654 9655 9656 9657 9658 9659 9660 9661 9662 9663 9664 9665 9666 9667 9668 9669 9670 9671 9672 9673 9674 9675 9676 9677 9678 9679 9680 9681 9682 9683 9684 9685 9686 9687 9688 9689 9690 9691 9692 9693 9694 9695 9696 9697 9698 9699 9700 9701 9702 9703 9704 9705 9706 9707 9708 9709 9710 9711 9712 9713 9714 9715 9716 9717 9718 9719 9720 9721 9722 9723 9724 9725 9726 9727 9728 9729 9730 9731 9732 9733 9734 9735 9736 9737 9738 9739 9740 9741 9742 9743 9744 9745 9746 9747 9748 9749 9750 9751 9752 9753 9754 9755 9756 9757 9758 9759 9760 9761 9762 9763 9764 9765 9766 9767 9768 9769 9770 9771 9772 9773 9774 9775 9776 9777 9778 9779 9780 9781 9782 9783 9784 9785 9786 9787 9788 9789 9790 9791 9792 9793 9794 9795 9796 9797 9798 9799 9800 9801 9802 9803 9804 9805 9806 9807 9808 9809 9810 9811 9812 9813 9814 9815 9816 9817 9818 9819 9820 9821 9822 9823 9824 9825 9826 9827 9828 9829 9830 9831 9832 9833 9834 9835 9836 9837 9838 9839 9840 9841 9842 9843 9844 9845 9846 9847 9848 9849 9850 9851 9852 9853 9854 9855 9856 9857 9858 9859 9860 9861 9862 9863 9864 9865 9866 9867 9868 9869 9870 9871 9872 9873 9874 9875 9876 9877 9878 9879 9880 9881 9882 9883 9884 9885 9886 9887 9888 9889 9890 9891 9892 9893 9894 9895 9896 9897 9898 9899 9900 9901 9902 9903 9904 9905 9906 9907 9908 9909 9910 9911 9912 9913 9914 9915 9916 9917 9918 9919 9920 9921 9922 9923 9924 9925 9926 9927 9928 9929 9930 9931 9932 9933 9934 9935 9936 9937 9938 9939 9940 9941 9942 9943 9944 9945 9946 9947 9948 9949 9950 9951 9952 9953 9954 9955 9956 9957 9958 9959 9960 9961 9962 9963 9964 9965 9966 9967 9968 9969 9970 9971 9972 9973 9974 9975 9976 9977 9978 9979 9980 9981 9982 9983 9984 9985 9986 9987 9988 9989 9990 9991 9992 9993 9994 9995 9996 9997 9998 9999 10000 10001 10002 10003 10004 10005 10006 10007 10008 10009 10010 10011 10012 10013 10014 10015 10016 10017 10018 10019 10020 10021 10022 10023 10024 10025 10026 10027 10028 10029 10030 10031 10032 10033 10034 10035 10036 10037 10038 10039 10040 10041 10042 10043 10044 10045 10046 10047 10048 10049 10050 10051 10052 10053 10054 10055 10056 10057 10058 10059 10060 10061 10062 10063 10064 10065 10066 10067 10068 10069 10070 10071 10072 10073 10074 10075 10076 10077 10078 10079 10080 10081 10082 10083 10084 10085 10086 10087 10088 10089 10090 10091 10092 10093 10094 10095 10096 10097 10098 10099 10100 10101 10102 10103 10104 10105 10106 10107 10108 10109 10110 10111 10112 10113 10114 10115 10116 10117 10118 10119 10120 10121 10122 10123 10124 10125 10126 10127 10128 10129 10130 10131 10132 10133 10134 10135 10136 10137 10138 10139 10140 10141 10142 10143 10144 10145 10146 10147 10148 10149 10150 10151 10152 10153 10154 10155 10156 10157 10158 10159 10160 10161 10162 10163 10164 10165 10166 10167 10168 10169 10170 10171 10172 10173 10174 10175 10176 10177 10178 10179 10180 10181 10182 10183 10184 10185 10186 10187 10188 10189 10190 10191 10192 10193 10194 10195 10196 10197 10198 10199 10200 10201 10202 10203 10204 10205 10206 10207 10208 10209 10210 10211 10212 10213 10214 10215 10216 10217 10218 10219 10220 10221 10222 10223 10224 10225 10226 10227 10228 10229 10230 10231 10232 10233 10234 10235 10236 10237 10238 10239 10240 10241 10242 10243 10244 10245 10246 10247 10248 10249 10250 10251 10252 10253 10254 10255 10256 10257 10258 10259 10260 10261 10262 10263 10264 10265 10266 10267 10268 10269 10270 10271 10272 10273 10274 10275 10276 10277 10278 10279 10280 10281 10282 10283 10284 10285 10286 10287 10288 10289 10290 10291 10292 10293 10294 10295 10296 10297 10298 10299 10300 10301 10302 10303 10304 10305 10306 10307 10308 10309 10310 10311 10312 10313 10314 10315 10316 10317 10318 10319 10320 10321 10322 10323 10324 10325 10326 10327 10328 10329 10330 10331 10332 10333 10334 10335 10336 10337 10338 10339 10340 10341 10342 10343 10344 10345 10346 10347 10348 10349 10350 10351 10352 10353 10354 10355 10356 10357 10358 10359 10360 10361 10362 10363 10364 10365 10366 10367 10368 10369 10370 10371 10372 10373 10374 10375 10376 10377 10378 10379 10380 10381 10382 10383 10384 10385 10386 10387 10388 10389 10390 10391 10392 10393 10394 10395 10396 10397 10398 10399 10400 10401 10402 10403 10404 10405 10406 10407 10408 10409 10410 10411 10412 10413 10414 10415 10416 10417 10418 10419 10420 10421 10422 10423 10424 10425 10426 10427 10428 10429 10430 10431 10432 10433 10434 10435 10436 10437 10438 10439 10440 10441 10442 10443 10444 10445 10446 10447 10448 10449 10450 10451 10452 10453 10454 10455 10456 10457 10458 10459 10460 10461 10462 10463 10464 10465 10466 10467 10468 10469 10470 10471 10472 10473 10474 10475 10476 10477 10478 10479 10480 10481 10482 10483 10484 10485 10486 10487 10488 10489 10490 10491 10492 10493 10494 10495 10496 10497 10498 10499 10500 10501 10502 10503 10504 10505 10506 10507 10508 10509 10510 10511 10512 10513 10514 | #!/usr/bin/perl -w
# PerlPrimer
# Designs primers for PCR, Bisulphite PCR, QPCR (Realtime), and Sequencing
# version 1.1.21 (21 Nov 2011)
# Copyright © 2003-2011, Owen Marshall
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or (at
# your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
# USA
use strict;
#---------------#
# Usage message #
#---------------#
my ($version, $commandline, $win_exe);
BEGIN {
$version = "1.1.21";
$win_exe = 0;
($commandline) = @ARGV;
if ($commandline && $commandline =~ /^-[\w-]+/) {
print <<EOT;
PerlPrimer v$version
Designs primers for PCR, Bisulphite PCR, QPCR (Realtime), and Sequencing
Copyright © 2003-2011 Owen Marshall\n
Usage: perlprimer.pl [file.ppr]\n
EOT
exit 0;
}
# Usage message for the Win32 dos box for the exe version:
if ($win_exe) {
print <<EOT;
PerlPrimer v$version
Copyright © 2003-2011 Owen Marshall
Designs primers for PCR, Bisulphite PCR, QPCR (Realtime), and Sequencing
This window is required for PerlPrimer to run -
you may minimise it but please do not close it
Please wait while PerlPrimer loads ...
EOT
}
}
#---------------#
# Load packages #
#---------------#
my $failed_packages;
BEGIN {
# A modular package checking routine ...
# ($failed_packages is used by the check_packages() subroutine)
$failed_packages = " "; # check_packages gives errors if undefined
my $warning;
my $eval_sub = sub {
eval $_;
if ($@) {
/(use|require)\s*([\w:\-\(\)]+)\;/;
my $package = $2;
$failed_packages .= " $package ";
# Special circumstances!
return if $package eq "Benchmark";
return if $package eq "File::Copy";
return if $package eq "Win32::GUI()";
# Print warning header if not already printed
unless ($warning) {
print "PerlPrimer v$version\nCopyright © 2003-2011 Owen Marshall\n\n";
$warning = 1;
}
# Print specific warning messages to alert the user that modules are missing
if ($package eq "Tk") {
print "Error: Perl/Tk not found!\nPerlPrimer requires Perl/Tk to run - please download from CPAN (http://cpan.org) and install before running.\n\n";
exit 0;
} elsif ($1 eq "require") {
print "Error: $package not found!\nPerlPrimer requires $package to run - please download from CPAN (http://cpan.org) and install before running.\n\n";
exit 0;
}
print "Warning: PerlPrimer requires $package for full functionality\n- some features may be disabled.\n$package should be obtainable from CPAN (http://cpan.org)\n\n";
}
};
foreach (split("\n","
use Tk;
use Benchmark;
use HTTP::Request;
use LWP::UserAgent;
use IO::Socket;
use Win32::GUI();
use File::Copy;
use File::Glob ':glob';
require Tk::NoteBook;
require Tk::HList;
require Tk::ItemStyle;
require Tk::Dialog;
require Tk::LabFrame;
require Tk::ROText;
require Tk::Balloon;
require Tk::BrowseEntry;
require Tk::DirTree;
")) {&$eval_sub($_)};
}
#------------------------------------------------------------------#
# Primer pair storage code for two dimensional array @primer_pair: #
#------------------------------------------------------------------#
# @primer_pair[index][see below]:
#
# 0. primer_f
# 1. pos_f
# 2. window_length_f
# 3. Tm_f
#
# 4. primer_r
# 5. pos_r
# 6. window_length_r
# 7. Tm_r
# 8. real_pos_r
#
# 9. amplicon_size
# 10. deltaG of most stable extensible primer-dimer
# 11. [primer_f sequence pre-conversion for Bisulphite PCR]
# 12. [primer_r sequence pre-conversion for Bisulphite PCR]
# 13. deltaG of most stable non-extensible primer-dimer
# Load thermodynamic data and genetic code...
my (%oligo_dH, %oligo_dH_full, %oligo_dS, %oligo_dS_full, %genetic_code);
load_data();
# Starting ionic concentration variables
my $oligo_conc = 200; #in nM
my $mg_conc=1.5; #in mM
my $monovalent_cation_conc=50; #in mM
my $dntp_conc=0.2; #in mM
# Default primer variables
my $max_tm_pr=63; # standard PCR
my $min_tm_pr=57;
my $max_diff_pr=3;
my $pri_win_min_pr=20;
my $pri_win_max_pr=24;
my $exclude_gc=1;
my $exclude_clamp=1;
my $max_tm_bs=65; # bisulphite PCR
my $min_tm_bs=55;
my $max_diff_bs=5;
my $pri_win_min_bs=25;
my $pri_win_max_bs=30;
my $bisul_min_c=30;
my $pre_bs=1;
my $exclude_3c=1;
my $exclude_cpg=0;
my $max_tm_q=62; # QPCR
my $min_tm_q=58;
my $max_diff_q=2;
my $pri_win_min_q=20;
my $pri_win_max_q=24;
my $min_ampsize_q=100;
my $max_ampsize_q=300;
my $ie_overlap=1;
my $exclude_ie=7;
my $ie_span=1;
my $min_tm_seq = 56; # Sequencing
my $max_tm_seq = 64;
my $pri_win_min_seq = 20;
my $pri_win_max_seq = 24;
my $seq_spacing_min = 500;
my $seq_spacing_max = 700;
my $exclude_gc_seq = 1;
my $exclude_clamp_seq = 1;
my $exclude_pd_seq = 1;
my $seq_pd_min = 5;
# Establish default varibles for opening a new file - perhaps a bit verbose
# but it is rather neat ...
my %default_variables = (
pd => {
\$min_tm_pr => $min_tm_pr,
\$max_tm_pr => $max_tm_pr,
\$max_diff_pr => $max_diff_pr,
\$pri_win_min_pr => $pri_win_min_pr,
\$pri_win_max_pr => $pri_win_max_pr,
\$exclude_gc => $exclude_gc,
\$exclude_clamp => $exclude_clamp,
},
seq => {
\$min_tm_seq => $min_tm_seq,
\$max_tm_seq => $max_tm_seq,
\$pri_win_min_seq => $pri_win_min_seq,
\$pri_win_max_seq => $pri_win_max_seq,
\$seq_spacing_min => $seq_spacing_min,
\$seq_spacing_max => $seq_spacing_max,
\$exclude_gc_seq => $exclude_gc_seq,
\$exclude_clamp_seq => $exclude_clamp_seq,
\$exclude_pd_seq => $exclude_pd_seq,
\$seq_pd_min => $seq_pd_min,
},
bis => {
\$min_tm_bs => $min_tm_bs,
\$max_tm_bs => $max_tm_bs,
\$max_diff_bs => $max_diff_bs,
\$pri_win_min_bs => $pri_win_min_bs,
\$pri_win_max_bs => $pri_win_max_bs,
\$exclude_cpg => $exclude_cpg,
\$pre_bs => $pre_bs,
\$exclude_3c => $exclude_3c,
\$bisul_min_c => $bisul_min_c,
},
qpcr => {
\$min_tm_q => $min_tm_q,
\$max_tm_q, => $max_tm_q,
\$max_diff_q => $max_diff_q,
\$pri_win_min_q => $pri_win_min_q,
\$pri_win_max_q => $pri_win_max_q,
\$min_ampsize_q => $min_ampsize_q,
\$max_ampsize_q => $max_ampsize_q,
\$exclude_gc => $exclude_gc,
\$exclude_clamp => $exclude_clamp,
\$ie_overlap => $ie_overlap,
\$exclude_ie => $exclude_ie,
\$ie_span => $ie_span,
},
);
# Home environment variables and OS-specific tweaking:
# These variables are the total changes required for nice cross-platform compatibility
# (and most of these are cosmetic - strange that the Tk look&feel is not consistent with
# things such as widget spacing, most notably the checkbuttons)
my $HOME = $ENV{HOME} || $ENV{HOMEPATH}; # HOMEPATH may not work correctly on Win32 ...
my $tmp = $ENV{TEMP} || $ENV{TMP};
my ($dir_sep, $os, $gui_font_face, $gui_font_size, $text_font_face, $text_font_size, $list_font_face, $list_font_size, $font_override, $menu_relief, $frame_pady, $check_pady, $button_pady, $button_pack_padx, $button_pack_pady, $browser);
if ($^O =~ /mswin/i) {
# MS Windows OS
$os = 'win';
$browser = 'c:\Program Files\Internet Explorere\iexplore';
$HOME ||= 'c:\\'; # only if not set by $ENV above
$tmp ||= 'c:\temp\\'; # only if not set by $ENV above
$dir_sep = '\\';
$gui_font_face = "Arial";
$gui_font_size = 8;
$list_font_face = "Verdana";
$list_font_size = 7;
$text_font_face = "Courier";
$text_font_size = 8;
$menu_relief = 'flat';
$button_pady = 1;
$button_pack_padx = 2;
$button_pack_pady = 2;
$frame_pady = 2;
$check_pady = 0;
} else {
# *nix OS
$os = 'nix';
$browser = 'firefox';
$HOME ||= (getpwuid($<))[7].'/'; # only if not set above
$tmp = '/tmp/'; # only if not set above
$dir_sep = '/';
$gui_font_face = "Helvetica";
$gui_font_size = 10;
$list_font_face = "Helvetica";
$list_font_size = 10;
$text_font_face = "Courier";
$text_font_size = 10;
$menu_relief = 'raised';
$button_pady = 2;
$button_pack_padx = 0;
$button_pack_pady = 0;
$frame_pady = 1;
$check_pady = 3;
}
# check tmp directory exists, is user readable and writable,
# else use the home directory
$tmp = $HOME unless (-e $tmp && -r $tmp && -w $tmp);
# check directories have trailing slash ...
$tmp = check_path($tmp);
$HOME = check_path($HOME);
# directory the program has been run in (for RE enzyme database)
my $program_directory = $0;
$program_directory =~ s/([^\\\/]*$)//;
# flags
my $bs=0;
my $qpcr_flag=0;
my $cancel=0;
my $defer_to_caps=0;
# benchmarking - for code optimisation
my $benchmark=0;
# DNA canvas sizing:
my $dna_canvas_offset=15;
my $dna_canvas_height=21;
my $dna_canvas_middle=int($dna_canvas_height/2)+2;
my $half_dna_size=3;
my $dc_dna_y1 = $dna_canvas_middle - $half_dna_size;
my $dc_dna_y2 = $dna_canvas_middle + $half_dna_size;
my $dc_selection_offset = 3;
my $dc_sel_y1 = $dc_dna_y1-$dc_selection_offset;
my $dc_sel_y2 = $dc_dna_y2+$dc_selection_offset;
my $dc_sel_offset2 = 2;
# Repeats/runs
my $exclude_rr = 1;
my $repeat = 3;
my $run = 4;
my $exclude_rr_bs = 1;
my $repeat_bs = 3;
my $run_bs = 4;
# %GC exclusions
my $max_gc = 60;
my $min_gc = 40;
# CpG prediction variables
my $cpg_window = 200;
my $min_cpg_island = 200;
my $cpg_gc = 50;
my $cpg_oe = 0.6;
my $cpgplot_method = 0;
# Http proxy
my $use_proxy = 0;
my ($http_proxy, $http_port);
# Ensembl data
my $ensembl; # GUI page
my $ensembl_gene;
my $ensembl_organism = 'Homo_sapiens';
my $ensembl_type = 'cdna';
my @ensembl_species = split("\n",
"Homo_sapiens
Mus_musculus
Danio_rerio
Drosophila_melanogaster
Caenorhabditis_elegans
Saccharomyces_cerevisiae
---- Primates ----
Otolemur_garnettii
Pan_troglodytes
Gorilla_gorilla
Homo_sapiens
Macaca_mulatta
Callithrix_jacchus
Microcebus_murinus
Pongo_pygmaeus
Tarsius_syrichta
---- Rodents etc. ----
Cavia_porcellus
Dipodomys_ordii
Mus_musculus
Ochotona_princeps
Oryctolagus_cuniculus
Rattus_norvegicus
Spermophilus_tridecemlineatus
Tupaia_belangeri
---- Laurasiatheria ----
Vicugna_pacos
Felis_catus
Bos_taurus
Canis_familiaris
Tursiops_truncatus
Erinaceus_europaeus
Equus_caballus
Pteropus_vampyrus
Myotis_lucifugus
Sus_scrofa
Sorex_araneus
---- Afrotheria ----
Loxodonta_africana
Procavia_capensis
Echinops_telfairi
---- Xenarthra ----
Dasypus_novemcinctus
Choloepus_hoffmanni
---- Other mammals ----
Monodelphis_domestica
Ornithorhynchus_anatinus
Macropus_eugenii
---- Birds & Reptiles ----
Anolis_carolinensis
Gallus_gallus
Taeniopygia_guttata
---- Amphibians ----
Xenopus_tropicalis
---- Fish ----
Takifugu_rubripes
Oryzias_latipes
Gasterosteus_aculeatus
Tetraodon_nigroviridis
Danio_rerio
---- Other chordates ----
Ciona_intestinalis
Ciona_savignyi
---- Other eukaryotes ----
Aedes_aegypti
Anopheles_gambiae
Apis_mellifera
Caenorhabditis_elegans
Drosophila_melanogaster
Aspergillus_nidulans
Saccharomyces_cerevisiae
Schizosaccharomyces_pombe");
my @ensembl_types = split("\n",
"genomic
cdna
coding
utr5
utr3");
# BLAST search parameters
my $blast_expect = 10;
my $blast_word_size = 7;
my $blast_database = 'nr';
my @blast_database_array = split("\n",
"nr
est
est_human
est_mouse
est_others
gss
htgs
pat
yeast
mito
vector
pdb
month
alu
dbsts
chromosome
E. coli
Drosophila genome");
my $blast_entrez_query = 'none';
my @blast_entrez_array = split("\n",
"none
-------------------
Viruses [ORGN]
Archaea [ORGN]
Bacteria [ORGN]
Eukaryota [ORGN]
Viridiplantae [ORGN]
Fungi [ORGN]
Metazoa [ORGN]
Arthropoda [ORGN]
Vertebrata [ORGN]
Mammalia [ORGN]
Rodentia [ORGN]
Primates [ORGN]
-------------------
Aeropyrum pernix [ORGN]
Aquifex aeolicus [ORGN]
Arabidopsis thaliana [ORGN]
Bacillus subtilis [ORGN]
Bos taurus [ORGN]
Caenorhabditis elegans [ORGN]
Danio rerio [ORGN]
Dictyostelium discoideum [ORGN]
Drosophila melanogaster [ORGN]
Escherichia coli [ORGN]
Gallus gallus [ORGN]
Homo sapiens [ORGN]
Human immunodeficiency virus type 1 [ORGN]
Methanococcus jannaschii [ORGN]
Mus musculus [ORGN]
Oryctolagus cuniculus [ORGN]
Oryza sativa [ORGN]
Ovis aries [ORGN]
Plasmodium falciparum [ORGN]
Rattus norvegicus [ORGN]
Saccharomyces cerevisiae [ORGN]
Schizosaccharomyces pombe [ORGN]
Simian immunodeficiency virus [ORGN]
Synechocystis PCC6803 [ORGN]
Takifugu rubripes [ORGN]
Xenopus laevis [ORGN]
Zea mays [ORGN]");
my $local_blast = 0;
my $local_blast_directory = $HOME;
my $local_blast_database;
my $blast_count;
my $http_abort;
# Primer-dimer parameters
# my $pd_full=0;
my $pd_extensible=1;
my $pd_temperature=37;
# Restriction enzyme cloning sequence parameters
my $cloning_anchor = "GCGCGC";
my $simple_sites = 1;
my $exclude_found_sites = 1;
# IPC using TCP sockets (with Contig Viewer)
my $file_data_overwrite = 1;
my $ipc_autofind = 0;
my $tcp_port = 2500;
my $socket_polling_interval = 1000; # msec
# Header columns
my @header_list_primers = split("\n",
"Forward Primer
Pos
Len
Tm
Reverse Primer
Pos
Len
Tm
Amp
Ext. dimer dG
Full dimer dG");
# Mouse wheel
my $scroll_factor = 2;
# Win32 only - for button pre-lights
my $activebackground_color="#ffffff";
# Spidey details
my (%spidey_exec);
my $spidey_path = "$HOME";
# search for spidey in program directory
my @spidey_files = glob("$program_directory*pidey.*");
@spidey_files = glob("$program_directory*pidey*") unless @spidey_files;
if (@spidey_files) {
$spidey_path = "$program_directory";
}
# my $spidey_out;
# More global variables
my (
$primer_f, $primer_r, $pos,
$rprimer_r,
$pd, @score_sort, $reverse,
$pfkeys, $pkeys, @PF, @PR, %primer_hash,
$gc_exclude, $gc_percent_ex, @primer_pairs,
$prl, $pfl, $pl, @bind_string, %rating_hash, @score,
%packed_widgets,
$save_seq, $save_seq2,
@primer_pairs_pr_s, @primer_pairs_seq_s, @primer_pairs_bs_s, @primer_pairs_q_s, @save_selection,
@intron_exon_bounds, $ie_limit, $ie_limit_5p, $ie_limit_3p,
$primer_seq_5f, $primer_seq_5r, $primer_seq_5f_frame, $primer_seq_5r_frame,
$primer_seq_5f_atg, $primer_seq_5r_atg,
);
my (
$min_ampsize_pr, $max_ampsize_pr, $max_range_5p_pr, $min_range_pr, $max_range_pr, $max_range_3p_pr,
$min_range_seq, $max_range_seq,
$min_ampsize_bs, $max_ampsize_bs, $max_range_5p_bs, $min_range_bs, $max_range_bs, $max_range_3p_bs,
$max_range_5p_q, $min_range_q, $max_range_q, $max_range_3p_q,
);
# GUI globals
my (
%prr, %prc, %pre, %prb, %prl, %prf,
$fprimer, $fprimer_tm, $fprimer_len, $fprimer_ds, $fprimer_dh, $fprimer_dg, $fprimer_gc,
$rprimer, $rprimer_tm, $rprimer_len, $rprimer_ds, $rprimer_dh, $rprimer_dg, $rprimer_gc,
$old_reference, $text_widget_ref,
$style_primer, $style_tm,
%min_amp_canvas, %max_amp_canvas, %min_range_canvas, %max_range_canvas,
$flag, $rid_get, @blast_results_1, @blast_results_2, @blast_results_3, $rptid, $blast_status,
$popup_sort, $popup_sort_seq,
$stored_page,
$forward_re_site, $reverse_re_site,
);
# GUI dialogues
my (
$blast_d, $view_base, $prefs, $ack_d, $canvas_info_d, $info_d,
$cloning_d, $view_ie,
);
my $balloon_help = 1;
# Recently used files
my @mru;
my $mru_number = 8;
# Define the perlprimer recognised filetypes
my $file_types = [
['PerlPrimer Files', '.ppr'],
['Fasta Files', '.fasta'],
['All Files', '*']
];
my $file_types_dna = [
['Fasta Files', '.fasta'],
['Text Files', '.txt'],
['All Files', '*']
];
my $file_types_text = [
['Text Files', '.txt'],
['All Files', '*']
];
# Open file hash (for writing reports)
my %open_file;
for my $i (qw(pd seq bis qpcr)) {
$open_file{$i} = "File not saved"
}
# Variable/array hashes for opening and saving
my %variables = (
pd => {
mintm => \$min_tm_pr,
maxtm => \$max_tm_pr,
maxdiff => \$max_diff_pr,
minwin => \$pri_win_min_pr,
maxwin => \$pri_win_max_pr,
minamp => \$min_ampsize_pr,
maxamp => \$max_ampsize_pr,
maxrange5p => \$max_range_5p_pr,
minrange => \$min_range_pr,
maxrange => \$max_range_pr,
maxrange3p => \$max_range_3p_pr,
exclude_gc => \$exclude_gc,
gc_clamp => \$exclude_clamp,
seq => \$save_seq,
primer_seq_5f => \$primer_seq_5f,
primer_seq_5f_frame => \$primer_seq_5f_frame,
primer_seq_5r => \$primer_seq_5r,
primer_seq_5r_frame => \$primer_seq_5r_frame,
},
seq => {
mintm => \$min_tm_seq,
maxtm => \$max_tm_seq,
minwin => \$pri_win_min_seq,
maxwin => \$pri_win_max_seq,
minrange => \$min_range_seq,
maxrange => \$max_range_seq,
seq_spacing_min => \$seq_spacing_min,
seq_spacing_max => \$seq_spacing_max,
exclude_gc => \$exclude_gc_seq,
gc_clamp => \$exclude_clamp_seq,
exclude_pd => \$exclude_pd_seq,
seq_pd_min => \$seq_pd_min,
seq => \$save_seq,
},
bis => {
mintm => \$min_tm_bs,
maxtm => \$max_tm_bs,
maxdiff => \$max_diff_bs,
minwin => \$pri_win_min_bs,
maxwin => \$pri_win_max_bs,
minamp => \$min_ampsize_bs,
maxamp => \$max_ampsize_bs,
maxrange5p => \$max_range_5p_bs,
minrange => \$min_range_bs,
maxrange => \$max_range_bs,
maxrange3p => \$max_range_3p_bs,
exclude_cpg => \$exclude_cpg,
rrpostconv => \$pre_bs,
exclude_cs => \$exclude_3c,
min_c => \$bisul_min_c,
seq => \$save_seq,
},
qpcr => {
mintm => \$min_tm_q,
maxtm => \$max_tm_q,
maxdiff => \$max_diff_q,
minwin => \$pri_win_min_q,
maxwin => \$pri_win_max_q,
minamp => \$min_ampsize_q,
maxamp => \$max_ampsize_q,
exclude_gc => \$exclude_gc,
gc_clamp => \$exclude_clamp,
mrna_seq => \$save_seq,
dna_seq => \$save_seq2,
ie_overlap => \$ie_overlap,
exclude_ie => \$exclude_ie,
ie_limit => \$ie_limit,
ie_limit_5p => \$ie_limit_5p,
ie_limit_3p => \$ie_limit_3p,
ie_span => \$ie_span,
},
);
my %arrays = (
pd => {
res => \@primer_pairs_pr_s,
selection => \@save_selection,
},
seq => {
res => \@primer_pairs_seq_s,
selection => \@save_selection,
},
bis => {
res => \@primer_pairs_bs_s,
selection => \@save_selection,
},
qpcr => {
res => \@primer_pairs_q_s,
selection => \@save_selection,
intron_exon => \@intron_exon_bounds,
},
);
# Hash for opening/saving prefs
my %pref_variables = (
# home => \$HOME,
browser => \$browser,
tmp => \$tmp,
spidey_path => \$spidey_path,
repeats => \$repeat,
runs => \$run,
exclude_rr => \$exclude_rr,
repeats_bs => \$repeat_bs,
runs_bs => \$run_bs,
exclude_rr_bs => \$exclude_rr_bs,
max_gc => \$max_gc,
min_gc => \$min_gc,
mg_conc => \$mg_conc,
monovalent_cation_conc => \$monovalent_cation_conc,
dNTP_conc => \$dntp_conc,
oligo_conc => \$oligo_conc,
cpg_window => \$cpg_window,
min_cpg_island => \$min_cpg_island,
cpg_gc_percent => \$cpg_gc,
cpg_observed_expected => \$cpg_oe,
balloon_help => \$balloon_help,
blast_database => \$blast_database,
blast_entrez_query => \$blast_entrez_query,
blast_expect => \$blast_expect,
blast_word_size => \$blast_word_size,
local_blast => \$local_blast,
local_blast_directory => \$local_blast_directory,
local_blast_database => \$local_blast_database,
gui_font_face => \$gui_font_face,
gui_font_size => \$gui_font_size,
list_font_face => \$list_font_face,
list_font_size => \$list_font_size,
text_font_face => \$text_font_face,
text_font_size => \$text_font_size,
font_override => \$font_override,
scroll_factor => \$scroll_factor,
ensembl_organism => \$ensembl_organism,
ensembl_type => \$ensembl_type,
use_proxy => \$use_proxy,
http_proxy => \$http_proxy,
http_proxy_port => \$http_port,
cpgplot_method => \$cpgplot_method,
defer_to_caps => \$defer_to_caps,
mru_number => \$mru_number,
re_simple_sites => \$simple_sites,
cloning_anchor_sequence => \$cloning_anchor,
pd_temperature => \$pd_temperature,
exclude_found_sites => \$exclude_found_sites,
file_overwrite => \$file_data_overwrite,
ipc_autofind => \$ipc_autofind,
tcp_port => \$tcp_port,
);
my %pref_arrays = (
mru => \@mru,
);
# Hash for variable references
my $null = undef;
my %page_specific_vars = (
pd => {
min_tm => \$min_tm_pr,
max_tm => \$max_tm_pr,
max_diff => \$max_diff_pr,
pri_win_win => \$pri_win_min_pr,
pri_win_max => \$pri_win_max_pr,
min_ampsize => \$min_ampsize_pr,
max_ampsize => \$max_ampsize_pr,
max_range_5p => \$max_range_5p_pr,
min_range => \$min_range_pr,
max_range => \$max_range_pr,
max_range_3p => \$max_range_3p_pr,
seq => \$packed_widgets{seq},
primers => \@primer_pairs_pr_s,
hlist => \$packed_widgets{res},
canvas => \$packed_widgets{primer_canvas},
subroutine => \&get_gene,
find_sub => \&find_orf,
primer_sub => \&get_primers,
popup => \$popup_sort,
},
seq => {
min_tm => \$min_tm_seq,
max_tm => \$max_tm_seq,
pri_win_win => \$pri_win_min_seq,
pri_win_max => \$pri_win_max_seq,
min_ampsize => \$null,
max_ampsize => \$null,
max_range_5p => \$null,
min_range => \$min_range_seq,
max_range => \$max_range_seq,
max_range_3p => \$null,
seq => \$packed_widgets{seq_seq},
primers => \@primer_pairs_seq_s,
hlist => \$packed_widgets{seq_res},
canvas => \$packed_widgets{seq_canvas},
subroutine => \&get_gene,
find_sub => \&find_orf,
primer_sub => \&get_seq_primers,
popup => \$popup_sort_seq,
},
bis => {
min_tm => \$min_tm_bs,
max_tm => \$max_tm_bs,
max_diff => \$max_diff_bs,
pri_win_win => \$pri_win_min_bs,
pri_win_max => \$pri_win_max_bs,
min_ampsize => \$min_ampsize_bs,
max_ampsize => \$max_ampsize_bs,
max_range_5p => \$max_range_5p_bs,
min_range => \$min_range_bs,
max_range => \$max_range_bs,
max_range_3p => \$max_range_3p_bs,
seq => \$packed_widgets{bisul_seq},
primers => \@primer_pairs_bs_s,
hlist => \$packed_widgets{bisul_res},
canvas => \$packed_widgets{bisul_canvas},
subroutine => \&get_cpg,
find_sub => \&find_cpg,
primer_sub => \&get_bisulphite,
popup => \$popup_sort,
},
qpcr => {
min_tm => \$min_tm_q,
max_tm => \$max_tm_q,
max_diff => \$max_diff_q,
pri_win_win => \$pri_win_min_q,
pri_win_max => \$pri_win_max_q,
min_ampsize => \$min_ampsize_q,
max_ampsize => \$max_ampsize_q,
max_range_5p => \$null,
min_range => \$null,
max_range => \$null,
max_range_3p => \$null,
seq => \$packed_widgets{qmrna_seq},
primers => \@primer_pairs_q_s,
hlist => \$packed_widgets{qpcr_res},
canvas => \$packed_widgets{qprimer_canvas},
find_sub => \&find_orf,
popup => \$popup_sort,
},
);
# prefs_file
my $pref_file = $HOME.'.perlprimer';
# check for upgrading users under win32 who have a different home environment from c:\
if ($os eq 'win' && !check_packages('File::Copy') && -e "c:\.perlprimer" && !-e $pref_file) {
print "\n\nPlease Note: as of PerlPrimer v1.1.5 the preferences file is now stored in the user's home directory\nCopying old PerlPrimer preferences to $pref_file ...\n";
copy("c:\.perlprimer",$pref_file);
}
read_prefs();
# Balloon help messages
my %balloonmsg = (
'primer_getgene', "Find the longest ORF within the sequence and set the selected range",
'primer_reset', "Reset the range to the ORF boundaries",
'primer_stepin', "Reduce the inner range by 10bp on each side",
'primer_stepout', "Increase the outer range by 10bp on each side",
'exclude_gc', "Exclude primers with a GC content outside the range specified in the preferences\n(default is 40-60% GC)",
'gc_clamp', "Require primers to have a 3' GC clamp\n(two of the last three bases G or C)",
'primer_seq_5f', "Sequence to add to the 5' end of the forward primer\nPlace an underscore (_) before restriction enzyme site\n\nUse the 'Add cloning sequences' menu option to configure this automatically",
'primer_seq_5r', "Sequence to add to the 5' end of the reverse primer\nPlace an underscore (_) before restriction enzyme site\n\nUse the 'Add cloning sequences' menu option to configure this automatically",
'primer_seq_5f_frame', "Frame of the restriction enzyme site in the cloning plasmid\n0 = in frame\n1 = +1 base\n2 = +2 bases",
'primer_seq_5r_frame', "Frame of the restriction enzyme site in the cloning plasmid\n0 = in frame\n1 = +1 base\n2 = +2 bases",
'seq', "DNA sequence: right-click for menu with options\nincluding opening and saving files",
'res', "Matching primer pairs are displayed here:\nDouble click to see primer-dimers\nRight-click for option menu",
'primerbutton', "Find primer pairs",
'autobuttonin', "Successively reduce the inner range by 10bp increments\nuntil primer pairs are found",
'autobuttonout', "Successively increase the outer range by 10bp increments\nuntil primer pairs are found",
'primer_cancel', "Cancel the current task",
'primer_view', "Copy the selected primer pairs to the clipboard\n(format is tab-delimited text)",
'primer_canvas', "Primer canvas",
'bisul_getcpg', "Find CpG islands within the sequence and set the selected range",
'bisul_reset', "Reset the range to the ORF boundaries",
'bisul_stepin', "Reduce the inner range by 10bp on each side",
'bisul_stepout', "Increase the outer range by 10bp on each side",
'bisul_seq', "DNA sequence: right-click for menu with options\nincluding opening and saving files",
'bisul_res', "Matching primer pairs are displayed here:\nDouble click to see primer-dimers\nRight-click for option menu",
'bisul_exclude_cpg', "Exclude primers with CpG residues",
'bisul_pre_bs', "Exclude primers with repeats / runs after bisulphite conversion",
'bisul_exclude_cs', "Exclude primers without 3' C content\n(either last base as C, or two of last three bases C)",
'bisul_min_c', "Minimum \%C content for primers",
'bisul_button', "Find primer pairs",
'bisul_autobuttonin', "Successively reduce the inner range by 10bp increments\nuntil primer pairs are found",
'bisul_autobuttonout', "Successively increase the outer range by 10bp increments\nuntil primer pairs are found",
'bisul_cancel', "Cancel the current task",
'bisul_view', "Copy the selected primer pairs to the clipboard\n(format is tab-delimited text)",
'qexclude_gc', "Exclude primers with a GC content outside the range specified in the preferences\n(default is 40-60% GC)",
'qgc_clamp', "Require primers to have a 3' GC clamp\n(two of the last three bases G or C)",
'qdna_seq', "Genomic DNA sequence: right-click for menu with options\nincluding opening and saving files",
'qmrna_seq', "mRNA sequence: right-click for menu with options\nincluding opening and saving files",
'qpcr_res', "Matching primer pairs are displayed here:\nDouble click to see primer-dimers\nRight-click for option menu",
'qprimerbutton', "Find primer pairs\n(at least one primer must span an intron-exon boundary)",
'qprimer_cancel', "Cancel the current task",
'qprimer_view', "Copy the selected primer pairs to the clipboard\n(format is tab-delimited text)",
'qprimer_spidey', "Detailed intron/exon boundary information",
'qexclude_ie', "Minimum number of bases within a primer that should overlap an intron/exon boundary",
'qie_limit', "Limit primer search to this range of exons",
'qie_limit_5p', "Leave blank to represent the first exon\nThe exon can also be selected by left-clicking on the DNA graphic",
'qie_limit_3p', "Leave blank to represent the last exon\nThe exon can also be selected by middle-clicking on the DNA graphic",
'qie_overlap', "Require at least one primer to overlap an intron/exon boundary",
'qie_span', "Require primers to span an intron/exon boundary",
'sspacingmin', "Minimum distance between sequencing primers",
'sspacingmax', "Maximum distance between sequencing primers",
'seqminrange', "The region of the DNA to be sequenced",
'seqmaxrange', "The region of the DNA to be sequenced",
'seq_getgene', "Set the sequencing region to the boundaries of the largest ORF present",
'exclude_gc_seq', "Exclude primers with a GC content outside the range specified in the preferences\n(default is 40-60% GC)",
'gc_clamp_seq', "Require primers to have a 3' GC clamp\n(two of the last three bases G or C)",
'exclude_pd_seq', "Do not consider primers which can form dimers\nwith a stability greater than this value",
'spdmin', "Do not consider primers which can form dimers\nwith a stability greater than this value",
'seq_button', "Find primer pairs",
'seq_cancel', "Cancel the current task",
'seq_view', "Copy the selected primer pairs to the clipboard\n(format is tab-delimited text)",
'tmbutton', "Calculate Tm, thermodynamic properties and primer-dimers from the primer sequences",
'blastbutton', "Perform a BLAST search on the primers\n(requires an internet connection)",
'prefs_defer', "Do not attempt to find an ORF or CpG Islands if\na captalised region is already present in the\nDNA sequence - use that region to set the range instead",
'prefs_cpgplot_method', "Emulate the behaviour of the program cpgplot when\nfinding CpG islands (please note that this will cause the \%GC and O/E\nto be an overestimate - see the documentation for details)",
'prefs_gui_override', "Use system default fonts for most widgets\n(requires program restart)",
'prefs_gui_family', "Changes will not take effect until program restart",
'prefs_gui_list_family', "Changes will not take effect until program restart",
'prefs_gui_text_family', "Please use a fixed-width font\nChanges will not take effect until program restart",
'prefs_simple_sites', "Limit restriction enzyme database to 6-base cutting enzymes\n(Also excludes degenerate cutting enzymes)",
'prefs_exclude_found_sites', "When displaying the list of restriction enzymes,\nonly list those that will not cut the input sequence\n(Highly recommended!)",
'cloning_anchor', "Sequence to add 5' of the restiction enzyme sites\n(recommended for successful digestion after amplification)",
'blast_f', "Display results for the forward primer",
'blast_r', "Display results for the reverse primer",
'blast_search_string', "Enter a string to limit results",
'blast_search', "Limit results",
'view_base_copy', "Copies the layout to the clipboard\nas 80-column wrapped text",
'view_base_pf', "Jump to the forward primer",
'view_base_pr', "Jump to the reverse primer",
);
#--------------------#
# deltaG (kcal/mol) #
#--------------------#
# Recalculate oligo_dG (kcal/mol) for PCR salt conditions
# (the initiation values are salt independent)
my %oligo_dG=(
qw(initC 0.98 initG 0.98
initA 1.03 initT 1.03),
);
recalculate_dG();
# Load pixmap icon data
my (
$perlprimer_icon, $icon_open, $icon_open_small, $icon_save, $icon_clear,
$icon_info, $icon_magnify, $icon_new, $dna_canvas_pixmap,
$icon_separator, $icon_prefs, $icon_report, $icon_save_as,
$icon_ensembl, $icon_dna_open, $icon_dna_save,
$info_pixmap, $error_pixmap,
);
load_icon_data();
# Setup UserAgent
my $ua = LWP::UserAgent->new();
# timeout - default value of 180 seconds is too long
$ua->timeout(60);
$ua->agent('User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3');
#-----------------#
# #
# GUI Interface #
# #
#-----------------#
#-------------#
# Main Window #
#-------------#
my $top = MainWindow->new(-title=>"PerlPrimer v$version");
$top->withdraw();
# configure fonts
my $gui_font = "{$gui_font_face} $gui_font_size";
my $font = $gui_font;
my $gui_font_bold = $gui_font . ' bold';
my $text_font = "{$text_font_face} $text_font_size";
my $list_font = "{$list_font_face} $list_font_size";
unless ($font_override) {
$top->optionAdd("*font", $gui_font);
$top->optionAdd("*ROText.font", $text_font);
$top->optionAdd("*Text.font", $text_font);
$top->optionAdd("*HList.font", $list_font);
}
# general options
$top->optionAdd("*Entry.relief", 'groove');
$top->optionAdd("*Entry.background", '#eeeeee');
$top->optionAdd("*Text.relief", 'groove');
$top->optionAdd("*Text.background", '#eeeeee');
$top->optionAdd("*ROText.relief", 'groove');
$top->optionAdd("*ROText.background", '#eeeeee');
$top->optionAdd("*HList.relief", 'groove');
$top->optionAdd("*HList.background", '#eeeeee');
$top->optionAdd("*HList.header", 1);
$top->optionAdd("*HList.selectmode", 'extended');
$top->optionAdd("*Label.justify", 'left');
$top->optionAdd("*Button.padY", $button_pady);
$top->optionAdd("*Button.padX", 5);
$top->optionAdd("*Checkbutton.padY", $check_pady);
$top->optionAdd("*LabFrame.LabelSide", 'acrosstop');
# $top->optionAdd("*LabFrame.background", '#eeeeee');
# $top->optionAdd("*BrowseEntry.background", '#eeeeee');
#--------------#
# Balloon help #
#--------------#
# Set the balloon background colour (nobody actually *likes* the default sick yellow
# colour, do they??)
$top->optionAdd("*Balloon.Background", "#ececec");
my $Balloon = $top->Balloon();
$Balloon->configure(-state => 'none') if $balloon_help == 0;
$Balloon->configure(-state => 'balloon') if $balloon_help == 1;
# Notebook reference hash
my %nb_page_ref = (
1 => 'pd',
2 => 'bis',
3 => 'qpcr',
4 => 'seq',
);
# Load user-defined default variables
load_defaults();
#---------#
# Menubar #
#---------#
# It seems impossible to get the same menu behaviour across platforms with the
# same code! This is a compromise which seems to work on my systems. Hopefully
# this will hold for other systems too ...
my $menu = $top->Menu(-bd => 1, -relief => $menu_relief, -type=>'menubar');
# setting $menu as the -menu for $top causes geometry problems under *nix ...
# packing the menubar as a widget causes alignment problems under Win32 ...
# (sometimes I think it was easier with menubuttons ....)
$menu->pack(-fill=>'x') if $os eq 'nix';
$top->configure(-menu => $menu) if $os eq 'win';
# recently used items
my $menu_mru = $menu->Menu(-title => "Recently opened", -menuitems => [
[command => "- none available -", -state => "disabled" ]
]);
recently_used_files();
my $menu_file = $menu->cascade(-label => "File", -menuitems => [
[command => "New file", -command =>\&new_file, -accelerator=>'Ctrl-N' ],
[command => "Open ...", -command =>\&pp_file_open, -accelerator=>'Ctrl-O' ],
[cascade => "Open Previous", -menu=>$menu_mru ],
"-",
[command => "Save ...", -command =>\&pp_file_save, -accelerator=>'Ctrl-S' ],
[command => "Save as ...", -command =>[sub {pp_file_save(1)}], ],
"-",
[command => "Retrieve gene from Ensembl", -command =>\&get_ensembl, -accelerator=>'Ctrl-E' ],
"-",
[command => "Restart", -command => \&restart, ],
[command => "Exit", -command => \&end_prog, -accelerator=>'Ctrl-Q' ]
]);
my $menu_tools = $menu->cascade(-label => 'Tools', -menuitems => [
[command => "Find primers for cloning", -command => \&get_primers_cloning, ],
[command => "Add cloning sequences", -command => \&find_re_sites, ],
"-",
[command => "Generate report", -command => \&generate_report, -accelerator=>'Ctrl-R' ],
"-",
[command => "Save default values for this page", -command => \&save_defaults, ],
[command => "Restore in-built default values", -command => \&restore_defaults, ],
"-",
[command => "Preferences", -command => \&prefs, -accelerator=>'Ctrl-P' ],
]);
my $menu_help = $menu->cascade(-label => "Help", -menuitems => [
['Checkbutton' => "Balloon help", -variable => \$balloon_help, -command => \&balloon_toggle],
"-",
[command => "Acknowledgements", -command => \&acknowledgements ],
[command => "About ...", -command => \&info, -accelerator=>'Ctrl-Shift-A' ],
]);
#--------------#
# Key bindings #
#--------------#
# If you're wondering about the anonymous sub for file opening - it's because
# Perl/Tk sends the calling widget as the first argument ...
$top->bind('<Control-n>' => \&new_file);
$top->bind('<Control-o>' => [sub {pp_file_open()}]);
$top->bind('<Control-s>' => [sub {pp_file_save()}]);
$top->bind('<Control-q>' => \&end_prog);
$top->bind('<Control-r>' => \&generate_report);
$top->bind('<Control-p>' => \&prefs);
$top->bind('<Control-A>' => \&info);
$top->bind('<Control-e>' => \&get_ensembl);
#---------#
# Toolbar #
#---------#
my $separator_menu = $top->Frame(-relief => "groove", -height=>2, -bd => 2);
$separator_menu->pack(-fill=> 'x') if $os eq 'win';
my $toolbar = $top->Frame(-relief => $menu_relief, -bd => 1) ->pack(-fill=> 'x');
my $tool_new = pack_button($toolbar, $top->Pixmap(-data => $icon_new), \&new_file)->pack(-side=>'left');
$Balloon->attach($tool_new, -balloonposition => 'mouse', -balloonmsg => "New file");
my $tool_open = pack_button($toolbar, $top->Pixmap(-data => $icon_open), \&pp_file_open)->pack(-side=>'left');
$Balloon->attach($tool_open, -balloonposition => 'mouse', -balloonmsg => "Open PerlPrimer file");
my $tool_save = pack_button($toolbar, $top->Pixmap(-data => $icon_save), \&pp_file_save)->pack(-side=>'left');
$Balloon->attach($tool_save, -balloonposition => 'mouse', -balloonmsg => "Save file");
my $tool_save_as = pack_button($toolbar, $top->Pixmap(-data => $icon_save_as), [sub {pp_file_save(1)}])->pack(-side=>'left');
$Balloon->attach($tool_save_as, -balloonposition => 'mouse', -balloonmsg => "Save file as ...");
my $tool_sep1 = $toolbar->Label(-image => $top->Pixmap(-data => $icon_separator))->pack(-side=>'left', -padx=>2);
my $tool_ensembl = pack_button($toolbar, $top->Pixmap(-data => $icon_ensembl), \&get_ensembl)->pack(-side=>'left');
$Balloon->attach($tool_ensembl, -balloonposition => 'mouse', -balloonmsg => "Retrieve gene from Ensembl");
my $tool_sep2 = $toolbar->Label(-image => $top->Pixmap(-data => $icon_separator))->pack(-side=>'left', -padx=>2);
my $tool_prefs = pack_button($toolbar, $top->Pixmap(-data => $icon_prefs), \&prefs)->pack(-side=>'left');
$Balloon->attach($tool_prefs, -balloonposition => 'mouse', -balloonmsg => "Preferences");
my $tool_report = pack_button($toolbar, $top->Pixmap(-data => $icon_report), \&generate_report)->pack(-side=>'left');
$Balloon->attach($tool_report, -balloonposition => 'mouse', -balloonmsg => "Generate report");
my $separator_tools = $top->Frame(-relief => "groove", -height=>2, -bd => 2);
$separator_tools->pack(-fill=> 'x') if $os eq 'win';
#---------------#
# Draw Notebook #
#---------------#
# notebook inactivebackground calculation
# (uses a 90% shade of the default widget colour - as per Perl/Tk *nix defaults.
# Win32 does not use this by default, but I feel it improves usability)
my $nb_colour = $top->cget(-bg);
my ($red, $green, $blue) = $top->rgb($nb_colour);
$red *= 0.9;
$green *= 0.9;
$blue *= 0.9;
$nb_colour = sprintf "%lx%lx%lx", $red, $green, $blue;
my $nb = $top->NoteBook(
-relief => 'raised',
-inactivebackground => "#$nb_colour",
-bd => 1,
)->pack(
-expand=>1,
-padx=>2,
-pady=>4,
-fill=>'both',
);
# Notebook pages
my $page_primer_design = $nb->add("pd", -label=>"Standard PCR", -anchor=>"nw");
my $page_bisul_seq = $nb->add("bis", -label=>"Bisulphite PCR", -anchor=>"nw");
my $page_qpcr = $nb->add("qpcr", -label=>"Real-time PCR", -anchor=>'nw');
my $page_seq = $nb->add("seq", -label=>"Sequencing", -anchor=>"nw");
my $page_primer = $nb->add("primer", -label=>"Primers", -anchor=>"nw");
# Event binding to allow name display
$page_primer_design->bind('<Visibility>' => \&update_title);
$page_bisul_seq->bind('<Visibility>' => \&update_title);
$page_qpcr->bind('<Visibility>' => \&update_title);
$page_seq->bind('<Visibility>' => \&update_title);
# Have to use frames to get the nw anchor - grid plonks everything in the centre ...
my $page_primerf = $page_primer->Frame()->pack(-anchor=>'nw', -expand=>'1', -fill=>'both');
my $page_primerfb = $page_primer->Frame()->pack(-side=>'bottom', -anchor=>'sw');
my $page_primer_designf = $page_primer_design->Frame()->pack(-anchor=>'nw', -expand=>'1', -fill=>'both');
my $page_primer_designfb = $page_primer_design->Frame()->pack(-side=>'bottom', -anchor=>'sw');
my $page_sequencingf = $page_seq->Frame()->pack(-anchor=>'nw', -expand=>'1', -fill=>'both');
my $page_sequencingfb = $page_seq->Frame()->pack(-side=>'bottom', -anchor=>'sw');
my $page_bisul_seqf = $page_bisul_seq->Frame()->pack(-anchor=>'nw', -expand=>'1', -fill=>'both');
my $page_bisul_seqfb = $page_bisul_seq->Frame()->pack(-side=>'bottom', -anchor=>'sw');
my $page_qpcrf = $page_qpcr->Frame()->pack(-anchor=>'nw', -expand=>'1', -fill=>'both');
my $page_qpcrfb = $page_qpcr->Frame()->pack(-side=>'bottom', -anchor=>'sw');
#------------#
# Status bar #
#------------#
my $status_bar_f = $top->Frame()->pack(-side=>'bottom', -fill=>'x', -padx=>0,);
my $status_bar = $status_bar_f->ROText(-height=>1,
-bg=>'#eeeeee',
-relief=>'sunken',
)->pack(-fill=>'x');
$status_bar->tagConfigure('red',
-foreground => 'red');
$status_bar->tagConfigure('blue',
-foreground => 'blue');
$status_bar->tagConfigure('grey',
-foreground => 'grey20');
tie (*SBAR, 'Tk::Text', $status_bar);
# Packing system
#
# IMPORTANT UPDATE: reliance on grid() has now been greatly reduced (only used for labframe
# widgets) - each widget row is now separately defined by the nr() subroutine and widgets
# are packed from the left until nr() is called again. Much simpler and easier!
# (NB - GUI code still has lots of relic options in the pack_gui() calls - needs to be
# tidied up a lot!)
#
# FURTHER UPDATE: as of versions > 1.1.4a, the system has been completely re-written, providing
# a simpler and more straightforward system with the ability to include any number of custom arguments.
# It should be slightly faster, too, at the expense of some code verbosity.
#
# New format is:
# <widget type> <Text/variable> <widget hash reference> [more specific args] [generic Perl/Tk options]
#
# Widgets are packed from the left into horizontal frames defined by the nr() call
my @row_counter;
#-------------#
# Primer page #
#-------------#
pack_gui('LabFrame', 'Forward primer', 'forward_l', \$page_primerf);
nr(\$packed_widgets{forward_l});
pack_gui('Label', 'Sequence', 'fprimerseql');
pack_gui('Entry', \$fprimer, 'fprimerseq', 40);
nr();
my $col_ref = $row_counter[-1];
nc(\$col_ref);
nr(\$row_counter[-1],0);
pack_gui('Label', 'Tm: ', 'fprimertm', -font=>$gui_font_bold);
pack_gui('Label', \$fprimer_tm, 'fprimertm');
pack_gui('Label', '°C', 'fprimertm');
nr('',0);
pack_gui('Label', 'dS°: ', 'fprimerds', -font=>$gui_font_bold);
pack_gui('Label', \$fprimer_ds, 'fprimerds');
pack_gui('Label', 'eu', 'fprimerds');
# nr('',0);
# pack_gui('Label', "dG°$pd_temperature: ", 'fprimerds');
# pack_gui('Label', \$fprimer_dg, 'fprimerds');
# pack_gui('Label', 'kcal/mol', 'fprimerds');
nc(\$col_ref);
nr(\$row_counter[-1],0);
pack_gui('Label', 'Length: ', 'fprimerlen', -font=>$gui_font_bold);
pack_gui('Label', \$fprimer_len, 'fprimerlen');
pack_gui('Label', 'bases', 'fprimerlen');
nr('',0);
pack_gui('Label', 'dH°: ', 'fprimerdh', -font=>$gui_font_bold);
pack_gui('Label', \$fprimer_dh, 'fprimerdh');
pack_gui('Label', 'kcal/mol', 'fprimerdh');
nc(\$col_ref);
nr(\$row_counter[-1],0);
pack_gui('Label', 'GC: ', 'fprimergc', -font=>$gui_font_bold);
pack_gui('Label', \$fprimer_gc, 'fprimergc');
pack_gui('Label', '%', 'fprimergc');
nr('',0);
pack_gui('Label', "dG°$pd_temperature: ", 'fprimerds', -font=>$gui_font_bold);
pack_gui('Label', \$fprimer_dg, 'fprimerds');
pack_gui('Label', 'kcal/mol', 'fprimerds');
pack_gui('LabFrame', 'Reverse primer', 'reverse_l', \$page_primerf);
nr(\$packed_widgets{reverse_l});
pack_gui('Label', 'Sequence', 'rprimerseq');
pack_gui('Entry', \$rprimer, 'rprimerseq', 40);
nr();
$col_ref = $row_counter[-1];
nc(\$col_ref);
nr(\$row_counter[-1],0);
pack_gui('Label', 'Tm: ', 'rprimertm', -font=>$gui_font_bold);
pack_gui('Label', \$rprimer_tm, 'rprimertm');
pack_gui('Label', '°C', 'rprimertm');
nr('',0);
pack_gui('Label', 'dS°: ', 'rprimerds', -font=>$gui_font_bold);
pack_gui('Label', \$rprimer_ds, 'rprimerds');
pack_gui('Label', 'eu', 'rprimerds');
# nr('',0);
# pack_gui('Label', "dG°$pd_temperature: ", 'rprimerds');
# pack_gui('Label', \$rprimer_dg, 'rprimerds');
# pack_gui('Label', 'kcal/mol', 'rprimerds');
nc(\$col_ref);
nr(\$row_counter[-1],0);
pack_gui('Label', 'Length: ', 'rprimerlen', -font=>$gui_font_bold);
pack_gui('Label', \$rprimer_len, 'rprimerlen');
pack_gui('Label', 'bases', 'rprimerlen');
nr('',0);
pack_gui('Label', 'dH°: ', 'rprimerdh', -font=>$gui_font_bold);
pack_gui('Label', \$rprimer_dh, 'rprimerdh');
pack_gui('Label', 'kcal/mol', 'rprimerdh');
nc(\$col_ref);
nr(\$row_counter[-1],0);
pack_gui('Label', 'GC: ', 'fprimergc', -font=>$gui_font_bold);
pack_gui('Label', \$rprimer_gc, 'fprimergc');
pack_gui('Label', '%', 'fprimergc');
nr('',0);
pack_gui('Label', "dG°$pd_temperature: ", 'fprimerds', -font=>$gui_font_bold);
pack_gui('Label', \$rprimer_dg, 'fprimerds');
pack_gui('Label', 'kcal/mol', 'fprimerds');
pack_gui('LabFrame', 'Dimers', 'dim_l', \$page_primerf);
nr(\$packed_widgets{dim_l}, $frame_pady, 1);
pack_gui('ROText', 'Dimers', 'dim', 60, 15, -scrollbars=>'oe');
$packed_widgets{dim}->bind('<Key-Right>' => \&jump_to_tm);
$packed_widgets{dim}->bind('<Key-Left>' => \&jump_back);
$packed_widgets{dim}->bind('<Return>' => \&jump_back);
nr(\$page_primerfb, 0);
pack_gui('Button', 'Calculate Tm', 'tmbutton', \&get_tm, 'active');
pack_gui('Button', 'BLAST primers', 'blastbutton', \&blast_primers);
# Grid layout
pack_grid(qw(forward_l));
pack_grid(qw(reverse_l));
pack_grid(qw(dim_l));
$packed_widgets{dim}->configure(-fg=>'grey30');
$packed_widgets{dim}->tagConfigure('blue',
-foreground => 'midnightblue');
$packed_widgets{dim}->tagConfigure('red',
-foreground => 'red');
$packed_widgets{dim}->tagConfigure('black',
-foreground => 'black');
# Column and row weights
$page_primerf->gridColumnconfigure(0,-weight=>1);
$page_primerf->gridRowconfigure(2,-weight=>1);
tie (*DIMER, 'Tk::Text',$packed_widgets{'dim'});
#--------------------#
# Primer Design page #
#--------------------#
pack_gui('LabFrame', 'Primer Tm', 'primer_tm_l', \$page_primer_designf);
nr(\$packed_widgets{primer_tm_l});
pack_gui('Entry', \$min_tm_pr, 'mintm', 3);
pack_gui('Label', '-');
pack_gui('Entry', \$max_tm_pr, 'maxtm', 3);
pack_gui('Label', '°C Difference');
pack_gui('Entry', \$max_diff_pr, 'maxdiff', 3);
pack_gui('Label', '°C');
pack_gui('LabFrame', 'Primer Length', 'primer_len_l', \$page_primer_designf);
nr(\$packed_widgets{primer_len_l});
pack_gui('Entry', \$pri_win_min_pr, 'minwin', 3);
pack_gui('Label', '-');
pack_gui('Entry', \$pri_win_max_pr, 'maxwin', 3);
pack_gui('Label', 'bases');
pack_gui('LabFrame', 'Amplified range', 'primer_range_l', \$page_primer_designf);
nr(\$packed_widgets{primer_range_l}, 2);
pack_gui('Label', "5'");
pack_gui('Entry', \$max_range_5p_pr, 'maxrange5p', 5);
pack_gui('Label', '-');
pack_gui('Entry', \$min_range_pr, 'minrange', 5);
pack_gui('Label', " 3'");
pack_gui('Entry', \$max_range_pr, 'maxrange', 5);
pack_gui('Label', '-');
pack_gui('Entry', \$max_range_3p_pr, 'maxrange3p', 5);
nr('');
pack_gui('Label', 'Amplicon size: ');
pack_gui('Label', \$min_ampsize_pr);
pack_gui('Label', '-');
pack_gui('Label', \$max_ampsize_pr);
pack_gui('Label', 'bases');
nr('', 0);
pack_gui('Button', 'Set from ORF', 'primer_getgene', \&reset_bounds);
pack_gui('Button', '-10', 'primer_stepin', \&step_in);
pack_gui('Button', '+10', 'primer_stepout', \&step_out);
pack_gui('LabFrame', 'Options', 'primer_options_l', \$page_primer_designf);
nr(\$packed_widgets{primer_options_l});
pack_gui('Checkbutton', 'Exclude %GC', 'exclude_gc', \$exclude_gc);
pack_gui('Checkbutton', 'GC clamp', 'gc_clamp', \$exclude_clamp);
nr();
pack_gui('Label', "Add 5' F seq ");
pack_gui('Entry', \$primer_seq_5f, 'primer_seq_5f', 12);
pack_gui('Label', 'Frame');
pack_gui('Entry', \$primer_seq_5f_frame, 'primer_seq_5f_frame', 2);
# not currently implemented and may never be ...
# pack_gui('ATG', $primer_seq_5f_atg, 'primer_seq_5f_atg', '', 'c', 0, 1);
nr();
pack_gui('Label', "Add 5' R seq ");
pack_gui('Entry', \$primer_seq_5r, 'primer_seq_5r', 12);
pack_gui('Label', 'Frame');
pack_gui('Entry', \$primer_seq_5r_frame, 'primer_seq_5r_frame', 2);
# pack_gui('ATG', $primer_seq_5r_atg, 'primer_seq_5r_atg', '', 'c', 0, 1);
pack_gui('LabFrame', 'Sequence', 'seq_l', \$page_primer_designf);
nr(\$packed_widgets{seq_l});
pack_gui('Text', 'Sequence', 'seq', 60, 6, -scrollbars=>'oe');
pack_menu('seq');
pack_osc_buttons('seq');
pack_gui('LabFrame', 'Results', 'res_l', \$page_primer_designf);
nr(\$packed_widgets{res_l}, $frame_pady, 1);
pack_gui('HList', '', 'res', 60, 10, 11, \&browse_primer);
header_create(\$packed_widgets{'res'}, @header_list_primers);
nr();
pack_gui('Canvas', '', 'primer_canvas', 1, 1);
nr(\$page_primer_designfb, 0);
pack_gui('Button', 'Find primers', 'primerbutton', \&get_primers, 'active');
pack_gui('Button', 'Find inwards', 'autobuttonin', \&get_primers_auto_in);
pack_gui('Button', 'Find outwards', 'autobuttonout', \&get_primers_auto_out);
pack_gui('Button', 'Cancel', 'primer_cancel', \&cancel);
pack_gui('Button', 'Copy selected', 'primer_view', \©_selected_primers);
# Grid layout
pack_grid(qw(primer_tm_l primer_len_l));
pack_grid(qw(primer_range_l primer_options_l));
pack_grid(qw(seq_l -));
pack_grid(qw(res_l -));
# Column and row weights
$page_primer_designf->gridColumnconfigure(0,-weight=>1);
$page_primer_designf->gridColumnconfigure(1,-weight=>1);
$page_primer_designf->gridRowconfigure(3,-weight=>1);
#-----------------#
# Sequencing page #
#-----------------#
pack_gui('LabFrame', 'Primer Tm', 'seq_tm_l', \$page_sequencingf);
nr(\$packed_widgets{seq_tm_l});
pack_gui('Entry', \$min_tm_seq, 'smintm', 3);
pack_gui('Label', '-');
pack_gui('Entry', \$max_tm_seq, 'smaxtm', 3);
pack_gui('Label', '°C');
pack_gui('LabFrame', 'Primer Length', 'seq_len_l', \$page_sequencingf);
nr(\$packed_widgets{seq_len_l});
pack_gui('Entry', \$pri_win_min_seq, 'sminwin', 3);
pack_gui('Label', '-');
pack_gui('Entry', \$pri_win_max_seq, 'smaxwin', 3);
pack_gui('Label', 'bases');
pack_gui('LabFrame', 'Spacing / Coverage', 'seq_amp_l', \$page_sequencingf);
nr(\$packed_widgets{seq_amp_l}, 2);
pack_gui('Label', 'Primers every');
pack_gui('Entry', \$seq_spacing_min, 'sspacingmin', 4);
pack_gui('Label', '-');
pack_gui('Entry', \$seq_spacing_max, 'sspacingmax', 4);
pack_gui('Label', 'bases');
nr('');
pack_gui('Label', "Range: 5'");
pack_gui('Entry', \$min_range_seq, 'seqminrange', 5);
pack_gui('Label', '-');
pack_gui('Entry', \$max_range_seq, 'seqmaxrange', 5);
pack_gui('Label', "3'");
nr('', 0);
pack_gui('Button', 'Set range from ORF', 'seq_getgene', \&reset_bounds);
pack_gui('LabFrame', 'Options', 'seq_options_l', \$page_sequencingf);
nr(\$packed_widgets{seq_options_l}, 0);
pack_gui('Checkbutton', 'Exclude %GC', 'exclude_gc_seq', \$exclude_gc_seq);
pack_gui('Checkbutton', 'GC clamp', 'gc_clamp_seq', \$exclude_clamp_seq);
nr('', 0);
pack_gui('Checkbutton', 'Exclude self-complimentarity > -', 'exclude_pd_seq', \$exclude_pd_seq);
pack_gui('Entry', \$seq_pd_min, 'spdmin', 3);
pack_gui('Label', 'dG°37');
pack_gui('LabFrame', 'Sequence', 'seq_seq_l', \$page_sequencingf);
nr(\$packed_widgets{seq_seq_l});
pack_gui('Text', 'Sequence', 'seq_seq', 60, 6, -scrollbars=>'oe');
pack_menu('seq_seq');
pack_osc_buttons('seq_seq');
pack_gui('LabFrame', 'Results', 'seq_res_l', \$page_sequencingf);
nr(\$packed_widgets{seq_res_l}, $frame_pady, 1);
pack_gui('HList', '', 'seq_res', 60, 10, 11, \&browse_primer);
header_create(\$packed_widgets{'seq_res'}, @header_list_primers);
nr();
pack_gui('Canvas', '', 'seq_canvas', 1, 1);
nr(\$page_sequencingfb, 0);
pack_gui('Button', 'Find primers', 'seq_button', \&get_seq_primers, 'active');
pack_gui('Button', 'Cancel', 'seq_cancel', \&cancel);
pack_gui('Button', 'Copy selected', 'seq_view', \©_selected_primers);
# Grid layout
pack_grid(qw(seq_tm_l seq_len_l));
pack_grid(qw(seq_amp_l seq_options_l));
pack_grid(qw(seq_seq_l -));
pack_grid(qw(seq_res_l -));
# Column and row weights
$page_sequencingf->gridColumnconfigure(0,-weight=>1);
$page_sequencingf->gridColumnconfigure(1,-weight=>1);
$page_sequencingf->gridRowconfigure(3,-weight=>1);
#----------------------------#
# Bisulphite sequencing page #
#----------------------------#
pack_gui('LabFrame', 'Primer Tm', 'bisul_tm_l', \$page_bisul_seqf);
nr(\$packed_widgets{bisul_tm_l});
pack_gui('Entry', \$min_tm_bs, 'bisul_mintm', 3);
pack_gui('Label', '-');
pack_gui('Entry', \$max_tm_bs, 'bisul_maxtm', 3);
pack_gui('Label', '°C Difference');
pack_gui('Entry', \$max_diff_bs, 'bisul_maxdiff', 3);
pack_gui('Label', '°C');
pack_gui('LabFrame', 'Primer Length', 'bisul_len_l', \$page_bisul_seqf);
nr(\$packed_widgets{bisul_len_l});
pack_gui('Entry', \$pri_win_min_bs, 'minwin', 3);
pack_gui('Label', '-');
pack_gui('Entry', \$pri_win_max_bs, 'maxwin', 3);
pack_gui('Label', 'bases');
pack_gui('LabFrame', 'Amplified range', 'bisul_range_l', \$page_bisul_seqf);
nr(\$packed_widgets{bisul_range_l}, 2);
pack_gui('Label', "5'");
pack_gui('Entry', \$max_range_5p_bs, 'bisul_maxrange5p', 5);
pack_gui('Label', '-');
pack_gui('Entry', \$min_range_bs, 'bisul_minrange', 5);
pack_gui('Label', " 3'");
pack_gui('Entry', \$max_range_bs, 'bisul_maxrange', 5);
pack_gui('Label', '-');
pack_gui('Entry', \$max_range_3p_bs, 'bisul_maxrange3p', 5);
nr('');
pack_gui('Label', 'Amplicon size: ');
pack_gui('Label', \$min_ampsize_bs);
pack_gui('Label', '-');
pack_gui('Label', \$max_ampsize_bs);
pack_gui('Label', 'bases');
nr('', 0);
pack_gui('Button', 'Set from CpG island', 'bisul_getcpg', \&reset_bounds);
pack_gui('Button', '-10', 'primer_stepin', \&step_in);
pack_gui('Button', '+10', 'primer_stepout', \&step_out);
pack_gui('LabFrame', 'Options', 'bisul_options_l', \$page_bisul_seqf);
nr(\$packed_widgets{bisul_options_l}, 0);
pack_gui('Checkbutton', 'Exclude CpG', 'bisul_exclude_cpg', \$exclude_cpg);
pack_gui('Checkbutton', "Require 3' C", 'bisul_exclude_cs', \$exclude_3c);
nr('', 0);
pack_gui('Checkbutton', 'Repeats / runs post conversion', 'bisul_pre_bs', \$pre_bs);
nr();
pack_gui('Label', 'Minimum primer C content ');
pack_gui('Entry', \$bisul_min_c, 'bisul_min_c', 4);
pack_gui('Label', '%');
pack_gui('LabFrame', 'Sequence', 'bisul_seq_l', \$page_bisul_seqf);
nr(\$packed_widgets{bisul_seq_l});
pack_gui('Text', 'Sequence', 'bisul_seq', 60, 6, -scrollbars=>'oe');
pack_menu('bisul_seq');
pack_osc_buttons('bisul_seq');
pack_gui('LabFrame', 'Results', 'bisul_res_l', \$page_bisul_seqf);
nr(\$packed_widgets{bisul_res_l}, $frame_pady, 1);
pack_gui('HList', '', 'bisul_res', 60, 10, 11, \&browse_bisulphite);
header_create(\$packed_widgets{'bisul_res'}, @header_list_primers);
nr();
pack_gui('Canvas', '', 'bisul_canvas', 1, 1);
nr(\$page_bisul_seqfb, 0);
pack_gui('Button', 'Find primers', 'bisul_button', \&get_bisulphite, 'active');
pack_gui('Button', 'Find inwards', 'bisul_autobuttonin', \&get_primers_auto_in);
pack_gui('Button', 'Find outwards', 'bisul_autobuttonout', \&get_primers_auto_out);
pack_gui('Button', 'Cancel', 'bisul_cancel', \&cancel);
pack_gui('Button', 'Copy selected', 'bisul_view', \©_selected_primers);
# Grid layout
pack_grid(qw(bisul_tm_l bisul_len_l));
pack_grid(qw(bisul_range_l bisul_options_l));
pack_grid(qw(bisul_seq_l -));
pack_grid(qw(bisul_res_l -));
# Column and row weights
$page_bisul_seqf->gridColumnconfigure(0,-weight=>1);
$page_bisul_seqf->gridColumnconfigure(1,-weight=>1);
$page_bisul_seqf->gridRowconfigure(3,-weight=>1);
#-----------#
# QPCR page #
#-----------#
pack_gui('LabFrame', 'Primer Tm', 'qprimer_tm_l', \$page_qpcrf);
nr(\$packed_widgets{qprimer_tm_l});
pack_gui('Entry', \$min_tm_q, 'qmintm', 3);
pack_gui('Label', '-');
pack_gui('Entry', \$max_tm_q, 'qmaxtm', 3);
pack_gui('Label', '°C Difference');
pack_gui('Entry', \$max_diff_q, 'qmaxdiff', 3);
pack_gui('Label', '°C');
pack_gui('LabFrame', 'Primer Length', 'qprimer_len_l', \$page_qpcrf);
nr(\$packed_widgets{qprimer_len_l});
pack_gui('Entry', \$pri_win_min_q, 'qminwin', 3);
pack_gui('Label', '-');
pack_gui('Entry', \$pri_win_max_q, 'qmaxwin', 3);
pack_gui('Label', 'bases');
pack_gui('LabFrame', 'Amplicon size', 'qprimer_amp_l', \$page_qpcrf);
nr(\$packed_widgets{qprimer_amp_l});
pack_gui('Entry', \$min_ampsize_q, 'qminamp', 4);
pack_gui('Label', '-');
pack_gui('Entry', \$max_ampsize_q, 'qmaxamp', 4);
pack_gui('Label', 'bases');
nr();
pack_gui('Checkbutton', 'Limit primers to exon(s)', 'qie_limit', \$ie_limit);
pack_gui('Entry', \$ie_limit_5p, 'qie_limit_5p', 3);
pack_gui('Label', '-');
pack_gui('Entry', \$ie_limit_3p, 'qie_limit_3p', 3);
pack_gui('LabFrame', 'Options', 'qprimer_options_l', \$page_qpcrf);
nr(\$packed_widgets{qprimer_options_l}, 0);
pack_gui('Checkbutton', 'Exclude %GC', 'qexclude_gc', \$exclude_gc);
pack_gui('Checkbutton', 'GC clamp', 'qgc_clamp', \$exclude_clamp);
nr();
pack_gui('Checkbutton', 'Span intron/exon boundary', 'qie_span', \$ie_span);
nr();
pack_gui('Checkbutton', 'Overlap intron/exon boundary by', 'qie_overlap', \$ie_overlap);
pack_gui('Entry', \$exclude_ie, 'qexclude_ie', 3);
pack_gui('Label', 'bases');
pack_gui('LabFrame', 'Genomic sequence', 'qdna_seq_l', \$page_qpcrf);
nr(\$packed_widgets{qdna_seq_l});
pack_gui('Text', '', 'qdna_seq', 25, 6, -scrollbars=>'oe');
pack_menu('qdna_seq');
pack_osc_buttons('qdna_seq');
pack_gui('LabFrame', 'mRNA sequence', 'qmrna_seq_l', \$page_qpcrf);
nr(\$packed_widgets{qmrna_seq_l});
pack_gui('Text', '', 'qmrna_seq', 25, 6, -scrollbars=>'oe');
pack_menu('qmrna_seq');
pack_osc_buttons('qmrna_seq');
pack_gui('LabFrame', 'Results', 'qpcr_res_l', \$page_qpcrf);
nr(\$packed_widgets{qpcr_res_l}, $frame_pady, 1);
pack_gui('HList', '', 'qpcr_res', 60, 10, 11, \&browse_primer);
header_create(\$packed_widgets{'qpcr_res'}, @header_list_primers);
nr();
pack_gui('Canvas', '', 'qprimer_canvas', 1, 1);
nr(\$page_qpcrfb, 0);
pack_gui('Button', 'Find primers', 'qprimerbutton', \&get_qprimers, 'active');
pack_gui('Button', 'Cancel', 'qprimer_cancel', \&cancel);
pack_gui('Button', 'Copy selected', 'qprimer_view', \©_selected_primers);
pack_gui('Button', 'View intron/exon structure', 'qprimer_view_ie', \&view_intron_exon_structure);
pack_gui('Button', 'Spidey output', 'qprimer_spidey', \&view_spidey_out);
# Grid layout
pack_grid(qw(qprimer_tm_l qprimer_len_l));
pack_grid(qw(qprimer_amp_l qprimer_options_l));
pack_grid(qw(qdna_seq_l qmrna_seq_l));
pack_grid(qw(qpcr_res_l -));
# Column and row weights
$page_qpcrf->gridColumnconfigure(0,-weight=>1);
$page_qpcrf->gridColumnconfigure(1,-weight=>1);
$page_qpcrf->gridRowconfigure(3,-weight=>1);
#-------------#
# Window icon #
#-------------#
my $pixmap = $top->Pixmap(-data => $perlprimer_icon);
# set icon for main window ...
$top->Icon(-image => $pixmap);
#-------------#
# Popup Menus #
#-------------#
# A big problem with perl/Tk:
# HList does not have any way to bind to column headers or even
# to identify in which column a click was - this is the only way to
# provide sorting ... It's very clumsy!
# (update: after using this for a while, I actually think it works rather well
# for this system - since not all the Hlist column headers are generally visible
# at any one time, it's nice to have this system in place)
my $sort_reverse=0;
my $sort_prev = 10;
$popup_sort = $top->Menu(-menuitems => [
[cascade => 'Sort primers by ...', -menuitems => [
[command => 'Forward position', -command => [\&sort_primers, 1]],
[command => ' ... length', -command => [\&sort_primers, 2]],
[command => ' ... Tm', -command => [\&sort_primers, 3]],
'-',
[command => 'Reverse position', -command => [\&sort_primers, 8]],
[command => ' ... length', -command => [\&sort_primers, 6]],
[command => ' ... Tm', -command => [\&sort_primers, 7]],
'-',
[command => 'Amplicon size', -command => [\&sort_primers, 9]],
[command => 'Extensible Dimer dG', -command => [\&sort_primers, 10]],
[command => 'Full Dimer dG', -command => [\&sort_primers, 13]],
'-',
[Checkbutton => 'Reversed', -variable => \$sort_reverse, -command =>[\&sort_primers, "r"]],
]],
'-',
[command => 'Select all', -command => [\&select_all_primers]],
[command => 'Copy', -command => [\©_selected_primers]],
'-',
[command => 'Set range from selected', -command => [\&primer_take_range]],
]);
$popup_sort_seq = $top->Menu(-menuitems => [
[Button => 'Select all', -command => [\&select_all_primers]],
'-',
[Button => 'Copy', -command => [\©_selected_primers]],
]);
# Text menu
my $popup_text = $top->Menu(-menuitems => [
[Button => 'Open sequence ...', -command => [\&open_seq, \$text_widget_ref]],
[Button => 'Save sequence ...', -command => [\&save_seq, \$text_widget_ref]],
'-',
[Button => 'Select All', -command => [\&select_all_text, \$text_widget_ref]],
[Button => 'Clear', -command => [\&clear_text, \$text_widget_ref]],
[Button => 'Lower case', -command => [\&lc_text, \$text_widget_ref]],
'-',
[Button => 'Reverse complement', -command => [\&reverse_complement, \$text_widget_ref]],
]);
# Minimize the dosbox if we're running as a standalone executable ...
if ($win_exe && !check_packages("Win32::GUI")) {
# Use GUI::Hide if you want to hide the box, but personally I'd rather leave
# the console visible in case of debugging info.
Win32::GUI::Minimize(scalar(Win32::GUI::GetPerlWindow()));
}
# Show the main window
$top->deiconify();
# prevent the user from resizing the window any smaller (which makes things hidden/messy)
my $min_width = $top->geometry;
my ($min_x, $min_y) = ($min_width =~ /(\d.*)x(\d.*?)\+/);
$top->minsize($min_x, $min_y);
# Open file if specified on the command line
if ($commandline) {
$top->update;
pp_file_open($commandline);
}
# Override HList bindings for left/right and other commands...
my $class = "Tk::HList";
$top->bind($class,'<Right>', \&jump_to_tm);
$top->bind($class,'<Left>', \&jump_back);
$top->bind($class,'<2>', \©_selected_primers);
$top->bind($class,'<Control-a>', \&select_all_primers);
$top->bind($class,'<Control-c>', \©_selected_primers);
$top->bind($class,'<3>', \&menu_popup);
# Socket code for contig viewer
my ($sock, $sel, $sock_repeat_id);
setup_sock();
if ($win_exe) {
print "\nPerlPrimer started successfully\n";
}
MainLoop();
# Program end
exit_program();
#------------------------------#
# #
# Subroutines start here ... #
# #
#------------------------------#
#------------------#
# Post-GUI routine #
#------------------#
sub exit_program {
# Save updated prefs, (including Balloon help)
my $file_data = "";
foreach my $i (keys %pref_variables) {
my $pointer = $pref_variables{$i};
$file_data .= "$i = $$pointer\n";
}
foreach my $i (keys %pref_arrays) {
my $pointer = $pref_arrays{$i};
$file_data .= "$i = [".join(",",@$pointer)."]\n";
}
open (PREFS, ">$pref_file") || die "Error: could not open $pref_file for writing: $!\n";
print PREFS $file_data;
close (PREFS);
exit 0;
}
#----------------#
# Socket reading #
#----------------#
sub setup_sock {
$sock = IO::Socket::INET->new(
Listen => SOMAXCONN,
Reuse => 1,
LocalPort => $tcp_port,
Proto => 'tcp',
);
if (defined($sock)) {
if ($os eq 'win') {
# Fileevent with sockets does not work with Win32 -
# here we check by manually polling the socket every second
use IO::Select;
$sel = IO::Select->new;
$sel->add($sock);
$sock_repeat_id = $top->repeat($socket_polling_interval => \&read_sock);
} else {
$top->fileevent($sock, 'readable' => \&read_sock);
}
} else {
# no socket available
print "Could not open socket at port $tcp_port\n";
}
}
sub read_sock {
# Read the socket
my $hand = $sock;
if ($os eq 'win') {
# direct polling ...
my(@ready) = $sel->can_read(0);
return if $#ready == -1; # Nothing to read ... move along ...
$hand = $ready[0];
}
my $new_sock = $hand->accept();
my $numbytes = 2048;
my $data = "";
my $count;
my $num = $numbytes;
while ($num==$numbytes) {
my $buf;
$num = sysread $new_sock, $buf, $numbytes;
unless (defined($num)) {
last;
}
$data .= $buf;
}
my (@lines) = split("\n", $data);
if ($#lines == -1) {
# connection has been broken or something has gone wrong
return;
} else {
# Open the socket data as a FASTA file
pp_file_open("[data from external application]", '', @lines);
my ($sub) = get_variables(qw(primer_sub));
&$sub() if $ipc_autofind;
}
}
#-------------------------#
# GUI building subroutine #
#-------------------------#
# The messy guts that allow all the other GUI parts of the program to be so neat
# and tidy. It's nothing fancy - in fact, it's downright inelegant - but it gets
# the job done, keeps things consistent, and writing new gui code (eg, the
# preferences dialogue) is a matter of minutes to do ...
sub nr {
# New row signal
my ($reference, $pady, $expand) = @_;
$reference ||= $old_reference;
$expand ||= 0;
my $fill = $expand ? 'both' : 'x';
$pady = $frame_pady unless defined($pady);
push @row_counter, $$reference->Frame(
)->pack(-side=>'top', -anchor=>'nw', -expand=>$expand, -fill=>$fill, -pady=>$pady, -padx=>3);
$old_reference = $reference;
}
sub nc {
# New column signal
my ($reference, $padx, $pady) = @_;
$reference ||= $old_reference;
$padx = 4 unless defined($padx);
$pady = $frame_pady unless defined($pady);
push @row_counter, $$reference->Frame(
)->pack(-side=>'left', -anchor=>'nw', -pady=>$pady, -padx=>$padx);
$old_reference = $reference;
}
sub pack_gui {
my ($widget_type, $textvariable, $widget_name, @args) = @_;
my $top_reference = $row_counter[-1];
$widget_name||='null'; # makes it easy for labels, etc, that don't need balloon messages
my $widget_ref = \$packed_widgets{$widget_name};
# Switch on $widget_type ...
for ($widget_type) {
/^Entry/ && do {
my ($width, @widget_args) = @args;
$$widget_ref = $top_reference->$widget_type(
-textvariable=>$textvariable,
-width=>$width,
@widget_args,
)->pack(-side=>'left');
last; };
/^Label/ && do {
my (@widget_args) = @args;
my $text_option = ref($textvariable) ? "textvariable" : "text";
$$widget_ref = $top_reference->$widget_type(
-$text_option=>$textvariable,
@widget_args,
)->pack(-side=>'left');
last; };
/^Checkbutton/ && do {
my ($variable, @widget_args) = @args;
$$widget_ref = $top_reference->$widget_type(
-text=>$textvariable,
-variable=>$variable,
-onvalue=>1,
-offvalue=>0,
@widget_args,
)->pack(-side=>'left', -anchor=>'w', -pady=>0, -ipady=>0);
last; };
/^BrowseEntry/ && do {
my ($array_ref, $listwidth, @widget_args) = @args;
$listwidth||=20;
$$widget_ref = $top_reference->$widget_type(
-variable=>$textvariable,
-choices=>[@$array_ref],
-listwidth=>$listwidth*7,
-width => $listwidth,
@widget_args,
)->pack(-side=>'left', -padx=>0, -ipadx=>0);
last; };
/^Button/ && do {
my ($command, $default, $state, @widget_args) = @args;
$state ||= 'normal';
$default ||= 'normal';
$$widget_ref = $top_reference->$widget_type(
-text=>$textvariable,
-command=>\$command,
-state=>$state,
-default=>$default,
@widget_args,
)->pack(-side=>'left', -anchor=>'w', -pady=>$button_pack_pady, -padx=>$button_pack_padx);
# bind return to default button
if ($default eq 'active') {
my $parent = $$old_reference->parent;
$parent->bind('<Return>' => sub{$$widget_ref->invoke()});
}
last; };
/^LabFrame/ && do {
my ($frame_reference, @widget_args) = @args;
$$widget_ref=$$frame_reference->$widget_type(
# -background=>'grey50',
-label=>$textvariable,
-labelside=>'acrosstop',
@widget_args,
);
last; };
/Text/ && do {
my ($width, $height, @widget_args) = @args;
$$widget_ref=$top_reference->Scrolled($widget_type,
-width=>$width,
-height=>$height,
@widget_args,
)->pack(-side=>'left', -expand=>1, -fill=>'both');
bind_mousewheel($$widget_ref);
last; };
/^HList/ && do {
my ($width, $height, $columns, $browse_command, @widget_args) = @args;
$$widget_ref=$top_reference->Scrolled($widget_type,
-scrollbars=>'osoe',
-width=>$width,
-height=>$height,
-columns=>$columns,
-browsecmd=>\&$browse_command,
-command=>\&hlist_command,
@widget_args,
)->pack(-side=>'left', -expand=>1, -fill=>'both');
bind_mousewheel($$widget_ref);
last; };
/^Canvas/ && do {
my ($buttons, $bindings, @widget_args) = @args;
canvas_buttons($top_reference, $widget_name) if $buttons;
$$widget_ref=$top_reference->$widget_type(
-height=>$dna_canvas_height,
@widget_args,
)->pack(-side=>'left', -expand=>1, -fill=>'x', -padx=>6, -pady=>2);
bind_canvas($widget_ref) if $bindings;
last; };
/^Radio/ && do {
my (@widget_args) = @args;
$$widget_ref=$top_reference->$widget_type(
-text=>$textvariable,
@widget_args,
)->pack(-side=>'left', -anchor=>'w');
last; };
# Warning - an undefined widget type ...
print "Undefined widget: @_\n";
}
#--------------#
# Balloon help #
#--------------#
# This is a very easy way to attach balloons to widgets, while keeping all the help messages together
# (in the %balloonmsg hash above)
if ($balloonmsg{$widget_name}) {
$Balloon->attach($$widget_ref, -balloonposition => 'mouse', -balloonmsg => $balloonmsg{$widget_name});
}
}
sub pack_grid {
my @widgets = map {/[\-\+\^]/ ? $_ : $packed_widgets{$_}} @_;
Tk::grid(@widgets, -sticky=>'nsew', -padx=>4);
}
sub pack_button {
my ($widget, $image, $sub_ref) = @_;
return $widget->Button(
-relief => 'flat',
-image => $image,
-command=> $sub_ref,
-activebackground=>$activebackground_color,
) if $os eq 'win';
return $widget->Button(
-relief => 'flat',
-image => $image,
-command=> $sub_ref,
)->pack(-side=>'left');
}
sub pack_osc_buttons {
#open/save/clear button stuff ...
my ($widget_name) = @_;
$packed_widgets{"$widget_name b"} = $row_counter[-1]->Frame()->pack(-side=>'left', -anchor=>'nw');
$packed_widgets{"$widget_name open"}=pack_button($packed_widgets{"$widget_name b"}, $top->Pixmap(-data => $icon_dna_open), [\&open_seq, \$packed_widgets{$widget_name}])
->pack(-side=>'top', -anchor=>'w', -fill=>'x');
$Balloon->attach($packed_widgets{"$widget_name open"}, -balloonposition => 'mouse', -balloonmsg => "Open DNA sequence");
$packed_widgets{"$widget_name save"}=pack_button($packed_widgets{"$widget_name b"}, $top->Pixmap(-data => $icon_dna_save), [\&save_seq, \$packed_widgets{$widget_name}])
->pack(-side=>'top', -anchor=>'w', -fill=>'x');
$Balloon->attach($packed_widgets{"$widget_name save"}, -balloonposition => 'mouse', -balloonmsg => "Save DNA sequence");
$packed_widgets{"$widget_name clear"}=pack_button($packed_widgets{"$widget_name b"}, $top->Pixmap(-data => $icon_clear), [\&clear_text, \$packed_widgets{$widget_name}])
->pack(-side=>'top', -anchor=>'w', -fill=>'x');
$Balloon->attach($packed_widgets{"$widget_name clear"}, -balloonposition => 'mouse', -balloonmsg => "Clear sequence");
}
sub pack_menu {
my $name = shift;
$packed_widgets{$name}->menu(undef);
$packed_widgets{$name}->bind('<3>', \&menu_text);
}
sub canvas_buttons {
my ($widget_ref, $widget_name) = @_;
$packed_widgets{"$widget_name info"}=pack_button($widget_ref, $top->Pixmap(-data => $icon_info), \&canvas_info)
->pack(-side=>'right', -expand=>0, -anchor=>'e', -fill=>'none');
$Balloon->attach($packed_widgets{"$widget_name info"}, -balloonposition => 'mouse', -balloonmsg => "Graphical display help");
$packed_widgets{"$widget_name magnify"}=pack_button($widget_ref, $top->Pixmap(-data => $icon_magnify), [\&dna_magnify, 0])
->pack(-side=>'right', -expand=>0, -anchor=>'e', -fill=>'none');
$Balloon->attach($packed_widgets{"$widget_name magnify"}, -balloonposition => 'mouse', -balloonmsg => "Magnified view");
}
sub bind_canvas {
# Bindings for DNA canvas
my ($widget_ref) = @_;
$$widget_ref->CanvasBind('<B1-Motion>' => sub {items_drag($Tk::event->x, $widget_ref)});
$$widget_ref->CanvasBind('<B2-Motion>' => sub {amplicon_drag($Tk::event->x, $widget_ref)});
$$widget_ref->CanvasBind('<1>' => sub {items_drag($Tk::event->x, $widget_ref)});
$$widget_ref->CanvasBind('<2>' => sub {amplicon_drag($Tk::event->x, $widget_ref)});
$$widget_ref->CanvasBind('<Control-B1-Motion>' => sub {amplicon_drag($Tk::event->x, $widget_ref)});
$$widget_ref->CanvasBind('<Control-1>' => sub {amplicon_drag($Tk::event->x, $widget_ref)});
$$widget_ref->CanvasBind('<3>' => sub {dna_magnify($Tk::event->x)});
$$widget_ref->CanvasBind('<Control-3>', \&draw_dna);
$$widget_ref->CanvasBind('<Configure>' => \&draw_dna);
}
#---------------------#
# MouseWheel bindings #
#---------------------#
sub bind_mousewheel {
# Thanks to Slaven Rezic, Steve Liddie and "Mastering Perl/Tk" for this routine (slightly modified) ...
my ($w) = @_;
if ($os eq 'win') {
# Windows bindings
# Apparently mousewheel support is now built in .... ?!
# $w->bind('<MouseWheel>' => [ sub {
# $_[0]->yview('scroll', -($_[1] / 120) * $scroll_factor, 'units')
# }, Ev('D') ]
# );
} else {
# *nix bindings
$w->bind('<4>' => sub {
$_[0]->yview('scroll', -$scroll_factor, 'units');
});
$w->bind('<5>' => sub {
$_[0]->yview('scroll', $scroll_factor, 'units');
});
}
}
sub update_title {
my $nb_page = which_nb_page();
if ($open_file{$nb_page}) {
if ($open_file{$nb_page} eq 'File not saved') {
$top->configure(-title=>"PerlPrimer v$version");
return;
} else {
my $file = $open_file{$nb_page};
$top->configure(-title=>"PerlPrimer v$version - $file");
}
}
return;
}
#-------------------#
# Read DNA sequence #
#-------------------#
sub read_windows {
my ($sub_ref, $dnaseq_f, $dnaseq_f_len, $dnaseq_r) = @_;
$reverse=0;
sbarprint("\nWindowing forward seq ...");
@PF = &$sub_ref($dnaseq_f, $dnaseq_f_len);
$pfkeys=@PF;
if ($dnaseq_r) {
$reverse=1;
sbarprint("\nWindowing reverse seq ...");
@PR = &$sub_ref($dnaseq_r, $dnaseq_f_len);
}
}
#-------------------------------------------------#
# basic complementation and bisulphite conversion #
#-------------------------------------------------#
sub complement {
$_ = shift;
tr/AGCTagct/TCGAtcga/;
return $_;
}
sub bisulphite {
$_ = shift;
tr/C/T/;
return $_;
}
#----------------------------#
# primer window calculations #
#----------------------------#
sub primer_window {
my ($primer_seq, $dnaseq_len) = @_;
my $key;
my @primer_list=();
my $repeat_real = $repeat-1;
my ($min_tm, $max_tm, $max_diff, $pri_win_min, $pri_win_max, $min_ampsize, $max_ampsize, $max_range_5p, $min_range, $max_range, $max_range_3p)
= get_variables(qw(min_tm max_tm max_diff pri_win_win pri_win_max min_ampsize max_ampsize max_range_5p min_range max_range max_range_3p));
# old method - using amplicon range only ...
my ($seqbound5,$seqbound3)=($$min_range,$$max_range);
$seqbound5 ||= 0;
$seqbound5 = $$max_range-$$max_ampsize if ($$max_range) && ($$max_ampsize) && ($reverse==0) && ($$max_range-$$max_ampsize>0);
$seqbound5 = $dnaseq_len-$$min_range-$$max_ampsize if ($$min_range) && ($reverse==1) && ($dnaseq_len-$$min_range-$$max_ampsize > 0);
if (($$max_ampsize) && ($$min_ampsize)) {
if ($reverse==0) {
unless ($$min_range) {
$seqbound3 = $dnaseq_len-$$min_ampsize;
} else {
$seqbound3 = ($dnaseq_len-$$min_ampsize>$$min_range ? $$min_range : $dnaseq_len-$$min_ampsize);
}
} else {
$seqbound3 = ($$max_range ? $dnaseq_len-$$max_range+$$pri_win_max : $dnaseq_len)
}
}
# my $i;
# foreach (@intron_exon_bounds) {
# print $i++," $_\n";
# }
# print "[$reverse] bounds: $seqbound5 - $seqbound3\n";
# QPCR specific (limiting range to specific exons)
if ($ie_limit) {
unless ($reverse) {
if ($ie_limit_5p) {
my $limit = $ie_limit_5p-2;
if ($limit>=0) {
$seqbound5 = $intron_exon_bounds[$limit]-$$pri_win_max;
}
}
if ($ie_limit_3p) {
my $limit = $ie_limit_3p-1;
$limit = 0 if $limit < 0;
if (defined($limit)) {
unless ($limit > $#intron_exon_bounds) {
$seqbound3 = $intron_exon_bounds[$limit]+$$pri_win_max;
}
}
}
} else {
# reverse sequence
if ($ie_limit_3p) {
#### in progress
my $limit = $ie_limit_3p-1;
$limit = 0 if $limit < 0;
if (defined($limit)) {
unless ($limit > $#intron_exon_bounds) {
$seqbound5 = $dnaseq_len - ($intron_exon_bounds[$limit]+$$pri_win_max);
}
}
}
if ($ie_limit_5p) {
my $limit = $ie_limit_5p-2;
if ($limit>=0) {
$seqbound3 = $dnaseq_len - ($intron_exon_bounds[$limit]-$$pri_win_max);
}
}
}
}
# print "[$reverse] bounds: $seqbound5 - $seqbound3\n";
# the above covers the unlikely possibility that $max_ampsize is set
# and $max_range_5p and $max_range_3p are not. It might be desirable at some
# point, and it was the original way of doing things. It doesn't hurt!
# ... and is now used for qpcr!
# To use without specific range boundaries but only with a minimum and
# maximum amplicon distance, keep $max_range_5p and $min_range equal,
# and likewise at the 3' end
if (defined($$max_range_5p)&&defined($$max_range_3p)) {
unless (($$max_range_5p==$$min_range)&&($$max_range_3p==$$max_range)) {
if ($reverse==0) {
$seqbound5 = $$max_range_5p;
$seqbound3 = $$min_range + $$pri_win_max;
}
if ($reverse==1) {
$seqbound5 = $dnaseq_len-$$max_range_3p-1;
$seqbound3 = $dnaseq_len-$$max_range + $$pri_win_max;
}
}
}
return unless defined($seqbound5) && defined($seqbound3);
for my $i ($seqbound5 .. $seqbound3) {
for my $primer_win ($$pri_win_min .. $$pri_win_max) {
next if $i+$primer_win>$dnaseq_len;
my $currwindow=substr($primer_seq, $i, $primer_win);
next if check_degenerate($currwindow);
if ($exclude_gc) {
# exclude based on %GC content
my $gc=gc($currwindow);
next if $gc < $min_gc or $gc > $max_gc;
}
if ($exclude_clamp) {
# calculate GC clamp at 5' end: two out of last three residues required...
my $gc_clamp=gc(substr($currwindow, -3, 3));
next unless $gc_clamp > 50;
}
if ($exclude_rr) {
# simple run exclusion:
# ($run is number of consecutive bases to exclude)
next if ($currwindow =~ /(C{$run,}|A{$run,}|G{$run,}|T{$run,})/);
# simple repeat exclusion:
# ($repeat is number of consecutive repeats of two or more bases)
next if ($currwindow =~ /(.{2,})\1{$repeat_real,}/);
}
# All possible primers have now been excluded
# Get the tm and check this against the accepted range:
my ($tm)=tm($currwindow);
if (($$min_tm < $tm) && ($tm < $$max_tm)) {
# Looks good, so let's add the primer to the array
push @primer_list, [$i, $primer_win, $currwindow, $tm];
}
}
}
return @primer_list;
}
sub check_degenerate {
$_ = shift;
if (/[^ATGC]/i) {
dialogue("One of your primer sequences has a degenerate or non-DNA character. PerlPrimer cannot calculate the Tm of degenerate sequences") if shift;
return 1;
}
}
#---------------------------------#
# bisulphite window calculations #
#---------------------------------#
sub bisul_window {
# See the primer_window subroutine above for general comments
my ($primer_seq, $dnaseq_len)=@_;
my $key;
my $repeat_bs_real = $repeat_bs-1;
my ($seqbound5,$seqbound3) = 0;
my @primer_list=();
my ($min_tm, $max_tm, $max_diff, $pri_win_min, $pri_win_max, $min_ampsize, $max_ampsize, $max_range_5p, $min_range, $max_range, $max_range_3p)
= get_variables(qw(min_tm max_tm max_diff pri_win_win pri_win_max min_ampsize max_ampsize max_range_5p min_range max_range max_range_3p));
$seqbound5 = 0;
$seqbound5 = $$max_ampsize-$$max_range if ($$max_range) && ($reverse==0) && ($$max_ampsize-$$max_range>0);
$seqbound5 = $dnaseq_len-$$min_range-$$max_ampsize if ($$min_range) && ($reverse==1) && ($dnaseq_len-$$min_range-$$max_ampsize > 0);
if (defined($$max_range_5p)&&defined($$max_range_3p)) {
unless (($$max_range_5p==$$min_range)&&($$max_range_3p==$$max_range)) {
if ($reverse==0) {
$seqbound5 = $$max_range_5p;
$seqbound3 = $$min_range + $$pri_win_max;
}
if ($reverse==1) {
$seqbound5 = $dnaseq_len-$$max_range_3p-1;
$seqbound3 = $dnaseq_len-$$max_range + $$pri_win_max;
}
}
} else {
if ($reverse==0) {
unless ($$min_range) {
$seqbound3 = $dnaseq_len-$$min_ampsize;
} else {
$seqbound3 = ($dnaseq_len-$$min_ampsize>$$min_range ? $$min_range : $dnaseq_len-$$min_ampsize);
}
} else {
$seqbound3 = ($$max_range ? $dnaseq_len-$$max_range+$$pri_win_max : $dnaseq_len)
}
}
return unless defined($seqbound5) && defined($seqbound3);
my $count;
for my $i ($seqbound5 .. $seqbound3) {
for my $primer_win ($$pri_win_min .. $$pri_win_max) {
$count++;
next if $i+$primer_win>$dnaseq_len;
my $currwindow=substr($primer_seq, $i, $primer_win);
next if check_degenerate($currwindow);
# Check for %C content
next if cc($currwindow) < $bisul_min_c;
#next if ga($currwindow) < 50;
# Check for exclude_cpg
# If exclude_cpg is set, no primers with CpG residues are include
# Otherwise, primers are allowed to have up to a maximum of 2 CpG residues
if ($exclude_cpg) {
next if $currwindow =~ /CG/
} else {
my $count_cpg = 0;
while ($currwindow =~ /CG/g) {
$count_cpg++
}
next if $count_cpg >2;
}
# Check for 3' C content
if ($exclude_3c) {
# It is important that primer specificity to the converted template is given
# by having C residues at the 3' end
# The following gives the most flexibility: a primer is accepted if
# it either ends in a C or has two of the last three bases as C's
next unless ((substr($currwindow, -1, 1) eq "C") or (cc(substr($currwindow, -3, 3)) > 50));
}
# now convert the primer ...
my $currwindowbs = bisulphite($currwindow);
# do we exclude repeats and runs before or after bisulphite conversion?
my $checkref = ($pre_bs ? \$currwindowbs : \$currwindow);
if ($exclude_rr_bs) {
# Run exclusion:
next if ($$checkref =~ /(C{$run_bs,}|A{$run_bs,}|G{$run_bs,}|T{$run_bs,})/);
# Repeat exclusion:
next if ($$checkref =~ /(.{2,})\1{$repeat_bs_real,}/);
}
# Need to complement if we're creating reverse primers,
# as the two converted strands of DNA are non-complementary
if ($reverse==1) {
$currwindowbs=complement($currwindowbs);
}
my ($tm)=tm($currwindowbs);
if (($$min_tm < $tm) && ($tm < $$max_tm)) {
# Add the original, unconverted sequence to the array as well:
# Note - this will not be complemented if reversed seq
push @primer_list, [$i, $primer_win, $currwindowbs, $tm, $currwindow];
}
}
}
return @primer_list;
}
#-----------------------------------------#
# Calculation of amplicon lengths and #
# compatible temperature matching primers #
#-----------------------------------------#
sub calc_amplicon {
my $dnaseq_r_len = shift;
my $count_amplicon=0;
@primer_pairs=();
my $count=0;
my ($min_tm, $max_tm, $max_diff, $pri_win_min, $pri_win_max, $min_ampsize, $max_ampsize, $max_range_5p, $min_range, $max_range, $max_range_3p)
= get_variables(qw(min_tm max_tm max_diff pri_win_win pri_win_max min_ampsize max_ampsize max_range_5p min_range max_range max_range_3p));
# (the reverse sequence was reversed to make it 5'->3')
# So I either have to recalculate the revese numbers or
# not reverse the sequence and count backwards!
#
# Solution:
#
# realpos_start = total_length - calc_pos
# and closest_real_base = realpos_start - window
# thus = total_length - calc_pos - window
foreach my $key_f (@PF) {
return if ($cancel==1);
my ($pos_f, $len_f, $seq_f, $tm_f, $unconverted_f ) = @$key_f;
foreach my $key_r (@PR) {
return if ($cancel==1);
my ($pos_r, $len_r, $seq_r, $tm_r, $unconverted_r ) = @$key_r;
my $realpos_r = $dnaseq_r_len - $pos_r - 1;
my $amp_size=$realpos_r-$pos_f;
# Skip all pairs where forward > reverse ...
next unless ($realpos_r-$len_r>$pos_f+$len_f);
# Range check (messy):
# Now should be covered in windowing! but need for qpcr
if (($$min_range) && ($$max_range)) {
next unless ($pos_f < $$min_range && $$max_range < $realpos_r);
}
# Temperature check:
### could be more efficient
next unless ($tm_r > ($tm_f-$$max_diff) && $tm_f > ($tm_r-$$max_diff));
# QPCR specific:
if ($qpcr_flag == 1) {
# Amplicon size check
next if ($amp_size < $$min_ampsize || $amp_size > $$max_ampsize);
#check amp range spans i/e boundary
my $qpcr_check=0;
if ($ie_span) {
foreach my $i (@intron_exon_bounds) {
$qpcr_check=1 if $pos_f<$i && $i<$realpos_r
}
next unless $qpcr_check==1;
}
#check at least one primer falls across i/e boundary
$qpcr_check=0;
if (($ie_overlap) && ($exclude_ie)) {
foreach my $i (@intron_exon_bounds) {
$qpcr_check=1 if $pos_f<($i-$exclude_ie) && ($i+$exclude_ie)<($pos_f+$len_f);
$qpcr_check=1 if ($realpos_r-$len_r)<($i-$exclude_ie) && ($i+$exclude_ie)<$realpos_r;
}
next unless $qpcr_check==1;
}
}
# all OK up to here, so let's check primer-dimers:
# NB: this is a big speed hit ...
# my (@pd_score, @pd_sorted)=();
#
# push(@pd_score,primer_dimer($seq_f,$seq_f));
# push(@pd_score,primer_dimer($seq_f,$seq_r));
# push(@pd_score,primer_dimer($seq_r,$seq_r));
# @pd_sorted=sort{$a <=> $b} @pd_score;
# extensible
my $pd_score = primer_dimer($seq_f,$seq_f);
my $new_score = primer_dimer($seq_f,$seq_r);
$pd_score = $new_score if $new_score < $pd_score;
$new_score = primer_dimer($seq_r,$seq_r);
$pd_score = $new_score if $new_score < $pd_score;
# non_extensible
my $pd_score_full = primer_dimer($seq_f,$seq_f,1);
$new_score = primer_dimer($seq_f,$seq_r,1);
$pd_score_full = $new_score if $new_score < $pd_score_full;
$new_score = primer_dimer($seq_r,$seq_r,1);
$pd_score_full = $new_score if $new_score < $pd_score_full;
$tm_f = sprintf("%.2f", $tm_f);
$tm_r = sprintf("%.2f", $tm_r);
push @primer_pairs, [ $seq_f, $pos_f, $len_f, $tm_f,
$seq_r, $pos_r, $len_r, $tm_r, $realpos_r, $amp_size, $pd_score, ( $unconverted_f ? $unconverted_f : 0), ( $unconverted_r ? $unconverted_r : 0), $pd_score_full ];
}
$count++;
my $percent = sprintf("%.f", ($count/$pfkeys)*100);
sbarprint("\nCalculating amplicons ... $percent% completed ...");
}
sbarprint("\nFinished ... found ".($#primer_pairs+1)." primer pairs");
}
#-----------------------------------------#
# Calculation of amplicon lengths and #
# compatible temperature matching primers #
#-----------------------------------------#
sub calc_seq_primers {
# scaled down calc_amplicon routine
my $count_amplicon=0;
@primer_pairs=();
my $count=0;
my $pdcheck=1;
my ($min_range, $max_range)
= get_variables(qw(min_range max_range));
my $last_seq;
# $pd_full = 1;
# $pd_extensible = 0;
foreach (@PF) {
return if ($cancel==1);
$count++;
my $percent = sprintf("%.f", ($count/$pfkeys)*100);
sbarprint("\nFinding primers ... $percent% completed ...");
my ($pos, $len, $seq, $tm_f ) = @$_;
# take the first one that fits if last_seq hasn't been set ...
unless (defined($last_seq)) {
next if $pos < $$min_range;
if ($pos > $seq_spacing_max+$$min_range) {
dialogue("Contiguous primers could not be found within the set parameters");
last;
}
} else {
next if $pos > $$max_range;
next if $pos < $last_seq + $seq_spacing_min;
if ($pos > $last_seq + $seq_spacing_max) {
dialogue("Contiguous primers could not be found within the set parameters");
last;
}
}
# calculate primer-dimers
my $pd = primer_dimer($seq,$seq,1);
# exclude all primer-dimers if asked ...
if ($exclude_pd_seq == 1) {
next if $pd < -$seq_pd_min;
}
$tm_f = sprintf("%.2f", $tm_f);
push @primer_pairs, [ $seq, $pos, $len, $tm_f, $pd ];
$last_seq = $pos;
}
# $pd_full = 0;
# $pd_extensible = 1;
sbarprint("\nFinished ... found ".($#primer_pairs+1)." primer pairs");
}
# sub calc_seq_primers {
# # scaled down calc_amplicon routine
# my $count_amplicon=0;
# @primer_pairs=();
# my $count=0;
#
# my $pdcheck=1;
#
# my ($min_range, $max_range)
# = get_variables(qw(min_range max_range));
#
# my $last_seq;
# my $seq_spacing_mid = int(($seq_spacing_max+$seq_spacing_min)/2);
#
# $pd_full = 1;
# # $pd_extensible = 0;
#
# # build hash table
# my $i;
# my $flag=0;
# my $skip;
# my $interval=1;
# my %seq_primers;
# foreach (@PF) {
# $i++;
# my ($pos) = @$_;
# $seq_primers{$pos} = $i;
# }
#
# my $j;
# for ($j=$$min_range; $j < $$max_range;) {
# my ($pos, $len, $seq, $tm_f);
# return if ($cancel==1);
#
# if ($skip) {
# $flag = 1-$flag;
# if ($flag) {
# $j+=$interval;
# } else {
# $j-=$interval;
# $interval++;
# }
# $skip=0;
# }
#
# $count++;
# # my $percent = sprintf("%.f", ($count/$pfkeys)*100);
# sbarprint("\nFinding primers ... $count primers checked ...");
#
#
# # take the first one that fits if last_seq hasn't been set ...
# unless (defined($last_seq)) {
# if ($seq_primers{$j}) {
# ($pos, $len, $seq, $tm_f ) = @{ $PF[$seq_primers{$j}] };
# } else {
# # we want the first primer to be as near to the start as possible
# print "$j\n";
# $j++;
# next;
# }
# print "$j: OK! pos was $pos\n";
#
# next if $pos < $$min_range;
# if ($pos > $seq_spacing_max+$$min_range) {
# dialogue("Contiguous primers could not be found within the set parameters");
# last;
# }
# } else {
# if ($seq_primers{$j}) {
# ($pos, $len, $seq, $tm_f ) = @{ $PF[$seq_primers{$j}] };
# } else {
# $skip=1;
# next;
# }
# if ($pos > $$max_range) {
# $skip=1;
# next;
# }
# if ($pos < $last_seq + $seq_spacing_min) {
# $skip=1;
# next;
# }
# if ($pos > $last_seq + $seq_spacing_max) {
# dialogue("Contiguous primers could not be found within the set parameters");
# last;
# }
# }
#
# # exclude all primer-dimers if asked ...
# my $pd;
# if ($exclude_pd_seq == 1) {
# if ($pd = primer_dimer($seq,$seq) < -$seq_pd_min) {
# $skip=1;
# next;
# }
# }
#
# $tm_f = sprintf("%.2f", $tm_f);
#
# push @primer_pairs, [ $seq, $pos, $len, $tm_f, $pd ];
# $interval = 1;
# $last_seq = $pos;
# $j = $pos + $seq_spacing_mid;
# }
#
# # $pd_extensible = 1;
# sbarprint("\nFinished ... found ".($#primer_pairs+1)." primer pairs");
# }
#-------------------------#
# calculate %base content #
#-------------------------#
# %GC
sub gc {
$_ = $_[0];
my($gc,$countgc,$counttotal);
$gc=0;
$countgc=0;
$countgc = tr/GCgc/GCgc/;
$counttotal = length();
$gc = $countgc/$counttotal*100;
return $gc;
}
# %C
sub cc {
$_ = $_[0];
my($cc,$countc,$counttotal);
$cc=0;
$countc=0;
$countc = tr/C/C/;
$counttotal = length();
$cc = $countc/$counttotal*100;
return $cc;
}
#----------------#
# Clean sequence #
#----------------#
sub clean_seq {
$_ = shift;
my $nb_page = which_nb_page();
my ($fasta_name) = /^\s*>(.*\n)/;
s/^\s*>(.*\n)//g; #remove FASTA formatting if it exists
# print "name = $fasta_name\n";
if ($fasta_name && $open_file{$nb_page} eq "File not saved") {
# if FASTA details are present ...
my $name = format_file_name($1);
$open_file{$nb_page} = $name;
$top->configure(-title=>"PerlPrimer v$version - $name");
}
s/[\s\n\r]//g; #remove spaces/new lines
s/-//g; #remove gaps in sequence
s/\d//g; #remove digits
return $_;
}
#-------------------------------#
# forward and reverse sequences #
#-------------------------------#
sub getseq {
my ($min_ampsize, $max_ampsize, $max_range_5p, $min_range, $max_range, $max_range_3p)
= get_variables(qw(min_ampsize max_ampsize max_range_5p min_range max_range max_range_3p));
if (($$min_range) && ($$max_range)) {
$$min_ampsize=$$max_range - $$min_range;
$$max_ampsize=$$max_range - $$min_range if ($$max_range - $$min_range)>$$max_ampsize;
}
# forward
$_ = uc(shift);
$_ = clean_seq($_);
my $dnaseq_f = $_;
# reverse
my $dnaseq_r_top = reverse($dnaseq_f);
my $dnaseq_r = complement($dnaseq_r_top);
my $dnaseq_f_len = length($dnaseq_f);
my $dnaseq_r_len = length($dnaseq_r);
return ($dnaseq_f, $dnaseq_f_len, $dnaseq_r_top, $dnaseq_r, $dnaseq_r_len);
}
#-----
# subroutine for calculating Tm as per SantaLucia(1998), cited above, with Mg++
# (and K+, Tris++) concentration calculated via equations 7 and 8 from
# von Ahsen, et al, 2001, Clinical Chemistry 47(11):1956-1961
#-----
sub tm {
my ($primer) = @_;
$primer = uc($primer); # if user enters primer directly as lower-case
my ($i, $nn, $initterm, $endterm);
my $primer_len = length($primer);
my ($deltaH, $deltaS);
#-----------------------------#
# calculate deltaH and deltaS #
#-----------------------------#
for ($i=0; $i<$primer_len-1; $i++) {
$nn = substr($primer, $i, 2);
$deltaH+= $oligo_dH{$nn};
$deltaS+= $oligo_dS{$nn};
}
#-------------------------#
# initial term correction #
#-------------------------#
$initterm="init" . substr($primer, 0, 1);
$deltaH+= $oligo_dH{$initterm};
$deltaS+= $oligo_dS{$initterm};
$endterm="init" . substr($primer, -1, 1);
$deltaH+= $oligo_dH{$endterm};
$deltaS+= $oligo_dS{$endterm};
# Tm at 1M NaCl
# $tm= ($deltaH * 1000) / ($deltaS + (1.987 * log($oligo_conc / 4))) - 273.15;
#------------------------------------------#
# correct for salt concentration on deltaS #
#------------------------------------------#
# Big problems if [dNTPs] > [Mg++] !! This is a quick fix ...
my $salt_correction;
if ($mg_conc > $dntp_conc) {
$salt_correction = sqrt($mg_conc - $dntp_conc);
} else {
$salt_correction = 0;
}
my $na_eq=($monovalent_cation_conc + 120 * $salt_correction)/1000;
# deltaS correction:
$deltaS += (0.368 * ($primer_len - 1) * log($na_eq));
my $oligo_conc_mols = $oligo_conc / 1000000000;
# Salt corrected Tm
# NB - for PCR I'm assuming for the moment that the [strand target] << [oligo]
# and that therefore the C(t) correction term approx equals [oligo]
my $corrected_tm=(($deltaH * 1000) / ($deltaS + (1.987 * log($oligo_conc_mols/4)))) - 273.15;
return ($corrected_tm, $deltaH, $deltaS);
}
#----------------------------------------------------------#
# Recalculate the oligo_dG hash on current salt conditions #
#----------------------------------------------------------#
sub recalculate_dG {
# because dG = dH - TdS, and dS is dependent on the salt concentration ...
my $temperature = shift || $pd_temperature;
# Big problems if [dNTPs] > [Mg++] !! This is a quick fix ...
my $salt_correction;
if ($mg_conc > $dntp_conc) {
$salt_correction = sqrt($mg_conc - $dntp_conc);
} else {
$salt_correction = 0;
}
my $na_eq=($monovalent_cation_conc + 120 * $salt_correction)/1000;
# the length of each NN dimer is 2, therefore the modifier is 1
my $entropy_adjust = (0.368 * log($na_eq));
foreach my $key (keys(%oligo_dH_full)) {
next if $key =~ /init/; # the length of each monomer is 1, thus the modifier of dS is 0 and the values are precalulated
my $dS = $oligo_dS_full{$key} + $entropy_adjust;
my $dG = $oligo_dH_full{$key}-((273.15+$temperature)*($dS/1000));
$oligo_dG{$key} = $dG;
}
}
#--------------------------#
# Primer-dimer calculation #
#--------------------------#
sub primer_dimer {
# This is my second attempt at implementing a primer-dimer system:
# The first attempt aligned each combination together explicitly; this attempt
# creates a binding matrix and then reads each primer combination from the
# matrix. It's not significantly faster, but it does have the advantage of
# extending this algorithm to allow for unequal loops (although this has not
# been implemented as yet) and providing the possiblity of reading all
# primer-dimers (not just 3') by adjusting a single variable (which is used when
# displaying primer information.
my ($primer_f, $primer_r, $pd_full) = @_;
return unless ($primer_f) && ($primer_r);
my ($k, $l);
@score=();
%primer_hash=();
@score_sort=();
@bind_string=();
%rating_hash=();
# $pl = greatest length
$pfl=length($primer_f);
$prl=length($primer_r);
$pl = ($pfl>$prl ? $pfl : $prl);
my $rcompr = reverse(complement($primer_r));
my $rcomprlc = lc($rcompr);
my $fprimer_r=lc(reverse($primer_f));
$rprimer_r=reverse($primer_r);
# Scan the primers against each other:
# The default is to only consider 3' primer-dimers, for speed concerns (5'
# pd's will reduce the primer population, but won't cause extendible dimers) -
# however, setting $pd_full to 1 will calculate all primer-dimers. This is
# currently used only when viewing individual primers, for both speed concerns
# and because it's 3' primer-dimers that are the real problem in PCR.
# create a binding array for each of the four bases
foreach $l (0 .. $pfl-1) {
my $mbase = substr($fprimer_r, $l, 1);
$primer_hash{$mbase}[$l]=1;
my @nucleotides = qw(a g c t);
foreach $k (@nucleotides) {
$primer_hash{$k}[$l] ||=0;
}
}
# create the primer matrix
my @primer_comp;
foreach $k (0 .. $prl-1) {
$primer_comp[$k]=$primer_hash{substr($rcomprlc, $k, 1)};
}
# read each combination from the matrix, calculate dG for each dimer
my $pd_len = ($pd_full ? $pfl+$prl-1 : $pl-2);
foreach $k (0 .. $pd_len) {
$score[$k]=0;
my $bind;
my $score_p=0;
# extensible primer short-circuit - ignore all primers that will
# not create extensible (i.e. amplifiable) dimers
my $start = $k>$pfl-1 ? $pfl-1 : $k;
my $end = $k>$prl-1 ? $prl-1 : $k;
if ($pd_extensible && !$pd_full) {
next unless $primer_comp[0][$start] == 1;
next unless $primer_comp[$end][$start-$k] == 1;
}
# elsif ($pd_extensible) {
# # no point reconsidering them!
# next if $primer_comp[0][$start] == 1 && $primer_comp[$end][$start-$k] == 1;
# }
# read the binding data
foreach $l (0 .. $prl-1) {
if (($k-$l)<$pfl) {
$bind .= $primer_comp[$l][$k-$l] if ($k-$l)>=0;
} else {
# spacer
$bind .= "2";
}
}
# Single matched bases surrounded by mismatches are unstable,
# so we remove them with the regexp (look ahead is needed otherwise
# strings of consecutive match/mismatches are not caught)
$bind =~ s/01(?=[^1])/00/gx;
# Short circuit if there's nothing to bind
next unless $bind =~ /[1]/;
# Find start and end of similarity
my ($pb_init,$pb_end);
foreach $l (0 .. length($bind)-1) {
# at first I tried finding the initiating terminal bases with
# regexps, but that was much slower ...
if (substr($bind, $l, 1) eq "1") {
defined($pb_init) || ($pb_init = $l);
$pb_end=$l;
}
}
if (defined($pb_init)) {
# deltaG calculation
foreach $l ($pb_init .. $pb_end-1) {
next if substr($bind, $l, 2) eq "00";
next if substr($bind, $l, 1) eq "2";
$score_p+=$oligo_dG{substr($primer_f, $pfl-$k+$l-1, 2).substr($rprimer_r, $l, 2)};
}
# init term corrections
my $initterm="init" . substr($rprimer_r, $pb_init, 1);
$score_p+= $oligo_dG{$initterm};
my $endterm="init" . substr($rprimer_r, $pb_end, 1);
$score_p+= $oligo_dG{$endterm};
# add to the hash ...
$score[$k]=sprintf("%.2f",$score_p);
$bind_string[$k]=$bind;
$rating_hash{$score[$k]}=$k;
}
}
# sort the dimers to give the most stable:
@score_sort = sort { $a <=> $b } @score;
# Returns the most stable dimer
return $score_sort[0];
}
sub primer_dimer_new {
# This is my second attempt at implementing a primer-dimer system:
# The first attempt aligned each combination together explicitly; this attempt
# creates a binding matrix and then reads each primer combination from the
# matrix. It's not significantly faster, but it does have the advantage of
# extending this algorithm to allow for unequal loops (although this has not
# been implemented as yet) and providing the possiblity of reading all
# primer-dimers (not just 3') by adjusting a single variable (which is used when
# displaying primer information.
### TODO:
# It is easily possible to calculate *all* primers when searching for primer
# pairs ... I really should add a preferences option to do this ...
my ($primer_f, $primer_r, $pd_full) = @_;
return unless ($primer_f) && ($primer_r);
my ($k, $l);
@score=();
%primer_hash=();
@score_sort=();
@bind_string=();
%rating_hash=();
# $pl = greatest length
$pfl=length($primer_f);
$prl=length($primer_r);
$pl = ($pfl>$prl ? $pfl : $prl);
my $rcompr = reverse(complement($primer_r));
my $rcomprlc = lc($rcompr);
my $fprimer_r=lc(reverse($primer_f));
$rprimer_r=reverse($primer_r);
# Scan the primers against each other:
# The default is to only consider 3' primer-dimers, for speed concerns (5'
# pd's will reduce the primer population, but won't cause extendible dimers) -
# however, setting $pd_full to 1 will calculate all primer-dimers. This is
# currently used only when viewing individual primers, for both speed concerns
# and because it's 3' primer-dimers that are the real problem in PCR.
# create a binding array for each of the four bases
foreach $l (0 .. $pfl-1) {
my $mbase = substr($fprimer_r, $l, 1);
$primer_hash{$mbase}[$l]=1;
foreach $k (qw(a g c t)) {
$primer_hash{$k}[$l] ||=0;
}
}
# create the primer matrix
my @primer_comp;
foreach my $kk (0 .. $prl-1) {
$primer_comp[$kk]=$primer_hash{substr($rcomprlc, $kk, 1)};
}
# print the matrix - for debugging
print "$primer_f vs. $primer_r - full pd = $pd_full\n";
print " \t";
foreach $l (0 .. $pfl-1) {
my $mbase = substr($fprimer_r, $l, 1);
print "$mbase ";
}
print "\n";
foreach my $kk (0 .. $prl-1) {
my $base = substr($rprimer_r, $kk, 1);
print "$base:\t@{$primer_comp[$kk]}\n";
}
my @binding_data;
# read each combination from the matrix, calculate dG for each dimer
my $pd_len = ($pd_full ? $pfl+$prl-1 : $pl-2);
foreach my $kk (0 .. $pd_len) {
$score[$kk]=0;
my $bind;
my $score_p=0;
# starting coords
my $pf_coord_start = ($kk >= $pfl ? $pfl-1 : $kk);
my $pr_coord_start = ($kk - $pfl > 0 ? $kk - $pfl : 0);
my ($pf_coord, $pr_coord, $first, $flag);
# read through each combination finding multiple matches
for ($pf_coord = $pf_coord_start, $pr_coord = $pr_coord_start;
$pf_coord>=0 && $pr_coord<$prl;
$pf_coord--,$pr_coord++) {
# read base
print "error: \[$pr_coord\] \[$pf_coord\]\n\n" unless defined($primer_comp[$pr_coord][$pf_coord]);
if ($primer_comp[$pr_coord][$pf_coord]==1) {
# binding bases
$bind++;
if ($flag) {
next;
} else {
$first=$pf_coord;
$flag=1;
}
} elsif ($flag) {
# end of a binding stretch
push @binding_data, [$kk, $first, $bind] if $bind > 1;
$bind=0;
$flag=0;
}
# set up for next loop
# $pf_coord--;
# $pr_coord++;
# last if $pf_coord<0 || $pr_coord>$prl;
# redo;
}
}
# check for best binding for each possibility that yeilds two or more matched bases together
my $last;
my @unequal_loops;
foreach my $i (@binding_data) {
# skip multiple matches
# next if @$i[0] == $last;
#
# $last = @$i[0];
my $pf_coord = @$i[1];
my $length = @$i[2];
print "@$i\n";
}
# # extensible primer short-circuit - ignore all primers that will
# # not create extensible (i.e. amplifiable) dimers
# # my $start = $k>$pfl-1 ? $pfl-1 : $k;
# # my $end = $k>$prl-1 ? $prl-1 : $k;
# # if ($pd_extensible && !$pd_full) {
# # next unless $primer_comp[0][$start] == 1;
# # next unless $primer_comp[$end][$start-$k] == 1;
# # }
#
# # read the binding data
# foreach $l (0 .. $prl-1) {
# if (($k-$l)<$pfl) {
# $bind .= $primer_comp[$l][$k-$l] if ($k-$l)>=0;
# } else {
# # spacer
# $bind .= "2";
# }
# }
#
# # Single matched bases surrounded by mismatches are unstable,
# # so we remove them with the regexp (look ahead is needed otherwise
# # strings of consecutive match/mismatches are not caught)
# $bind =~ s/01(?=[^1])/00/gx;
#
# # Short circuit if there's nothing to bind
# next unless $bind =~ /[1]/;
#
# # Find start and end of similarity
# my ($pb_init,$pb_end);
# foreach $l (0 .. length($bind)-1) {
# # at first I tried finding the initiating terminal bases with
# # regexps, but that was much slower ...
# if (substr($bind, $l, 1) eq "1") {
# defined($pb_init) || ($pb_init = $l);
# $pb_end=$l;
# }
# }
#
# if (defined($pb_init)) {
# # deltaG calculation
# foreach $l ($pb_init .. $pb_end-1) {
# next if substr($bind, $l, 2) eq "00";
# next if substr($bind, $l, 1) eq "2";
# $score_p+=$oligo_dG{substr($primer_f, $pfl-$k+$l-1, 2).substr($rprimer_r, $l, 2)};
# }
#
# # init term corrections
# my $initterm="init" . substr($rprimer_r, $pb_init, 1);
# $score_p+= $oligo_dG{$initterm};
#
# my $endterm="init" . substr($rprimer_r, $pb_end, 1);
# $score_p+= $oligo_dG{$endterm};
#
# # add to the hash ...
# $score[$k]=sprintf("%.2f",$score_p);
# $bind_string[$k]=$bind;
# $rating_hash{$score[$k]}=$k;
# }
# }
#
# # sort the dimers to give the most stable:
# @score_sort = sort { $a <=> $b } @score;
#
# # Returns the most stable dimer
# return $score_sort[0];
}
#--------------------------------#
# Rountine to draw primer-dimers #
#--------------------------------#
sub draw_dimer {
# This all seems a bit cumbersome!!
my ($primer_f, $primer_r, $pos, $FH) = @_;
my $rprimer_r=reverse($primer_r);
my $dimer_binding="";
my $pr_space="";
my $fspace="";
my $rspace="";
my $fspace_def = $pl-$pfl>0 ? $pl-$pfl : 0;
$fspace=" "x($fspace_def+($pos>$pl-1?$pos-$pl+1:0));
if ($pos+1>=$pfl) {
$rspace=" "x($pl-$pos-1);
} else {
$rspace=$fspace;
}
$pr_space=" "x($pfl-$pos-1);
for my $j (0 .. $pos) {
next unless $j < $prl;
if (substr($bind_string[$pos],$j,1)==1) {
$dimer_binding=$dimer_binding."|"
} elsif (substr($bind_string[$pos],$j,1)==0) {
$dimer_binding=$dimer_binding."."
} else {
$dimer_binding=$dimer_binding." "
}
}
print $FH "$fspace"."5' "."$primer_f"." 3'\n".
"$rspace"." "."$pr_space"."$dimer_binding\n".
"$rspace"."$pr_space"."3' "."$rprimer_r"." 5'\n\n";
}
#----------------------#
# Program exit/restart #
#----------------------#
sub end_prog {
# This sends the program to the pref writing routine after Mainloop() ...
$top->destroy;
}
sub restart {
exec "$0";
}
#---------------------#
# GUI button routines #
#---------------------#
sub get_tm {
my ($report) = @_;
# Lower case bug fix:
$fprimer = uc($fprimer);
$rprimer = uc($rprimer);
my ($deltaG, $deltaH, $deltaS);
my $oligo_conc_mols = $oligo_conc / 1000000000;
# my $check = check_degenerate($fprimer, 1);
# print "fprimer was $fprimer; check was $check\n";
if ($fprimer && !check_degenerate($fprimer, 1)) {
($fprimer_tm, $deltaH, $deltaS) = tm($fprimer);
$fprimer_gc = int(gc($fprimer));
$fprimer_tm = sprintf("%.2f", $fprimer_tm);
# since dG = dH - TdS, we don't need to calculate based on NN's ...
$deltaG = $deltaH-((273.15+$pd_temperature)*($deltaS/1000));
$fprimer_ds = sprintf("%.2f", $deltaS);
$fprimer_dh = sprintf("%.2f", $deltaH);
$fprimer_dg = sprintf("%.2f", $deltaG);
$fprimer_len = length($fprimer);
}
if ($rprimer && !check_degenerate($rprimer, 1)) {
($rprimer_tm, $deltaH, $deltaS) = tm($rprimer);
$rprimer_gc = int(gc($rprimer));
$rprimer_tm = sprintf("%.2f", $rprimer_tm);
$deltaG = $deltaH-((273.15+$pd_temperature)*($deltaS/1000));
$rprimer_ds = sprintf("%.2f", $deltaS);
$rprimer_dh = sprintf("%.2f", $deltaH);
$rprimer_dg = sprintf("%.2f", $deltaG);
$rprimer_len = length($rprimer);
}
my $repeat_real = $repeat-1;
$packed_widgets{dim}->delete(0.1,"end");
$packed_widgets{dim}->insert('end', "Warning: forward primer run found\n", 'red') if ($fprimer =~ /(C{$run,}|A{$run,}|G{$run,}|T{$run,})/);
$packed_widgets{dim}->insert('end', "Warning: forward primer repeat found : $1\n", 'red') if ($fprimer =~ /(.{2,})\1{$repeat_real,}/);
$packed_widgets{dim}->insert('end', "Warning: reverse primer run found\n", 'red') if ($rprimer =~ /(C{$run,}|A{$run,}|G{$run,}|T{$run,})/);
$packed_widgets{dim}->insert('end', "Warning: reverse primer repeat found\n", 'red') if ($rprimer =~ /(.{2,})\1{$repeat_real,}/);
$packed_widgets{dim}->insert('end', "Most stable 3' extensible primer-dimers (at $pd_temperature°C), if any\n\n", 'blue');
my ($pd1, $pd2, $pd3);
if ($fprimer && !check_degenerate($fprimer)) {
$pd1 = primer_dimer($fprimer,$fprimer);
$pos=$rating_hash{$score_sort[0]};
unless ($score_sort[0]==0) {
$packed_widgets{dim}->insert('end', "Forward vs. Forward: $score_sort[0] kcal/mol\n\n", 'black');
draw_dimer($fprimer, $fprimer, $pos, \ *DIMER);
}
if ($rprimer && !check_degenerate($rprimer)) {
$pd2 = primer_dimer($fprimer,$rprimer);
$pos=$rating_hash{$score_sort[0]};
unless ($score_sort[0]==0) {
$packed_widgets{dim}->insert('end', "Forward vs. Reverse: $score_sort[0] kcal/mol\n\n", 'black');
draw_dimer($fprimer, $rprimer, $pos, \ *DIMER);
}
}
}
if ($rprimer && !check_degenerate($rprimer)) {
$pd3 = primer_dimer($rprimer,$rprimer);
$pos=$rating_hash{$score_sort[0]};
unless ($score_sort[0]==0) {
$packed_widgets{dim}->insert('end', "Reverse vs. Reverse: $score_sort[0] kcal/mol\n\n", 'black');
draw_dimer($rprimer, $rprimer, $pos, \ *DIMER) unless ($score_sort[0]==0);
}
}
# $pd_full = 1;
$packed_widgets{dim}->insert('end', "\nMore stable non-extensible primer-dimers (at $pd_temperature°C), if any\n\n", 'blue');
if ($fprimer && !check_degenerate($fprimer)) {
primer_dimer($fprimer,$fprimer,1);
$pos=$rating_hash{$score_sort[0]};
if ($score_sort[0]<$pd1) {
$packed_widgets{dim}->insert('end', "Forward vs. Forward: $score_sort[0] kcal/mol\n\n", 'black');
draw_dimer($fprimer, $fprimer, $pos, \ *DIMER);
}
if ($rprimer && !check_degenerate($rprimer)) {
primer_dimer($fprimer,$rprimer,1);
$pos=$rating_hash{$score_sort[0]};
if ($score_sort[0]<$pd2) {
$packed_widgets{dim}->insert('end', "Forward vs. Reverse: $score_sort[0] kcal/mol\n\n", 'black');
draw_dimer($fprimer, $rprimer, $pos, \ *DIMER);
}
}
}
if ($rprimer && !check_degenerate($rprimer)) {
primer_dimer($rprimer,$rprimer,1);
$pos=$rating_hash{$score_sort[0]};
if ($score_sort[0]<$pd3) {
$packed_widgets{dim}->insert('end', "Reverse vs. Reverse: $score_sort[0] kcal/mol\n\n", 'black');
draw_dimer($rprimer, $rprimer, $pos, \ *DIMER);
}
}
# $pd_full = 0;
# again ... messy tie in for report generating routine ...
# Yes, I know this is a really, really, ugly way to do things!!
if ($report) {
my $dimer_text = $packed_widgets{dim}->get('0.1','end');
my $primer_text = <<EOT;
Forward primer: $fprimer
Tm: $fprimer_tm°C\t\tLength: $fprimer_len bases
dS°: $fprimer_ds eu\t\tdH°: $fprimer_dh kcal/mol
dG°$pd_temperature: $fprimer_dg kcal/mol
Reverse primer: $rprimer
Tm: $rprimer_tm°C\t\tLength: $rprimer_len bases
dS°: $rprimer_ds eu\t\tdH°: $rprimer_dh kcal/mol
dG°$pd_temperature: $rprimer_dg kcal/mol
$dimer_text\n
EOT
return $primer_text;
}
$packed_widgets{dim}->see(0.1);
}
sub blast_primers {
return if check_packages("HTTP::Request", "LWP::UserAgent");
### Todo: find matching sequence names from f and r primer blast results
### - easily check possible amp problems
# I've tried to make this the way blast *should* be, with colour output
# and the ability to limit the results ...
if (($fprimer eq "") && ($rprimer eq "")) {
dialogue("Please enter primers to BLAST");
return;
}
my ($blast_out_f,$blast_out_r)=("Waiting on Blast Server for forward primer results ...","Waiting on Blast Server for reverse primer results ...");
my ($blast_header_f, @blast_summary_f, @blast_results_f1, @blast_results_f2, @blast_results_f3);
my ($blast_header_r, @blast_summary_r, @blast_results_r1, @blast_results_r2, @blast_results_r3);
my $display='f';
my $blast_search_string;
$blast_status = "";
my $blast_display = sub {
# I don't know whether this is messy or beautiful ...
# But I really love the fact that I can do it!!
my ($blast_header_ref, $blast_summary_ref, $blast_results_1_ref, $blast_results_2_ref, $blast_results_3_ref, $search_string);
if ($display eq 'f') {
$blast_header_ref = \$blast_header_f;
$blast_summary_ref = \@blast_summary_f;
$blast_results_1_ref = \@blast_results_f1;
$blast_results_2_ref = \@blast_results_f2;
$blast_results_3_ref = \@blast_results_f3;
} else {
$blast_header_ref = \$blast_header_r;
$blast_summary_ref = \@blast_summary_r;
$blast_results_1_ref = \@blast_results_r1;
$blast_results_2_ref = \@blast_results_r2;
$blast_results_3_ref = \@blast_results_r3;
}
$packed_widgets{'blast_text'}->delete('0.1', 'end');
unless ($$blast_header_ref) {
return
}
$packed_widgets{'blast_text'}->insert('0.1', $$blast_header_ref, 'black');
### TODO: hyperlinks??
# Users might get confused about "."'s in the string box ...
($search_string = $blast_search_string) ||=".";
for my $i (0 .. $#$blast_summary_ref) {
$_ = $$blast_summary_ref[$i];
next unless /$search_string/;
if (m/^(\w*\|[\w\|\.\d]+)(.*?)([\d\.]+\s+[\d\.\w\-]+\s*$)/) {
$packed_widgets{'blast_text'}->insert('end', $1);
$packed_widgets{'blast_text'}->insert('end', $2, 'blue');
$packed_widgets{'blast_text'}->insert('end', $3."\n");
} else {
## Debug only
# print "WARNING: failed parsing $_ from BLAST results\n";
}
}
for my $i (0 .. $#$blast_results_1_ref) {
next unless $$blast_results_1_ref[$i] =~ /$search_string/;
$packed_widgets{'blast_text'}->insert('end', "\n\n".$$blast_results_1_ref[$i]."\n\n ", 'blue');
$packed_widgets{'blast_text'}->insert('end', $$blast_results_2_ref[$i]."\n\n", 'black');
$packed_widgets{'blast_text'}->insert('end', $$blast_results_3_ref[$i]."\n");
}
};
# GUI code
# destroy old window if one exists (and cancel last blast search ...)
if (Exists($blast_d)) {
# $top->afterCancel($rptid);
$rptid->cancel;
$blast_d->destroy;
}
$blast_d = $top->Toplevel(-title=>'BLAST Search');
$blast_d->withdraw();
my $blast_d_f = $blast_d->Frame()->pack(-expand=>1, -side=>'top', -fill=>'both');
my $blast_d_fb = $blast_d->Frame()->pack(-side=>'left', -anchor=>'sw');
my $blast_d_fs = $blast_d->Frame()->pack(-side=>'right', -anchor=>'se');
$blast_d->Icon(-image => $pixmap);
nr(\$blast_d_f, $frame_pady, 1);
pack_gui('ROText', '', 'blast_text', 95, 30, -scrollbars=>'osoe');
# buttons
nr(\$blast_d_fb);
pack_gui('Button', "OK", "blast_full", sub{
$rptid->cancel if $rptid;
$blast_d->destroy;
}, "active");
pack_gui('Button', "Forward", "blast_f", sub {
$display='f';
&$blast_display;
}, 'disabled');
pack_gui('Button', "Reverse", "blast_r", sub {
$display='r';
&$blast_display;
}, 'disabled');
# Status line
pack_gui('Label', 'Status: ', 'blast_status_l');
pack_gui('Label', \$blast_status, 'blast_status');
# text search button
nr(\$blast_d_fs);
pack_gui('Label', 'String:');
pack_gui('Entry', \$blast_search_string, 'blast_search_string', 20);
pack_gui('Button', 'Search', "blast_search", sub {
&$blast_display;
}, 'disabled');
$packed_widgets{blast_text}->configure(-fg=>'grey30');
$packed_widgets{blast_text}->tagConfigure('blue',
-foreground => 'midnightblue');
$packed_widgets{blast_text}->tagConfigure('black',
-foreground => 'black');
$blast_status = "Sending BLAST request ...";
$blast_d->update;
$blast_d->deiconify();
$top->update;
my $blast_summary;
if ($fprimer) {
# Blast forward primer
$blast_status="Blasting forward primer ...";
($blast_header_f, $blast_summary) = blast($fprimer);
if ($blast_summary) {
@blast_summary_f = split("\n",$blast_summary);
@blast_results_f1 = @blast_results_1;
@blast_results_f2 = @blast_results_2;
@blast_results_f3 = @blast_results_3;
$display='f';
&$blast_display;
$packed_widgets{blast_f}->configure(-state=>'normal');
$packed_widgets{blast_search}->configure(-state=>'normal');
} else {
$blast_status="Unable to connect to server";
}
}
if ($rprimer) {
#Blast reverse primer
$blast_status="Blasting reverse primer ...";
($blast_header_r, $blast_summary) = blast($rprimer);
if ($blast_summary) {
@blast_summary_r = split("\n",$blast_summary);
@blast_results_r1 = @blast_results_1;
@blast_results_r2 = @blast_results_2;
@blast_results_r3 = @blast_results_3;
$packed_widgets{blast_r}->configure(-state=>'normal');
$packed_widgets{blast_search}->configure(-state=>'normal');
$blast_status="Blast search complete";
} else {
$blast_status="Unable to connect to server";
}
}
}
sub get_primers {
my ($max_ampsize, $max_range_5p, $max_range_3p)
= get_variables(qw(max_ampsize max_range_5p max_range_3p));
$cancel=0;
$bs=0;
my $seq = get_seq();
check_range();
# set the max_ampsize in case the user has modified
# either max_range_5p or max_range_3p by hand ...
if (($$max_range_5p)&&($$max_range_3p)) {
$$max_ampsize = $$max_range_3p-$$max_range_5p
}
@PF=@PR=();
my ($gene_5p, $gene_3p)=find_gene($seq);
sbarprint("\nMoving forward and reverse into arrays ...");
my ($dnaseq_f, $dnaseq_f_len, $dnaseq_r_top, $dnaseq_r, $dnaseq_r_len) = getseq($seq);
return if ($cancel==1);
# Check that there was actually a DNA sequence found!
if (length($dnaseq_f)==0) {
sbarprint("\nNo DNA sequence");
$cancel = 1;
return;
}
read_windows(\&primer_window, $dnaseq_f, $dnaseq_f_len, $dnaseq_r);
return if ($cancel==1);
sbarprint("\nCalculating amplicons ...");
calc_amplicon($dnaseq_r_len);
@primer_pairs_pr_s = @primer_pairs;
sort_primers('13',1);
sort_primers('10');
sbarprint("\nFinished ... found ".($#primer_pairs+1)." primer pairs");
# draw_dna(\$packed_widgets{primer_canvas},\$packed_widgets{seq});
draw_dna();
}
sub get_seq_primers {
my ($min_range, $max_range, $slist) = get_variables(qw(min_range max_range primers));
$cancel=0;
$bs=0;
my $seq = get_seq();
# check_range();
# unless boundaries are set, set them to sequence limits
unless (($$max_range)&&($$max_range)) {
$$min_range = 0;
$$max_range = length($seq);
}
$$max_range = length($seq) if $$max_range > length($seq);
@PF=@PR=();
my ($gene_5p, $gene_3p)=find_gene($seq);
sbarprint("\nMoving forward and reverse into arrays ...");
my ($dnaseq_f, $dnaseq_f_len) = getseq($seq);
return if ($cancel==1);
# Check that there was actually a DNA sequence found!
if (length($dnaseq_f)==0) {
sbarprint("\nNo DNA sequence");
return;
}
read_windows(\&primer_window, $dnaseq_f, $dnaseq_f_len);
return if ($cancel==1);
sbarprint("\nFinding primers ...");
calc_seq_primers();
@$slist = @primer_pairs;
sort_primers('1');
sbarprint("\nFinished ... found ".($#primer_pairs+1)." primer pairs");
# draw_dna(\$packed_widgets{primer_canvas},\$packed_widgets{seq});
draw_dna();
}
sub get_qprimers {
$cancel=0;
$bs=0;
my ($spidey_out, $mrna_seq) = run_spidey(1);
return if $cancel == 1;
@PF=@PR=();
my ($gene_5p, $gene_3p)=find_gene($mrna_seq);
sbarprint("\nMoving forward and reverse into arrays ...");
my ($dnaseq_f, $dnaseq_f_len, $dnaseq_r_top, $dnaseq_r, $dnaseq_r_len) = getseq($mrna_seq);
return if ($cancel==1);
# Check that there was actually a DNA sequence found!
if (length($dnaseq_f)==0) {
sbarprint("\nNo DNA sequence");
return;
}
read_windows(\&primer_window, $dnaseq_f, $dnaseq_f_len, $dnaseq_r);
return if ($cancel==1);
sbarprint("\nCalculating amplicons ...");
# set qpcr flag for amplicon and draw_dna subroutines:
$qpcr_flag=1;
calc_amplicon($dnaseq_r_len);
@primer_pairs_q_s = @primer_pairs;
sort_primers('13',1);
sort_primers('10');
sbarprint("\nFinished ... found ".($#primer_pairs+1)." primer pairs");
draw_dna();
# unset flag
$qpcr_flag=0;
}
sub find_re_sites {
my $page = which_nb_page();
unless ($page eq "pd") {
dialogue("This feature is only relevant for the Standard PCR page");
return;
}
my $seq = get_seq();
my ($max_range_5p, $max_range_3p)
= get_variables(qw(max_range_5p max_range_3p));
$seq = substr($seq, $$max_range_5p, $$max_range_3p-$$max_range_5p) if $seq;
# find the rebase file (different versions are released constantly)
my @gcg_paths = glob("$HOME"."gcg.*");
print @gcg_paths;
unless (@gcg_paths) {
# search for the file in the program directory
@gcg_paths = glob("$program_directory"."gcg.*");
}
unless (@gcg_paths) {
# search for the file where it should be
@gcg_paths = glob("/usr/share/perlprimer/"."gcg.*");
}
unless (@gcg_paths) {
# search for the file in the current directory
@gcg_paths = glob("./"."gcg.*");
}
my $gcg_path;
foreach (@gcg_paths) {
if (/.*gcg\.\d*$/) {
$gcg_path = $_;
}
}
unless ($gcg_path) {
dialogue("Error: Cannot find the Restriction Enzyme database.\n\nYou need the GCG database from REBASE (http://rebase.neb.com/rebase/rebase.html) for this function to work. The file 'gcg.###' (where ### is the version) should be included in the PerlPrimer distribution - please place that file either in the directory where the program is located, or in the directory $HOME, and try again.\n\nAlternatively, you can download the latest version of the database from the REBASE ftp site.");
return;
}
# open rebase
unless (open (REBASE, "<$gcg_path")) {
dialogue("Error: Cannot open the Restriction Enzyme database: $!");
return;
}
my @re_data = <REBASE>;
close REBASE;
# parse data
my $i;
my %enzymes;
my %enzyme_sites;
my %enzymes_full;
foreach (@re_data) {
s/[\n\r]//g;
my ($enzyme, $re_site) = /^\;*([A-Z|a-z|0-9|\;]+)\s+\d+\s+([A-z\'_]+)\s+/;
next unless $enzyme && $re_site;
my $original_site = $re_site;
$re_site =~ s/\'//g;
$re_site =~ s/_//g;
if ($enzymes_full{$re_site}) {
$enzymes_full{$re_site}.=" | $enzyme";
} else {
$enzymes_full{$re_site}=$enzyme;
}
$enzyme_sites{$enzyme}=$original_site;
if ($simple_sites) {
next if $re_site =~ /[rymkswbdhvn]/i;
next if length($re_site) > 6;
next if length($re_site) < 6;
} else {
$re_site =~ s/r/[ga]/ig;
$re_site =~ s/y/[ct]/ig;
$re_site =~ s/m/[ac]/ig;
$re_site =~ s/k/[gt]/ig;
$re_site =~ s/s/[gc]/ig;
$re_site =~ s/w/[at]/ig;
$re_site =~ s/b/[cgt]/ig;
$re_site =~ s/d/[agt]/ig;
$re_site =~ s/h/[act]/ig;
$re_site =~ s/v/[acg]/ig;
$re_site =~ s/n/[acgt]/ig;
}
$enzymes{$enzyme}=$re_site;
}
my @no_matches;
if ($exclude_found_sites) {
foreach my $key (keys(%enzymes)) {
if ($seq !~ /$enzymes{$key}/i) {
push @no_matches, "$key - $enzyme_sites{$key}";
}
}
} else {
foreach my $key (keys(%enzymes)) {
push @no_matches, "$key - $enzyme_sites{$key}";
}
}
unless (Exists($cloning_d)) {
$cloning_d = $top->Toplevel(-title=>'Cloning site configuration');
my $cloning_f = $cloning_d->Frame()->pack(-fill=>'both', -pady=>7);
my $cloning_fb = $cloning_d->Frame()->pack(-side=>'bottom', -fill=>'none');
my $re_enzymes = [sort @no_matches];
# deconstruct current info if it exists
my ($tmp_site, $enzyme, $key);
if ($primer_seq_5f) {
$_ = uc($primer_seq_5f);
($cloning_anchor, $tmp_site) = /([A-Z]*)_([A-Z]*)/;
if ($enzymes_full{$tmp_site}) {
$enzyme = $enzymes_full{$tmp_site};
($key) = ($enzyme =~ /([A-z0-9]*)/);
$forward_re_site = "$enzyme - $enzyme_sites{$key}";
} else {
$forward_re_site = $tmp_site;
}
}
if ($primer_seq_5r) {
$_ = uc($primer_seq_5r);
my $tmp_site;
($cloning_anchor, $tmp_site) = /([A-Z]*)_([A-Z]*)/;
if ($enzymes_full{$tmp_site}) {
$enzyme = $enzymes_full{$tmp_site};
($key) = ($enzyme =~ /([A-z0-9]*)/);
$reverse_re_site = "$enzyme - $enzyme_sites{$key}";
} else {
$reverse_re_site = $tmp_site;
}
}
nr(\$cloning_f);
pack_gui('Label', 'Forward restriction enzyme site: ', 'cloning_re_f');
pack_gui('BrowseEntry', \$forward_re_site, 'cloning_re_f', $re_enzymes);
nr();
pack_gui('Label', 'Reverse restriction enzyme site: ', 'cloning_re_r');
pack_gui('BrowseEntry', \$reverse_re_site, 'cloning_re_r', $re_enzymes);
nr('', 5);
pack_gui('Label', "5' anchor sequence", "cloning_anchor");
pack_gui('Entry', \$cloning_anchor, "cloning_anchor", 15);
nr(\$cloning_fb);
pack_gui('Button', 'OK', 'cloning_ok', sub {
my ($enzyme) = ($forward_re_site =~ /([A-z0-9]*)/);
$primer_seq_5f = lc("$cloning_anchor\_$enzymes{$enzyme}");
($enzyme) = ($reverse_re_site =~ /([A-z0-9]*)/);
$primer_seq_5r = lc("$cloning_anchor\_$enzymes{$enzyme}");
$cloning_d->destroy;
return;
}, "active");
pack_gui('Button', 'Cancel', 'cloning_cancel', sub {$cloning_d->destroy;});
$cloning_d->Icon(-image => $pixmap);
} else {
$cloning_d->deiconify;
$cloning_d->raise;
}
}
sub run_spidey {
my ($print_alignment) = @_;
$print_alignment ||= 0;
# Find the spidey executable
my @spidey_files = glob("$spidey_path*pidey.*");
@spidey_files = glob("$spidey_path*pidey*") unless @spidey_files;
unless (@spidey_files) {
dialogue("Error: cannot find the Spidey executable in $spidey_path\n\nIf this is not the directory where Spidey is located, please specify the correct location in the Preferences");
$cancel=1;
return;
}
my %sizes_names;
foreach (@spidey_files) {
my $size = (stat($_))[7];
$sizes_names{$size}=$_;
}
my $largest = (sort {$b <=> $a} keys %sizes_names)[0];
my $spidey_exec = $sizes_names{$largest};
my $spidey_command = "\"$spidey_exec\" -i \"$tmp.dna_tmp\" -m \"$tmp.mrna_tmp\" -p $print_alignment";
my $mrna_seq = $packed_widgets{"qmrna_seq"}->get(0.1,"end");
unless (length(clean_seq($mrna_seq))) {
dialogue("Error: Please enter an mRNA sequence\n");
$cancel=1;
return;
}
my $dna_seq = $packed_widgets{"qdna_seq"}->get(0.1,"end");
unless (length(clean_seq($dna_seq))) {
dialogue("Error: Please enter a DNA sequence\n");
$cancel=1;
return;
}
# Spidey will only accept input as files, so we need to move the two
# sequences to temporary files
unless (open (MRNA, ">".$tmp.".mrna_tmp")) {
dialogue("Error: could not write mRNA temp file: $!\n");
$cancel=1;
return;
}
print MRNA $mrna_seq;
close (MRNA);
unless (open (DNA, ">".$tmp.".dna_tmp")) {
dialogue("Error: could not write DNA temp file: $!\n");
$cancel=1;
return;
}
print DNA $dna_seq;
close (DNA);
# run spidey ...
sbarprint("\nRunning spidey ...");
$_ = `$spidey_command`;
# open(SPIDEY, "$spidey_command |");
# $_ = join("",<SPIDEY>);
# close SPIDEY;
# abort and complain if we don't see the --SPIDEY signature
unless (/--SPIDEY/) {
print "$_\n";
if (m/no valid bioseqs(.*)/i) {
dialogue("Error: No valid bioseqs$1\n\n(If all sequences are present, this may mean that the temp directory is incorrectly set in the preferences - please make sure that this directory is writable)");
sbarprint("\nCancelled - No valid bioseqs$1");
} else {
dialogue("Error: Cannot run Spidey executable correctly\n(Please check the console for error messages)");
sbarprint("\nCancelled - Spidey executable not found");
}
$cancel=1;
return;
}
# Warn if problems occur ...
print "\n\nWarning: incomplete sequence data or large intron present\n" unless /overall percent identity: 100\.0%/;
print "\n\nWarning: mRNA coverage incomplete\n" unless /mRNA coverage: 100%/;
# ... and try using the large intron option if they have
unless (/overall percent identity: 100\.0%/ && /mRNA coverage: 100%/) {
print "Trying spidey again using large intron option ...\n";
$_ = `$spidey_command -X`;
# if things are still crap, display a dialogue with spidey's output,
# so the user can work out what's gone wrong
dialogue("Alignment error:\nSequence data is incomplete\n\n$_") unless /overall percent identity: 100\.0%/;
dialogue("Alignment error:\nmRNA coverage is incomplete\n\n$_") unless /mRNA coverage: 100%/;
}
# delete those tmp files
unlink("$tmp.mrna_tmp") || dialogue("Error: could not delete temporary file $spidey_path.mrna_tmp");
unlink("$tmp.dna_tmp") || dialogue("Error: could not delete temporary file $spidey_path.dna_tmp");
sbarprint("\n");
return ($_, $mrna_seq) unless $print_alignment;
# isolate intron/exon boundaries
@intron_exon_bounds = ();
while (/(\d+)-(\d+) \(mRNA\)/g) {
push (@intron_exon_bounds, $2);
}
# last boundary is end of mRNA sequence: remove
pop @intron_exon_bounds;
return ($_, $mrna_seq);
}
sub get_bisulphite {
# Criteria:
# Nested or heminested PCR
# Primer amplicon not greater than 450bp
# Selection for bisulphite-converted templates
# Even distribution of bases prior to conversion
# As high GA content as posible [currently not used]
# Lack of CpG residues or degeneracy
# Long (25-30mer) primer
$cancel=0;
# old benchmarking code - used for optimising routines
my $t_old = new Benchmark if $benchmark;
$bs = 1;
check_range();
my ($max_ampsize, $max_range_5p, $max_range_3p)
= get_variables(qw(max_ampsize max_range_5p max_range_3p));
# set the max_ampsize in case the user has modified
# either max_range_5p or max_range_3p by hand ...
if (($$max_range_5p)&&($$max_range_3p)) {
$$max_ampsize = $$max_range_3p-$$max_range_5p
}
my $seq = $packed_widgets{"bisul_seq"}->get(0.1,"end");
my ($dnaseq_f, $dnaseq_f_len, $dnaseq_r_top, $dnaseq_r, $dnaseq_r_len) = getseq($seq);
# Check that there was actually a DNA sequence found!
if (length($dnaseq_f)==0) {
sbarprint("\nNo DNA sequence");
return;
}
@PF=@PR=();
return if ($cancel==1);
# Only use top strand for primer design (because conversion makes
# the two templates non-complementary), so use $dnaseq_r_top
read_windows(\&bisul_window, $dnaseq_f, $dnaseq_f_len, $dnaseq_r_top);
return if ($cancel==1);
sbarprint("\nCalculating amplicons ...");
calc_amplicon($dnaseq_r_len);
@primer_pairs_bs_s = @primer_pairs;
sort_primers('13',1);
sort_primers('10');
$bs = 0;
# benchmarking code
if ($benchmark) {
my $t_new = new Benchmark;
my $diff = timediff ($t_new, $t_old);
my $str = timestr ($diff, "all", "5.3f");
print "Time for bisulphite was $str\n\n";
}
}
sub check_range {
my ($max_ampsize, $max_range_5p, $min_range, $max_range, $max_range_3p)
= get_variables(qw(max_ampsize max_range_5p min_range max_range max_range_3p));
$$max_range_5p = undef if defined($$max_range_5p) && $$max_range_5p eq "";
$$max_range_3p = undef if defined($$max_range_3p) && $$max_range_3p eq "";
unless (defined($$max_range_5p)&&defined($$max_range_3p)) {
return unless defined($$min_range)&&defined($$max_range);
$$max_range_5p = $$min_range unless $$max_range_5p;
$$max_range_3p = $$max_range unless $$max_range_3p;
$$max_ampsize = $$max_range_3p - $$max_range_5p;
}
}
sub copy_selected_primers {
# Get variable refs
my ($ref, $slist) = get_variables(qw(hlist primers));
my $page = which_nb_page();
# get selected primers
my @sel = $$ref->selectionGet;
# Clipboard copying routine
my $clip = "Forward Primer\tPos\tLen\tTm\tReverse Primer\tPos\tLen\tTm\tAmp\tdG\n";
my (@gene_array, $gene_frame, $seq);
if ($page eq "pd" && (($primer_seq_5f) || ($primer_seq_5r))) {
$seq = get_seq();
@gene_array=find_gene($seq);
$gene_frame=$gene_array[0][0]%3;
}
foreach (@sel) {
my $sel = $_;
for my $j ( 0 .. 4, 8, 6, 7, 9, 10 ) {
if ($page eq "bis") {
# Primer redundancy for CpG residues:
# Replaces T with Y (pyrimidine) for forward
# Replaces A with R (purine) for reverse
my $temp_seq;
if ($j == 0) {
$temp_seq = $$slist[$sel][0];
my $f_original = $$slist[$sel][11];
for my $i (0 .. length($f_original)) {
if (substr($f_original, $i, 2) eq "CG") {
substr($temp_seq, $i, 1) = 'Y';
}
}
$clip .= "$temp_seq\t";
} elsif ($j == 4) {
$temp_seq = $$slist[$sel][4];
my $r_original = $$slist[$sel][12];
for my $i (0 .. length($r_original)) {
if (substr($r_original, $i, 2) eq "CG") {
substr($temp_seq, $i, 1) = 'R';
}
}
$clip .= "$temp_seq\t";
} else {
$clip .= "$$slist[$sel][$j]\t";
}
} elsif ($page eq "pd") {
if ($j == 0 && $primer_seq_5f) {
my $fprimer = $$slist[$sel][$j];
my ($primer_seq_5f_real, $insert_f) = add_cloning($seq, $fprimer, $$slist[$sel][1]);
$clip .= uc("$primer_seq_5f_real$insert_f\_$fprimer\t");
} elsif ($j == 4 && $primer_seq_5r) {
my $rprimer = $$slist[$sel][$j];
my ($primer_seq_5r_real, $insert_r) = (add_cloning($seq, '', '', '', $rprimer, $$slist[$sel][8]))[5,6];
# print
$clip .= uc("$primer_seq_5r_real$insert_r\_$rprimer\t");
} else {
$clip .= "$$slist[$sel][$j]\t";
}
} else {
$clip .= "$$slist[$sel][$j]\t";
}
}
$clip .= "\n";
}
$top->clipboardClear;
$top->clipboardAppend($clip);
}
sub select_all_primers {
my ($ref, $slist) = get_variables(qw(hlist primers));
$$ref->selectionSet(0,$#$slist);
}
sub primer_take_range {
# Get variable refs
my ($max_range_5p, $min_range, $max_range, $max_range_3p, $hlist, $slist)
= get_variables(qw(max_range_5p min_range max_range max_range_3p hlist primers));
# get selected primer
my @sel = $$hlist->selectionGet;
my $primer = shift @sel;
$$max_range_5p = $$min_range = $$slist[$primer][1]+$$slist[$primer][2];
$$max_range_3p = $$max_range = $$slist[$primer][8]-$$slist[$primer][6];
draw_dna();
browse_primer($primer);
}
sub menu_popup {
my ($popup_ref) = get_variables(qw(popup));
$$popup_ref->Popup(
-popanchor => 'nw',
-popover => 'cursor');
}
sub menu_text {
$text_widget_ref = $_[0];
$popup_text->Popup(
-popanchor => 'nw',
-popover => 'cursor');
}
sub sort_primers {
my ($sort_criteria, $quiet) = @_;
my ($list, $slist) = get_variables(qw(hlist primers));
my @old_slist = @$slist;
$$list->delete('all');
# Re-sort forwards or backwards
# allow the ability to simply redisplay the list (when opening files)
if ($sort_criteria) {
$sort_criteria = $sort_prev if $sort_criteria eq "r";
# We want dG to be sorted from highest to lowest by default:
# this is really inelegant!
my $sort_order = $sort_reverse;
$sort_order = 1-$sort_reverse if ($sort_criteria eq '10' || $sort_criteria eq '13');
@$slist = sort {@$a[$sort_criteria] <=> @$b[$sort_criteria]} @old_slist if $sort_order==0;
@$slist = sort {@$b[$sort_criteria] <=> @$a[$sort_criteria]} @old_slist if $sort_order==1;
}
return if $quiet;
my $num_elements = @{ @$slist[0] } if @$slist;
$num_elements ||=0;
# Re-draw
if ($num_elements == 5) { # sequencing quick fix!!
for my $i ( 0 .. $#$slist ) {
$$list->add($i);
$$list->itemCreate($i, 0, -text=>"$$slist[$i][0]", -style=> $style_primer);
$$list->itemCreate($i, 1, -text=>"$$slist[$i][1]");
$$list->itemCreate($i, 2, -text=>"$$slist[$i][2]");
$$list->itemCreate($i, 3, -text=>"$$slist[$i][3]", -style=> $style_tm);
$$list->itemCreate($i, 4, -text=>"$$slist[$i][4]");
}
} else {
for my $i ( 0 .. $#$slist ) {
$$list->add($i);
$$list->itemCreate($i, 0, -text=>"$$slist[$i][0]", -style=> $style_primer);
$$list->itemCreate($i, 1, -text=>"$$slist[$i][1]");
$$list->itemCreate($i, 2, -text=>"$$slist[$i][2]");
$$list->itemCreate($i, 3, -text=>"$$slist[$i][3]", -style=> $style_tm);
$$list->itemCreate($i, 4, -text=>"$$slist[$i][4]", -style=> $style_primer);
$$list->itemCreate($i, 5, -text=>"$$slist[$i][8]");
$$list->itemCreate($i, 6, -text=>"$$slist[$i][6]");
$$list->itemCreate($i, 7, -text=>"$$slist[$i][7]", -style=> $style_tm);
$$list->itemCreate($i, 8, -text=>"$$slist[$i][9]");
$$list->itemCreate($i, 9, -text=>"$$slist[$i][10]");
$$list->itemCreate($i, 10, -text=>"$$slist[$i][13]") if defined($$slist[$i][13]);
}
}
# save last value so that "reverse" can be applied if neccessary
$sort_prev = $sort_criteria;
}
sub cancel {
# Set cancel flag
# (this stops the primer-pairs calculation,
# which can go on for some time ...)
$cancel = 1;
sbarprint("\nOperation cancelled");
}
sub get_primers_auto_in {
my ($sub_ref, $primers_ref) = get_variables(qw(primer_sub primers));
&$sub_ref();
while ($#$primers_ref < 0) {
step_in();
return if $cancel==1;
&$sub_ref();
}
}
sub get_primers_auto_out {
my ($sub_ref, $primers_ref) = get_variables(qw(primer_sub primers));
&$sub_ref();
while ($#$primers_ref < 0) {
step_out();
return if $cancel==1;
&$sub_ref();
}
}
sub get_primers_cloning {
my $page = which_nb_page();
unless ($page eq 'pd') {
dialogue("This feature is only relevant for the Standard PCR page");
return;
}
my $seq = get_seq();
unless ($seq) {
dialogue("No DNA sequence found!");
return;
}
my ($sub_ref, $primers_ref) = get_variables(qw(primer_sub primers));
&$sub_ref();
while ($#$primers_ref < 0) {
step_cloning();
return if $cancel==1;
&$sub_ref();
}
}
#----------#
# New File #
#----------#
sub new_file {
my ($widget_ref) = @_;
my $page = which_nb_page();
if ($page eq "primer") {
dialogue("You can't open a new file from the primer information page - please switch to the relevant project page first");
return;
}
my ($seq_ref, $hlist) = get_variables(qw(seq hlist));
$seq_ref = $widget_ref if ref($widget_ref);
$_ = $$seq_ref->get(0.1,"end");
my ($seq_check) = /atcg/i;
# print "seq was $_\n\n\$seq was $seq\n";
# my $seq = $$seq_ref->search(-regexp => "[a|g|t|c|A|T|G|C]", "0.1");
# If there's a sequence present, prompt to make sure the user wants to
# lose all changes ...
if (defined($seq_check) && $file_data_overwrite) {
my $answer = dialogue("Save before closing?", 'Yes', 'No', 'Cancel');
if ($answer =~ /cancel/i) {
$cancel = 1;
return;
} elsif ($answer =~ /yes/i) {
pp_file_save();
}
}
if ($page eq "qpcr") {
# only for qpcr - quick and dodgy fix
$packed_widgets{qdna_seq}->delete(0.1,"end");
$packed_widgets{qmrna_seq}->delete(0.1,"end");
}
# Clear variables
foreach my $key (keys %{ $variables{$page}}) {
my $pointer = $variables{$page}{$key};
if (eval {defined($$pointer)}) {
undef($$pointer);
if ($default_variables{$page}{$pointer}) {
$$pointer = $default_variables{$page}{$pointer};
}
}
}
# Clear arrays
foreach my $key (keys %{ $arrays{$page}}) {
my $pointer = $arrays{$page}{$key};
if (eval {@$pointer}) {
undef(@$pointer);
}
}
# Clear sequence and hlist displays
$$seq_ref->delete(0.1,"end");
$$hlist->delete('all');
draw_dna();
# Clear title
$top->configure(-title=>"PerlPrimer v$version");
$open_file{$page} = 'File not saved';
}
#-----------------------------------------------#
# Saving/loading/deleting user-defined defaults #
#-----------------------------------------------#
sub save_defaults {
# Save user-defined default values
my $page = which_nb_page();
my $file_defaults = "$HOME.perlprimer.$page";
my $defaults;
# get list of variables and values
foreach my $key (keys %{ $variables{$page}}) {
my $pointer = $variables{$page}{$key};
if (eval {defined($$pointer)}) {
if (defined($default_variables{$page}{$pointer})) {
$default_variables{$page}{$pointer} = $$pointer;
$defaults .= "$key = $$pointer\n";
}
}
}
unless (open (DEFAULTS, ">$file_defaults")) {
dialogue("Error: could not open $file_defaults for writing: $!");
return;
}
print DEFAULTS $defaults;
close DEFAULTS;
}
sub restore_defaults {
# Remove user-specified preferences file if exists
my $page = which_nb_page();
my $file_defaults = "$HOME.perlprimer.$page";
if (-e $file_defaults) {
my $answer = dialogue("Warning: This will permanently remove the user-defined default values for this page and restore the built-in values (requires program restart)",'OkCancel');
return if $answer =~ /cancel/i;
unlink($file_defaults) || dialogue("Error: cannot delete file $file_defaults: $1");
dialogue("Built-in values restored. Please restart the program for changes to take effect");
} else {
dialogue("Error - User-defined defaults have not been saved for this page.\n\nIf you are trying to reset the parameters for this tab and remove all sequence data, use the \"New File\" command from the File menu");
}
}
sub load_defaults {
# load user-defined default values (same idea as save defaults above, but in reverse)
foreach my $key (keys (%nb_page_ref)) {
my $page = $nb_page_ref{$key};
my $file_defaults = "$HOME.perlprimer.$nb_page_ref{$key}";
if (-e $file_defaults) {
print "Loading user-defined defaults file: $file_defaults\n";
unless (open (DEFAULTS, "<$file_defaults")) {
dialogue("Error: could not open $file_defaults for reading: $!");
return;
}
while (<DEFAULTS>) {
chomp;
my ($variable, $value) = split / = /;
my $pointer = $variables{$page}{$variable};
if (defined($default_variables{$page}{$pointer})) {
$$pointer = $value;
$default_variables{$page}{$pointer} = $value;
}
}
close DEFAULTS;
}
}
}
#----------------#
# Blast routines #
#----------------#
sub blast {
# for more info on using BLAST via http requests, see:
# http://www.ncbi.nlm.nih.gov/BLAST/Doc/
# which details the request syntax
unless (Exists($blast_d)) {
# this routine should not continue running if the user has destroyed
# the blast search dialogue. Hopefully this will stop it!
# $top->afterCancel($rptid);
$rptid->cancel;
return;
}
return unless (my $query=shift);
unless ($local_blast) {
# Standard NCBI server blast over http
my $blast_put = "http://www.ncbi.nlm.nih.gov/blast/Blast.cgi?QUERY=$query&DATABASE=$blast_database&ENTREZ_QUERY=($blast_entrez_query)&EXPECT=$blast_expect&WORD_SIZE=$blast_word_size&FORMAT_TYPE=Text&PROGRAM=blastn&SERVICE=plain&CMD=Put";
# send off the query
$_ = http_get($blast_put);
# abort if unsuccessfull
return if $_ eq " ";
# find the RID string
/QBlastInfoBegin(.*)QBlastInfoEnd/sm;
$_ = $1;
/RID = ([\d\w\-.]*)/;
$rid_get = "http://www.ncbi.nlm.nih.gov/blast/Blast.cgi?RID=$1&FORMAT_TYPE=Text&CMD=Get";
# Hah! How about this for a simple way to unblock your GUI ... the only way I
# know of to use non-blocking, sleeping subroutines without forks - which we
# can't use with ActivePerl for Win32 :(
$flag=undef;
$blast_count = time();
$rptid = $top->repeat(15000, \&blast_wait);
$blast_d->waitVariable(\$flag);
# $blast_d->afterCancel($rptid);
$rptid->cancel;
# Having asked for text output, blast still provides some HTML formatting!
s/\<!\-\-.*\-\-\>//sg;
s/\<[\w\\]*\>//g;
s/<a href=".*?ALT="New"> //g;
} else {
# local BLAST server
# need to save the primer sequence to a temp file for input to local BLAST
unless (open (PRIMER, ">$tmp.primer_tmp")) {
dialogue("Error: could not write BLAST temp file: $!\n");
return;
}
print PRIMER $query;
close (PRIMER);
my $local_blast_command = $local_blast_directory."blastall -p blastn -d $local_blast_database -W $blast_word_size -i $tmp.primer_tmp";
$_ = `$local_blast_command`;
# delete tmp file
unlink "$tmp.primer_tmp";
}
# OK, let's try something really nifty ... let's pull each entry out:
my $blast_out = $_;
undef(@blast_results_1);
undef(@blast_results_2);
undef(@blast_results_3);
# s/\r//g;
/(BLASTN.*?Value.*?)(\w+.*?)\>/s;
my ($blast_header, $blast_summary) = ($1,$2);
# search for each sequence identifier and find corresponding blast entry
while (m/^(\w*\|[\w\|\.\d]+)/mg) {
my $found_result = $1;
if ($blast_out =~ /\n\>(\Q$found_result\E.*?Length\s*?=\s*?\d*)[\n\s]*(Score\s*?=.*?Strand\s*?=\s*?\w*\s*?\/\s*?\w*)[\n\s]*(Query.*?Sbjct.*?)\n/s) {
push @blast_results_1, $1;
push @blast_results_2, $2;
push @blast_results_3, $3;
}
}
return ($blast_header, $blast_summary);
}
sub blast_wait {
#print "Waiting for server response ...\n";
my $time_now = time();
my $time = convert_time($time_now-$blast_count);
$blast_status = "Waiting for server response ... $time elapsed";
$top->update;
# print "status: $blast_status\n";
$_ = http_get($rid_get);
unless (/Status=WAITING/) {
$flag=0;
} else {
#### debugging ... really need to use a timeout with repeat above ...
# print "output was $_\n";
}
}
sub convert_time {
my ($time) = @_;
my $seconds = $time % 60;
my $minutes_total = ($time-$seconds)/60;
# my $minutes = $minutes_total % 60;
# my $hours = ($minutes_total-$minutes)/60;
my $time_readable = sprintf("%02d:%02d", $minutes_total, $seconds);
return $time_readable;
}
#------------------#
# Ensembl routines #
#------------------#
sub get_ensembl {
return if check_packages("HTTP::Request", "LWP::UserAgent");
# retrieve a gene sequence (or a gene and genomic sequence) from ensembl.org ...
# Why do we use Ensembl? Simply because it happens to provide easy sequence
# retrieval, including the genomic sequence of a gene (i.e. not just the cDNA
# sequence). However, unlike NCBI, Ensembl provides no documentation on their
# cgi scripts; this was all worked out from going through the page sources.
my $nb_page = which_nb_page();
if ($nb_page eq "primer") {
dialogue("Please switch to the project page that you wish to enter the Ensembl data into");
return;
}
unless (Exists($ensembl)) {
$ensembl = $top->Toplevel(-title=>'Retrieve gene from Ensembl');
my $ensembl_f = $ensembl->Frame()->pack(-fill=>'both', -pady=>7);
my $ensembl_fb = $ensembl->Frame()->pack(-side=>'bottom', -fill=>'none');
nr(\$ensembl_f);
pack_gui('Label', 'Gene name ', "ensembl_gene");
pack_gui('Entry', \$ensembl_gene, "ensembl_gene", 15);
nr();
pack_gui('Label', 'Organism', 'ensembl_organsim');
pack_gui('BrowseEntry', \$ensembl_organism, 'ensembl_organsim', \@ensembl_species, 20);
nr();
pack_gui('Label', 'Retrieve', 'ensembl_type');
pack_gui('BrowseEntry', \$ensembl_type, 'ensembl_type', \@ensembl_types, 10);
nr(\$ensembl_fb);
pack_gui('Button', 'OK', 'ensembl_ok', \&fetch_ensembl, "active");
pack_gui('Button', 'Cancel', 'ensembl_cancel', sub {$ensembl->destroy;});
$ensembl->Icon(-image => $pixmap);
} else {
$ensembl->deiconify;
$ensembl->raise;
}
}
sub fetch_ensembl {
my $page = which_nb_page();
unless (($ensembl_gene) && ($ensembl_organism) && ($ensembl_type)) {
dialogue("Please make sure gene name, organism and retrieval type are filled in");
return;
}
# Search for the gene:
# New search method as of v1.1.18 (modified in 1.1.20, and again in 1.1.21 thanks to Nick Kennedy)
$_ = http_get("http://www.ensembl.org/$ensembl_organism/Search/Details?species=$ensembl_organism;idx=Gene;end=2;q=$ensembl_gene");
#$_ = http_get("http://www.ensembl.org/$ensembl_organism/Search/Details?species=$ensembl_organism;idx=Gene;q=$ensembl_gene");
#print "http://www.ensembl.org/$ensembl_organism/Search/Details?species=$ensembl_organism;idx=Gene;q=$ensembl_gene\n";
s/<\/*span.*?>//g; # rip out highlight spans
s/<\/*font.*?>//g; # rip out font spans
# Print the HTML output for debugging:
# print "$_\n\n";
# find the Ensembl gene ID, and count the number - if there's more than one
# we'll have to ask the user to be more specific
my $gene_id;
my @gene_names;
my $name;
my %ids;
my @enst;
my %trans;
my @enst_readable;
# As of 03/2010, Ensembl now returns the matching genes first, without listing transcripts
# So we need a new http call to get the page we really want, and we'll need to prompt the
# if there's more than one match here ...
#~ # Find genes and gene_ids
#~ while (m/\<a href="(.*?)"\>[\w_]+ ([\w_]+) Gene: ([\w\d\.\-]+) \(.*?: ([\w\d\.\-]+)\)/mg) {
#~ my ($href, $gene_type, $gene_id, $name) = ($1, $2, $3, $4);
#~ #print "($href, $gene_type, $gene_id, $name)\n\n";
#~ $name ||= "$gene_id: no description available";
#~ push @gene_names, $name;
#~ $ids{$name}=[$gene_id, $href];
#~ }
# As of 02/2011, Ensembl has changed formats again, leading to a slightly different parsing ... and again for version 1.1.21
# Find genes and gene_ids
while (m/\<div class=\"hit\"\>.*?href=\"(.*?)\".*?strong\>(.*?)\W*\<.*?\[(.*?): (.*?) ].*?Description.*?dd\>\W*(.*?)\W*\</sg) {
my ($href, $name, $gene_type, $gene_id, $gene_des) = ($1, $2, $3, $4, $5);
#print "($href, $gene_type, $gene_id, $name, $gene_des)\n\n";
$name .= " -- $gene_des";
$name ||= "$gene_id: no description available";
push @gene_names, $name;
$ids{$name}=[$gene_id, $href];
}
# No need to sort -- genes are listed in order of relevance
#@gene_names = sort(@gene_names);
if (@gene_names) {
# Ask user to confirm gene identity or pick the gene of interest if multiple matches
my $ensembl_mm = $top->Toplevel(-title=>"Select gene of interest ...");
my $ensembl_mm_f = $ensembl_mm->Frame()->pack(-fill=>'both', -pady=>7);
my $ensembl_mm_fb = $ensembl_mm->Frame()->pack(-side=>'bottom', -fill=>'none');
nr(\$ensembl_mm_f);
pack_gui('Label', "Found ".($#gene_names+1)." matching gene".($#gene_names > 0 ? 's' : '')." ...", "ensemble_mm_d_note");
nr();
$name = $gene_names[0];
pack_gui('BrowseEntry', \$name, 'ensembl_mm_d_genes', \@gene_names, 40);
my $cancel=1;
nr(\$ensembl_mm_fb);
pack_gui('Button', 'OK', 'ensembl_ok', sub {
$cancel=undef;
$ensembl_mm->destroy;
$gene_id = $ids{$name}[0];
}, "active");
pack_gui('Button', 'Cancel', 'ensembl_cancel', sub {
$ensembl_mm->destroy;
});
$ensembl_mm->Icon(-image => $pixmap);
# (we need it to freeze execution at this point, since the user may
# wish to cancel and refine their choice)
$ensembl_mm->waitWindow;
return if $cancel;
}
# Having selected the gene, we can now get the transcripts ... (parsing changed for 1.1.21)
if ($name && ($ids{$name}[1])) {
$_ = http_get("http://www.ensembl.org/$ids{$name}[1]");
#print "$_\n";
my ($transcripts) = m/id="transcripts"(.*?)\/table/sg;
while ($transcripts =~ m/\/Summary\?.*?t=([\w\d\.]+).*?<td.*?>.*?<td.*?>.*?<td.*?>([\d\-]+).*?<td.*?>.*?>([\w\s]+)</sg) {
#print "$1 $2 $3\n";
push @enst, $1;
if ($2 eq '-') {
# Processed transcript, not protein coding
push @enst_readable, "$1 $3";
} else {
# Protein coding
push @enst_readable, "$1 $3 (size: $2 aa)";
}
$ids{$1} = [$2, $3];
}
}
my $transcript;
if (@enst) {
$transcript = $enst[0];
if ($#enst > 1) {
# multiple transcripts: ask user to select transcript ID
my @transcripts = @enst;
my $ensembl_mt = $top->Toplevel(-title=>"Please select transcipt ...");
my $ensembl_mt_f = $ensembl_mt->Frame()->pack(-fill=>'both', -pady=>7);
my $ensembl_mt_fb = $ensembl_mt->Frame()->pack(-side=>'bottom', -fill=>'none');
nr(\$ensembl_mt_f);
pack_gui('Label', "Ensemble gene $ids{$name}[0] has ".($#transcripts+1)." transcript".($#transcripts > 0 ? 's' : '')." ...", "ensemble_mt_d_note");
nr();
pack_gui('BrowseEntry', \$transcript, 'ensembl_mt_d_genes', \@enst_readable, 50);
my $cancel=1;
nr(\$ensembl_mt_fb);
pack_gui('Button', 'OK', 'ensembl_ok', sub {
$cancel=undef;
$ensembl_mt->destroy;
}, "active");
pack_gui('Button', 'Cancel', 'ensembl_cancel', sub {
$ensembl_mt->destroy;
});
pack_gui('Button', 'View transcripts', 'ensembl_view_transcripts', sub {
my $command = "\"$browser\" http://www.ensembl.org/$ensembl_organism/geneview?gene=$gene_id";
if ($os eq 'win') {
system "$command &";
} else {
system "$command &";
}
});
$ensembl_mt->Icon(-image => $pixmap);
# (we need it to freeze execution at this point, since the user may
# wish to cancel and refine their choice)
$ensembl_mt->waitWindow;
return if $cancel;
}
}
($transcript) = ($transcript =~ m/([\w\d\.\-]+)/) if $transcript;
unless ($gene_id) {
# no matches
if (/did not match any records in the database/si) {
dialogue("Your query did not match any records in the database. Please make sure all terms are spelled correctly.");
} elsif ($_ eq " ") {
# returned if response->is_error below
return;
} else {
dialogue("Error: Unable to find gene_id in response from server.\n\nIf this problem persists, it probably means that Ensembl has changed formats - please report this in an email to owenjm\@users.sf.net or submit a bug report at http://perlprimer.sf.net ...\n\nThanks!");
# print "output was\n$_\n";
}
return;
}
new_file();
if ($page eq 'qpcr') {
# retrieve both gene and transcript sequences - retrieval type is ignored
$_ = http_get(convert_ensembl($ensembl_organism,$transcript,'genomic','Location'));
$packed_widgets{qdna_seq}->delete(0.1,"end");
$packed_widgets{qdna_seq}->insert(0.1,$_);
$_ = http_get(convert_ensembl($ensembl_organism,$transcript,'cdna'));
$packed_widgets{qmrna_seq}->delete(0.1,"end");
$packed_widgets{qmrna_seq}->insert(0.1,$_);
# Run spidey automatically to show the user the intron/exon boundaries
run_spidey(1);
} else {
# retrieve requested sequence
my ($seq_ref) = get_variables('seq');
$_ = http_get(convert_ensembl($ensembl_organism,$transcript,$ensembl_type));
$$seq_ref->delete(0.1,"end");
$$seq_ref->insert(0.1,$_);
}
# update title
my $file_name = "$ensembl_gene"."_($ensembl_organism)";
$file_name = format_file_name($file_name);
$top->configure(-title=>"PerlPrimer v$version - $file_name");
$open_file{$page} = $file_name;
sbarprint("\n$ensembl_gene ($ensembl_organism) retrieved sucessfully");
# destroy dialogue, draw the sequence
$ensembl->destroy;
draw_dna();
reset_bounds();
return;
}
sub convert_ensembl {
# argument to http address converter (addresses changed for 1.1.21)
my ($ensembl_organism,$transcript,$ensembl_type,$export_type) = @_;
$export_type||='Transcript';
# my $address = "http://www.ensembl.org/$ensembl_organism/exportview?seq_region_name=&type1=transcript&anchor1=$transcript&type2=bp&anchor2=&downstream=&upstream=&format=fasta&action=export&_format=Text&options=$ensembl_type&output=txt";
# my $address = "http://www.ensembl.org/$ensembl_organism/$export_type/Export/fasta?db=core;t=$transcript;st=$ensembl_type;_format=Text";
# return $address;
# Thanks to Karl Kashofer for the following fix ...
# for genomic retrieval we need to append "genomic=unmasked"
if ($ensembl_type eq 'genomic') {
my $address = "http://www.ensembl.org/$ensembl_organism/Export/Output/Transcript?output=fasta;db=core;t=$transcript;param=$ensembl_type;genomic=unmasked;_format=Text";
return $address;
} else {
my $address = "http://www.ensembl.org/$ensembl_organism/Export/Output/Transcript?output=fasta;db=core;t=$transcript;param=$ensembl_type;_format=Text";
return $address;
};
}
#------------------------#
# http retrieval routine #
#------------------------#
sub http_get {
return if check_packages("HTTP::Request", "LWP::UserAgent");
# simple html retrieval ... used by BLAST and Ensembl routines
# I'd love to fork this and stop the GUI blocking here - but I cannot find
# an effective way to do this ... :(
my ($address, $method) = @_;
#print "address:$address\n";
# proxy server
if ($use_proxy) {
# allow for users using "http://" in the proxy address
$http_proxy =~ /(http:\/\/)*(.*)/;
my $proxy = $2;
$ua->proxy('http', "http://$proxy:$http_port");
} else {
# still allow env_proxy
$ua->env_proxy();
}
my $req = HTTP::Request->new(GET => "$address");
my $response = $ua->request($req);
if ($response->is_error) {
my $code = $response->code;
my $message = $response->message;
dialogue("Error: $code $message");
return " ";
}
$top->update;
my $http = $response->content;
return $http;
}
#---------------------#
# Status bar updating #
#---------------------#
sub sbarprint {
print SBAR $_[0];
$top->update;
}
#------------#
# HList subs #
#------------#
sub header_create {
my ($widget_r, @headers) = @_;
my $i=0;
foreach (@headers) {
$$widget_r->header('create', $i, -text => $_);
$i++;
}
$style_primer = $$widget_r->ItemStyle("text",
-background => '#eeeeee',
-foreground => 'red');
$style_tm = $$widget_r->ItemStyle("text",
-background => '#eeeeee',
-foreground => 'blue');
}
sub browse_bisulphite {
# my $seq = get_seq();
# Believe it or not, when a primer-pair is double-clicked to send the user
# to the hlist-command sub, the browse-command sub is still executed! In
# our case, that's pretty bad since we're now requesting a sequence on a
# page that doesn't have one. So there's a failsafe here:
# return if $seq eq "1";
my ($hlist_sel) = @_;
# This routine colours original C residues red and original CpG C's blue
# if ($primer_pairs_bs_s[$hlist_sel][10]) {
# brute force!!
my $f_original = $primer_pairs_bs_s[$hlist_sel][11];
my $f_converted = $primer_pairs_bs_s[$hlist_sel][0];
my $r_original = $primer_pairs_bs_s[$hlist_sel][12];
my $r_comp_original = complement($r_original);
my $r_converted = $primer_pairs_bs_s[$hlist_sel][4];
$status_bar->insert('end',"\nF: 5' ", 'grey');
for my $i (0 .. length($f_original)) {
if (substr($f_original, $i, 2) eq "CG") {
$status_bar->insert('end',substr($f_converted, $i, 1), 'blue');
} elsif (compare_bs($f_original, $f_converted, $i)) {
$status_bar->insert('end',substr($f_converted, $i, 1), 'red')
} else {
$status_bar->insert('end',substr($f_converted, $i, 1))
}
}
$status_bar->insert('end'," 3' R: 5' ", 'grey');
for my $i (0 .. length($r_comp_original)) {
if (substr($r_comp_original, $i, 2) eq "GC") {
$status_bar->insert('end',substr($r_converted, $i, 1), 'blue');
} elsif (compare_bs($r_comp_original, $r_converted, $i)) {
$status_bar->insert('end',substr($r_converted, $i, 1), 'red')
} else {
$status_bar->insert('end',substr($r_converted, $i, 1))
}
}
$status_bar->insert('end'," 3'", 'grey');
$status_bar->see('end');
browse_primer($hlist_sel);
# }
}
sub browse_primer {
my ($hlist, $slist, $canv) = get_variables(qw(hlist primers canvas));
my $seq = get_seq();
return if $seq eq "1";
my $hlist_sel;
if (defined($_[0])) {
$hlist_sel = $_[0];
} else {
my @sel = $$hlist->selectionGet;
$hlist_sel = shift @sel;
}
my $width = $$canv->width;
my $height= $$canv->height;
my $dna_canvas_size=($width-($dna_canvas_offset*2))/length($seq);
$$canv->delete('primerf','primerr');
my $fprimerpos = $$slist[$hlist_sel][1];
my $rprimerpos = $$slist[$hlist_sel][8];
my $fprimerposl = $$slist[$hlist_sel][2];
my $rprimerposl = $$slist[$hlist_sel][6];
my ($fprimer_x1,$fprimer_x2,$rprimer_x1,$rprimer_x2);
if (defined($fprimerpos)) {
$fprimer_x1 = $fprimerpos*$dna_canvas_size + $dna_canvas_offset;
$fprimer_x2 = ($fprimerpos+$fprimerposl)*$dna_canvas_size + $dna_canvas_offset;
}
if (defined($rprimerpos)) {
$rprimer_x1 = $rprimerpos*$dna_canvas_size + $dna_canvas_offset;
$rprimer_x2 = ($rprimerpos-$rprimerposl)*$dna_canvas_size + $dna_canvas_offset;
}
my $line_arrow_h = 4;
my $line_arrow_w = 4;
$$canv->createLine($fprimer_x1,$dc_sel_y1,$fprimer_x2,$dc_sel_y1,$fprimer_x2-$line_arrow_w,$dc_sel_y1-$line_arrow_h, -fill=>'red', -width=>2, -tag=>'primerf') if $fprimerpos;
$$canv->createLine($rprimer_x1,$dc_sel_y2,$rprimer_x2,$dc_sel_y2,$rprimer_x2+$line_arrow_w,$dc_sel_y2+$line_arrow_h, -fill=>'red', -width=>2, -tag=>'primerr') if $rprimerpos;
}
sub compare_bs {
return 1 if substr($_[0], $_[2], 1) ne substr($_[1], $_[2], 1);
}
sub jump_to_tm {
# an arrow key shortcut ... jumps from the primer listings to detailed info
# including primer-dimers
my $nb_page = which_nb_page();
return if $nb_page eq "primer";
$stored_page = $nb_page;
my ($hlist, $slist) = get_variables(qw(hlist primers));
my @sel = $$hlist->selectionGet;
my $hlist_sel = $sel[0];
return unless @$slist;
$fprimer = $$slist[$hlist_sel][0];
$rprimer = $$slist[$hlist_sel][4] if $$slist[$hlist_sel][5];
get_tm();
$nb->raise('primer');
$packed_widgets{dim}->focus;
}
sub jump_back {
# jumps back from the primer information page to the project page
my $nb_page = which_nb_page();
return unless $nb_page eq "primer";
return unless $stored_page;
$nb->raise($stored_page);
my ($hlist) = get_variables(qw(hlist));
$$hlist->focus;
}
sub hlist_command {
my $hlist_sel = $_[0];
my ($hlist_ref, $slist) = get_variables(qw(hlist primers));
my $nb_page = which_nb_page();
return unless ref($slist) eq 'ARRAY';
$stored_page = $nb_page;
$fprimer = $$slist[$hlist_sel][0];
if ($$slist[$hlist_sel][5]) {
$rprimer = $$slist[$hlist_sel][4];
} else {
$rprimer = "";
}
get_tm();
$nb->raise('primer');
}
#----------------------------#
# Generate Report subroutine #
#----------------------------#
sub generate_report {
my ($hlist_ref, $slist) = get_variables(qw(hlist primers));
my $nb_page = which_nb_page();
if ($nb_page eq "primer") {
dialogue("You can't generate a report from the primer information page - please switch to the project page first");
return;
}
my ($hlist_sel) = $$hlist_ref->selectionGet;
unless (defined(@$slist) && defined($hlist_sel)) {
dialogue("The Generate Report function saves the statistics and alignment of a particular primer pair - please select a primer pair first");
return;
}
my $fprimer_mod = $fprimer = $$slist[$hlist_sel][0];
my $rprimer_mod = $rprimer = $$slist[$hlist_sel][4] unless $nb_page eq 'seq';
my $fprimerpos = $$slist[$hlist_sel][1];
my $rprimerpos = $$slist[$hlist_sel][8] unless $nb_page eq 'seq';
my $amplicon_size = $$slist[$hlist_sel][9] unless $nb_page eq 'seq';
# Generate modified primers:
my (@gene_array, $gene_frame, $seq);
if ($nb_page eq "pd" && (($primer_seq_5f) || ($primer_seq_5r))) {
$seq = get_seq();
@gene_array=find_gene($seq);
$gene_frame=$gene_array[0][0]%3;
}
for my $primer ($fprimer, $rprimer) {
if ($nb_page eq "bis") {
# Primer redundancy for CpG residues:
# Replaces T with Y (pyrimidine) for forward
# Replaces A with R (purine) for reverse
my $f_original = $$slist[$hlist_sel][11];
for my $i (0 .. length($f_original)) {
if (substr($f_original, $i, 2) eq "CG") {
substr($fprimer_mod, $i, 1) = 'Y';
}
}
my $r_original = $$slist[$hlist_sel][12];
for my $i (0 .. length($r_original)) {
if (substr($r_original, $i, 2) eq "CG") {
substr($rprimer_mod, $i, 1) = 'R';
}
}
} elsif ($nb_page eq "pd") {
if ($primer_seq_5f) {
my ($primer_seq_5f_real, $insert_f) = add_cloning($seq, $fprimer, $fprimerpos);
$fprimer_mod = uc("$primer_seq_5f_real$insert_f\_$fprimer");
}
if ($primer_seq_5r) {
my ($primer_seq_5r_real, $insert_r) = (add_cloning($seq, '', '', '', $rprimer, $rprimerpos))[5,6];
$rprimer_mod = uc("$primer_seq_5r_real$insert_r\_$rprimer");
}
}
}
my $tm_text = get_tm(1);
my $text = dna_magnify('',1);
my $time = localtime;
my $amplicon = "$amplicon_size bases ($fprimerpos - $rprimerpos)" unless $nb_page eq 'seq';
$amplicon ||= "";
my $output = <<EOT;
[$open_file{$nb_page} - Report generated at $time]
PRIMERS
-------
Forward: 5' $fprimer_mod 3'
Reverse: 5' $rprimer_mod 3'
$amplicon
PRIMER DETAILS
--------------
$tm_text
SEQUENCE MAP
------------
$text
EOT
my $file;
unless ($open_file{$nb_page} eq 'File not saved') {
my $filename = $open_file{$nb_page};
$filename =~ s/\.ppr//g;
$filename .= "_report";
$file = $top->getSaveFile(-defaultextension=>'.txt', -initialfile=>$filename, -filetypes=>$file_types_text);
} else {
$file = $top->getSaveFile(-defaultextension=>'.txt', -filetypes=>$file_types_text);
}
if (defined($file)) {
open (REPORT, ">$file") || dialogue("Error: Could not open file: $!");
print REPORT $output;
close (REPORT);
sbarprint("\n$file report generated");
}
}
#---------------#
# Gui dialogues #
#---------------#
sub dialogue {
my ($message, @buttons) = @_;
@buttons = ('OK') unless @buttons;
my ($title, $text) = $message =~ /(\w+?)\:\s*/;
$title ||= "Warning";
$text ||= $message;
my $icon = 'info';
$icon = 'error' if $title =~ /error/i;
$icon = 'question' if $#buttons > 1;
### Neither messageBox or Dialog are really suitable here - clunky, ugly,
### different appearances under different OSes. Need to write our own dialogue
### handling code sometime ...
# messageBox code
my $type = join("", @buttons);
my $selected = $top->messageBox(
-title=>$title,
-message=> $text,
-type => $type,
-icon=> $icon,
);
# dialog code (currently not used)
# my $dialogue = $top->Dialog(
# -title => $title,
# -text => $text,
# -bitmap => $pixmap,
# -default_button => $buttons[0],
# -buttons => \@buttons,
# );
#
# my $selected = $dialogue->Show();
return $selected;
}
sub info {
if (Exists($info_d)) {
$info_d->deiconify();
$info_d->raise();
return;
}
my $text = <<EOT;
PerlPrimer v$version
Copyright © 2003-2011 Owen Marshall\n
EOT
my $text2 = <<EOT;
An application to design primers for PCR, Bisulphite PCR, Real-time PCR and Sequencing.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.\n
EOT
my $address = <<EOT;
http://perlprimer.sourceforge.net
EOT
$info_d = $top->Toplevel(-title=>'About PerlPrimer ...');
my $info_d_f = $info_d->Frame()->pack(-padx=>4, -pady=>4, -expand=>1, -fill=>'both');
my $info_icon = $info_d_f->Label(-image => $pixmap)->pack(-side=>'left', -anchor=>'n');
# Because of a few tweaks and the custom layout, this is the one window that
# doesn't use pack_gui()
# Want the text widget to have the same background colour as the window
# (so the user can't tell it's a text widget!) We're using a text widget
# rather than a frame to get some formatting options (i.e. bold text)
my $colour = $info_d->cget(-bg);
my $info_text = $info_d_f->ROText(
-relief => 'flat',
-wrap => 'word',
-bg => $colour,
-width => 50,
-height => 12,
-font => $gui_font,
)->pack( -expand=>0, -fill=>'both', -anchor=>'nw');
$info_text->tagConfigure('bold',
-font => "$gui_font bold");
$info_text->tagConfigure('center',
-justify => 'center');
$info_text->insert('end', $text, 'bold');
$info_text->insert('end', $text2);
$info_text->insert('end', $address);
my $info_OK = $info_d->Button(
-text => 'OK',
-font => $gui_font,
-padx=>4,
-pady=>$button_pady,
-command => sub {$info_d->destroy},
)->pack(-pady=>4, -side=>'bottom');
$info_d->Icon(-image => $pixmap);
}
sub canvas_info {
if (Exists($canvas_info_d)) {
$canvas_info_d->deiconify();
$canvas_info_d->raise();
return;
}
$canvas_info_d = $top->Toplevel(-title=>'PerlPrimer Help');
my $canvas_info_d_f = $canvas_info_d->Frame()->pack(-expand=>1, -fill=>'both');
my $canvas_info_d_fb = $canvas_info_d->Frame()->pack(-side=>'bottom', -fill=>'none');
nr(\$canvas_info_d_f, $frame_pady, 1);
pack_gui('ROText', '', 'canvas_info_text', 80, 35, -scrollbars=>'oe', -wrap=>'word');
nr(\$canvas_info_d_fb);
pack_gui('Button', "OK", "canvas_info_OK", sub {$canvas_info_d->destroy}, "active");
$packed_widgets{canvas_info_text}->configure(-font=>"$gui_font");
$packed_widgets{canvas_info_text}->tagConfigure('bold',
-font => "$gui_font bold");
$packed_widgets{canvas_info_text}->tagConfigure('center',
-justify => 'center');
my $info_text_dna=<<EOT;
\nThe grey line represents the DNA sequence, with genes [Standard PCR and Real-time PCR tabs] or CpG islands [Bisulphite PCR tab] marked in dark blue. Intron/exon boundaries are displayed in the Real-time PCR tab.
EOT
my $info_text_ranges=<<EOT;
\nThe light blue rectangle [Standard PCR and Bisulphite PCR tabs only] marks the minimum amplified area. It can be automatically set to the gene boundaries by clicking the "Set from ORF" or "Set from CpG Islands" buttons, or can be resized using the left mouse button. Alternatively, you can set it precisely in the "Amplified range" section.
The orange rectangle marks the maximum amplified area - no primers will be taken from outside of this range. You can resize it by using the middle mouse button or Ctrl-left mouse button.
EOT
my $info_text_primers=<<EOT;
\nClicking on a primer pair in the Results list displays the primers in red, drawn to scale.
EOT
my $info_text_other=<<EOT;
\nRight-clicking on the DNA will open a detailed view aligning the primers, DNA, translated ORF [Standard PCR and Real-time PCR tabs] or CpG island boundaries [Bisulphite PCR tab]. Intron/exon boundaries [Real-time PCR tab] or CpG residues [Bisulphite PCR tab] are also highlighted. The "Copy printable" button in this dialogue window will copy the entire layout to the clipboard wrapped at 80 characters, which can then be pasted into a word processor/text editor and printed.
EOT
$packed_widgets{canvas_info_text}->insert('1.0', " ", 'center');
$packed_widgets{canvas_info_text}->imageCreate('end', -image=>$top->Pixmap(-data => $dna_canvas_pixmap));
$packed_widgets{canvas_info_text}->insert('end', "\n\n\nDNA sequence\n", 'bold');
$packed_widgets{canvas_info_text}->insert('end', $info_text_dna);
$packed_widgets{canvas_info_text}->insert('end', "\n\nAmplified ranges\n", 'bold');
$packed_widgets{canvas_info_text}->insert('end', $info_text_ranges);
$packed_widgets{canvas_info_text}->insert('end', "\n\nPrimers\n", 'bold');
$packed_widgets{canvas_info_text}->insert('end', $info_text_primers);
$packed_widgets{canvas_info_text}->insert('end', "\n\nOther features\n", 'bold');
$packed_widgets{canvas_info_text}->insert('end', $info_text_other);
}
sub acknowledgements {
# just raise the dialogue if it already exists ....
if (Exists($ack_d)) {
$ack_d->deiconify();
$ack_d->raise();
return;
}
$ack_d = $top->Toplevel(-title=>'Acknowledgements');
my $ack_d_f = $ack_d->Frame()->pack(-expand=>1, -fill=>'both');
my $ack_d_fb = $ack_d->Frame()->pack(-side=>'bottom', -fill=>'none');
nr(\$ack_d_f, $frame_pady, 1);
pack_gui('ROText', '', 'ack_text', 70, 35, -scrollbars=>'oe', -wrap=>'word');
nr(\$ack_d_fb);
pack_gui('Button', "OK", "ack_OK", sub {$ack_d->destroy}, "active");
$packed_widgets{ack_text}->configure(-font=>"$gui_font");
$packed_widgets{ack_text}->tagConfigure('bold',
-font =>"$gui_font bold");
my $text_rebase=<<EOT;
Restriction enzyme data are provided by the REBASE project (http://rebase.neb.com)
Roberts RJ, Vincze T, Posfai J, Macelis D. REBASE - restriction enzymes and methylases. Nucleic Acids Res. 2003; 31:418-20.
EOT
my $text_thermo=<<EOT;
Thermodynamic parameters are based on the following papers:
Allawi HT, SantaLucia J Jr. Thermodynamics and NMR of internal G.T mismatches in DNA. Biochemistry. 1997 Aug 26;36(34):10581-94
SantaLucia J Jr. A unified view of polymer, dumbbell, and oligonucleotide DNA nearest-neighbor thermodynamics. Proc Natl Acad Sci U S A. 1998 Feb 17;95(4):1460-5.
Allawi HT, SantaLucia J Jr. Nearest neighbor thermodynamic parameters for internal G.A mismatches in DNA. Biochemistry. 1998 Feb 24;37(8):2170-9.
Allawi HT, SantaLucia J Jr. Thermodynamics of internal C.T mismatches in DNA. Nucleic Acids Res. 1998 Jun 1;26(11):2694-701.
Allawi HT, SantaLucia J Jr. Nearest-neighbor thermodynamics of internal A.C mismatches in DNA: sequence dependence and pH effects. Biochemistry. 1998 Jun 30;37(26):9435-44.
Peyret N, Seneviratne PA, Allawi HT, SantaLucia J Jr. Nearest-neighbor thermodynamics and NMR of DNA sequences with internal A.A, C.C, G.G, and T.T mismatches. Biochemistry. 1999 Mar 23;38(12):3468-77.
EOT
my $text_entropy=<<EOT;
Entropy corrections for PCR salt conditions are based on:
von Ahsen N, Wittwer CT, Schütz E. Oligonucleotide Melting Temperatures under PCR Conditions: Nearest-Neighbor Corrections for Mg2+, Deoxynucleotide Triphosphate, and Dimethyl Sulfoxide Concentrations with Comparison to Alternative Empirical Formulas. Clinical Chemistry. 2001; 47(11):1956-1961
EOT
my $text_cpg=<<EOT;
Parameters for Bisulphate PCR primer design are based upon:
Warnecke PM, Stirzaker C, Song J, Grunau C, Melki JR, Clark SJ. Identification and resolution of artifacts in bisulfite sequencing. Methods. 2002 Jun;27(2):101-7.
EOT
my $text_thanks=<<EOT;
Alf Eaton
Alexander Kozik
Chris Vega
Katrina Bell
Richard Saffery
Nick Wong
Karl Billeter
Steffen Moeller
Karl Kashofer
Henning Lenz
Nick Kennedy
EOT
$packed_widgets{ack_text}->insert('0.1', "Restriction enzyme data\n\n", 'bold');
$packed_widgets{ack_text}->insert('end', $text_rebase);
$packed_widgets{ack_text}->insert('end', "\n\nThermodynamic parameters\n\n", 'bold');
$packed_widgets{ack_text}->insert('end', $text_thermo);
$packed_widgets{ack_text}->insert('end', "\n\nEntropy corrections\n\n", 'bold');
$packed_widgets{ack_text}->insert('end', $text_entropy);
$packed_widgets{ack_text}->insert('end', "\n\nBisulphate PCR primer design\n\n", 'bold');
$packed_widgets{ack_text}->insert('end', $text_cpg);
$packed_widgets{ack_text}->insert('end', "\n\nSpecial thanks for comments, testing, suggestions and bugfixes\n(in no particular order)\n\n", 'bold');
$packed_widgets{ack_text}->insert('end', $text_thanks);
# icon
$ack_d->Icon(-image => $pixmap);
}
sub view_spidey_out {
my ($spidey_out) = run_spidey(1);
my $spidey_d = $top->Toplevel(-title=>'Spidey output');
my $spidey_d_f = $spidey_d->Frame()->pack(-expand=>1, -fill=>'both');
my $spidey_d_fb = $spidey_d->Frame()->pack(-side=>'bottom', -fill=>'x');
$spidey_d->Icon(-image => $pixmap);
nr(\$spidey_d_f, $frame_pady, 1);
pack_gui('ROText', '', 'spidey_text', 100, 25, -scrollbars=>'osoe');
nr(\$spidey_d_fb);
pack_gui('Button', "OK", "spidey_OK", sub {$spidey_d->destroy}, "active");
pack_gui('Button', "Full output", "spidey_full", sub {
($spidey_out) = run_spidey(0);
$packed_widgets{'spidey_text'}->delete('0.1', 'end');
$packed_widgets{'spidey_text'}->insert('0.1', $spidey_out)
});
$packed_widgets{spidey_text}->insert('0.1', $spidey_out);
}
#-------------#
# Preferences #
#-------------#
sub prefs {
# Preferences dialogue
# Preference file is $pref_file; all variables saved/restored are given in
# the hash %pref_variables. It should be fairly clear that this makes the
# preference system easily extensible and yet also extremely simple ...
# just raise the dialogue if it already exists ....
if (Exists($prefs)) {
$prefs->deiconify();
$prefs->raise();
return;
}
$prefs = $top->Toplevel(-title=>'Preferences');
my $prefs_nb = $prefs->NoteBook(
-inactivebackground=>"#$nb_colour",
-relief => 'raised',
-bd => 1,
)->pack(
-expand=>1,
-padx=>4,
-pady=>4,
-fill=>'both',
);
my $prefs_page_general = $prefs_nb->add('files', -label=>'General', -anchor=>'nw');
my $prefs_page_repeats = $prefs_nb->add('repeats', -label=>'Exclusions', -anchor=>'nw');
my $prefs_page_blast = $prefs_nb->add('blast', -label=>'BLAST', -anchor=>'nw');
my $prefs_page_cloning = $prefs_nb->add('cloning', -label=>'Cloning', -anchor=>'nw');
my $prefs_page_orfcpg = $prefs_nb->add('orfcpg', -label=>'CpG Islands', -anchor=>'nw');
my $prefs_page_dimers = $prefs_nb->add('dimers', -label=>'Dimers', -anchor=>'nw');
my $prefs_page_connection = $prefs_nb->add('connection', -label=>'Network', -anchor=>'nw');
my $prefs_page_gui = $prefs_nb->add('gui', -label=>'GUI', -anchor=>'nw');
my $prefs_page_general_f = $prefs_page_general->Frame()->pack(-anchor=>'nw', -expand=>0, -fill=>'none');
my $prefs_page_repeats_f = $prefs_page_repeats->Frame()->pack(-anchor=>'nw', -expand=>0, -fill=>'none');
my $prefs_page_blast_f = $prefs_page_blast->Frame()->pack(-anchor=>'nw', -expand=>0, -fill=>'none');
my $prefs_page_orfcpg_f = $prefs_page_orfcpg->Frame()->pack(-anchor=>'nw', -expand=>0, -fill=>'none');
my $prefs_page_cloning_f = $prefs_page_cloning->Frame()->pack(-anchor=>'nw', -expand=>0, -fill=>'none');
my $prefs_page_dimers_f = $prefs_page_dimers->Frame()->pack(-anchor=>'nw', -expand=>0, -fill=>'none');
my $prefs_page_connection_f = $prefs_page_connection->Frame()->pack(-anchor=>'nw', -expand=>0, -fill=>'none');
my $prefs_page_gui_f = $prefs_page_gui->Frame()->pack(-anchor=>'nw', -expand=>0, -fill=>'none');
my $prefs_fb = $prefs->Frame()->pack(-side=>'bottom', -padx=>2, -fill=>'none');
# new Tk choose directory code:
my $browse_directory = sub {
my ($dir_ref, $title) = @_;
my $dir = $prefs->chooseDirectory();
return unless defined($dir);
if ($os eq 'win') {
# directory separator correction if running through cygwin
$dir =~ s/\//\\/g;
}
$dir = $dir.$dir_sep unless ($dir =~ /$dir_sep$/);
$$dir_ref = $dir;
};
my $browse_file = sub {
my ($file_ref, $title) = @_;
my $file = $top->getOpenFile(-initialfile=>$$file_ref);
return unless defined($file);
if ($os eq 'win') {
# directory separator correction if running through cygwin
$file =~ s/\//\\/g;
}
$$file_ref = $file;
};
nr(\$prefs_page_general_f, 2);
nr();
pack_gui('Label', "Directories", "prefs_directories_l", -font=>$gui_font_bold);
nr();
pack_gui('Label', "Home directory", "prefs_files_home");
pack_gui('Label', \$HOME, "prefs_files_home");
# my $open_home = pack_button($row_counter[-1], $top->Pixmap(-data => $icon_open_small), [$browse_directory, (\$HOME, "home")])->pack(-side=>'left');
nr('',0);
pack_gui('Label', "Temp directory", "prefs_files_tmp");
pack_gui('Entry', \$tmp, "prefs_files_tmp", 20);
my $open_tmp = pack_button($row_counter[-1], $top->Pixmap(-data => $icon_open_small), [$browse_directory, (\$tmp, "tmp")])->pack(-side=>'left');
nr('',0);
pack_gui('Label', "Path to Spidey executable", "prefs_files_spidey");
pack_gui('Entry', \$spidey_path, "prefs_files_spidey", 20);
my $open_spidey = pack_button($row_counter[-1], $top->Pixmap(-data => $icon_open_small), [$browse_directory, (\$spidey_path, "Spidey")])->pack(-side=>'left');
nr('', 7);
nr();
pack_gui('Label', "Opening files", "prefs_files_l", -font=>$gui_font_bold);
nr('',0);
pack_gui('Checkbutton', 'Prompt to save existing project before opening new data', "prefs_files_overwrite", \$file_data_overwrite);
nr('', 7);
nr();
pack_gui('Label', "PCR component concentrations", "prefs_oligo", -font=>$gui_font_bold);
nr();
pack_gui('Label', "Mg++: ");
pack_gui('Entry', \$mg_conc, "prefs_mg_conc", 5);
pack_gui('Label', "mM");
nr();
pack_gui('Label', "Oligos: ");
pack_gui('Entry', \$oligo_conc, "prefs_oligo_conc", 5);
pack_gui('Label', "nM");
nr();
pack_gui('Label', "dNTPs: ");
pack_gui('Entry', \$dntp_conc, "prefs_oligo_conc", 5);
pack_gui('Label', "mM");
nr();
pack_gui('Label', "Monovalent cations: ");
pack_gui('Entry', \$monovalent_cation_conc, "prefs_monocat_conc", 5,);
pack_gui('Label', "mM");
nr('', 7);
nr();
pack_gui('Label', "ORF / CpG island finding behaviour", '', -font=>$gui_font_bold);
nr('',0);
pack_gui('Checkbutton', 'Defer to capitalised regions', "prefs_defer", \$defer_to_caps);
nr('',2);
nr(\$prefs_page_repeats_f, 2);
nr();
pack_gui('Label', "PCR excluded repeats / runs", '', -font=>$gui_font_bold);
nr('',0);
pack_gui('Checkbutton', 'Exclude primers containing more than', "prefs_exclude_rr", \$exclude_rr);
nr();
pack_gui('Entry', \$repeat, "prefs_rr_repeats", 3);
pack_gui('Label', 'Repeats or');
pack_gui('Entry', \$run, "prefs_rr_runs", 3);
pack_gui('Label', 'Runs');
nr('', 7);
nr();
pack_gui('Label', "Bisulphite PCR excluded repeats / runs", '', -font=>$gui_font_bold);
nr('',0);
pack_gui('Checkbutton', 'Exclude primers containing more than', "prefs_exclude_rr_bs", \$exclude_rr_bs);
nr();
pack_gui('Entry', \$repeat, "prefs_rrbs_repeats", 3);
pack_gui('Label', 'Repeats or');
pack_gui('Entry', \$run, "prefs_rrbs_repeats", 3);
pack_gui('Label', 'Runs');
nr('', 7);
nr();
pack_gui('Label', 'Exclude %GC content', '', -font=>$gui_font_bold);
nr();
pack_gui('Label', "Only consider primers with ", "prefs_gc_max");
pack_gui('Entry', \$min_gc, "prefs_gc_min", 3);
pack_gui('Label', '-');
pack_gui('Entry', \$max_gc, "prefs_gc_max", 3);
pack_gui('Label', '% GC content');
nr();
pack_gui('Label', '(Used when "Exclude %GC" is checked on a project page)');
nr('',2);
nr(\$prefs_page_blast_f, 2);
nr();
pack_gui('Label', "BLAST search parameters", '', -font=>$gui_font_bold);
nr();
pack_gui('Label', 'Expect value: ', "prefs_blast_expect");
pack_gui('Entry', \$blast_expect, "prefs_blast_expect", 4);
nr();
pack_gui('Label', 'Word size: ', "prefs_blast_wordsize");
pack_gui('Entry', \$blast_word_size, "prefs_blast_wordsize", 4);
nr();
pack_gui('Radiobutton', "Use remote BLAST server", 'remote_blast_r', -variable=>\$local_blast, -value=>0);
pack_gui('Radiobutton', "Use local BLAST server", 'remote_blast_r', -variable=>\$local_blast, -value=>1);
nr('', 7);
nr();
pack_gui('Label', "Remote BLAST (NCBI server)", '', -font=>$gui_font_bold);
nr();
pack_gui('Label', 'Database: ', 'prefs_blast_database');
pack_gui('BrowseEntry', \$blast_database, 'prefs_blast_database', \@blast_database_array, 10);
nr();
pack_gui('Label', 'Limit to organism (Entrez query): ', 'prefs_blast_entrez');
pack_gui('BrowseEntry', \$blast_entrez_query, 'prefs_blast_entrez', \@blast_entrez_array, 20);
nr('',7);
nr();
pack_gui('Label', "Local BLAST", '', -font=>$gui_font_bold);
nr();
pack_gui('Label', 'BLAST server location', "prefs_blast_expect");
pack_gui('Entry', \$local_blast_directory, "prefs_blast_expect", 30);
my $open_blast_srv = pack_button($row_counter[-1], $top->Pixmap(-data => $icon_open_small), [$browse_directory, (\$local_blast_directory, "BLAST directory")])->pack(-side=>'left');
nr('',0);
pack_gui('Label', 'Database: ', "prefs_blast_expect");
pack_gui('Entry', \$local_blast_database, "prefs_blast_expect", 30);
my $open_blast_database = pack_button($row_counter[-1], $top->Pixmap(-data => $icon_open_small), [$browse_file, (\$local_blast_database, "BLAST database")])->pack(-side=>'left');
nr('',0);
nr(\$prefs_page_orfcpg_f, 2);
nr();
pack_gui('Label', "CpG island prediction", '', -font=>$gui_font_bold);
nr();
pack_gui('Label', "Window size: ", "prefs_bioinf_window");
pack_gui('Entry', \$cpg_window, "prefs_bioinf_window", 5);
pack_gui('Label', 'bases');
nr();
pack_gui('Label', "Minimum island size: ", "prefs_bioinf_island");
pack_gui('Entry', \$min_cpg_island, "prefs_bioinf_island", 5);
pack_gui('Label', 'bases');
nr();
pack_gui('Label', "Minimum obs/exp: ", "prefs_bioinf_oe");
pack_gui('Entry', \$cpg_oe, "prefs_bioinf_oe", 5);
nr();
pack_gui('Label', "Minimum GC content: ", "prefs_bioinf_gc");
pack_gui('Entry', \$cpg_gc, "prefs_bioinf_gc", 5);
pack_gui('Label', '%');
nr('',0);
pack_gui('Checkbutton', 'Emulate cpgplot', "prefs_cpgplot_method", \$cpgplot_method);
nr('', 7);
nr(\$prefs_page_cloning_f, 2);
nr();
pack_gui('Label', "Restriction enzyme cloning sequences", '', -font=>$gui_font_bold);
nr('',0);
pack_gui('Checkbutton', 'Use 6-base cutting enzymes only', "prefs_simple_sites", \$simple_sites);
nr('',0);
pack_gui('Checkbutton', 'Only list enzymes that do not cut sequence', "prefs_exclude_found_sites", \$exclude_found_sites);
nr('',7);
nr(\$prefs_page_dimers_f, 2);
nr();
pack_gui('Label', "Primer-dimer parameters", '', -font=>$gui_font_bold);
nr();
pack_gui('Label', 'Calculate primer-dimer dG at ', 'prefs_dimer_temp');
pack_gui('Entry', \$pd_temperature, 'prefs_dimer_temp', 3);
pack_gui('Label', '°C');
nr(\$prefs_page_connection_f, 2);
nr();
pack_gui('Label', "Web browser", '', -font=>$gui_font_bold);
nr();
pack_gui('Label', 'Browser: ', 'prefs_connection_browser');
pack_gui('Entry', \$browser, 'prefs_connection_browser', 30);
my $open_browser = pack_button($row_counter[-1], $top->Pixmap(-data => $icon_open_small), [$browse_file, (\$browser, "Browser")])->pack(-side=>'left');
nr('', 7);
nr();
pack_gui('Label', "Proxy server", '', -font=>$gui_font_bold);
nr('',0);
pack_gui('Checkbutton', 'Use http proxy server', "prefs_connection_proxy", \$use_proxy);
nr();
pack_gui('Label', 'Address: ', 'prefs_connection_address');
pack_gui('Entry', \$http_proxy, 'prefs_connection_address', 30);
pack_gui('Label', 'Port', 'prefs_connection_port');
pack_gui('Entry', \$http_port, 'prefs_connection_port', 5);
nr('',7);
nr();
pack_gui('Label', "Interaction with external applications", '', -font=>$gui_font_bold);
nr();
pack_gui('Label', 'Listen to port ',"prefs_contigviewer_port");
pack_gui('Entry', \$tcp_port, "prefs_contigviewer_port", 6);
nr('',0);
pack_gui('Checkbutton', 'Automatically find primers upon receiving data', "prefs_contigviewer_autofind", \$ipc_autofind);
nr(\$prefs_page_gui_f, 3);
nr();
pack_gui('Label', "Fonts", '', -font=>$gui_font_bold);
nr();
my @font_families = sort $top->fontFamilies;
pack_gui('Label', 'Main font:', 'prefs_gui_family');
pack_gui('BrowseEntry', \$gui_font_face, 'prefs_gui_family', \@font_families);
pack_gui('Label', ' Size:', 'prefs_gui_size');
pack_gui('BrowseEntry', \$gui_font_size, 'prefs_gui_size', [(3 .. 32)], 3);
nr();
pack_gui('Label', 'List font:', 'prefs_gui_list_family');
pack_gui('BrowseEntry', \$list_font_face, 'prefs_gui_list_family', \@font_families);
pack_gui('Label', ' Size:', 'prefs_gui_list_size');
pack_gui('BrowseEntry', \$list_font_size, 'prefs_gui_list_size', [(3 .. 32)], 3);
nr();
pack_gui('Label', 'Fixed font:', 'prefs_gui_text_family');
pack_gui('BrowseEntry', \$text_font_face, 'prefs_gui_text_family', \@font_families);
pack_gui('Label', ' Size:', 'prefs_gui_text_size');
pack_gui('BrowseEntry', \$text_font_size, 'prefs_gui_text_size', [(3 .. 32)], 3);
nr();
pack_gui('Checkbutton', 'Use OS font defaults', 'prefs_gui_override', \$font_override);
nr('',7);
nr();
pack_gui('Label', "Previously opened files", '', -font=>$gui_font_bold);
nr();
pack_gui('Label', 'List the last ', "prefs_gui_mru_number");
pack_gui('Entry', \$mru_number, "prefs_gui_mru_number", 3);
pack_gui('Label', 'files', "prefs_gui_mru_number");
nr('',7);
nr();
pack_gui('Label', "Mouse Wheel", '', -font=>$gui_font_bold);
nr();
pack_gui('Label', 'Mouse wheel scrolls ', "prefs_gui_wheel");
pack_gui('Entry', \$scroll_factor, "prefs_gui_wheel", 3);
pack_gui('Label', 'lines');
nr('',2);
nr(\$prefs_fb);
pack_gui('Button', 'OK', 'prefs_ok', sub {
# check if [dNTPs] > [Mg++] ...
if ($dntp_conc > $mg_conc) {
my $answer = dialogue("Setting [dNTPs] > [Mg++] will have unexpected results - Tm calculations may be inaccurate", 'OK', 'Cancel');
return if $answer eq 'Cancel';
}
# if the salt concentration has been changed, we need to recalculate %oligo_dG
recalculate_dG();
# write the data to the pref_file ...
my $file_data = "";
foreach my $i (keys %pref_variables) {
my $pointer = $pref_variables{$i};
$file_data .= "$i = $$pointer\n";
}
foreach my $i (keys %pref_arrays) {
my $pointer = $pref_arrays{$i};
$file_data .= "$i = [".join(",",@$pointer)."]\n";
}
open (PREFS, ">$pref_file") || dialogue("Error: Could not open prefs file for writing: $!");
print PREFS $file_data;
close (PREFS);
# You really don't want to know why we have to read the prefs file
# just after writing it ...
# (hint: if we don't, and we open and OK the prefs window twice,
# perl starts saying that 1.5-0.2 = 1 ... I don't know why ... )
read_prefs();
$prefs->destroy;
}, 'active');
pack_gui('Button', 'Revert', 'prefs_cancel', sub {
# This is perhaps a bit inefficient, re-reading the pref_file each time
# the dialogue is cancelled. However, it does not seem to cause a
# noticable time-lag and it's certainly the simplest way to do things
# (otherwise we'd have to save each value to a temporary hash and update
# each variable on prefs_OK ... to make this extensible we'd have to make
# a hash with the same keys as %pref_variables ...
# it's definitely possible, but a bit of a fuss!!
read_prefs();
$prefs->destroy;
});
$prefs->Icon(-image => $pixmap);
}
sub read_prefs {
return unless -e $pref_file;
open (PREFS, "<$pref_file") || dialogue("Error: Could not open prefs file for reading: $!");
my $pointer;
while (<PREFS>) {
s/[\n\r]//g;
next if /^$/;
my ($key, $value) = split / = /;
if ($value =~ /\[(.+)\]/) {
# an array
$pointer = $pref_arrays{$key};
@$pointer = split(",",$1);
} else {
$pointer = $pref_variables{$key};
$$pointer = $value;
}
}
close (PREFS);
}
#------------------------#
# DNA graphical routines #
#------------------------#
sub find_gene {
# Find genes (or CpG islands, or whatever else you might fancy) based on
# case (upper-case marks genes) (can have more than one ORF in the same
# sequence, which the ORF-finding sub doesn't allow; also speeds things
# up a bit by not having to ORF/CpG-find each time)
$_ = shift;
return if length($_) == 0;
my ($subroutine) = get_variables(qw(find_sub));
# s/\>.*\n//g; #remove FASTA formatting if it exists
$_ = clean_seq($_);
my @array = ();
my $prev = 0;
my $nb_page = which_nb_page();
# if the user wishes to defer to capitalised regions, do so ...
# i.e. a sequence with lowercase and capitalised regions will be assumed to
# use caps to mark the gene/cpg island
# NB - this is no longer the default behaviour
if ($defer_to_caps) {
my $i;
while (/([a-z]*)([A-Z]*)(?=[a-z]*)/xg) {
$i++;
push @array, [$prev+length($1), $prev+length($1)+length($2)] if (length($2)>0 && length($1)>0);
$prev += length($1)+length($2);
}
return @array if @array;
}
# if we didn't find any marked regions, let's hand it over to our built in,
# trusty orf and cpg finding routines ...
return &$subroutine($_);
}
sub find_orf {
# no gene marked - try to find ORF since user has requested it
$_ = lc(shift);
$_ = clean_seq($_);
my ($seq_ref) = get_variables('seq');
my @orf=();
my $seq = $_;
for my $i (0 .. 2) {
$orf[$i][0] = 0;
my $init;
my $met_init;
my $orf_count = 0;
my $orf_start = -1;
my $j;
for ($j = $i; $j<(length($seq)-3); $j+=3) {
my $codon = uc(substr($seq, $j, 3));
my $aa = $genetic_code{$codon};
$aa ||= "X";
unless ($aa eq "*") {
# only take ORF from initiating Met codon or rare alternatives
unless ($init) {
if ($codon =~ m/[ATGC]TG/) {
$init=1;
$orf_start = $j;
} else {
next;
}
}
# prefer initiation from downstream ATG if it exists ...
if (!$met_init && ($aa eq 'M')) {
$met_init=1;
$orf_start = $j;
$orf_count = 0;
}
$orf_count++;
next;
}
# stop codon
if ($orf_count > $orf[$i][0]) {
$orf[$i][0]=$orf_count+1;
$orf[$i][1]=$orf_start;
# end orf
$orf[$i][2]=$j+3;
# frame
$orf[$i][3]=$i;
}
$orf_count=$met_init=$init=0;
$orf_start=-1;
}
if ($orf_count > $orf[$i][0]) {
$orf[$i][0]=$orf_count+1;
$orf[$i][1]=$orf_start;
# end orf
$orf[$i][2]=$j+3;
# frame
$orf[$i][3]=$i;
}
$orf_start=$orf_count=$met_init=0;
}
# sort by orf length:
@orf = sort {@$b[0] <=> @$a[0]} @orf;
return unless $orf[0][0] > 1;
# Recreate DNA sequence based on ORF
my $dna3 ="";
my $dna1 = substr($seq, 0, $orf[0][1]);
my $dna2 = uc(substr($seq, $orf[0][1], $orf[0][0]*3));
$dna3 = substr($seq, $orf[0][0]*3+$orf[0][1], ) unless $orf[0][0]*3+$orf[0][1]>=length($seq);
push my @orf_return, [$orf[0][1], $orf[0][2]];
# Re-enter DNA sequence using capitalised ORF, lowercase upstream and downstream regions
$$seq_ref->delete(0.1,"end");
$$seq_ref->insert(0.1,$dna1.$dna2.$dna3);
return @orf_return;
# return $orf[0][1], $orf[0][2];
}
sub find_cpg {
# no CpG marked - try to find CpG islands from sequence
# two methods: correct and cpgplot emulation
$_ = lc(shift);
$_ = clean_seq($_);
my $seq = $_;
my $seq_len = length($seq);
my @cpg_island =();
my $cpg_flag = 0;
my $cpg_start = 0;
my $cpg_count = 0;
my $island_max = 0;
my $last_cpg_pos = 0;
my $win_count =0;
# when cpgplot method is 1, we're emulating cpgplot behaviour (see comment
# below)
my $cpg_av = ($cpgplot_method ? 10 : 9);
# CpG finding routine
#
# This is based on the method first described in Gardiner-Garden and Frommer
# (1987) and used in many other programs since. The most common utility is
# cpgplot, but cpgplot does not give the same results as this routine!
# Analysing the source, it's apparent that cpgplot is buggy and in fact does
# not use the parameters it claims to, but slightly an underestimate.
#
# The worst bug of all in cpgplot is that the avg readings for each window are
# inflated: they are not an average at all; rather, 11 frames are read and the
# totals divided by 10!! The second bug comes in calculating the number of CpG
# residues in a window - cpgplot actually adds in an extra base when
# performing this calculation, but does not add in an extra base when counting
# the c's and g's in a sequence, or the %GC content!!
#
# PerlPrimer has the option to deliberately allow for this and return the
# same results as cpgplot, simply because cpgplot has been around for so long
# seems to be the de facto standard for CpG island prediction. However, by
# default PerlPrimer uses my algorithmically correct approach.
my (@cpg_oe, @cpg_pgc)=();
# We use an average of 10 (or 11 in cpgplot's case) window values at each
# point, so to save recalculating the same value 10 times we save it in an
# array ...
for my $i (0 .. $seq_len-$cpg_window) {
$_ = substr($seq, $i, $cpg_window);
# calculate O/E
my $g = tr/Gg/Gg/;
my $c = tr/Cc/Cc/;
my $exp_gc = ($c*$g)/(length($_)-1);
if ($cpgplot_method) {
$_ = substr($seq, $i, $cpg_window+1);
}
my $cg = s/cg/cg/ig;
# save data
$cpg_pgc[$i] = gc($_);
if ($exp_gc == 0) {
$cpg_oe[$i] = 0;
} else {
$cpg_oe[$i] = $cg/$exp_gc;
}
}
# Calculate the averages and find the islands
for my $i (0 .. $seq_len-$cpg_window-10) {
# the real position is in the middle of the window...
my $cpg_real_pos = int($i+($cpg_window/2));
# of course, this is (10 or 11)/2 bases upstream from the real mid-point,
# since we're averaging 10 frames from here (another bug in cpgplot!)
$cpg_real_pos += int($cpg_av/2) unless $cpgplot_method;
my $sum_cg = 0;
my $sum_obs_exp = 0;
# Cpgplot uses an 11 window "average" (it thinks it's only using 10 ...)
for my $j ($i .. $i+$cpg_av) {
$sum_cg += $cpg_pgc[$j];
$sum_obs_exp += $cpg_oe[$j];
}
my $av_obs_exp = $sum_obs_exp/10;
my $av_cg = $sum_cg/10;
if (($av_cg > $cpg_gc) && ($av_obs_exp>$cpg_oe)) {
# A possible island: set the start point if it's the first
$cpg_start=$cpg_real_pos if $cpg_flag==0;
$cpg_flag=1;
next;
}
unless ($cpg_flag==0) {
if ($cpg_real_pos-$cpg_start < $min_cpg_island) {
# don't save the island if it's less than the minimum size
$cpg_flag=0;
$cpg_count=0;
$cpg_start=0;
next;
}
# Save the island
# This should have an end point of $cpg_real_pos-1, as we're
# now a base ahead of the last positive, but cpgplot has it
# as $cpg_real_pos+1 (?!?)
my $cpg_island_end = ($cpgplot_method ? $cpg_real_pos-1 : $cpg_real_pos+1);
push @cpg_island, [$cpg_start, $cpg_island_end];
# reset flags
$cpg_flag=0;
$cpg_count=0;
$cpg_start=0;
}
}
$packed_widgets{"bisul_seq"}->delete(0.1,"end");
my $cpg_pos = 0;
for my $i (0 .. $#cpg_island) {
print "Island No. $i: start $cpg_island[$i][0], end $cpg_island[$i][1], length ",$cpg_island[$i][1]-$cpg_island[$i][0],"\n";
# Recreate DNA sequence based on ORF
my $dna1 = substr($seq, $cpg_pos, $cpg_island[$i][0]-$cpg_pos);
# print "pos, len = $cpg_pos, $cpg_island[$i][0]\n";
my $dna2 = uc(substr($seq, $cpg_island[$i][0], $cpg_island[$i][1]-$cpg_island[$i][0]));
# print "dna2 pos, len = $cpg_island[$i][0], $cpg_island[$i][1]\n";
$cpg_pos = $cpg_island[$i][1];
# print "pos = $cpg_pos\n";
# Re-enter DNA sequence using capitalised ORF, lowercase 5' and 3' regions
$packed_widgets{"bisul_seq"}->insert("1.end",$dna1.$dna2);
}
# Last part of the reconstructed sequence:
my $dna3 = substr($seq, $cpg_pos);
$packed_widgets{"bisul_seq"}->insert("1.end",$dna3);
return (-1) unless @cpg_island;
return @cpg_island;
# return the start of the first island and the end of the last island
return $cpg_island[0][0], $cpg_island[$#cpg_island][0]+$cpg_island[$#cpg_island][1];
}
sub draw_dna {
my $old_defer = $defer_to_caps; # save state
$defer_to_caps = 1 if @_ && $_[0] == 1;
my ($min_ampsize, $max_ampsize, $max_range_5p, $min_range, $max_range, $max_range_3p, $hlist, $slist, $canvas)
= get_variables(qw(min_ampsize max_ampsize max_range_5p min_range max_range max_range_3p hlist primers canvas));
my $seq = get_seq();
return unless $seq =~ /[a|t|c|g]/i;
# delete old canvas elements
$$canvas->delete('dna', 'amp_range', 'gene_range', 'dna_range','primerf','primerr', 'direction', 'ie_boundary');
# get dimensions of canvas
my $width = $$canvas->width;
my $height= $$canvas->height;
my $dna_canvas_size=($width-($dna_canvas_offset*2))/length($seq);
my $canv = which_nb_page();
# Amplicon size
if (($$max_ampsize)&&($$min_ampsize)&&($$max_range)) {
$min_amp_canvas{$canv} = $$max_range_5p * $dna_canvas_size + $dna_canvas_offset if defined($$max_range_5p);
$max_amp_canvas{$canv} = $$max_range_3p * $dna_canvas_size + $dna_canvas_offset if defined($$max_range_3p);
$$canvas->createRectangle($min_amp_canvas{$canv},$dc_sel_y1-$dc_sel_offset2,$max_amp_canvas{$canv},$dc_sel_y2+$dc_sel_offset2, -fill=>'orange', -outline=>'orange4', -width=>1, -tag=>'amp_range');
}
# range
if (defined($$max_range)&&defined($$min_range)) {
$min_range_canvas{$canv} = $$min_range * $dna_canvas_size + $dna_canvas_offset;
$max_range_canvas{$canv} = $$max_range * $dna_canvas_size + $dna_canvas_offset;
$$canvas->createRectangle($min_range_canvas{$canv},$dc_sel_y1,$max_range_canvas{$canv},$dc_sel_y2, -fill=>'dodgerblue', -outline=>'dodgerblue4', -tag=>'dna_range');
}
# max_range_5p and 3p variables set
check_range();
# draw DNA
$$canvas->createRectangle($dna_canvas_offset,$dc_dna_y1,$width-($dna_canvas_offset+1),$dc_dna_y2, -fill=>'grey50', -tag=>'dna');
$$canvas->createText(5,$dna_canvas_middle, -text=>"5'", -justify=>'right', -tag=>'direction');
$$canvas->createText($width-6,$dna_canvas_middle, -text=>"3'", -justify=>'right', -tag=>'direction');
# gene (from capitals, if present)
my @gene_array = find_gene($seq);
for my $i (0 ... $#gene_array) {
my($gene_5p,$gene_3p)=($gene_array[$i][0], $gene_array[$i][1]);
if (defined($gene_5p)&&defined($gene_3p)) {
$min_range_canvas{$canv} = $gene_5p * $dna_canvas_size + $dna_canvas_offset;
$max_range_canvas{$canv} = $gene_3p * $dna_canvas_size + $dna_canvas_offset;
$$canvas->createRectangle($min_range_canvas{$canv},$dc_dna_y1,$max_range_canvas{$canv},$dc_dna_y2, -fill=>'midnightblue', -tag=>'gene_range');
}
}
# QPCR specific:
if ($canv eq 'qpcr') {
foreach my $i (@intron_exon_bounds) {
my $iex = $i * $dna_canvas_size + $dna_canvas_offset;
$$canvas->createLine($iex, $dc_dna_y1, $iex, $dc_dna_y2, -fill=>'white', -tag=>'ie_boundary');
}
}
my @sel = $$hlist->selectionGet;
my $hlist_sel = shift @sel;
if (defined($hlist_sel)) {
# my $width = $$canv->width;
# my $height= $$canv->height;
# my $dna_canvas_size=($width-($dna_canvas_offset*2))/length($seq);
$$canvas->delete('primerf','primerr');
my $fprimerpos = $$slist[$hlist_sel][1];
my $rprimerpos = $$slist[$hlist_sel][8];
my $fprimerposl = $$slist[$hlist_sel][2];
my $rprimerposl = $$slist[$hlist_sel][6];
my ($fprimer_x1,$fprimer_x2,$rprimer_x1,$rprimer_x2);
if (defined($fprimerpos)) {
$fprimer_x1 = $fprimerpos*$dna_canvas_size + $dna_canvas_offset;
$fprimer_x2 = ($fprimerpos+$fprimerposl)*$dna_canvas_size + $dna_canvas_offset;
}
if (defined($rprimerpos)) {
$rprimer_x1 = $rprimerpos*$dna_canvas_size + $dna_canvas_offset;
$rprimer_x2 = ($rprimerpos-$rprimerposl)*$dna_canvas_size + $dna_canvas_offset;
}
my $line_arrow_h = 4;
my $line_arrow_w = 4;
$$canvas->createLine($fprimer_x1,$dc_sel_y1,$fprimer_x2,$dc_sel_y1,$fprimer_x2-$line_arrow_w,$dc_sel_y1-$line_arrow_h, -fill=>'red', -width=>2, -tag=>'primerf') if $fprimerpos;
$$canvas->createLine($rprimer_x1,$dc_sel_y2,$rprimer_x2,$dc_sel_y2,$rprimer_x2+$line_arrow_w,$dc_sel_y2+$line_arrow_h, -fill=>'red', -width=>2, -tag=>'primerr') if $rprimerpos;
}
$defer_to_caps = $old_defer; # restore state
}
sub view_intron_exon_structure {
# Draws a typical genomic DNA diagram showing exons and introns
if (Exists($view_ie)) {
$view_ie->destroy;
}
$cancel=0;
# Create dialogue
$view_ie = $top->Toplevel(-title=>'Intron/Exon Genomic Structure');
my $view_ie_f = $view_ie->Frame()->pack(-expand=>1, -fill=>'both');
my $view_ie_fb = $view_ie->Frame()->pack(-side=>'bottom', -fill=>'none');
nr(\$view_ie_f);
pack_gui('Canvas', '', 'view_ie_canvas', 0, 0, -width=>600, -height=>$dna_canvas_height+35);
nr(\$view_ie_fb);
pack_gui('Button', 'OK', 'view_ie_ok', sub {$view_ie->destroy}, 'active');
$view_ie->Icon(-image => $pixmap);
my $canvas = \$packed_widgets{view_ie_canvas};
# get spidey output
($_) = run_spidey(1);
if ($cancel==1) {
# cannot find spidey
$cancel=0;
$view_ie->destroy;
return;
}
# isolate genomic structure
my @exon_structure;
while (m/Exon \d+[\(\-\)]*: (\d+)-(\d+) \(gen\)/g) {
push @exon_structure, [$1, $2];
}
# Get strand orientation - will need to reverse array if minus strand
my ($strand) = m/Strand: (\w+)/;
@exon_structure = reverse(@exon_structure) if $strand eq "minus";
# length of genomic sequence
my $gen_length = $exon_structure[-1][1];
# get dimensions of canvas
my $width = $$canvas->width;
my $height= $$canvas->height;
my $dna_canvas_size=($width-($dna_canvas_offset*2))/$gen_length;
my $intron_y1 = $dc_dna_y1+2;
my $intron_y2 = $dc_dna_y2-2;
my $text_y = $dna_canvas_height+5;
my $previous_canvas_j;
my $count;
foreach my $a (@exon_structure) {
$count++;
my ($i, $j) = @$a;
my ($canvas_i, $canvas_j) = ($i * $dna_canvas_size + $dna_canvas_offset, $j * $dna_canvas_size + $dna_canvas_offset);
if ($previous_canvas_j) {
# draw intron
$$canvas->createRectangle($previous_canvas_j, $intron_y1, $canvas_i, $intron_y2, -fill=>'grey');
}
# draw exon
$$canvas->createRectangle($canvas_i, $dc_dna_y1, $canvas_j, $dc_dna_y2, -fill=>'midnightblue');
my $canvas_text = ($canvas_i + $canvas_j)/2;
# label exon
$$canvas->createText($canvas_text, $text_y, -fill=>'midnightblue', -text=>$count);
$previous_canvas_j = $canvas_j;
}
# draw sequence length info
for my $i (0 .. 5) {
my $base_real = $i * $gen_length / 5;
my $base = int($base_real/1000) * 1000;
my $canvas_text = $base * $dna_canvas_size + $dna_canvas_offset;
$$canvas->createText($canvas_text, $text_y+20, -justify=>'left', -fill=>'grey30', -text=>int($base/1000) . "kb");
}
}
sub items_drag {
my ($min_ampsize, $max_range_5p, $min_range, $max_range, $max_range_3p)
= get_variables(qw(min_ampsize max_range_5p min_range max_range max_range_3p));
my $canv = which_nb_page();
my ($x,$ref) = @_;
my $width = $$ref->width;
my $dna_max = $width-$dna_canvas_offset;
my $dna_min = $dna_canvas_offset;
my $seq = get_seq();
return unless $seq =~ /[a|t|c|g]/i;
my $dna_canvas_size=($width-($dna_canvas_offset*2))/length($seq);
$x = sprintf("%.0f", $$ref->canvasx($x));
$x = $dna_min if $x < $dna_min;
$x = $dna_max if $x > $dna_max;
if ($canv eq 'qpcr') {
# get DNA base
$x = ($x-$dna_canvas_offset) / $dna_canvas_size;
# exon selection
my $last_ie = 0;
my $exon_count;
foreach (@intron_exon_bounds) {
$exon_count++;
if ($x>$last_ie && $x<$_) {
select_exon($exon_count, 5);
return;
}
}
$exon_count++;
select_exon($exon_count, 5);
return;
}
if (($$max_range)&&($$min_range)) {
$min_range_canvas{$canv} = $$min_range * $dna_canvas_size + $dna_canvas_offset;
$max_range_canvas{$canv} = $$max_range * $dna_canvas_size + $dna_canvas_offset;
}
if (($min_amp_canvas{$canv}) && ($max_amp_canvas{$canv})) {
$x = $min_amp_canvas{$canv} if $x < $min_amp_canvas{$canv};
$x = $max_amp_canvas{$canv} if $x > $max_amp_canvas{$canv};
}
if ($x-$min_range_canvas{$canv}<$max_range_canvas{$canv}-$x) {
$$ref->coords('dna_range', $x, $dc_sel_y1, $max_range_canvas{$canv},$dc_sel_y2);
$$min_range = sprintf("%.0f", ($x-$dna_canvas_offset) / $dna_canvas_size);
$$min_range = $$max_range_5p if $$max_range_5p && $min_range<$$max_range_5p;
} else {
$$ref->coords('dna_range', $min_range_canvas{$canv}, $dc_sel_y1, $x, $dc_sel_y2);
$$max_range = sprintf("%.0f", ($x-$dna_canvas_offset) / $dna_canvas_size);
$$max_range = $$max_range_3p if $$max_range_3p && $$max_range>$$max_range_3p;
}
$$min_ampsize = $$max_range - $$min_range;
}
sub select_exon {
my ($exon, $end) = @_;
$ie_limit ||= 1;
$ie_limit_5p = $exon if $end == 5;
$ie_limit_3p = $exon if $end == 3;
}
sub amplicon_drag {
my ($x,$widget_ref) = @_;
my ($min_ampsize, $max_ampsize, $max_range_5p, $min_range, $max_range, $max_range_3p)
= get_variables(qw(min_ampsize max_ampsize max_range_5p min_range max_range max_range_3p));
my $canv = which_nb_page();
my $width = $$widget_ref->width;
my $dna_max = $width-$dna_canvas_offset;
my $dna_min = $dna_canvas_offset;
my $seq = get_seq();
return unless $seq =~ /[a|t|c|g]/i;
my $dna_canvas_size=($width-($dna_canvas_offset*2))/length($seq);
$x = sprintf("%.0f", $$widget_ref->canvasx($x));
$x = $dna_min if $x < $dna_min;
$x = $dna_max if $x > $dna_max;
if ($canv eq 'qpcr') {
# get DNA base
$x = ($x-$dna_canvas_offset) / $dna_canvas_size;
# exon selection
my $last_ie = 0;
my $exon_count;
foreach (@intron_exon_bounds) {
$exon_count++;
if ($x>$last_ie && $x<$_) {
select_exon($exon_count, 3);
return;
}
}
$exon_count++;
select_exon($exon_count, 3);
return;
}
$seq = clean_seq($seq);
my $seq_len = length($seq)-1;
my $dna_max2 = $$max_range*$dna_canvas_size + $dna_canvas_offset;
my $dna_min2 = $$min_range*$dna_canvas_size + $dna_canvas_offset;
# grab default values if not assigned
if (($min_ampsize)&&($max_ampsize)) {
$min_amp_canvas{$canv} = $$min_range * $dna_canvas_size + $dna_canvas_offset unless $min_amp_canvas{$canv};
$max_amp_canvas{$canv} = ($$max_ampsize+$$min_range) * $dna_canvas_size + $dna_canvas_offset unless $max_amp_canvas{$canv} ;
}
if ($x-$min_amp_canvas{$canv}<$max_amp_canvas{$canv}-$x) {
# Changing amp_size at 5' end
$x = $dna_min2 if $x > $dna_min2;
$$widget_ref->coords('amp_range', $x, $dc_sel_y1-$dc_sel_offset2, $max_amp_canvas{$canv},$dc_sel_y2+$dc_sel_offset2);
$min_amp_canvas{$canv}=$x;
$$max_range_5p = sprintf("%.0f", ($x-$dna_canvas_offset) / $dna_canvas_size);
} else {
# Changing amp_size at 3' end
$x = $dna_max2 if $x < $dna_max2;
$$widget_ref->coords('amp_range', $min_amp_canvas{$canv}, $dc_sel_y1-$dc_sel_offset2, $x, $dc_sel_y2+$dc_sel_offset2);
$max_amp_canvas{$canv}=$x;
$$max_range_3p = sprintf("%.0f", ($x-$dna_canvas_offset) / $dna_canvas_size);
$$max_range_3p = $seq_len if $$max_range_3p>$seq_len;
}
$$max_ampsize = sprintf("%.0f", ($max_amp_canvas{$canv}-$min_amp_canvas{$canv}) / $dna_canvas_size);
}
sub get_gene {
my ($min_ampsize, $max_ampsize, $max_range_5p, $min_range, $max_range, $max_range_3p)
= get_variables(qw(min_ampsize max_ampsize max_range_5p min_range max_range max_range_3p));
my $seq = get_seq();
my @gene_array = find_gene($seq);
return unless @gene_array;
($$min_range, $$max_range)=($gene_array[0][0], $gene_array[$#gene_array][1]-1);
$$max_range_5p ||= $$min_range;
$$max_range_3p ||= $$max_range;
$$max_range_5p = $$min_range if $$min_range < $$max_range_5p;
$$max_range_3p = $$max_range if $$max_range > $$max_range_3p;
$$min_ampsize=$$max_range - $$min_range;
$$max_ampsize=$$max_range - $$min_range; # if ($max_range - $min_range)>$max_ampsize;
draw_dna(1);
}
sub get_cpg {
my ($min_ampsize, $max_ampsize, $max_range_5p, $min_range, $max_range, $max_range_3p)
= get_variables(qw(min_ampsize max_ampsize max_range_5p min_range max_range max_range_3p));
my $seq = get_seq();
my @gene_array = find_gene($seq);
if ($gene_array[0] == -1) {
sbarprint("\nNo CpG Island found!");
return;
}
($$min_range, $$max_range)=($gene_array[0][0], $gene_array[$#gene_array][1]-1);
$$max_range_5p ||= $$min_range;
$$max_range_3p ||= $$max_range;
$$max_range_5p = $$min_range if $$min_range < $$max_range_5p;
$$max_range_3p = $$max_range if $$max_range > $$max_range_3p;
$$min_ampsize=$$max_range - $$min_range;
$$max_ampsize=$$max_range - $$min_range; # if ($max_range - $min_range)>$max_ampsize;
draw_dna(1);
}
sub reset_bounds {
my $page = which_nb_page();
return if $page eq "qpcr";
my ($min_ampsize, $max_ampsize, $max_range_5p, $min_range, $max_range, $max_range_3p, $sub_ref)
= get_variables(qw(min_ampsize max_ampsize max_range_5p min_range max_range max_range_3p subroutine));
$$max_range_5p = $$max_range_3p = $$min_range = $$max_range = $$min_ampsize = $$max_ampsize = undef;
&$sub_ref();
}
sub step_in {
my ($min_ampsize, $max_ampsize, $max_range_5p, $min_range, $max_range, $max_range_3p, $sub_ref, $canv_ref, $seq_ref)
= get_variables(qw(min_ampsize max_ampsize max_range_5p min_range max_range max_range_3p subroutine canvas seq));
&$sub_ref() unless defined($$max_range_5p) && defined($$max_range_3p);
$$min_range += 10;
$$max_range -= 10;
if ($$min_range >= $$max_range) {
sbarprint("\nNo primers found");
$cancel=1;
return;
}
$$min_ampsize=$$max_range - $$min_range;
$$max_ampsize=$$max_range_3p - $$max_range_5p;
draw_dna(1);
}
sub step_out {
my ($min_ampsize, $max_ampsize, $max_range_5p, $min_range, $max_range, $max_range_3p, $sub_ref, $canv_ref, $seq_ref)
= get_variables(qw(min_ampsize max_ampsize max_range_5p min_range max_range max_range_3p subroutine canvas seq));
my $seq_len = length(get_seq());
&$sub_ref() unless defined($$max_range_5p) && defined($$max_range_3p);
$cancel=1 if ($$max_range_5p==0) && ($$max_range_3p==$seq_len);
$$max_range_5p -= 10;
$$max_range_3p += 10;
$$max_range_5p = 0 if $$max_range_5p < 0;
$$max_range_3p = $seq_len if $$max_range_3p>$seq_len;
$$min_ampsize=$$max_range - $$min_range;
$$max_ampsize=$$max_range_3p - $$max_range_5p;
draw_dna(1);
}
sub step_cloning {
my ($min_ampsize, $max_ampsize, $max_range_5p, $min_range, $max_range, $max_range_3p, $sub_ref, $canv_ref, $seq_ref)
= get_variables(qw(min_ampsize max_ampsize max_range_5p min_range max_range max_range_3p subroutine canvas seq));
my $seq_len = length(get_seq());
&$sub_ref() unless defined($$max_range_5p) && defined($$max_range_3p);
$cancel=1 if ($$max_range_5p==0) && ($$max_range_3p==$seq_len);
$$max_range_5p -= 10;
$$max_range -= 10;
$$max_range_5p = 0 if $$max_range_5p < 0;
$$max_range = $$min_range if $$max_range < $$min_range;
return if $$max_range_5p == 0 && $$max_range == $$min_range;
$$min_ampsize=$$max_range - $$min_range;
$$max_ampsize=$$max_range_3p - $$max_range_5p;
draw_dna(1);
}
sub add_cloning {
my ($seq, $fprimer, $fprimerpos, $fprimerposl, $rprimer, $rprimerpos, $rprimerposl) = @_;
# Adding an extra sequence is all very well.
# But we want to automagically keep it in frame when creating
# fusion constructs ...
# Warning!! This is clumsy!
my @gene_array=find_gene($seq);
my $gene_frame=$gene_array[0][0]%3;
my $insert_f = "";
my $insert_r = "";
my ($primer_seq_5f_real, $rprimer_seq_5r_real, $primer_seq_5r_real);
if ($primer_seq_5f && $fprimer) {
# calculate frame position for forward primer + insert
$_ = $primer_seq_5f;
my ($fspl1, $fspl2)=split('_');
my $renz_offset_f = 3-length($fspl2);
s/[\|_]//g;
$primer_seq_5f_real = $_;
if (defined($primer_seq_5f_frame) && ($primer_seq_5f_frame ne "")) {
my $fjoinframe = 3-$primer_seq_5f_frame;
my $primer_frame_f= (($fprimerpos - $gene_frame)%3 + $fjoinframe + $renz_offset_f)%3;
# Add spacers if needed between primer sequences and the inserts,
# and adjust the spacing of the primerpos and primerposl variables
# so that the primers are still displayed in the correct positions
$insert_f = "A" x $primer_frame_f;
}
$fprimer = "$primer_seq_5f_real$insert_f$fprimer";
$fprimerpos -= length($insert_f)+length($primer_seq_5f_real);
$fprimerposl += length($insert_f)+length($primer_seq_5f);
}
if ($primer_seq_5r && $rprimer) {
# calculate frame position for reverse primer + insert
$_ = $primer_seq_5r;
my ($rspl1, $rspl2)=split('_');
# my $renz_offset_r = 3-length($rspl2);
s/[\|_]//g;
$primer_seq_5r_real = $_;
$rprimer_seq_5r_real = reverse($primer_seq_5r_real);
if (defined($primer_seq_5r_frame) && ($primer_seq_5r_frame ne "")) {
my $rjoinframe = $primer_seq_5r_frame;
my $primer_frame_r= (2-($rprimerpos - $gene_frame)%3 + $rjoinframe)%3;
$insert_r = "A" x $primer_frame_r;
}
$rprimer = "$rprimer$insert_r$rprimer_seq_5r_real";
$rprimerpos += length($insert_r)+length($primer_seq_5r_real);
$rprimerposl += length($insert_r)+length($primer_seq_5r_real);
}
return ($primer_seq_5f_real, $insert_f, $fprimer, $fprimerpos, $fprimerposl, $primer_seq_5r_real, $insert_r, $rprimer, $rprimerpos, $rprimerposl);
}
sub dna_magnify {
# This is one long, convoluted subroutine that attempts
# to please all of the people all of the time :)
# A bit ungainly, but it just kept on growing ...
# Design could still do with a bit of tweaking ...
my ($x, $report) = @_;
my $seq = get_seq();
return unless $seq =~ /[a|t|c|g]/i;
my $page = which_nb_page();
my ($max_range_5p, $min_range, $max_range, $max_range_3p, $primer_array, $list_ref, $ref)
= get_variables(qw(max_range_5p min_range max_range max_range_3p primers hlist canvas));
my ($fprimer, $rprimer, $fprimerpos, $rprimerpos, $fprimerposl, $rprimerposl, $primer_seq_5f_real, $insert_f, $primer_seq_5r_real, $insert_r);
# get dimensions of canvas
my $width = $$ref->width;
my $dna_canvas_size=($width-($dna_canvas_offset*2))/length($seq);
# This sub used to jump to the exact position right clicked; however, all I ever
# want to do is look at the primers, so I feel the routine would be better jumping
# straight to the forward primer ...
# my $base_pos = sprintf("%.0f",($x-$dna_canvas_offset)/$dna_canvas_size);
my $text_ref = \$packed_widgets{view_base_text};
# Local subroutines:
my $copy_report = sub {
# Copies the content into 80-column wrapped text
my ($clip, $last_i);
my $length = 80;
for (my $i=$length; $i<=length($seq)+$length; $i+=$length) {
$last_i ||= 0;
for my $j (0 .. 4) {
$clip .= $$text_ref->get("$j.$last_i","$j.$i");
$clip .= "\n";
}
$clip .= "\n\n";
$last_i=$i;
}
return $clip;
};
my $copy_printable = sub {
# copy report for the clipboard ...
$top->clipboardClear;
my $clip = &$copy_report();
$top->clipboardAppend($clip);
};
my $view_fprimer = sub {
$$text_ref->see("1.".($fprimerpos+10));
};
my $view_rprimer = sub {
$$text_ref->see("1.".($rprimerpos-10));
};
### In progress!!
# my $multiline_pos = sub {
# my ($x,$y) = @_;
# # if ($multiline) {
# # # single lines to multiple lines
# #
# # }
# };
# if previous window exists we destroy it first, to avoid confusion
# (trying to simply erase the contents in the text box and
# re-configuring the buttons has about the same effect with Perl/Tk,
# so there's not much point in doing so ...)
if (Exists($view_base)) {
$view_base->destroy;
}
$view_base = $top->Toplevel(-title=>'Details ...');
my $view_basef = $view_base->Frame()->pack(-expand=>1, -fill=>'both');
my $view_basefb = $view_base->Frame()->pack(-side=>'left');
my $view_basefbr = $view_base->Frame()->pack(-side=>'right');
$view_base->withdraw if $report;
nr(\$view_basef);
pack_gui('ROText', '', 'view_base_text', 80, 4, -scrollbars=>'os', -wrap=>'none');
nr(\$view_basefb);
pack_gui('Button', 'OK', 'view_base_ok', sub {$view_base->destroy}, 'active');
pack_gui('Button', 'Copy printable', 'view_base_copy', \&$copy_printable);
nr(\$view_basefbr);
pack_gui('Button', 'Forward', 'view_base_pf', \&$view_fprimer, 'disabled' );
pack_gui('Button', 'Reverse', 'view_base_pr', \&$view_rprimer, 'disabled' );
$$text_ref->tagConfigure('red',
-foreground => 'red');
$$text_ref->tagConfigure('blue',
-foreground => 'midnightblue',
-background => '#cee3ee');
$$text_ref->tagConfigure('blue_utr',
-foreground => '#459ecc',
-background => '#dde8ee');
$$text_ref->tagConfigure('blue_cpg',
-foreground => 'royalblue',
-background => 'royalblue');
$$text_ref->tagConfigure('numbers',
-foreground => 'grey75',
-background => 'grey35');
$$text_ref->tagConfigure('grey60',
-foreground => 'grey50');
$$text_ref->tagConfigure('grey40',
-foreground => 'grey40');
$$text_ref->tagConfigure('black',
-foreground => 'black',
-background => 'grey89');
$$text_ref->tagConfigure('codon',
-foreground => 'black',
-background => 'grey81');
$$text_ref->tagConfigure('codon_utr',
-foreground => 'black',
-background => 'grey84');
$$text_ref->tagConfigure('codonbg',
-foreground => 'black',
-background => 'grey93');
$$text_ref->tagConfigure('orange',
-foreground => 'orange');
$$text_ref->tagConfigure('dodgerblue',
-foreground => 'dodgerblue');
$$text_ref->tagConfigure('ie',
-foreground => 'white',
-background => 'red');
for my $i (1 .. 3) {
$$text_ref->insert("$i.0","\n")
}
# my $list_ref = which_hlist();
my @sel= $$list_ref->selectionGet;
my $sel=shift(@sel);
# Selected primers, if any ...
if (defined($sel)) {
$fprimer = $$primer_array[$sel][0];
$rprimer = reverse($$primer_array[$sel][4]) if $$primer_array[$sel][5];
$fprimerpos = $$primer_array[$sel][1];
$rprimerpos = $$primer_array[$sel][8];
$fprimerposl = $$primer_array[$sel][2];
$rprimerposl = $$primer_array[$sel][6];
# need to do this before adding sequences ...
my $spacerrp = " "x($rprimerpos-$rprimerposl-$fprimerpos-$fprimerposl-5) if $rprimer;
# Added sequences?
if ($page eq 'pd' && (($primer_seq_5f) || ($primer_seq_5r))) {
($primer_seq_5f_real, $insert_f, $fprimer, $fprimerpos, $fprimerposl, $primer_seq_5r_real, $insert_r, $rprimer, $rprimerpos, $rprimerposl)
= add_cloning($seq, $fprimer, $fprimerpos, $fprimerposl, $rprimer, $rprimerpos, $rprimerposl);
}
my $spacerfp = " "x($fprimerpos-3);
# print "($rprimerpos-$rprimerposl-$fprimerpos-$fprimerposl-5) = ".($rprimerpos-$rprimerposl-$fprimerpos-$fprimerposl-5);
$$text_ref->insert('2.0',$spacerfp."5' ", 'grey60');
$$text_ref->insert('2.end',$fprimer, 'red');
if ($rprimer) {
$$text_ref->insert('2.end'," 3'".$spacerrp."3' ", 'grey60');
$$text_ref->insert('2.end',$rprimer, 'red');
$$text_ref->insert('2.end'," 5'", 'grey60');
} else {
$$text_ref->insert('2.end'," 3'", 'grey60');
}
# Make buttons active or inactive:
$packed_widgets{view_base_pf}->configure(-state=>($fprimer ? 'active' : 'disabled'));
$packed_widgets{view_base_pr}->configure(-state=>($rprimer ? 'active' : 'disabled'));
}
# Numbering along the top (starts at 0)
my $numbers="0.........";
for my $i(1 .. length($seq)/10) {
$numbers.=($i*10)."."x(9-length($i));
}
# insert the numbers and the sequence
$$text_ref->insert('1.0',$numbers,'numbers');
$$text_ref->insert('3.0',$seq, 'grey40');
# translation of ORFs
# (or if Bisulphite sequencing highlights CpG island)
my @gene_array=find_gene($seq);
my $prev_end = 0;
for my $i (0 .. $#gene_array) {
my $peptide="";
my ($start, $end)=($gene_array[$i][0],$gene_array[$i][1]);
# if f_primer starts before ORF, translate from there up
my ($new_start, $new_peptide);
if ($fprimerpos && $fprimerpos < $start) {
my $start_mod = $start%3;
my $fprimer_mod = $fprimerpos%3;
$new_start = $fprimerpos + ($start_mod-$fprimer_mod);
# $start = $new_start;
}
$$text_ref->tagAdd('black', "3.$start", "3.$end");
$$text_ref->tagAdd('black', "3.$new_start", "3.$end") if $new_start;
if ($page eq 'bis') {
$peptide = "-"x($end-$start);
} else {
my ($j,$k)=(0,0);
if ($new_start) {
for ($j=$new_start; $j<$start; $j+=3) {
my $codon = uc(substr($seq, $j, 3));
my $aa = $genetic_code{$codon};
$aa ||= "X";
$new_peptide .= $aa." ";
if ($k == 1) {
my $tend = $j+3;
$$text_ref->tagAdd('codon_utr', "3.$j", "3.$tend");
}
$k = 1 - $k;
}
}
for ($j=$start; $j<$end; $j+=3) {
my $codon = uc(substr($seq, $j, 3));
my $aa = $genetic_code{$codon};
$aa ||= "X";
$peptide .= $aa." ";
if ($k == 1) {
my $tend = $j+3;
$$text_ref->tagAdd('codon', "3.$j", "3.$tend");
}
$k = 1 - $k;
}
}
$start = $new_start if $new_start;
my $spacer=" "x($start-$prev_end);
$prev_end=$end;
$$text_ref->insert("4.0",$spacer);
unless ($page eq 'bis') {
$$text_ref->insert("4.end",$new_peptide,'blue_utr') if $new_peptide;
$$text_ref->insert("4.end",$peptide,'blue');
} else {
$$text_ref->insert("4.end",$peptide,'blue_cpg');
}
}
# highlight intron-exon boundaries for QPCR
# or ranges otherwise
if ($page eq 'qpcr') {
foreach my $i (@intron_exon_bounds) {
my $tag_start=$i-1;
my $tag_end=$i+1;
$$text_ref->tagAdd('ie', "3.$tag_start", "3.$tag_end");
}
} else {
my $sel_range=$$max_range+1;
my $sel_range_3p=$$max_range_3p+1 if $$max_range_3p;
$$text_ref->tagAdd('orange', "3.$$max_range_5p", "3.$sel_range_3p") if $$max_range_3p;
$$text_ref->tagAdd('dodgerblue', "3.$$min_range", "3.$sel_range");
}
if ($page eq 'bis') {
# CpG labeling
for my $i (0 .. length($seq)) {
if (substr($seq, $i, 2) =~ /CG|cg/ ) {
my $tagcpg = $i+2;
$$text_ref->tagAdd('ie', "3.$i", "3.$tagcpg");
}
}
}
# this is very inefficient and messy, but gets the job done ...
if ($report) {
my $sequence_report = &$copy_report;
$view_base->destroy;
return $sequence_report;
}
# icon
$view_base->Icon(-image => $pixmap);
# Show the position where the user clicked
# my $center_base_pos = $base_pos-30;
# $$text_ref->see("1.$center_base_pos");
# Show the forward primer if it exists
if ($fprimerpos) {
my $center_base_pos = $fprimerpos-30;
$$text_ref->see("1.$center_base_pos");
}
}
#---------------#
# File commands #
#---------------#
sub pp_file_open {
# NB - there's several reasons why we're not using XML as a file format here.
# The first is simplicity, both for the programmer and for the end-user (who
# would have to download and install a CPAN module otherwise - which might be
# daunting to many). The second is that I can't abide XML.
# The system that follows is both simple and highly extensible (adding
# support for another varible simple entails a single line in either the
# %variables or %arrays hashes - everything else is automatic ... )
my ($file, $widget_ref, @file_data) = @_;
$file ||= $top->getOpenFile(-filetypes=>$file_types);
return unless defined($file);
unless (@file_data) {
unless (open (SEQ, "<$file")) {
dialogue("Could not open file $file: $!");
return;
}
sbarprint("\nOpening $file ...");
@file_data = <SEQ>;
close SEQ;
} else {
sbarprint("\nReading data from port $tcp_port ...");
}
# clear previous selections:
# new_file();
my ($nb_page, $name) = open_file_type($file, $widget_ref, @file_data);
unless ($nb_page) {
$cancel = 0;
return;
}
# redraw dna
draw_dna();
# reset qpcr_flag
$qpcr_flag = 0;
sbarprint("\n$file opened successfully");
$file =~ s/\//\\/g if $os eq 'win'; # path bug in Win32 Perl/Tk
# since we're taking the name from FASTA files directly ...
my $title_filename = ($name ? $name : $file);
# my $full_path = $file;
# $file =~ s/.*[\/\\]//g;
$top->configure(-title=>"PerlPrimer v$version - $title_filename");
$open_file{$nb_page} = $title_filename;
recently_used_files($file);
}
sub open_file_type {
my ($file, $widget_ref, @file_data) = @_;
my ($page, $name);
foreach (@file_data) {
# This loop is in case the first line is blank.
# It's probably unnecessary ..
next if /^$/;
if (/nb = .+/) {
# file appears to be a perlprimer file
return ($page, $name) = open_ppr($file, @file_data);
} elsif (/^\>.+/) {
# file appears to be FASTA format
return ($page, $name) = open_fasta($file, $widget_ref, @file_data);
# } elsif (/[efijlopqz\d]+/i) {
# # file is unknown format
# dialogue("File does not appear to be a PerlPrimer file or in FASTA format.\nIf you are trying to open a DNA sequence file, please use the open icon next to the sequence entry field");
# last;
# } else {
# return ($page, $name) = open_fasta($file, @file_data);
}
}
}
sub open_ppr {
my $file = shift;
my @file_data = @_;
my $nb_page;
my $array_flag=0;
@save_selection=();
$save_seq=$save_seq2="";
my %flag=();
my $pointer;
my ($key, $value, $lines, $open_percent);
my $total_lines = @file_data + 1;
foreach (@file_data) {
# we're supporting both *nix and win32 ...
s/[\n\r]//g;
$open_percent = sprintf("%.f", $lines++/$total_lines*100);
sbarprint("\nOpening $file ... $open_percent\%");
# get nb_page entry (NB: must come before all data entry)
# or look for [array] section
if (/nb = (.*)/) {
$nb->raise($1);
$top->update;
new_file();
if ($cancel) {
sbarprint("\nFile open cancelled");
return;
}
$nb_page = $1;
next;
} elsif (/\[arrays\]/) {
$array_flag=1;
next;
}
# ignore blank lines
next if /^$/;
# grab values
# my ($key, $value) = split / = /;
if (/ = /) {
($key, $value) = split / = /;
} elsif ($array_flag==0) {
# allow multi-line variables - eg for genomic DNA
$$pointer .= "\n$_";
next;
}
# set variables
unless ($array_flag==1) {
$pointer = $variables{$nb_page}{$key};
$$pointer = $value;
next;
}
# array parsing
$pointer = $arrays{$nb_page}{$key};
unless ($flag{$key}) {
# clear the array
@$pointer=();
$flag{$key}=1;
}
# this is so easy!
my @temp = split(/ /,$value);
if ($#temp == 0) {
push (@$pointer, $temp[0]);
} else {
push (@$pointer, [@temp]);
}
}
# restore sequence(s)
my ($seq_ref, $hlist) = get_variables(qw(seq hlist));
$$seq_ref->delete(0.1,"end");
$$seq_ref->insert(0.1,$save_seq);
if ($save_seq2) {
# only for qpcr
$packed_widgets{qdna_seq}->delete(0.1,"end");
$packed_widgets{qdna_seq}->insert(0.1,$save_seq2);
}
# restore results
sort_primers();
# restore intron-exon boundaries if qpcr
$qpcr_flag = 1 if $nb_page eq 'qpcr';
# restore selection
for my $i (0 .. $#save_selection) {
$$hlist->selectionSet("$save_selection[$i]");
}
if (@save_selection) {
browse_primer($save_selection[$#save_selection]);
$$hlist->see($save_selection[$#save_selection]);
}
return $nb_page;
}
sub open_fasta {
my ($file, $widget_ref, @file_data) = @_;
my ($flag, $dna, $name, $range_5a, $range_5b, $range_3a, $range_3b, $page);
my $nb_page = which_nb_page();
my ($key, $value, $lines, $open_percent);
my $total_lines = @file_data + 1;
foreach (@file_data) {
$open_percent = sprintf("%.f", $lines++/$total_lines*100);
sbarprint("\nOpening $file ... $open_percent\%");
next if /^$/;
# if ($flag) {
# $dna .= "$_";
# next;
# } elsif (/^\>/) {
if (/^\>/) {
next if $flag;
($name, $range_5a, $range_5b, $range_3a, $range_3b, $page) = /^\>\s*(.+?)\s*(?:5prime_region\[(\d+)-(\d+)\])?\s*(?:3prime_region\[(\d+)-(\d+)\])?\s*(?:page\[(\d+)\])?\s*$/;
# process name (remove whitespace, other illegal filename chars)
$name = format_file_name($name);
# page defaults to 1 if there's other info that suggests this is a socket file
$page ||= 1 if ($range_5a || $range_5b || $range_3a || $range_3b);
$nb_page = $nb_page_ref{$page} if $page;
$nb->raise($nb_page);
$top->update;
if ($cancel) {
sbarprint("\nFile open cancelled");
return;
}
$flag = 1;
} else {
$dna .= "$_";
}
}
# insert dna sequence if present
if ($dna && $dna =~ /[agct]/i) {
($widget_ref) = get_variables(qw(seq)) unless ref($widget_ref);
$_ = $$widget_ref->get(0.1,"end");
# New file if we're overwriting a previous sequence
my ($seq_check) = /atcg/i;
new_file($widget_ref) if $seq_check;
$$widget_ref->delete(0.1,"end");
$$widget_ref->insert(0.1,$dna);
}
# set ranges if specified
my ($min_ampsize, $max_ampsize, $max_range_5p, $min_range, $max_range, $max_range_3p)
= get_variables(qw(min_ampsize max_ampsize max_range_5p min_range max_range max_range_3p));
if ($range_5a && $range_5b && $range_3a && $range_3b) {
$$max_range_5p = $range_5a;
$$min_range = $range_5b;
$$max_range = $range_3a;
$$max_range_3p = $range_3b;
$$min_ampsize=$$max_range - $$min_range;
$$max_ampsize=$$max_range_3p - $$max_range_5p;
}
# set range to ORF if not
reset_bounds() unless $$min_range && $$max_range;
return ($nb_page, $name);
}
sub format_file_name {
my ($name) = @_;
$name =~ s/\s+/_/g; # replace spaces with underscores
$name =~ s/[\(\)\,\.\;]//g; # remove brackets and punctuation
$name =~ s/\|/-/g; # replace pipes with dashes
$name =~ s/_$//g; # remove final, terminating underscore
$name =~ s/-_/-/g; # fix -_ problems
return $name;
}
sub pp_file_save {
my $nb_page = which_nb_page();
if ($nb_page eq "primer") {
dialogue("You can't save a file from the primer information page - please save from the project page instead");
return;
}
# Either prompt for file name if file not saved or "Save as ..." was
# called, or save without prompting if file has been saved before
# (It's amazing how complicated "simple" behaviour can be ...)
my ($flag) = @_ || 0;
my $file;
if ($open_file{$nb_page} eq 'File not saved') {
$file = $top->getSaveFile(-filetypes=>$file_types, -defaultextension=>'.ppr');
} elsif (($flag == 1) || ($open_file{$nb_page} !~ /\.ppr/)) {
$file = $top->getSaveFile(-filetypes=>$file_types, -defaultextension=>'.ppr', -initialfile=>$open_file{$nb_page});
} else {
$file = $open_file{$nb_page};
}
return unless defined($file);
$file .= '.ppr' unless $file =~ /\.ppr/;
sbarprint("\nSaving $file ...");
my $total_keys = keys(%{ $variables{$nb_page} }) + keys(%{ $arrays{$nb_page} }) + 1;
my ($keys_saved, $saved_percent);
# Now the guts of the saving routine - see the pp_file_open routine for general
# comments ... this is all straightforward stuff
# save sequence data
$save_seq = get_seq();
$save_seq2 = $packed_widgets{qdna_seq}->get(0.1,"end") if $nb_page eq "qpcr";
# save selection data
my ($hlist) = get_variables('hlist');;
@save_selection = $$hlist->selectionGet;
# save variables
my $file_data = "nb = $nb_page\n";
my $pointer;
foreach my $i (keys %{ $variables{$nb_page} }) {
$pointer = $variables{$nb_page}{$i};
$file_data .= "$i = $$pointer\n" if defined($$pointer);
$saved_percent = sprintf("%.f", $keys_saved++/$total_keys*100);
sbarprint("\nSaving $file ... $saved_percent\%");
}
# save arrays
$file_data .= "[arrays]\n";
foreach my $i (keys %{ $arrays{$nb_page} }) {
$pointer = $arrays{$nb_page}{$i};
for my $j (0 .. $#$pointer) {
unless (ref($$pointer[$j])) {
$file_data .= "$i = $$pointer[$j]\n";
} else {
$file_data .= "$i = @{$$pointer[$j]}\n";
}
}
$saved_percent = sprintf("%.f", $keys_saved++/$total_keys*100);
sbarprint("\nSaving $file ... $saved_percent\%");
}
# write file
open (SEQ, ">$file") || dialogue("Could not open file for saving: $!\n");
print SEQ $file_data;
close (SEQ);
sbarprint("\n$file saved successfully");
# Set the program title to reflect the new file name
# $file =~ s/.*\/.*\///g;
$file =~ s/\//\\/g if $os eq 'win'; # path bug in Win32 Perl/Tk
$top->configure(-title=>"PerlPrimer v$version - $file");
$open_file{$nb_page} = $file;
recently_used_files($file);
}
sub recently_used_files {
# recently used files
my ($file) = @_;
if ($file) {
for my $i (0 .. $#mru) {
$mru[$i] = "" if $mru[$i] eq $file;
}
push(@mru, $file);
}
# the subroutine gets called when the program loads, so we need an escape
return if @mru == 0;
# clean up the space from before if it exists
my @new_mru;
for my $i (0 .. $#mru) {
push(@new_mru, $mru[$i]) if ($mru[$i]);
}
# take only the last requested files so the list doesn't grow too big
my $start = $#new_mru-($mru_number-1)<0 ? 0 : $#new_mru-($mru_number-1);
my $end = $#new_mru;
@mru = @new_mru[$start .. $end];
# clear the old menu
$menu_mru->delete(1,'end');
# ... and insert the new list
for my $i (0 .. $#mru) {
$menu_mru->insert(0,'command', -label=>"$mru[$i]", -command =>[sub {pp_file_open($mru[$i])}] );
}
}
sub open_seq {
# opens file and writes contents to text widget
my ($widget_ref) = @_;
my $file = $top->getOpenFile(-filetypes=>$file_types_dna);
if (defined($file)) {
pp_file_open($file, $widget_ref);
}
}
sub save_seq {
# saves sequence in text widget to file
my ($widget_ref) = @_;
my $file = $top->getSaveFile(-filetypes=>$file_types_dna, -defaultextension=>'.fasta');
my $seq = $$widget_ref->get(0.1, 'end');
my $nb_page = which_nb_page();
if (defined($file)) {
my $out;
if ($file =~ /\.fasta$/) {
my $description = $open_file{$nb_page};
$description = $file if $description eq 'File not saved';
$description =~ s/.*[\\\/]//g;
# open description window
my $descript_w = $top->Toplevel(-title=>'Enter FASTA description line');
nr(\$descript_w);
pack_gui('Entry',\$description, 'description_text', 35);
pack_gui('Button', 'OK', 'description_ok', sub {$descript_w->destroy}, 'active');
$descript_w->Icon(-image => $pixmap);
$descript_w->grab;
$descript_w->waitWindow;
my $fasta = ">$description\n$seq";
$out = $fasta;
} else {
$out = $seq;
}
open (SEQ, ">$file") || dialogue("Could not open file: $!");
print SEQ $out;
close (SEQ);
sbarprint("\n$file saved successfully");
}
}
#------------------#
# Text subroutines #
#------------------#
sub clear_text {
my $ref = $_[0];
$$ref->delete(0.1,'end');
}
sub select_all_text {
my $ref = $_[0];
$$ref->selectAll;
}
sub lc_text {
my $ref = $_[0];
my $text = $$ref->get(0.1,"end");
my $text_lc = lc($text);
$$ref->delete(0.1,'end');
$$ref->insert(0.1,$text_lc);
}
sub reverse_complement {
my $ref = $_[0];
my $text = $$ref->get(0.1,"end");
$text =~ s/[\n\s]//g;
my $text_comp_rev = reverse(complement($text));
$$ref->delete(0.1,'end');
$$ref->insert(0.1,$text_comp_rev);
}
#----------------#
# Reference subs #
#----------------#
sub get_seq {
my ($seq_ref) = get_variables('seq');
return 1 unless $$seq_ref;
$_ = $$seq_ref->get(0.1,"end");
$_ = clean_seq($_);
# s/(\>.*\n)//g; #remove FASTA formatting if it exists
# if ($1 && !$open_file{$nb_page}) {
# # if FASTA details are present ...
# my $name = format_file_name($1);
#
# $open_file{$nb_page} = $name;
# $top->configure(-title=>"PerlPrimer v$version - $name");
# }
#
# s/[\n\r]//g; # remove line breaks
return $_;
}
sub which_nb_page {
return $nb->raised;
}
sub get_variables {
my $note_page = which_nb_page();
$null = undef;
my @return_args;
foreach my $var (@_) {
if ($page_specific_vars{$note_page}{$var}) {
push @return_args, $page_specific_vars{$note_page}{$var};
} else {
push @return_args, \undef;
}
}
return @return_args;
}
sub check_packages {
my $failed;
foreach (@_) {
if ($failed_packages =~ / $_ /) {
dialogue("PerlPrimer requires the package $_ for this feature to work\n\nPlease download and install $_ from CPAN (http://cpan.org)");
$failed = 1;
}
}
return 1 if $failed;
}
sub check_packages_no_warn {
my $failed;
foreach (@_) {
if ($failed_packages =~ / $_ /) {
$failed = 1;
}
}
return 1 if $failed;
}
#----------------------#
# Balloon state toggle #
#----------------------#
sub balloon_toggle {
$Balloon->configure(-state => 'none') if $balloon_help == 0;
$Balloon->configure(-state => 'balloon') if $balloon_help == 1;
}
sub check_path {
$_ = shift;
my $regexp_sep = "\\"."$dir_sep";
return $_.$dir_sep unless m/$regexp_sep$/;
return $_;
}
sub load_data {
#-----
#
# NN thermodynamics hashes (AA = 5' AA 3'/3' TT 5') derived from ...
#
# Allawi HT, SantaLucia J Jr. Thermodynamics and NMR of internal G.T mismatches in DNA.
# Biochemistry. 1997 Aug 26;36(34):10581-94
#
# SantaLucia J Jr. A unified view of polymer, dumbbell, and oligonucleotide DNA nearest-neighbor thermodynamics.
# Proc Natl Acad Sci U S A. 1998 Feb 17;95(4):1460-5.
#
# ... with mismatch dG data (AGTG = 5' AG 3'/3' TG 5') derived from ...
#
# Peyret N, Seneviratne PA, Allawi HT, SantaLucia J Jr. Nearest-neighbor thermodynamics and NMR of DNA sequences with internal A.A, C.C, G.G, and T.T mismatches.
# Biochemistry. 1999 Mar 23;38(12):3468-77.
#
# Allawi HT, SantaLucia J Jr. Nearest-neighbor thermodynamics of internal A.C mismatches in DNA: sequence dependence and pH effects.
# Biochemistry. 1998 Jun 30;37(26):9435-44.
#
# Allawi HT, SantaLucia J Jr. Thermodynamics of internal C.T mismatches in DNA.
# Nucleic Acids Res. 1998 Jun 1;26(11):2694-701.
#
# Allawi HT, SantaLucia J Jr. Nearest neighbor thermodynamic parameters for internal G.A mismatches in DNA.
# Biochemistry. 1998 Feb 24;37(8):2170-9.
#
# Allawi HT, SantaLucia J Jr. Thermodynamics and NMR of internal G.T mismatches in DNA.
# Biochemistry. 1997 Aug 26;36(34):10581-94
#
#-----
#-------------------#
# deltaH (kcal/mol) #
#-------------------#
%oligo_dH=qw(
AA -7.9 TT -7.9
AT -7.2 TA -7.2
CA -8.5 TG -8.5
GT -8.4 AC -8.4
CT -7.8 AG -7.8
GA -8.2 TC -8.2
CG -10.6 GC -9.8
GG -8.0 CC -8.0
initC 0.1 initG 0.1
initA 2.3 initT 2.3
);
%oligo_dH_full=(
qw(AATT -7.9 TTAA -7.9
ATTA -7.2 TAAT -7.2
CAGT -8.5 TGAC -8.5
GTCA -8.4 ACTG -8.4
CTGA -7.8 AGTC -7.8
GACT -8.2 TCAG -8.2
CGGC -10.6 GCCG -9.8
GGCC -8.0 CCGG -8.0
initC 0.1 initG 0.1
initA 2.3 initT 2.3),
# Like pair mismatches
qw(AATA 1.2 ATAA 1.2
CAGA -0.9 AGAC -0.9
GACA -2.9 ACAG -2.9
TAAA 4.7 AAAT 4.7
ACTC 0.0 CTCA 0.0
CCGC -1.5 CGCC -1.5
GCCC 3.6 CCCG 3.6
TCAC 6.1 CACT 6.1
AGTG -3.1 GTGA -3.1
CGGG -4.9 GGGC -4.9
GGCG -6.0 GCGG -6.0
TGAG 1.6 GAGT 1.6
ATTT -2.7 TTTA -2.7
CTGT -5.0 TGTC -5.0
GTCT -2.2 TCTG -2.2
TTAT 0.2 TATT 0.2 ),
# G.T mismatches
qw(AGTT 1.0 TTGA 1.0
ATTG -2.5 GTTA -2.5
CGGT -4.1 TGGC -4.1
CTGG -2.8 GGTC -2.8
GGCT 3.3 TCGG 3.3
GGTT 5.8 TTGG 5.8
GTCG -4.4 GCTG -4.4
GTTG 4.1 GTTG 4.1
TGAT -0.1 TAGT -0.1
TGGT -1.4 TGGT -1.4
TTAG -1.3 GATT -1.3),
# G.A mismatches
qw(AATG -0.6 GTAA -0.6
AGTA -0.7 ATGA -0.7
CAGG -0.7 GGAC -0.7
CGGA -4.0 AGGC -4.0
GACG -0.6 GCAG -0.6
GGCA 0.5 ACGG 0.5
TAAG 0.7 GAAT 0.7
TGAA 3.0 AAGT 3.0),
# C.T mismatches
qw(ACTT 0.7 TTCA 0.7
ATTC -1.2 CTTA -1.2
CCGT -0.8 TGCC -0.8
CTGC -1.5 CGTC -1.5
GCCT 2.3 TCCG 2.3
GTCC 5.2 CCTG 5.2
TCAT 1.2 TACT 1.2
TTAC 1.0 CATT 1.0),
# A.C mismatches
qw(AATC 2.3 CTAA 2.3
ACTA 5.3 ATCA 5.3
CAGC 1.9 CGAC 1.9
CCGA 0.6 AGCC 0.6
GACC 5.2 CCAG 5.2
GCCA -0.7 ACCG -0.7
TAAC 3.4 CAAT 3.4
TCAA 7.6 AACT 7.6),
);
#--------------------#
# deltaS (cal/K.mol) #
#--------------------#
%oligo_dS=qw(
AA -22.2 TT -22.2
AT -20.4 TA -21.3
CA -22.7 TG -22.7
GT -22.4 AC -22.4
CT -21.0 AG -21.0
GA -22.2 TC -22.2
CG -27.2 GC -24.4
GG -19.9 CC -19.9
initC -2.8 initG -2.8
initA 4.1 initT 4.1
sym -1.4
);
%oligo_dS_full=(
qw(AATT -22.2 TTAA -22.2
ATTA -20.4 TAAT -21.3
CAGT -22.7 TGAC -22.7
GTCA -22.4 ACTG -22.4
CTGA -21.0 AGTC -21.0
GACT -22.2 TCAG -22.2
CGGC -27.2 GCCG -24.4
GGCC -19.9 CCGG -19.9
initC -2.8 initG -2.8
initA 4.1 initT 4.1
sym -1.4),
# Like pair mismatches
qw(AATA 1.7 ATAA 1.7
CAGA -4.2 AGAC -4.2
GACA -9.8 ACAG -9.8
TAAA 12.9 AAAT 12.9
ACTC -4.4 CTCA -4.4
CCGC -7.2 CGCC -7.2
GCCC 8.9 CCCG 8.9
TCAC 16.4 CACT 16.4
AGTG -9.5 GTGA -9.5
CGGG -15.3 GGGC -15.3
GGCG -15.8 GCGG -15.8
TGAG 3.6 GAGT 3.6
ATTT -10.8 TTTA -10.8
CTGT -15.8 TGTC -15.8
GTCT -8.4 TCTG -8.4
TTAT -1.5 TATT -1.5),
# G.T mismatches
qw(AGTT 0.9 TTGA 0.9
ATTG -8.3 GTTA -8.3
CGGT -11.7 TGGC -11.7
CTGG -8.0 GGTC -8.0
GGCT 10.4 TCGG 10.4
GGTT 16.3 TTGG 16.3
GTCG -12.3 GCTG -12.3
GTTG 9.5 GTTG 9.5
TGAT -1.7 TAGT -1.7
TGGT -6.2 TGGT -6.2
TTAG -5.3 GATT -5.3),
# G.A mismatches
qw(AATG -2.3 GTAA -2.3
AGTA -2.3 ATGA -2.3
CAGG -2.3 GGAC -2.3
CGGA -13.2 AGGC -13.2
GACG -1.0 GCAG -1.0
GGCA 3.2 ACGG 3.2
TAAG 0.7 GAAT 0.7
TGAA 7.4 AAGT 7.4),
# C.T mismatches
qw(ACTT 0.2 TTCA 0.2
ATTC -6.2 CTTA -6.2
CCGT -4.5 TGCC -4.5
CTGC -6.1 CGTC -6.1
GCCT 5.4 TCCG 5.4
GTCC 13.5 CCTG 13.5
TCAT 0.7 TACT 0.7
TTAC 0.7 CATT 0.7),
# A.C mismatches
qw(AATC 4.6 CTAA 4.6
ACTA 14.6 ATCA 14.6
CAGC 3.7 CGAC 3.7
CCGA -0.6 AGCC -0.6
GACC 14.2 CCAG 14.2
GCCA -3.8 ACCG -3.8
TAAC 8.0 CAAT 8.0
TCAA 20.2 AACT 20.2),
);
# Genetic code hash
%genetic_code=qw(
TTT F TTC F TTA L TTG L
CTT L CTC L CTA L CTG L
ATT I ATC I ATA I ATG M
GTT V GTC V GTA V GTG V
TCT S TCC S TCA S TCG S
CCT P CCC P CCA P CCG P
ACT T ACC T ACA T ACG T
GCT A GCC A GCA A GCG A
TAT Y TAC Y TAA * TAG *
CAT H CAC H CAA Q CAG Q
AAT N AAC N AAA K AAG K
GAT D GAC D GAA E GAG E
TGT C TGC C TGA * TGG W
CGT R CGC R CGA R CGG R
AGT S AGC S AGA R AGG R
GGT G GGC G GGA G GGG G
);
}
#----------------------#
# Icon and pixmap data #
#----------------------#
# ... just a little bit of bloat :)
sub load_icon_data {
$perlprimer_icon = <<'end_of_pixmap';
/* XPM */
static char * dna_icon2_xpm[] = {
"32 32 25 1",
" c #FFFFFF",
". c #402E33",
"+ c #A0302D",
"@ c #918FC4",
"# c #B89590",
"$ c #CAC7EE",
"% c #E4B82A",
"& c #969096",
"* c #E3382B",
"= c #924E32",
"- c #E76029",
"; c #EFD4C7",
"> c #69647F",
", c #F9FBF8",
"' c #DD6C69",
") c #80696A",
"! c #C0817E",
"~ c #9F6160",
"{ c #E08B27",
"] c #F7B6B3",
"^ c #D2D1CF",
"/ c #B3AEB2",
"( c #F92C2B",
"_ c #AEACF1",
": c #E7A19D",
" *(;,,;:>@_>##!((;=((+ ",
" -;,,/>@_@/^,;(-;)=. ",
" +*~&#/__&,,,-(({ ",
" .!,::#.>*',;*(** ",
" ),;~&,'--,,~=++ ",
" &/&,!(*%:^) ",
" +#,'*({(#& ",
" .(:,^+=**/^. ",
" +(%%],,#&&&)++ ",
" +({*(!&>>....~ ",
" +#+{(()$@@@>)!^^ ",
" +%;^/))/$____::,,!(+ ",
" ({(*;/&&&@)>)!#,,/*+ ",
" +-((~^^,__@:],@$^,;= ",
" .=~&,,,___:]___,#+*+ ",
" =*#/&&&&>.!]$_$^!(*** ",
" +**+#__#:@@/^//,,]'%* ",
" ++./__::__,,,^+'#/{ ",
" &/@#!@_$,^'*(-(+ ",
" !,##>&&^/,]({{*+ ",
" &,:@_@~'/^,,{{+ ",
" /~>@@**-(~,:+ ",
" ).&(%-(*,) ",
" )#^^,;%{*~/&) ",
" (-*+,,'(~))&/. ",
" {((*;,;+))!))+ ",
" %-(',,,>)!&^^'= ",
" =*=!](*!,/>>)~#,,/*+ ",
" **(;,''~.>>>&:];':(* ",
" *(*,,,^>>@@_$/^'**++ ",
" +=*{,,/)~@__>^,,,-* ",
" *(''*!)#~.>@$]];,;((+ "};
end_of_pixmap
$icon_open = <<'end_of_pixmap';
/* XPM */
static char * open_20_xpm[] = {
"20 20 27 1",
" c None",
". c #020501",
"+ c #37372E",
"@ c #5B5D5A",
"# c #8E8F7E",
"$ c #BABCAC",
"% c #B8BB98",
"& c #ACB0A3",
"* c #1A1B18",
"= c #43433B",
"- c #CDD0AD",
"; c #737561",
"> c #A1A68A",
", c #898F73",
"' c #D7D9C6",
") c #525548",
"! c #AEB293",
"~ c #C4C7A4",
"{ c #242521",
"] c #61624E",
"^ c #808673",
"/ c #C2C5B4",
"( c #959B7E",
"_ c #D5D8B6",
": c #B1B39D",
"< c #999B8E",
"[ c #6C6D59",
" ",
" ",
" ..... ",
" +#<<<^= ",
" @____~[{ ",
"=$_~~~-(+ ",
"=/%!!%%>;======+ ",
"+->(>>>>>>:::::#. ",
"{/,)+++++++++++{.. ",
"{:]<$$$///$////$$$@ ",
"{$=&__---_-----~~!) ",
"{<<'_---------~%!,+ ",
"{<<'-~--~~~~%~%:>]* ",
"*&/~%%%%%%%!!>>>^+ ",
"*$/!!>>>>>>>((,,]. ",
"{&,^;;;;[[[]]]))+ ",
" ............... ",
" ",
" ",
" "};
end_of_pixmap
$icon_open_small = <<'end_of_pixmap';
/* XPM */
static char * open_xpm[] = {
"18 18 64 1",
" c None",
". c #000000",
"+ c #E4E5DF",
"@ c #D5D6CB",
"# c #D6D7CA",
"$ c #A3A39D",
"% c #F5F6F0",
"& c #8D907B",
"* c #92957E",
"= c #90937D",
"- c #979B84",
"; c #6D705F",
"> c #EAECDB",
", c #8A8C7D",
"' c #8E917B",
") c #91947F",
"! c #8B8E7A",
"~ c #999B87",
"{ c #919480",
"] c #989B86",
"^ c #B1B4A2",
"/ c #A2A394",
"( c #F7F7F7",
"_ c #878A75",
": c #666858",
"< c #4B4D3F",
"[ c #4D4F40",
"} c #404135",
"| c #424337",
"1 c #434437",
"2 c #404236",
"3 c #3C3D32",
"4 c #48493C",
"5 c #1A1A16",
"6 c #C6C6BE",
"7 c #848672",
"8 c #25261F",
"9 c #F1F2E9",
"0 c #DDE0C7",
"a c #D6DABB",
"b c #CDD2AC",
"c c #C7CCA7",
"d c #989C80",
"e c #C6C7BE",
"f c #5F6152",
"g c #888980",
"h c #A7AB8C",
"i c #878A70",
"j c #9FA19A",
"k c #EFF0E5",
"l c #9EA284",
"m c #80817B",
"n c #96968D",
"o c #E3E5D1",
"p c #83866D",
"q c #97998D",
"r c #EDEFE2",
"s c #A2A688",
"t c #767671",
"u c #E7E9DA",
"v c #D1D3BD",
"w c #BBBF9D",
"x c #989B80",
"y c #6E715C",
" ",
" ",
" ",
" .... ",
" .+@#$. ",
" .%&*=-;..... ",
" .>,')!~{]{^/. ",
" .(_:<[}||12345 ",
" .67890abbbbbcd. ",
" .efg0bbbbbbbhi. ",
" .j8kabbbbbbbl. ",
" .mnobbbbbbbbp. ",
" .qrbbbbbbbbs. ",
" .tuvwwwwwwxy. ",
" ........... ",
" ",
" ",
" "};
end_of_pixmap
$icon_save = <<'end_of_pixmap';
/* XPM */
static char * save_20_xpm[] = {
"20 20 27 1",
" c None",
". c #1B2226",
"+ c #728BA0",
"@ c #ADC9E0",
"# c #424B54",
"$ c #CA766B",
"% c #5F7688",
"& c #E3E5E1",
"* c #8DAAC4",
"= c #2A3138",
"- c #AEAEAC",
"; c #878A89",
"> c #656764",
", c #DF9A8E",
"' c #4E3F3B",
") c #55534E",
"! c #DCDDDA",
"~ c #7D8690",
"{ c #3B424A",
"] c #F8FAF7",
"^ c #C7C6C1",
"/ c #6E757D",
"( c #4A5E6D",
"_ c #7F98AD",
": c #757879",
"< c #9BBAD0",
"[ c #F5E8E8",
" ",
" ",
" .{='''''''''''={. ",
" #@+,,,,,,,,,,,/*# ",
" {<%,$$$$$$$$$$/_= ",
" #<~![[[[[[[[[[/+= ",
" {<~!]]]]][&[[[:_= ",
" {<~^!&!!&!&&!!/+= ",
" {</[]]]]]]]]]]~+= ",
" {<~^!!!!&!&!!!/+= ",
" {</!]]]]]]]]]]:+= ",
" {<_~//////////~+. ",
" {*__++++++_+++_+. ",
" {*_%:;----;;((+_. ",
" {*+#^^;:^^^-:(+_. ",
" #*+#[^))^^^^;(%_. ",
" {*+#&-)'-^^[/%%_. ",
" .%%#^->:-!&&:(%~. ",
" .==))>>>::>=={(. ",
" "};
end_of_pixmap
$icon_clear = <<'end_of_pixmap';
/* XPM */
static char * clear_20_xpm[] = {
"20 20 27 1",
" c None",
". c #000100",
"+ c #504B3D",
"@ c #989981",
"# c #332B22",
"$ c #6D7163",
"% c #ADB8A6",
"& c #1E1E1B",
"* c #CEBF94",
"= c #8D745E",
"- c #554537",
"; c #A6AA95",
"> c #847B60",
", c #3D3E32",
"' c #5A5C4F",
") c #BDA793",
"! c #B5AB88",
"~ c #E3D3A4",
"{ c #CFBAAA",
"] c #48382B",
"^ c #282017",
"/ c #6A634C",
"( c #797E6C",
"_ c #6D5644",
": c #A38E79",
"< c #C9BE9F",
"[ c #11100E",
" ",
" ",
" ^-& ",
" -)_. ",
" ]))^ ",
" ^={_. ",
" #=:^ ",
" #=_^ .. ",
" ]_- .['& ",
" ]_[(@%, . ",
" -;%%$+# .",
" &$%%$>*' . . ",
" &(%%$>~<!&.. ",
" [%%'>~~>@>.. .",
" [$'>~<~!'(/.. ",
" .'*~)@;@^',.. ",
" #>!!/]'+. ",
" [,+,&.. ",
" ",
" "};
end_of_pixmap
$icon_info = <<'end_of_pixmap';
/* XPM */
static char * info_20_xpm[] = {
"20 20 147 2",
" c None",
". c #ABABB1",
"+ c #D6D6DE",
"@ c #E5E5EF",
"# c #E5E5F2",
"$ c #D8D8E6",
"% c #BBBBC9",
"& c #6F7078",
"* c #CECED4",
"= c #F4F4F9",
"- c #F8F8FB",
"; c #F0F0F7",
"> c #E9E9F4",
", c #E4E4F2",
"' c #DEDFF0",
") c #D7D8EA",
"! c #8B8B97",
"~ c #C4C4CA",
"{ c #F6F6FB",
"] c #FCFCFD",
"^ c #F9F9FC",
"/ c #F1F1F8",
"( c #ECECF6",
"_ c #E6E6F3",
": c #E0E1F1",
"< c #DADDEF",
"[ c #D6D9EB",
"} c #6C6D77",
"| c #EEEEF3",
"1 c #FBFBFD",
"2 c #F3F3F9",
"3 c #EEEEF7",
"4 c #E8E8F5",
"5 c #E2E2F2",
"6 c #D7DBED",
"7 c #C5C8DA",
"8 c #BFBFC4",
"9 c #FAFAFC",
"0 c #F6F6FA",
"a c #F2F3F9",
"b c #E7E8F5",
"c c #DCE0EF",
"d c #D6DCEC",
"e c #D5DBED",
"f c #55575E",
"g c #CBCBD2",
"h c #F2F2F9",
"i c #F7F7FB",
"j c #F9F9FB",
"k c #F7F8FB",
"l c #F4F4FA",
"m c #E0E4F1",
"n c #D6DFEC",
"o c #D4DCED",
"p c #6A6C77",
"q c #C6C6CD",
"r c #EFEFF7",
"s c #F6F6F8",
"t c #F9F9FA",
"u c #F6F7FA",
"v c #ECECF2",
"w c #E1E6F1",
"x c #D6E3EB",
"y c #D4DEEC",
"z c #676973",
"A c #A8A8AF",
"B c #EAEAF4",
"C c #EDEEF5",
"D c #F1F1F7",
"E c #E7E7E9",
"F c #F2F2F8",
"G c #EBECF3",
"H c #E3E6ED",
"I c #DCE5EC",
"J c #D5E8EA",
"K c #D3E0EC",
"L c #404248",
"M c #DADBE6",
"N c #E3EAEF",
"O c #E5EBF1",
"P c #E0E3E6",
"Q c #E5EAF2",
"R c #E3E8F2",
"S c #D8DDE6",
"T c #CED6DC",
"U c #D6E9E9",
"V c #D3E9E9",
"W c #B2BBC8",
"X c #8D8F96",
"Y c #DEE3ED",
"Z c #DCE7EB",
"` c #C6D0D0",
" . c #D8E2E9",
".. c #D7E0E9",
"+. c #CED5D4",
"@. c #D4E4E6",
"#. c #D3EBE9",
"$. c #C8D6DF",
"%. c #43454B",
"&. c #8D8E98",
"*. c #D5D8E6",
"=. c #CBCFD2",
"-. c #C5CBC5",
";. c #CFD5CE",
">. c #C1C9C2",
",. c #D1DDDE",
"'. c #C4D0DA",
"). c #55585F",
"!. c #847F75",
"~. c #C9C3B4",
"{. c #C7C5C0",
"]. c #CDC9BE",
"^. c #D0CAB5",
"/. c #C1B99B",
"(. c #2E2E2C",
"_. c #F0E4BA",
":. c #EBE0B7",
"<. c #E1D29A",
"[. c #D5C58C",
"}. c #AE9E66",
"|. c #13110A",
"1. c #F1E5BC",
"2. c #F1E7C5",
"3. c #E6D69E",
"4. c #D8C890",
"5. c #AFA06C",
"6. c #15130C",
"7. c #EFE4BF",
"8. c #E7DEBE",
"9. c #DACD9C",
"0. c #CDBE8A",
"a. c #B0A16D",
"b. c #14120B",
"c. c #E7DDB6",
"d. c #E2D8B4",
"e. c #D1C28C",
"f. c #C3B47D",
"g. c #9A8D5F",
"h. c #0F0D08",
"i. c #898060",
"j. c #BCB18A",
"k. c #AD9F6C",
"l. c #82764C",
"m. c #312C1A",
"n. c #2D2D2D",
"o. c #404040",
"p. c #060606",
" ",
" . + @ # $ % & ",
" * = - ; > , ' ) ! ",
" ~ { ] ^ / ( _ : < [ } ",
" | ^ 1 - 2 3 4 5 < 6 7 ",
" 8 = ^ ] 9 0 a 3 b c d e f ",
" g h i j j ^ k l 3 m n o p ",
" q r 2 s t 9 9 u v w x y z ",
" A B C D E F ; G H I J K L ",
" M N O P Q R S T U V W ",
" X Y Z ` ...+.@.#.$.%. ",
" &.*.=.-.;.>.,.'.). ",
" !.~.{.].^./.(. ",
" _.:.<.[.}.|. ",
" 1.2.3.4.5.6. ",
" 7.8.9.0.a.b. ",
" c.d.e.f.g.h. ",
" i.j.k.l.m. ",
" n.o.p. ",
" "};
end_of_pixmap
$icon_magnify = <<'end_of_pixmap';
/* XPM */
static char * stock_zoom_in_20_xpm[] = {
"20 20 108 2",
" c None",
". c #3E3E3E",
"+ c #535353",
"@ c #585858",
"# c #565656",
"$ c #525252",
"% c #3F3F3F",
"& c #484848",
"* c #797979",
"= c #A7A7A7",
"- c #BDBDBD",
"; c #C1C1C1",
"> c #B5B5B5",
", c #8C8C8C",
"' c #2B2B2B",
") c #4D4D4D",
"! c #9A9A9A",
"~ c #CBCBCB",
"{ c #D9D9D9",
"] c #E2E2E2",
"^ c #E6E6E6",
"/ c #E4E4E4",
"( c #D5D5D5",
"_ c #6E6E6E",
": c #272727",
"< c #D1D1D1",
"[ c #F3F3F3",
"} c #F8F8F8",
"| c #F9F9F9",
"1 c #F7F7F7",
"2 c #F1F1F1",
"3 c #C6C6C6",
"4 c #626262",
"5 c #1A1A1A",
"6 c #757575",
"7 c #CFCFCF",
"8 c #FAFAFA",
"9 c #FCFCFC",
"0 c #A1A1A1",
"a c #454545",
"b c #DDDDDD",
"c c #F0F0F0",
"d c #E8E8E8",
"e c #C3C3C3",
"f c #343434",
"g c #434343",
"h c #AAAAAA",
"i c #E0E0E0",
"j c #FDFDFD",
"k c #A2A2A2",
"l c #F2F2F2",
"m c #EAEAEA",
"n c #DFDFDF",
"o c #808080",
"p c #080808",
"q c #4C4C4C",
"r c #C9C9C9",
"s c #F4F4F4",
"t c #9F9F9F",
"u c #737373",
"v c #909090",
"w c #9D9D9D",
"x c #B7B7B7",
"y c #060606",
"z c #D4D4D4",
"A c #E9E9E9",
"B c #444444",
"C c #424242",
"D c #7A7A7A",
"E c #DBDBDB",
"F c #C0C0C0",
"G c #050505",
"H c #EDEDED",
"I c #D7D7D7",
"J c #8E8E8E",
"K c #D2D2D2",
"L c #A3A3A3",
"M c #030303",
"N c #929292",
"O c #979797",
"P c #414141",
"Q c #D6D6D6",
"R c #C8C8C8",
"S c #BCBCBC",
"T c #D8D8D8",
"U c #DEDEDE",
"V c #CDCDCD",
"W c #949494",
"X c #171717",
"Y c #181818",
"Z c #6A6A6A",
"` c #CECECE",
" . c #D3D3D3",
".. c #3B3B3B",
"+. c #ACACAC",
"@. c #C2C2C2",
"#. c #898989",
"$. c #393939",
"%. c #000000",
"&. c #0A0A0A",
"*. c #262626",
"=. c #656565",
"-. c #A0A0A0",
";. c #878787",
">. c #474747",
",. c #141414",
"'. c #101010",
"). c #313131",
" ",
" . + @ # $ % ",
" & * = - ; > , # ' ",
" ) ! ~ { ] ^ / ( > _ : ",
" % ! < / [ } | 1 2 ^ 3 4 5 ",
" ' 6 7 ^ 8 9 0 a b 1 c d e f ",
" g h i [ 8 j k a b } l m n o p ",
" q r d s t 0 u a v w x m n > y ",
" ) z A l g B B B B C D ^ E F G ",
" a 3 ^ H z I J g - K I i ( L M ",
" ' N E / m H O P 7 ^ i Q R # ",
" ) S T U ] h u V E z ~ W X ",
" Y Z F ` .z .K ` 3 0 ..y ",
" Y # +.; @.; ; x #.$.p %. ",
" &.*.=.N -.;.>.,.y %.%.%.%. ",
" %.%.%.%.%. 5 *.y %. ",
" %.>.$.&.%. ",
" '.B ).G ",
" ,.X G ",
" "};
end_of_pixmap
$icon_new = <<'end_of_pixmap';
/* XPM */
static char * new_20_xpm[] = {
"20 20 160 2",
" c None",
". c #2D2D2D",
"+ c #4E4E4E",
"@ c #545454",
"# c #555555",
"$ c #505050",
"% c #3D3D3D",
"& c #727272",
"* c #F3F3F3",
"= c #FEFEFE",
"- c #FFFFFF",
"; c #EEEEEE",
"> c #B2B2B2",
", c #838383",
"' c #7E7E7E",
") c #EAEAEA",
"! c #CFCFCF",
"~ c #E3E3E3",
"{ c #7D7D7D",
"] c #808080",
"^ c #FDFDFC",
"/ c #FDFDFD",
"( c #FCFCFB",
"_ c #CDCDCC",
": c #F6F6F6",
"< c #DADADA",
"[ c #666666",
"} c #FEFEFD",
"| c #FCFCFC",
"1 c #FBFBFB",
"2 c #FAFAF9",
"3 c #FBFBFA",
"4 c #FAFAF8",
"5 c #DCDCDB",
"6 c #B6B6B5",
"7 c #D0D0D0",
"8 c #CDCDCD",
"9 c #A6A6A6",
"0 c #626262",
"a c #F9F9F8",
"b c #F8F8F7",
"c c #F9F8F7",
"d c #F8F7F6",
"e c #E3E3E2",
"f c #828282",
"g c #484747",
"h c #3F3E3E",
"i c #323232",
"j c #242423",
"k c #141412",
"l c #FAFAFA",
"m c #F7F7F6",
"n c #F6F6F4",
"o c #F7F6F5",
"p c #F6F5F4",
"q c #F4F4F2",
"r c #EAEAE8",
"s c #DAD9D7",
"t c #CACAC8",
"u c #B0AFAD",
"v c #878582",
"w c #3B3A35",
"x c #F5F4F3",
"y c #F4F3F2",
"z c #F2F2F0",
"A c #EDEDEB",
"B c #E8E7E5",
"C c #E4E3E1",
"D c #CFCECC",
"E c #ADABA7",
"F c #464440",
"G c #F3F3F1",
"H c #F1F1EF",
"I c #F0EFED",
"J c #EDECEA",
"K c #EBEAE8",
"L c #E6E5E3",
"M c #DFDEDB",
"N c #BAB7B2",
"O c #47443F",
"P c #F3F2F1",
"Q c #F0F0EE",
"R c #F1F0EE",
"S c #EEEDEB",
"T c #EAE9E7",
"U c #E6E5E2",
"V c #E4E3E0",
"W c #E2E1DE",
"X c #C9C6C1",
"Y c #4D4A45",
"Z c #F2F1F0",
"` c #EFEFED",
" . c #EFEEEC",
".. c #E9E8E6",
"+. c #E5E4E2",
"@. c #E4E2DF",
"#. c #E2E0DD",
"$. c #CCC9C3",
"%. c #524F49",
"&. c #F4F4F3",
"*. c #EEEEEC",
"=. c #ECEBE9",
"-. c #EBEAE7",
";. c #E7E5E2",
">. c #E1E0DC",
",. c #DFDEDA",
"'. c #CAC8C1",
"). c #514E48",
"!. c #E8E7E4",
"~. c #E9E8E5",
"{. c #E4E3DF",
"]. c #E2E1DD",
"^. c #DDDCD8",
"/. c #C9C6C0",
"(. c #E7E6E3",
"_. c #E6E4E1",
":. c #E5E4E0",
"<. c #DBD9D5",
"[. c #C6C3BC",
"}. c #504D47",
"|. c #7C7C7C",
"1. c #E3E2DF",
"2. c #E3E2DE",
"3. c #DDDBD7",
"4. c #DCDAD6",
"5. c #D9D7D3",
"6. c #C5C1BB",
"7. c #4F4C46",
"8. c #E2E1DF",
"9. c #E1DFDC",
"0. c #E0DFDB",
"a. c #E0DEDB",
"b. c #DFDDD9",
"c. c #DEDCD8",
"d. c #D7D6D1",
"e. c #C3C0B9",
"f. c #4E4B45",
"g. c #5B5A59",
"h. c #BEBBB5",
"i. c #C2BEB7",
"j. c #C1BDB6",
"k. c #C1BDB5",
"l. c #C0BDB5",
"m. c #C0BCB4",
"n. c #BFBBB3",
"o. c #BEBAB2",
"p. c #BBB7AF",
"q. c #BAB6AE",
"r. c #A6A299",
"s. c #413E39",
"t. c #20201F",
"u. c #353431",
"v. c #373531",
"w. c #363431",
"x. c #363430",
"y. c #353330",
"z. c #35332F",
"A. c #34322F",
"B. c #2E2C29",
"C. c #151412",
" ",
" . + @ # # # # # # $ % ",
" & * = - - - - - = ; > , ",
" ' = - - - - - - = ) ! ~ { ",
" ] - - - - = ^ / ( ~ _ : < [ ",
" ] - - } | 1 2 3 4 5 6 7 8 9 0 ",
" ] = | 3 2 a b c d e f g h i j k ",
" ] | l a b m n o p q r s t u v w ",
" ] 3 b m n x q x y z A B C D E F ",
" ] a p q y G z z H I J K L M N O ",
" ] d P z Q Q I R I S T U V W X Y ",
" ] o Z H ` ` .I .J ..+.@.#.$.%. ",
" ] &.*.S J J K =.-...;.V >.,.'.). ",
" ] z K T ....!.~.!.;.{.].,.^./.). ",
" ] ` (.L U U _._.:.{.>.,.^.<.[.}. ",
" |.T 1.2.2.2.].].].>.,.3.4.5.6.7. ",
" & 8.9.0.0.0.0.a.0.b.c.4.5.d.e.f. ",
" g.h.i.j.j.j.k.l.k.m.n.o.p.q.r.s. ",
" t.u.v.w.x.x.x.x.x.x.y.z.A.A.B.C. ",
" "};
end_of_pixmap
$icon_report = <<'end_of_pixmap';
/* XPM */
static char * report_20_xpm[] = {
"20 20 95 2",
" c None",
". c #323232",
"+ c #282828",
"@ c #292929",
"# c #2C2C2C",
"$ c #E8E8E8",
"% c #ECECEC",
"& c #EDEDED",
"* c #EEEEEE",
"= c #EFEFEF",
"- c #F0F0F0",
"; c #F1F1F1",
"> c #F2F2F2",
", c #F3F3F3",
"' c #F4F4F4",
") c #000000",
"! c #E1E1E1",
"~ c #E2E2E2",
"{ c #E3E3E3",
"] c #E5E4E5",
"^ c #E6E6E6",
"/ c #E7E6E7",
"( c #E8E7E8",
"_ c #E9E9E9",
": c #EAEAEA",
"< c #EBECEC",
"[ c #ECEDED",
"} c #EFEEEF",
"| c #F0F0F1",
"1 c #EDEDEC",
"2 c #E4E5E5",
"3 c #777777",
"4 c #EDEEED",
"5 c #E4E4E4",
"6 c #E6E5E5",
"7 c #E7E7E7",
"8 c #EEEDEE",
"9 c #E6E7E6",
"0 c #EEEEEF",
"a c #E5E5E6",
"b c #E6E6E7",
"c c #E7E7E8",
"d c #E9E9E8",
"e c #EBEBEB",
"f c #EEEDED",
"g c #F5F5F5",
"h c #E8E8E9",
"i c #F7F7F7",
"j c #EBECEB",
"k c #F6F6F6",
"l c #F6F7F7",
"m c #F8F8F7",
"n c #F8F9F9",
"o c #F4F4F5",
"p c #F9F9F8",
"q c #FAFAFA",
"r c #FBFBFB",
"s c #EFEFF0",
"t c #F4F3F4",
"u c #F8F8F8",
"v c #F9F8F9",
"w c #FAF9F9",
"x c #FBFBFC",
"y c #FCFCFC",
"z c #FDFDFE",
"A c #F5F4F4",
"B c #F1F0F1",
"C c #F1F2F1",
"D c #F2F3F3",
"E c #F3F3F4",
"F c #F7F7F8",
"G c #F9F9F9",
"H c #FAF9FA",
"I c #FEFDFD",
"J c #FEFEFE",
"K c #F0EFF0",
"L c #F1F1F2",
"M c #F2F2F3",
"N c #F3F4F3",
"O c #F4F5F4",
"P c #F6F6F5",
"Q c #F7F7F6",
"R c #FAFAFB",
"S c #FCFBFC",
"T c #FDFDFD",
"U c #9A9A9A",
"V c #A2A2A2",
"W c #A4A4A4",
"X c #A5A5A5",
"Y c #A6A6A6",
"Z c #A7A7A7",
"` c #A8A8A8",
" . c #A9A9A9",
".. c #AAAAAA",
"+. c #979797",
" . + + + + + @ @ @ @ @ @ @ @ @ # ",
". $ % & & * * = - - ; > > , ' ' & ) ",
"+ % ! ~ { ] ^ / ( _ : < [ * } - | ) ",
"+ 1 ) ) 2 3 3 3 3 3 3 3 3 3 3 3 > ) ",
"+ 4 { 5 6 7 $ _ : % [ 8 = - ; > , ) ",
"+ * ) ) 9 3 3 3 3 3 3 3 3 3 3 3 ' ) ",
"@ 0 a b c d : e % f 0 - ; > , ' g ) ",
"@ = ) ) h 3 3 3 3 3 3 3 3 3 3 3 i ) ",
"@ - c h : j % & * - ; > , ' k l m ) ",
"@ ; ) ) e 3 3 3 3 3 3 3 3 3 3 3 n ) ",
"@ ; : e % & * - ; > , o g k m p q ) ",
"@ > ) ) & 3 3 3 3 3 3 3 3 3 3 3 r ) ",
"@ , % & * s | > , t g k u v w x y ) ",
"@ ' ) ) = 3 3 3 3 3 3 3 3 3 3 3 z ) ",
"@ A * = B C D E g k F G H r y I J ) ",
"@ % K L M N O P Q u G R S y T J ' ) ",
"# U V W W X X Y Y Z ` .......` +.) ",
" ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ",
" ",
" "};
end_of_pixmap
$icon_prefs = <<'end_of_pixmap';
/* XPM */
static char * preferences_20_xpm[] = {
"20 20 138 2",
" c None",
". c #201F1E",
"+ c #242422",
"@ c #1B1B19",
"# c #97948D",
"$ c #B6B3AC",
"% c #5E5C57",
"& c #2E2D2C",
"* c #9F9C98",
"= c #C9C6BE",
"- c #20201E",
"; c #404040",
"> c #676767",
", c #888786",
"' c #D6D4CE",
") c #222120",
"! c #272727",
"~ c #BBBBBB",
"{ c #BEBEBE",
"] c #373737",
"^ c #7C7B77",
"/ c #434341",
"( c #000000",
"_ c #3E3E3E",
": c #CDCCCB",
"< c #CECBC4",
"[ c #72706B",
"} c #262626",
"| c #D2D2D2",
"1 c #696969",
"2 c #111111",
"3 c #6C6966",
"4 c #BCB8B1",
"5 c #CFCBC4",
"6 c #E7E6E2",
"7 c #D6D2CD",
"8 c #BFBBB1",
"9 c #BBB6AC",
"0 c #161514",
"a c #A8A8A8",
"b c #6B6863",
"c c #827F79",
"d c #878580",
"e c #8E8C87",
"f c #C7C5C0",
"g c #D0CDC6",
"h c #8B8781",
"i c #272624",
"j c #3D3D3D",
"k c #959595",
"l c #5B5B5A",
"m c #DEDDDC",
"n c #D4D2CD",
"o c #716F6A",
"p c #2C2C2C",
"q c #616161",
"r c #1A1A1A",
"s c #494949",
"t c #D2D2D1",
"u c #545352",
"v c #585858",
"w c #131313",
"x c #393939",
"y c #6B6B6B",
"z c #3A3937",
"A c #4B4A45",
"B c #0D0D0C",
"C c #171B20",
"D c #191D21",
"E c #040505",
"F c #7C7C7C",
"G c #232323",
"H c #717170",
"I c #898885",
"J c #85827C",
"K c #151413",
"L c #4B5967",
"M c #9CB0C6",
"N c #99AFC5",
"O c #343F4A",
"P c #3C3C3C",
"Q c #AAAAA9",
"R c #CAC8C3",
"S c #242321",
"T c #53606E",
"U c #A9BACC",
"V c #99A8B8",
"W c #94ACC3",
"X c #6B839D",
"Y c #575757",
"Z c #D9D9D8",
"` c #D6D3CE",
" . c #87847E",
".. c #292725",
"+. c #5A6673",
"@. c #BBC9D8",
"#. c #8C9DAF",
"$. c #7A90A6",
"%. c #859FBB",
"&. c #637A93",
"*. c #484848",
"=. c #EFEEED",
"-. c #CBC9C5",
";. c #74726F",
">. c #1D1C1B",
",. c #5F6A76",
"'. c #D1DAE2",
"). c #899BAF",
"!. c #748BA4",
"~. c #87A1BC",
"{. c #69819B",
"]. c #1D232B",
"^. c #474747",
"/. c #C0BFBE",
"(. c #6A6968",
"_. c #7D7D7C",
":. c #4B5661",
"<. c #D2DCE5",
"[. c #A3AEBC",
"}. c #7289A2",
"|. c #8AA5C0",
"1. c #5E758D",
"2. c #1B2128",
"3. c #3A3A3A",
"4. c #969695",
"5. c #8F8F8E",
"6. c #4D5864",
"7. c #BFCFDF",
"8. c #A0ACB9",
"9. c #92ABC4",
"0. c #5C728A",
"a. c #202831",
"b. c #212932",
"c. c #6A8097",
"d. c #93A9C0",
"e. c #6D8299",
"f. c #242C36",
"g. c #1D242C",
" . + ",
" @ # $ % ",
" & * = - ; > ",
" , ' ) ! ~ { ] ",
" ^ / ( _ : < [ ( } | 1 2 ",
" 3 4 5 6 7 8 9 0 } a ( ( ",
" ( b c d e f g h i j k ( ",
" ( ( ( l m n o p q r ",
" s t u v w ",
" x y z A B ",
" C D E F G H I J K ",
" L M N O ( P Q R h S ",
" T U V W X ( Y Z ` ... ",
" +.@.#.$.%.&.( *.=.-.;.>. ",
" ,.'.).!.~.{.]. ^./.(._.r ",
" :.<.[.}.|.1.2. 3.4.5.r ",
" 6.7.8.9.0.a.( ( ( ",
" b.c.d.e.a.( ",
" ].f.g.( ",
" "};
end_of_pixmap
$icon_save_as = <<'end_of_pixmap';
/* XPM */
static char * stock_save_as_20_xpm[] = {
"20 20 274 2",
" c None",
". c #272309",
"+ c #29200C",
"@ c #3F3B0F",
"# c #C2A930",
"$ c #CA9F41",
"% c #000000",
"& c #2A2E34",
"* c #5B6976",
"= c #43494F",
"- c #6D5C58",
"; c #78645F",
"> c #78615C",
", c #775E5A",
"' c #77605B",
") c #614C48",
"! c #2A270A",
"~ c #BCA22F",
"{ c #CAA13E",
"] c #44381C",
"^ c #282A2C",
"/ c #4A555F",
"( c #2D353B",
"_ c #3F474F",
": c #A9C6DE",
"< c #76818F",
"[ c #D0968C",
"} c #E69989",
"| c #E49586",
"1 c #E29384",
"2 c #E19284",
"3 c #DC9488",
"4 c #5C4C36",
"5 c #C1A72F",
"6 c #C59B3C",
"7 c #493B1E",
"8 c #492820",
"9 c #53565D",
"0 c #7891A4",
"a c #34424D",
"b c #3E474E",
"c c #A1BED6",
"d c #727B8B",
"e c #BB7E79",
"f c #CE7D73",
"g c #CE7B72",
"h c #CE7C72",
"i c #CD7C71",
"j c #3F2623",
"k c #D6B932",
"l c #CB9A3C",
"m c #45361D",
"n c #552D27",
"o c #8B4E4B",
"p c #5E626C",
"q c #6D899F",
"r c #293742",
"s c #3D464D",
"t c #9FBED4",
"u c #7A858D",
"v c #E8E8E8",
"w c #FFFFFF",
"x c #E9E9E9",
"y c #625F4D",
"z c #D5B631",
"A c #C29643",
"B c #433C26",
"C c #6E6E6E",
"D c #CBCBCB",
"E c #E3E3E3",
"F c #72777B",
"G c #718DA4",
"H c #293640",
"I c #3E464D",
"J c #9FBBD3",
"K c #79838C",
"L c #DADADA",
"M c #EEEEEE",
"N c #D7D7D7",
"O c #7E785E",
"P c #BE9C2C",
"Q c #C8963A",
"R c #403A23",
"S c #5C5C5C",
"T c #BCBCBC",
"U c #D3D3D3",
"V c #E2E2E2",
"W c #757A7E",
"X c #728EA4",
"Y c #26333D",
"Z c #9EBAD2",
"` c #737D86",
" . c #D2D2D2",
".. c #E6E6E6",
"+. c #989898",
"@. c #73602A",
"#. c #BC9341",
"$. c #42371D",
"%. c #6B6B6B",
"&. c #B6B6B6",
"*. c #CDCDCD",
"=. c #DEDEDE",
"-. c #DFDFDF",
";. c #767B7F",
">. c #728DA3",
",. c #24303A",
"'. c #3D444D",
"). c #9BB7D0",
"!. c #747F87",
"~. c #E7E7E7",
"{. c #4A473D",
"]. c #3E331A",
"^. c #2D2617",
"/. c #6D6C6A",
"(. c #CACACA",
"_. c #F6F6F6",
":. c #FDFDFD",
"<. c #718CA1",
"[. c #232E37",
"}. c #3A444C",
"|. c #96B6CE",
"1. c #76828A",
"2. c #C6C6C6",
"3. c #B0B0B0",
"4. c #040401",
"5. c #474642",
"6. c #828282",
"7. c #A3A3A3",
"8. c #BEBEBE",
"9. c #D4D4D4",
"0. c #D5D5D5",
"a. c #D0D0D0",
"b. c #758C9F",
"c. c #293035",
"d. c #3A454C",
"e. c #98B8CD",
"f. c #797880",
"g. c #D5D3D3",
"h. c #E4E4E4",
"i. c #C4C4C4",
"j. c #D6D6D7",
"k. c #757B80",
"l. c #71899C",
"m. c #272D31",
"n. c #39444C",
"o. c #91B3CA",
"p. c #7B95A8",
"q. c #7D8992",
"r. c #788289",
"s. c #747E86",
"t. c #727B84",
"u. c #707C87",
"v. c #768087",
"w. c #79828A",
"x. c #79838A",
"y. c #757E86",
"z. c #798A98",
"A. c #6D879A",
"B. c #1C272E",
"C. c #39424B",
"D. c #8EADC8",
"E. c #7696B0",
"F. c #7A99B3",
"G. c #637684",
"H. c #647686",
"I. c #6C8091",
"J. c #708596",
"K. c #6B8192",
"L. c #708494",
"M. c #6E8291",
"N. c #6D8190",
"O. c #637B8D",
"P. c #627585",
"Q. c #829FB8",
"R. c #778D9F",
"S. c #1B252B",
"T. c #8EADC7",
"U. c #7090A9",
"V. c #5B6F7E",
"W. c #828380",
"X. c #ADAFAF",
"Y. c #B8BBBC",
"Z. c #BDC0C2",
"`. c #BBBFC0",
" + c #B1B3B4",
".+ c #A6A9A8",
"++ c #939491",
"@+ c #5F696E",
"#+ c #465A69",
"$+ c #6C8AA3",
"%+ c #8299AA",
"&+ c #1A2328",
"*+ c #39434B",
"=+ c #8BACC4",
"-+ c #6D8DA5",
";+ c #49545D",
">+ c #D3D0CB",
",+ c #C2C1BC",
"'+ c #74716B",
")+ c #6C6962",
"!+ c #C9C7C4",
"~+ c #CAC7C2",
"{+ c #C0BCB5",
"]+ c #C1BDB7",
"^+ c #71777A",
"/+ c #4C6478",
"(+ c #607F94",
"_+ c #879BAB",
":+ c #192025",
"<+ c #38424B",
"[+ c #89AAC3",
"}+ c #6F8EA4",
"|+ c #47525A",
"1+ c #E4E3DF",
"2+ c #C1BFBB",
"3+ c #5A5850",
"4+ c #524F47",
"5+ c #B8B5B0",
"6+ c #C2BEB8",
"7+ c #C6C2BC",
"8+ c #D6D3CF",
"9+ c #7C8286",
"0+ c #4D6578",
"a+ c #607E92",
"b+ c #8A9CAB",
"c+ c #191F24",
"d+ c #323B42",
"e+ c #809DB4",
"f+ c #6C89A0",
"g+ c #3F4950",
"h+ c #DEDCD8",
"i+ c #B3B1AC",
"j+ c #4F4C44",
"k+ c #4E4B43",
"l+ c #B1AEA7",
"m+ c #C8C5BE",
"n+ c #DAD8D3",
"o+ c #E7E6E3",
"p+ c #7C8386",
"q+ c #4B6272",
"r+ c #5B798D",
"s+ c #7F96A8",
"t+ c #1C1F21",
"u+ c #1E2226",
"v+ c #505F6C",
"w+ c #5F7889",
"x+ c #465159",
"y+ c #C0BCB7",
"z+ c #B3AFA9",
"A+ c #88847D",
"B+ c #8C8982",
"C+ c #C1BEB8",
"D+ c #DDDAD7",
"E+ c #DAD8D5",
"F+ c #717679",
"G+ c #485D6F",
"H+ c #597385",
"I+ c #7C95A6",
"J+ c #1B1E20",
"K+ c #14181B",
"L+ c #1D2327",
"M+ c #1B1F22",
"N+ c #383735",
"O+ c #3F3E3B",
"P+ c #413F3D",
"Q+ c #444341",
"R+ c #474645",
"S+ c #4C4C4B",
"T+ c #4D4C4B",
"U+ c #222425",
"V+ c #181F25",
"W+ c #222B32",
"X+ c #3A4853",
"Y+ c #0B0D0E",
" . + ",
" @ # $ % ",
" & * = - ; > , ' ' ) ! ~ { ] ^ / ( ",
" _ : < [ } | 1 2 3 4 5 6 7 8 9 0 a ",
" b c d e f g h i j k l m n o p q r ",
" s t u v w w x y z A B C D E F G H ",
" I J K L M N O P Q R S T U V W X Y ",
" s Z ` ...+.@.#.$.%.&.*.=.-.;.>.,. ",
" '.).!.~.V {.].^./.(.E _.:.w ;.<.[. ",
" }.|.1.2.3.4.5.6.7.8.*.9.0.a.;.b.c. ",
" d.e.f.g.h.9.i.(.j.V ~.v v ..k.l.m. ",
" n.o.p.q.r.s.t.s.u.v.w.x.w.y.z.A.B. ",
" C.D.E.F.G.H.I.J.K.L.M.N.O.P.Q.R.S. ",
" C.T.U.V.W.X.Y.Z.`. +.+++@+#+$+%+&+ ",
" *+=+-+;+>+,+'+)+!+~+{+]+^+/+(+_+:+ ",
" <+[+}+|+1+2+3+4+5+6+7+8+9+0+a+b+c+ ",
" d+e+f+g+h+i+j+k+l+m+n+o+p+q+r+s+t+ ",
" u+v+w+x+y+z+A+B+C+D+o+E+F+G+H+I+J+ ",
" K+L+M+N+O+P+Q+R+S+T+Q+U+V+W+X+Y+ ",
" "};
end_of_pixmap
$icon_separator = <<'end_of_pixmap';
/* XPM */
static char * sep_20_xpm[] = {
"4 20 3 1",
" c None",
". c #000000",
"+ c #FFFFFF",
" ",
" ",
" ",
" ",
" .+ ",
" .+ ",
" .+ ",
" .+ ",
" .+ ",
" .+ ",
" .+ ",
" .+ ",
" .+ ",
" .+ ",
" .+ ",
" .+ ",
" ",
" ",
" ",
" "};
end_of_pixmap
$icon_ensembl = <<'end_of_pixmap';
/* XPM */
static char * ensembl_20_xpm[] = {
"20 20 236 2",
" c None",
". c #2D2D2D",
"+ c #4E4E4E",
"@ c #545454",
"# c #555555",
"$ c #505050",
"% c #3D3D3D",
"& c #CC0000",
"* c #950000",
"= c #727272",
"- c #F3F3F3",
"; c #FEFEFE",
"> c #FFFFFF",
", c #EEEEEE",
"' c #B2B2B2",
") c #838383",
"! c #DC0000",
"~ c #AB0000",
"{ c #6A0000",
"] c #7E7E7E",
"^ c #EAEAEA",
"/ c #CFCFCF",
"( c #E3E3E3",
"_ c #867373",
": c #9B0000",
"< c #530000",
"[ c #808080",
"} c #FDFDFC",
"| c #FAFCFD",
"1 c #F4F8FB",
"2 c #DDE0E3",
"3 c #CDCDCC",
"4 c #F6F6F6",
"5 c #DDB8B8",
"6 c #B60C0C",
"7 c #850000",
"8 c #FEFEFD",
"9 c #F9FBFC",
"0 c #DBEAF9",
"a c #B2CEF1",
"b c #90B4EB",
"c c #7EA5E5",
"d c #7598D7",
"e c #7D93BB",
"f c #C7C9CD",
"g c #D49F9F",
"h c #B70B0B",
"i c #620C0C",
"j c #FCFCFC",
"k c #D6E8F9",
"l c #97BBEB",
"m c #5F8DD7",
"n c #4168AF",
"o c #4D68A0",
"p c #5A73A8",
"q c #3E66B8",
"r c #234A9B",
"s c #313A4E",
"t c #6F2C2C",
"u c #9F0202",
"v c #360E0E",
"w c #131311",
"x c #B2CFF2",
"y c #6594DB",
"z c #3D63AF",
"A c #61759F",
"B c #9EA3AF",
"C c #D6D6D7",
"D c #C7D7E6",
"E c #5F89D2",
"F c #37589E",
"G c #9399A4",
"H c #D38281",
"I c #840D0D",
"J c #665C5A",
"K c #3B3A35",
"L c #B3D0F2",
"M c #5385D4",
"N c #3A5EA7",
"O c #7D8BA7",
"P c #D6D5D4",
"Q c #EFF2F2",
"R c #CADEF3",
"S c #80A6DF",
"T c #395EA6",
"U c #7080A0",
"V c #D5D4D3",
"W c #DC7E7D",
"X c #843A3A",
"Y c #A19F9B",
"Z c #464440",
"` c #718292",
" . c #6695DB",
".. c #416BBF",
"+. c #5573AE",
"@. c #ABBCD4",
"#. c #ADC7E7",
"$. c #83A4D3",
"%. c #557BB4",
"&. c #566C9A",
"*. c #8D95A8",
"=. c #D6D5D3",
"-. c #EBE9E7",
";. c #C76969",
">. c #9A7C7A",
",. c #BAB7B2",
"'. c #47443F",
"). c #5978A1",
"!. c #4572C7",
"~. c #3A5DA6",
"{. c #5E729A",
"]. c #7589A8",
"^. c #808FA9",
"/. c #939BAC",
"(. c #B4B6BD",
"_. c #D8D7D6",
":. c #EEEDEB",
"<. c #EAE9E7",
"[. c #E6E0DD",
"}. c #B76968",
"|. c #C0B9B6",
"1. c #C9C6C1",
"2. c #4D4A45",
"3. c #446DA9",
"4. c #416CC0",
"5. c #516B9E",
"6. c #D0D0D1",
"7. c #EAEAE8",
"8. c #EEEEEC",
"9. c #EFEEEC",
"0. c #F0EFED",
"a. c #EDECEA",
"b. c #E9E8E6",
"c. c #E3D5D3",
"d. c #BC8684",
"e. c #DCDAD7",
"f. c #CCC9C3",
"g. c #524F49",
"h. c #3862AB",
"i. c #416ABF",
"j. c #5570A6",
"k. c #DBDBDB",
"l. c #EBEAE8",
"m. c #ECEBE9",
"n. c #E5E8E7",
"o. c #D5D8DD",
"p. c #E7E5E2",
"q. c #E2D9D6",
"r. c #CFC1BD",
"s. c #DFDEDA",
"t. c #CAC8C1",
"u. c #514E48",
"v. c #3960A7",
"w. c #406BBE",
"x. c #3E65B4",
"y. c #93A7D0",
"z. c #CED7E6",
"A. c #D5DDE7",
"B. c #C9D7E5",
"C. c #ABC4E3",
"D. c #7B95B6",
"E. c #A3AEBF",
"F. c #E8908D",
"G. c #D55E5C",
"H. c #CA918E",
"I. c #DDDCD8",
"J. c #C9C6C0",
"K. c #4F6694",
"L. c #3E67B8",
"M. c #3D67BC",
"N. c #406BC0",
"O. c #547FCD",
"P. c #5883CB",
"Q. c #4B6FAC",
"R. c #637A9F",
"S. c #9A9EA8",
"T. c #E0B6B3",
"U. c #CC2221",
"V. c #A40101",
"W. c #912827",
"X. c #C4BAB6",
"Y. c #C6C3BC",
"Z. c #504D47",
"`. c #71747A",
" + c #8595B7",
".+ c #4C669C",
"++ c #405E99",
"@+ c #475F92",
"#+ c #687695",
"$+ c #979BA4",
"%+ c #D0CFCB",
"&+ c #E2E1DD",
"*+ c #DFB3B0",
"=+ c #B11211",
"-+ c #9C0101",
";+ c #6F1716",
">+ c #B7B1AE",
",+ c #C5C1BB",
"'+ c #4F4C46",
")+ c #DFDEDC",
"!+ c #C9C8C8",
"~+ c #BDBDBE",
"{+ c #C7C6C4",
"]+ c #D9D8D4",
"^+ c #E0DFDB",
"/+ c #E0DEDB",
"(+ c #DCD5D1",
"_+ c #AA6463",
":+ c #712323",
"<+ c #836765",
"[+ c #D1D0CC",
"}+ c #C3C0B9",
"|+ c #4E4B45",
"1+ c #5B5A59",
"2+ c #BEBBB5",
"3+ c #C2BEB7",
"4+ c #C1BDB6",
"5+ c #C1BDB5",
"6+ c #C0BDB5",
"7+ c #C0BCB4",
"8+ c #BFBBB3",
"9+ c #BEBAB2",
"0+ c #BBB7AF",
"a+ c #BAB6AE",
"b+ c #A6A299",
"c+ c #413E39",
"d+ c #20201F",
"e+ c #353431",
"f+ c #373531",
"g+ c #363431",
"h+ c #363430",
"i+ c #353330",
"j+ c #35332F",
"k+ c #34322F",
"l+ c #2E2C29",
"m+ c #151412",
" ",
" . + @ # # # # # # $ % & * ",
" = - ; > > > > > ; , ' ) ! ~ { ",
" ] ; > > > > > > ; ^ / ( _ & : < ",
" [ > > > > ; } | 1 2 3 4 5 6 7 ",
" [ > > 8 9 0 a b c d e f g h i ",
" [ ; j k l m n o p q r s t u v w ",
" [ 9 x y z A B C D E F G H I J K ",
" [ L M N O P Q R S T U V W X Y Z ",
" ` ...+.@.#.$.%.&.*.=.-.;.>.,.'. ",
" ).!.~.{.].^./.(._.:.<.[.}.|.1.2. ",
" 3.4.5.6.7.8.9.0.9.a.b.c.d.e.f.g. ",
" h.i.j.k.a.a.l.m.n.o.p.q.r.s.t.u. ",
" v.w.x.y.z.A.B.C.D.E.F.G.H.I.J.u. ",
" K.L.M.N.O.P.Q.R.S.T.U.V.W.X.Y.Z. ",
" `. +.+++@+#+$+%+&+*+=+-+;+>+,+'+ ",
" = )+!+~+{+]+^+/+^+(+_+:+<+[+}+|+ ",
" 1+2+3+4+4+4+5+6+5+7+8+9+0+a+b+c+ ",
" d+e+f+g+h+h+h+h+h+h+i+j+k+k+l+m+ ",
" "};
end_of_pixmap
$icon_dna_save = <<'end_of_pixmap';
/* XPM */
static char * save_dna_20_xpm[] = {
"20 20 247 2",
" c None",
". c #2A3034",
"+ c #525860",
"@ c #4E545A",
"# c #756966",
"$ c #7E7370",
"% c #877D7A",
"& c #908784",
"* c #9A918F",
"= c #A29A98",
"- c #ACA5A3",
"; c #B6AFAE",
"> c #BEB8B7",
", c #C8C3C2",
"' c #D1CDCC",
") c #D2D4D5",
"! c #E1E2E3",
"~ c #E6E7E8",
"{ c #4E575F",
"] c #B6CFE3",
"^ c #899EB0",
"/ c #E6B0A7",
"( c #E7B5AC",
"_ c #E9BAB2",
": c #EBC0B8",
"< c #ECC5BE",
"[ c #EECAC4",
"} c #F0CFCA",
"| c #F1D5D0",
"1 c #F3DAD5",
"2 c #F5DFDB",
"3 c #F6E4E1",
"4 c #E0E2E3",
"5 c #EDF2F5",
"6 c #EAEBEC",
"7 c #484E56",
"8 c #A6C2D5",
"9 c #798D9C",
"0 c #D89B93",
"a c #DBA29B",
"b c #DDA9A2",
"c c #E0B0AA",
"d c #E3B8B2",
"e c #E6BFB9",
"f c #E8C6C1",
"g c #EBCDC9",
"h c #EED4D1",
"i c #F1DBD8",
"j c #EAEEF2",
"k c #E9E9EA",
"l c #A7C2D5",
"m c #929AA2",
"n c #E3E4E2",
"o c #F7EEEE",
"p c #F8EFEF",
"q c #F8F0F0",
"r c #F9F1F1",
"s c #F9F3F3",
"t c #FAF4F4",
"u c #FAF5F5",
"v c #FBF6F6",
"w c #FBF7F7",
"x c #FCF9F9",
"y c #E8ECF0",
"z c #E8E9E9",
"A c #F9FBF9",
"B c #FAFBF9",
"C c #FAFBFA",
"D c #7C8BDE",
"E c #6E6F72",
"F c #726F6F",
"G c #6F6F6F",
"H c #737070",
"I c #737171",
"J c #766765",
"K c #862A21",
"L c #B6382B",
"M c #E4D3D2",
"N c #939AA3",
"O c #D3D2CE",
"P c #E5E6E4",
"Q c #ECEDEA",
"R c #E9E9E7",
"S c #7483E0",
"T c #5769DE",
"U c #DCDFEA",
"V c #F0F1EF",
"W c #F2F3F2",
"X c #F2F2F1",
"Y c #F3F4F3",
"Z c #DEE0E1",
"` c #DB675A",
" . c #DB7E77",
".. c #878C93",
"+. c #F7EDED",
"@. c #F1F2F8",
"#. c #5E6FE1",
"$. c #485CD3",
"%. c #484F80",
"&. c #757675",
"*. c #747576",
"=. c #757676",
"-. c #696A6B",
";. c #6D6E71",
">. c #BF8B87",
",. c #E7E8E6",
"'. c #EAEBE9",
"). c #8F9BE4",
"!. c #455ADD",
"~. c #5568DE",
"{. c #8A8FB1",
"]. c #707070",
"^. c #676869",
"/. c #CD7C6C",
"(. c #DD958C",
"_. c #868C92",
":. c #FAFCFA",
"<. c #FBFCFA",
"[. c #FBFCFB",
"}. c #E2E5F6",
"|. c #5768DF",
"1. c #4156DC",
"2. c #6F75DA",
"3. c #DA775D",
"4. c #DA6544",
"5. c #E6DEDD",
"6. c #95A9BB",
"7. c #99A0A8",
"8. c #959AA0",
"9. c #9DA1A7",
"0. c #A4A8AD",
"a. c #ABAFB4",
"b. c #B3B7BB",
"c. c #BBBEC2",
"d. c #C2C5C8",
"e. c #CACACD",
"f. c #9A6F98",
"g. c #C85F55",
"h. c #A05B80",
"i. c #ACACDF",
"j. c #E7E8E8",
"k. c #9AB4CA",
"l. c #94A9BA",
"m. c #9BAFBF",
"n. c #98AABA",
"o. c #9FB0BE",
"p. c #A7B6C3",
"q. c #AEBCC8",
"r. c #B6C2CD",
"s. c #BDC8D2",
"t. c #D5AEA1",
"u. c #DF7F5D",
"v. c #D16846",
"w. c #8E6163",
"x. c #3645AC",
"y. c #3647B4",
"z. c #C6CAE5",
"A. c #8294A2",
"B. c #9A9D9D",
"C. c #AEB0AF",
"D. c #CCCCCB",
"E. c #D0D0CF",
"F. c #D8B7AD",
"G. c #E08768",
"H. c #E28664",
"I. c #DE8B6C",
"J. c #BCB3B4",
"K. c #9DA1A4",
"L. c #ACB0B3",
"M. c #6471BF",
"N. c #909BE2",
"O. c #8A9FB0",
"P. c #6C737A",
"Q. c #D6D5D2",
"R. c #D9D8D5",
"S. c #B4B6B5",
"T. c #C78B7D",
"U. c #DF6F51",
"V. c #DF8468",
"W. c #796058",
"X. c #666666",
"Y. c #616161",
"Z. c #5F6164",
"`. c #67696D",
" + c #5960B6",
".+ c #A0A6E3",
"++ c #4D565E",
"@+ c #959390",
"#+ c #D9654B",
"$+ c #C98373",
"%+ c #C6C7C8",
"&+ c #CBCCCA",
"*+ c #CDCDCC",
"=+ c #C9CACA",
"-+ c #969BDB",
";+ c #5960DF",
">+ c #5962DF",
",+ c #E0E1E7",
"'+ c #6B7279",
")+ c #EAECE9",
"!+ c #C8C8C7",
"~+ c #C1665B",
"{+ c #747473",
"]+ c #7A7B7C",
"^+ c #7C7D7E",
"/+ c #5E5E90",
"(+ c #4F50BD",
"_+ c #535ADF",
":+ c #7378E0",
"<+ c #E1E6F0",
"[+ c #292F33",
"}+ c #718696",
"|+ c #9FA09E",
"1+ c #C05452",
"2+ c #7A3434",
"3+ c #786D89",
"4+ c #7777E4",
"5+ c #6565E1",
"6+ c #6D6FDE",
"7+ c #B0B7DA",
"8+ c #DDE2E6",
"9+ c #EAECED",
"0+ c #353C3F",
"a+ c #4D5359",
"b+ c #585E63",
"c+ c #83817D",
"d+ c #8C8A87",
"e+ c #9EA09E",
"f+ c #A99EA0",
"g+ c #9E5796",
"h+ c #7770DF",
"i+ c #9363A9",
"j+ c #B38FA9",
"k+ c #BCBEC0",
"l+ c #C7C8CA",
"m+ c #D6D7D9",
"n+ c #E2E5E8",
"o+ c #6360E1",
"p+ c #6B67E2",
"q+ c #6A4E8B",
"r+ c #942D22",
"s+ c #D7402D",
"t+ c #D34434",
"u+ c #5F5EE0",
"v+ c #D7402F",
"w+ c #D63B2F",
"x+ c #D34441",
" ",
" . + @ # $ % & * = - ; > , ' ) ! ~ ",
" { ] ^ / ( _ : < [ } | 1 2 3 4 5 6 ",
" 7 8 9 / 0 a b c d e f g h i 4 j k ",
" { l m n o p q r s t u v w x 4 y z ",
" 7 8 m n A B C D E F G H I J K L M ",
" 7 8 N O P Q R S T U V W X Y Z ` . ",
" 7 8 ..+.A B C @.#.$.%.&.*.=.-.;.>. ",
" 7 8 N O P ,.R '.V ).!.~.{.].^./.(. ",
" 7 8 _.n A B C :.<.[.}.|.1.2.3.4.5. ",
" 7 8 6.7.8.9.0.a.b.c.d.e.f.g.h.i.j. ",
" 7 k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z. ",
" 7 k.l.A.B.C.D.E.F.G.H.I.J.K.L.M.N. ",
" 7 k.O.P.Q.R.S.T.U.V.W.X.Y.Z.`. +.+ ",
" ++k.^ P.o R.@+#+$+%+&+*+=+-+;+>+,+ ",
" 7 k.^ '+)+!+@+~+{+]+^+/+(+_+:+<+~ ",
" [+}+9 '+Q.!+|+1+2+3+4+5+6+7+8+9+j. ",
" 0+a+b+c+d+e+f+g+h+i+j+k+l+m+n+j. ",
" o+p+q+r+s+t+ ",
" u+ v+w+x+ "};
end_of_pixmap
$icon_dna_open = <<'end_of_pixmap';
/* XPM */
static char * open_dna_20_iii_xpm[] = {
"20 20 214 2",
" c None",
". c #1C1F1B",
"+ c #292C28",
"@ c #373936",
"# c #444643",
"$ c #515350",
"% c #414138",
"& c #999A8B",
"* c #A9AA9F",
"= c #AEAFA5",
"- c #B3B5AB",
"; c #A7AB9E",
"> c #888883",
", c #5569D6",
"' c #0E0F15",
") c #000000",
"! c #210B08",
"~ c #84251B",
"{ c #B53528",
"] c #646563",
"^ c #D9DCBD",
"/ c #DBDEC1",
"( c #DDE0C5",
"_ c #E0E2C9",
": c #D6D8C0",
"< c #A2A296",
"[ c #80817F",
"} c #4B60DE",
"| c #485CDD",
"1 c #D74130",
"2 c #D5463A",
"3 c #43433B",
"4 c #BDBFB0",
"5 c #CDD0B2",
"6 c #D0D2B6",
"7 c #D3D5BB",
"8 c #DCDEC7",
"9 c #BCBFAD",
"0 c #8A8A85",
"a c #4B5EDE",
"b c #485CD3",
"c c #212A65",
"d c #040407",
"e c #030405",
"f c #020102",
"g c #A44F48",
"h c #C5C8B8",
"i c #BFC2A2",
"j c #BBBEA4",
"k c #BEC2A9",
"l c #CACCB3",
"m c #CED0B8",
"n c #C3C6B5",
"o c #AEAFA3",
"p c #9B9B97",
"q c #A6A6A2",
"r c #7580C9",
"s c #4459DC",
"t c #5063DA",
"u c #787D9E",
"v c #616160",
"w c #010102",
"x c #C65E48",
"y c #D65848",
"z c #37372E",
"A c #CFD2B1",
"B c #AAAF95",
"C c #A5AA92",
"D c #B4B8A2",
"E c #B9BDA8",
"F c #BEC1AE",
"G c #C8CBBB",
"H c #CDD0C1",
"I c #DADBD0",
"J c #DEDFD5",
"K c #CBCEDA",
"L c #5466DC",
"M c #4156DC",
"N c #6B71D6",
"O c #D8755B",
"P c #DA5F3D",
"Q c #242521",
"R c #C5C7B7",
"S c #959A81",
"T c #6D6F64",
"U c #61615A",
"V c #6B6B64",
"W c #767670",
"X c #80807B",
"Y c #8B8B86",
"Z c #959591",
"` c #A0A09B",
" . c #ABABA7",
".. c #B5B5B1",
"+. c #C0BEBC",
"@. c #9A6E97",
"#. c #C85F55",
"$. c #A05B80",
"%. c #AAA8D8",
"&. c #B5B7A2",
"*. c #717260",
"=. c #C8CABD",
"-. c #CCCDC1",
";. c #CFD1C6",
">. c #D8DACF",
",. c #DBDDD3",
"'. c #DEE0D7",
"). c #DEDFD7",
"!. c #E5E6DF",
"~. c #E5B8A5",
"{. c #E07F5E",
"]. c #D16846",
"^. c #926465",
"/. c #3645AC",
"(. c #3647B4",
"_. c #D1D5F0",
":. c #56564F",
"<. c #B9BCB1",
"[. c #DFE1CB",
"}. c #E1E3CF",
"|. c #E8EAD8",
"1. c #E4C4B0",
"2. c #E18968",
"3. c #E28664",
"4. c #E28F6F",
"5. c #DED1C7",
"6. c #B7B8B3",
"7. c #BBBBB7",
"8. c #6773BF",
"9. c #97A1E8",
"0. c #9EA093",
"a. c #A3A599",
"b. c #DDDECE",
"c. c #DADCC2",
"d. c #E0A58D",
"e. c #DF6F51",
"f. c #DF8568",
"g. c #7A6257",
"h. c #6D6D69",
"i. c #6D6E69",
"j. c #6E6E6B",
"k. c #6E6E6F",
"l. c #5B61B6",
"m. c #A7ACE9",
"n. c #9EA094",
"o. c #D7D9BE",
"p. c #DCDEC6",
"q. c #DCDECA",
"r. c #DC684D",
"s. c #C98470",
"t. c #C8CABF",
"u. c #C9CAC0",
"v. c #CED0C7",
"w. c #DADBD2",
"x. c #A6A8E4",
"y. c #5A61DF",
"z. c #5962DE",
"A. c #EBECF2",
"B. c #1A1B18",
"C. c #B0B4A7",
"D. c #C7C9AD",
"E. c #D2D4BD",
"F. c #D5D7C3",
"G. c #CE7566",
"H. c #787970",
"I. c #767873",
"J. c #797A77",
"K. c #595A89",
"L. c #4F50BD",
"M. c #535ADF",
"N. c #767AE0",
"O. c #E0E1E7",
"P. c #BFC2A9",
"Q. c #C65A55",
"R. c #7A3433",
"S. c #716680",
"T. c #7575E1",
"U. c #6565E1",
"V. c #6F71DF",
"W. c #C1C4E0",
"X. c #E6E6E3",
"Y. c #E4E4E4",
"Z. c #B0B4A8",
"`. c #939888",
" + c #909282",
".+ c #97998A",
"++ c #9EA092",
"@+ c #A6A79B",
"#+ c #A9AA9E",
"$+ c #B2A8A0",
"%+ c #9E5796",
"&+ c #7770DF",
"*+ c #9363A9",
"=+ c #B592A9",
"-+ c #D1D2CE",
";+ c #DADBD8",
">+ c #DFDFDE",
",+ c #0E110D",
"'+ c #363835",
")+ c #454744",
"!+ c #525451",
"~+ c #5F615E",
"{+ c #6B6C70",
"]+ c #6562D7",
"^+ c #6B67DF",
"/+ c #77648D",
"(+ c #942F24",
"_+ c #D7402D",
":+ c #D05142",
"<+ c #C9A7A6",
"[+ c #5F5EE0",
"}+ c #D7402F",
"|+ c #D63B2F",
"1+ c #D34441",
" ",
" ",
" . + @ # $ ",
" % & * = - ; > , ' ) ) ) ) ! ~ { ",
" ] ^ / ( _ : < [ } | 1 2 ",
"3 4 ^ 5 6 7 8 9 0 a b c ) d e ) f g ",
"3 h i j k l m n o p q r s t u v w x y ",
"z A B C D E F n G H I J K L M N O P ",
"Q R S T U V W X Y Z ` ...+.@.#.$.%. ",
"Q &.*.* =.-.;.>.,.'.).!.~.{.].^./.(._. ",
"Q 4 :.<.( _ 8 [.}.|.1.2.3.4.5.6.7.8.9. ",
"Q 0.a.b.( c.8 [.}.d.e.f.g.h.i.j.k.l.m. ",
"Q n.a.b.o.7 p.[.q.r.s.t.u.v.w.x.y.z.A. ",
"B.C.G 5 D.l m E.F.G.H.I.J.K.L.M.N.O. ",
"B.4 G j P.E F n G Q.R.S.T.U.V.W.X.Y. ",
"Q Z.S `. +.+++@+#+$+%+&+*+=+-+;+>+ ",
" ,+. + '+)+!+~+{+]+^+/+(+_+:+<+ ",
" [+ }+|+1+ ",
" ",
" "};
end_of_pixmap
$info_pixmap = <<'end_of_pixmap';
/* XPM */
static char * info_qt_ii_xpm[] = {
"32 32 5 1",
" c None",
". c #CECECE",
"+ c #FFFFFF",
"@ c #2C4DA0",
"# c #000000",
" ........ ",
" ...++++++++... ",
" ..++++++++++++++.. ",
" .++++++++++++++++++. ",
" .++++++++@@@@++++++++# ",
" .++++++++@@@@@@++++++++# ",
" .+++++++++@@@@@@+++++++++# ",
" .+++++++++++@@@@+++++++++++# ",
" .++++++++++++++++++++++++++#. ",
".++++++++++++++++++++++++++++#. ",
".++++++++++@@@@@@@+++++++++++#. ",
".++++++++++++@@@@@+++++++++++#..",
".++++++++++++@@@@@+++++++++++#..",
".++++++++++++@@@@@+++++++++++#..",
".++++++++++++@@@@@+++++++++++#..",
".++++++++++++@@@@@+++++++++++#..",
" .+++++++++++@@@@@++++++++++#...",
" .+++++++++++@@@@@++++++++++#...",
" .++++++++++@@@@@+++++++++#... ",
" #+++++++@@@@@@@@@++++++#.... ",
" #++++++++++++++++++++#.... ",
" #++++++++++++++++++#.... ",
" ##++++++++++++++##.... ",
" .###++++++++###..... ",
" ...###++++#....... ",
" ....#+++#..... ",
" .#+++#.. ",
" #++#.. ",
" #+#.. ",
" ##.. ",
" ... ",
" .. "};
end_of_pixmap
$error_pixmap = <<'end_of_pixmap';
/* XPM */
static char * error_xpm[] = {
"34 34 4 1",
" c None",
". c #000000",
"+ c #F9BD3B",
"@ c #CECECE",
" ",
" ... ",
" .+++. ",
" .+++++.@ ",
" .+++++.@@ ",
" .+++++++.@@ ",
" .+++++++.@@ ",
" .+++++++++.@@ ",
" .+++++++++.@@ ",
" .+++++++++++.@@ ",
" .++++...++++.@@ ",
" .++++.....++++.@@ ",
" .++++.....++++.@@ ",
" .+++++.....+++++.@@ ",
" .+++++.....+++++.@@ ",
" .++++++.....++++++.@@ ",
" .++++++.....++++++.@@ ",
" .++++++++...++++++++.@@ ",
" .++++++++...++++++++.@@ ",
" .+++++++++...+++++++++.@@ ",
" .++++++++++.++++++++++.@@ ",
" .+++++++++++.+++++++++++.@@ ",
" .+++++++++++++++++++++++.@@ ",
" .++++++++++++..+++++++++++.@@ ",
" .+++++++++++....++++++++++.@@ ",
" .++++++++++++....+++++++++++.@@ ",
" .+++++++++++++..++++++++++++.@@ ",
" .+++++++++++++++++++++++++++.@@@ ",
" .+++++++++++++++++++++++++++.@@@ ",
" .+++++++++++++++++++++++++.@@@@ ",
" .........................@@@@@ ",
" @@@@@@@@@@@@@@@@@@@@@@@@@@@ ",
" @@@@@@@@@@@@@@@@@@@@@@@@@ ",
" "};
end_of_pixmap
$dna_canvas_pixmap = <<'end_of_pixmap';
/* XPM */
static char * perlprimer_dna_canvas_2_aa_xpm[] = {
"528 52 306 2",
" c None",
". c #EEEEEE",
"+ c #000000",
"@ c #1B1B1B",
"# c #1C1C1C",
"$ c #545454",
"% c #DBDBDB",
"& c #DEDEDE",
"* c #C8C8C8",
"= c #484848",
"- c #1A1A1A",
"; c #181818",
"> c #424242",
", c #C4C4C4",
"' c #E8E8E8",
") c #D0D0D0",
"! c #191919",
"~ c #9A9A9A",
"{ c #ECECEC",
"] c #A2A2A2",
"^ c #171717",
"/ c #E3E3E3",
"( c #212121",
"_ c #595959",
": c #7C7C7C",
"< c #858585",
"[ c #474747",
"} c #EEE7E7",
"| c #F2AFAF",
"1 c #525252",
"2 c #555555",
"3 c #DFDFDF",
"4 c #4F4F4F",
"5 c #AEAEAE",
"6 c #9B9B9B",
"7 c #060606",
"8 c #E5E5E5",
"9 c #5D5D5D",
"0 c #8B8B8B",
"a c #C7C7C7",
"b c #373737",
"c c #151515",
"d c #777777",
"e c #333333",
"f c #626262",
"g c #2A2A2A",
"h c #C3C3C3",
"i c #A5A5A5",
"j c #6E6E6E",
"k c #232323",
"l c #131313",
"m c #878787",
"n c #676767",
"o c #DDDDDD",
"p c #4E4E4E",
"q c #6B6B6B",
"r c #EBEBEB",
"s c #D2D2D2",
"t c #070707",
"u c #7E7E7E",
"v c #727272",
"w c #141414",
"x c #848484",
"y c #353535",
"z c #5E5E5E",
"A c #EFD6D6",
"B c #F67B7B",
"C c #FE0000",
"D c #D7D7D7",
"E c #616161",
"F c #EAEAEA",
"G c #606060",
"H c #505050",
"I c #909090",
"J c #767676",
"K c #585858",
"L c #161616",
"M c #ACACAC",
"N c #EDEDED",
"O c #5F5F5F",
"P c #969696",
"Q c #C9C9C9",
"R c #E4E4E4",
"S c #444444",
"T c #7F7F7F",
"U c #888888",
"V c #707070",
"W c #8E8E8E",
"X c #B1B1B1",
"Y c #ADADAD",
"Z c #949494",
"` c #464646",
" . c #8A8A8A",
".. c #030303",
"+. c #D8D8D8",
"@. c #E9E9E9",
"#. c #818181",
"$. c #BABABA",
"%. c #E6E6E6",
"&. c #494949",
"*. c #7A7A7A",
"=. c #F1C4C4",
"-. c #F86262",
";. c #FB3030",
">. c #F39B9B",
",. c #0A0A0A",
"'. c #CFCFCF",
"). c #090909",
"!. c #D3D3D3",
"~. c #272727",
"{. c #1F1F1F",
"]. c #808080",
"^. c #6C6C6C",
"/. c #B9B9B9",
"(. c #383838",
"_. c #A9A9A9",
":. c #565656",
"<. c #DCDCDC",
"[. c #0B0B0B",
"}. c #E2E2E2",
"|. c #0F0F0F",
"1. c #C6C6C6",
"2. c #D5D5D5",
"3. c #D6D6D6",
"4. c #F2B5B5",
"5. c #CDCDCD",
"6. c #0D0D0D",
"7. c #A6A6A6",
"8. c #414141",
"9. c #CECECE",
"0. c #D1D1D1",
"a. c #E7E7E7",
"b. c #E0E0E0",
"c. c #5C5C5C",
"d. c #7B7B7B",
"e. c #DADADA",
"f. c #F48F8F",
"g. c #FD0E0E",
"h. c #6D6D6D",
"i. c #252525",
"j. c #828282",
"k. c #C0C0C0",
"l. c #8C8C8C",
"m. c #4C4C4C",
"n. c #787878",
"o. c #919191",
"p. c #3B3B3B",
"q. c #4B4B4B",
"r. c #E1E1E1",
"s. c #303030",
"t. c #F0CCCC",
"u. c #9C9C9C",
"v. c #A7A7A7",
"w. c #111111",
"x. c #AAAAAA",
"y. c #8F8F8F",
"z. c #8D8D8D",
"A. c #B8B8B8",
"B. c #323232",
"C. c #242424",
"D. c #B0B0B0",
"E. c #393939",
"F. c #1D1D1D",
"G. c #CCCCCC",
"H. c #EEE0E0",
"I. c #FF0000",
"J. c #959595",
"K. c #F49494",
"L. c #636363",
"M. c #BCBCBC",
"N. c #F0CDCD",
"O. c #F1BABA",
"P. c #1E1E1E",
"Q. c #2D2D2D",
"R. c #B6B6B6",
"S. c #F76666",
"T. c #8B5A00",
"U. c #A44600",
"V. c #CF2400",
"W. c #9A4D00",
"X. c #FFA500",
"Y. c #FFA100",
"Z. c #FF7200",
"`. c #FF6600",
" + c #FF9400",
".+ c #104E8B",
"++ c #FF6A00",
"@+ c #FF5A00",
"#+ c #FF9B00",
"$+ c #1E90FF",
"%+ c #FFA400",
"&+ c #FF9900",
"*+ c #FF9C00",
"=+ c #191970",
"-+ c #916D6D",
";+ c #391560",
">+ c #9D6060",
",+ c #F60707",
"'+ c #551252",
")+ c #F00107",
"!+ c #956868",
"~+ c #E41919",
"{+ c #B14C4C",
"]+ c #827B7B",
"^+ c #8B7272",
"/+ c #CA3434",
"(+ c #070000",
"_+ c #650000",
":+ c #CB0000",
"<+ c #2D0000",
"[+ c #430000",
"}+ c #EF0000",
"|+ c #F1BEBE",
"1+ c #FE0E0E",
"2+ c #596ABC",
"3+ c #F00910",
"4+ c #248CF8",
"5+ c #77569A",
"6+ c #3481E6",
"7+ c #F85E5E",
"8+ c #EFDDDD",
"9+ c #536DC2",
"0+ c #FC0103",
"a+ c #AF325A",
"b+ c #4B73CC",
"c+ c #2D85ED",
"d+ c #4E3966",
"e+ c #F00408",
"f+ c #553762",
"g+ c #A01E37",
"h+ c #F10407",
"i+ c #3F3E6F",
"j+ c #204881",
"k+ c #FF7900",
"l+ c #FF0A00",
"m+ c #FF8400",
"n+ c #FF4100",
"o+ c #FF0900",
"p+ c #A94200",
"q+ c #F70500",
"r+ c #935300",
"s+ c #A24800",
"t+ c #D12300",
"u+ c #F80400",
"v+ c #EEEDED",
"w+ c #F0D2D2",
"x+ c #FE0D0D",
"y+ c #F76B6B",
"z+ c #FB2F2F",
"A+ c #EEE8E8",
"B+ c #F1B9B9",
"C+ c #F49999",
"D+ c #FE0505",
"E+ c #F3A5A5",
"F+ c #FE0303",
"G+ c #FE0404",
"H+ c #F85555",
"I+ c #F48E8E",
"J+ c #F85C5C",
"K+ c #979797",
"L+ c #C1C1C1",
"M+ c #515151",
"N+ c #202020",
"O+ c #050505",
"P+ c #C2C2C2",
"Q+ c #3C3C3C",
"R+ c #343434",
"S+ c #282828",
"T+ c #939393",
"U+ c #363636",
"V+ c #5B5B5B",
"W+ c #D4D4D4",
"X+ c #0E0E0E",
"Y+ c #B7B7B7",
"Z+ c #747474",
"`+ c #989898",
" @ c #BEBEBE",
".@ c #9F9F9F",
"+@ c #222222",
"@@ c #2F2F2F",
"#@ c #535353",
"$@ c #BDBDBD",
"%@ c #CBCBCB",
"&@ c #D9D9D9",
"*@ c #010101",
"=@ c #717171",
"-@ c #BFBFBF",
";@ c #292929",
">@ c #3E3E3E",
",@ c #313131",
"'@ c #9E9E9E",
")@ c #9D9D9D",
"!@ c #5A5A5A",
"~@ c #080808",
"{@ c #B2B2B2",
"]@ c #040404",
"^@ c #BBBBBB",
"/@ c #A4A4A4",
"(@ c #6F6F6F",
"_@ c #CACACA",
":@ c #404040",
"<@ c #646464",
"[@ c #0C0C0C",
"}@ c #2B2B2B",
"|@ c #868686",
"1@ c #A8A8A8",
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + @ # # # $ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + % . . . . . . . . . . . . . . . # & . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . * = - ; > , . . . . . . . . . . ' . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + % . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + % . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ) ! ~ { . ] ^ * . . . . . . . . / ( . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + % . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + % . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . _ : . . . . < [ . . . . . . . . % + . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . } | . . . + % . . . . & 1 ! - 2 3 . . + 4 ; + 5 . 6 7 8 . 9 0 a b # c d . . + 4 ; < e # f + % . . . . + f # g h . . + 4 ; i + % . + j k l m $ c n . o p @ - q r . + 4 ; i . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ; , . . . . s t r . + % . . + % @ + b o p @ - q r . + 4 ; i . . . + 4 ; u b # c d . . + v k w x . s y # z + % o p @ - q r . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A B C | . . + @ # # # D 4 E F F G H . . + I . J q . K L M N ; D O P . Q + R . + I . S T . U + % . . . . + V . W e . . + I . { + % . + : . X + Y s + R H Z . 8 ` .. + I . { . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ..+.. . . . @.+ 3 . + % . . + % % + . H Z . 8 ` .. + I . { . . . + I . 9 P . Q + R . + #.. $...%.&.*.. U + % H Z . 8 ` .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . =.-.;.>.. . . + % . . . . ,.'.. . '.).. . + !.. , ~.. {.].^./.(.. r _.u :.+ <.. + !.. [.s . }.+ % . . . . + ) . R + 8 . + !.. . + % . + s . % + F . + % [.@ # # |.H . + !.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ; 1.. . . . 2.7 r . + % . . + % % + . [.@ # # |.H . + !.. . . . . + !.. r _.u :.+ <.. + 3.. N + <.[.s . / + % [.@ # # |.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . } 4.;.-.=.. . . . + % . . . . ,.'.. . 5.6.. . + % . . ( 7.8.* g V < . ` :.] 9.+ % . + % . [.0.. 8 + % . . . . + s . / + a.. + % . . + % . + % . % + . . + % ).9.. . b.8 . + % . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . c.d.. . . . .` . . + e.. %.+ % % + . ).9.. . b.8 . + % . . . . . + % . ` :.] 9.+ % . + % . . + % ).s . R + % ).9.. . b.8 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A f.g.f.A . . . . . + % . . . . p E F F G 4 . . + % . . h.i.j.. # @ s . t k.. l.+ 3.. + % . m.n.. o.+ % . . . . + u . 0 p.. . + % . . + % . + % . % + . . + % q.f { r.s.U . + % . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . } t.. !.- u.N . v.^ a . . w.x.. y.+ % & + @.q.f { r.s.U . + % . . . . . + % . t k.. l.+ 3.. + % . . + % = u . z.+ <.q.f { r.s.U . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . =.-.;.4.} . . . . . . + % . . . . <.H ! # 2 o . . + % . . A.+ h . 9 B.. . ].c C.d ~.D.. + % . 2.E.# O + % . . . . + _ F.e G.. . + % . . + % . + % . % + . . + % % m.! L n { . + % . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . H.f.I.t.. 5.= ! - > , . . . J.; k u + % N s.C.% m.! L n { . + % . . . . . + % . ].c C.d ~.D.. + % . . + % s e @ :.+ r.% m.! L n { . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.;.-.=.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + % . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A K.C 4.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . L.M.. 5 @ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . t.g.f.A . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + % . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . N.-.C O.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . l.P.F.Q.R.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . I.I.. . . . t.} . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . N.S.C =.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . I.I.I.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . =.C C N.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . T.T.T.T.I.I.I.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.U.C V.W.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . T.X.X.I.I.I.I.I.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.Y.Z.I.`. +T.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . T.X.X.I.I.I.I.I.X.X.X.X.X.X.X..+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+X.X.X.X.X.X.X.X.Y.++I.@+#+X.T.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
". . . . . . + + + + + . . + . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . T.X.X.X.X.X.X.X.X.X.X.X.X.X.X..+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+.+X.X.X.X.X.X.X.X.%+&+++*+X.X.T.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + + . . . + . . . . . ",
". . . . . . + . . . . . . + . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . T.X.X.X.X.X.X.X.X.X.X.X.X.X.X..+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+.+X.X.X.X.X.X.X.X.X.%+Y.X.X.X.T.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + . . . + . . + . . . . . ",
". . . . . . + . . . . . . + . . . . . . + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + . . . . . . . . . + . . + . . . . . ",
". . . . . . + + + + . . . . . . . . . . + T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T + =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=++ T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T + . . . . . . . + + . . . . . . . . . ",
". . . . . . . . . . + . . . . . . . . . + T T T T T T T T T T T T T T T T T T T T T T T T T T T T T -+T T T T T T T T T T T T T T T T T T T T T + =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+;+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=++ T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T + . . . . . . . . . + . . . . . . . . ",
". . . . . . . . . . + . . . . . . . . . + T T T T T T T T T T T T T T T T T T T T T T T T T T T T >+,+-+T T T T T T T T T T T T T T T T T T T T + =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+'+)+;+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=++ T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T + . . . . . . . . . + . . . . . . . . ",
". . . . . . + . . . + . . . . . . . . . + T T T T T T T T T T T T T T T T T T T T T T T T T T T !+~+{+]+T T T T T T T T T T T T T T T T T T T T + =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+'+)+'+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=++ T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T + . . . . . + . . . + . . . . . . . . ",
". . . . . . + . . . + . . . . . . . . . + T T T T T T T T T T T T T T T T T T T T T T T T T T ^+/+/+^+T T T T T T T T T T T T T T T T T T T T T + =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+'+)+'+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=++ T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T + . . . . . + . . . + . . . . . . . . ",
". . . . . . . + + + . . . . . . . . . . + + + + + + + + + + + + + + + + + + + + + + + + + + (+_+:+<++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [+}+[++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + (++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + . . . . . . + + + . . . . . . . . . ",
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |+1+4.. . . . . . . . . . . . . . . . . . . . T.X.X.X.X.X.X.X.X.X.X.X.X.X.X..+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+2+3+2+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+4+5+6+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+.+X.X.X.X.X.X.X.X.X.X.X.X.X.X.T.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . N.S.7+8+. . . . . . . . . . . . . . . . . . . . T.X.X.X.X.X.X.X.X.X.X.X.X.X.X..+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+2+3+2+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+9+0+a+b+c+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+$+I.I.I.I.I.X.X.X.X.X.X.X.X.X.X.X.X.X.X.T.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8+7+S.N.. . . . . . . . . . . . . . . . . . . . . T.X.X.X.X.X.X.X.X.X.X.X.X.X.X..+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+d+e+d+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+f+g+h+g+i+j+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+I.I.I.I.I.I.X.X.X.X.X.X.X.X.X.X.X.X.X.X.T.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.1+|+. . . . . . . . . . . . . . . . . . . . . . T.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.k+l+k+X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.&+m+n+o+n+m+&+X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.I.I.I.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.T.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . =.;.f.} . . . . . . . . . . . . . . . . . . . . . . T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.p+q+p+T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.r+s+t+u+t+s+r+T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.I.I.I.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . v+w+-.-.A . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . } | g.| . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8+|+7+x+7+|+8+. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . I.I.I.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . v+A y+z+=.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . } B g.| . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8+|+7+x+7+|+8+. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A+B+8+. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A+C+D+E+. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.F+>.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8+|+7+x+7+|+8+. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A+C+G+H+|+8+. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A+B+. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8+|+7+x+7+|+. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . v+8+I+J+x+7+|+8+. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8+|+7+1+t.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . v+A+8+|+7+x+7+|+8+. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + @ # # ~.K+. . . + n.. . . % + . . . { - [ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . * = - ; > , . . . + @ # F.L y a . . + @ # # # $ . . . . . 1 L+. . . . 5.M+@ # k u { . . . . . . . . . . 5.M+@ # k u { . . . . . # & . . . . . . . . + % . . . . . . . . . . . . . . . . . + % . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8+t.. . + % . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8+|+7+x+7+|+. . . + @ # F.L y a . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . # & . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + % . . 5.N+v.. . + O+P+. . % + . . . Y Q+w 3.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ) ! ~ { . ] ^ * . . + % . . N *.R+. . + % . . . . . . . . { S+N . . . s ; T+F . s U+*.. . . . . . . . . s ; T+F . s U+*.. . . . . . . . . . . . . . . + % . . . . . . . . . . . . . . . . . + % . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + % . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8+|+7+1+t.. . + % . . N *.R+. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + % . . . ] U+. . + V+g ' . % + . . . 2 U G : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . _ : . . . . < [ . . + % . . . s O+. . + % . . . . . . . . M.2 . . . . O V . . . . 1.0 . . . . . . . . . O V . . . . 1.0 . . . . . . . . . . . . . . . + % . . . . . . . . . . . . . . . . . + % . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + % . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8+t.. . . + % . . . s O+. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + % . . . & ..r . + W+~.v . % + . . }.X+e.Y+N+N . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ; , . . . . s t r . + % . . { Z+B.. . + % . . . . . . . . d.`+. . . . ! @. . . . . . . . + f # g h . . ! @. . . . . . . . . . . + % . .@+@@ @@k.. . + % a b # c d . . + v k w x . 9.e # f + % . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + % . + v k w x . . + v k w x . o p @ - q r . + 4 ; i . . . + 4 ; u b # c d . . + v k w x . s y # z + % o p @ - q r . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + % . . { Z+B.. o p @ - q r #@#.. . l.H o p @ - q r . + 4 ; i .@+@@ @@k.. o p @ - q r . . . . + f # g h . . + 4 ; i + % . + j k l m $ c n . o p @ - q r . + 4 ; i . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + % . . . r + b.. + % $@t $@% + . . P [ . . +@D.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ..+.. . . . @.+ 3 . + @ # # w ` %@. . + @ # # # D . . . . E.&@. . . . *@3.. . =@# # # . . + V . W e . . *@3.. . =@# # # . . . . . + % . 6.-@. `+: . . + % O P . Q + R . + #.. $...%.` T . U + % . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + % . + #.. $...%.. + #.. $...%.H Z . 8 ` .. + I . { . . . + I . 9 P . Q + R . + #.. $...%.&.*.. U + % H Z . 8 ` .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + @ # # w ` %@. H Z . 8 ` .X ;@. . B.5 H Z . 8 ` .. + I . { 6.-@. `+: . H Z . 8 ` .. . . . + V . W e . . + I . { + % . + : . X + Y s + R H Z . 8 ` .. + I . { . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + % . . . &@O+r . + % . v ~.W++ . . >@X+# # ,.#@. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ; 1.. . . . 2.7 r . + % N $.! m . . . + % . . . . . . . r.,@. . . . . c L+. . . . % + . . + ) . R + 8 . c L+. . . . % + . . . . . + % . :.# G '@%.. . + % r _.u :.+ <.. + 3.. N + <.[.s . }.+ % . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + % . + 3.. N + <.. + 3.. N + <.[.@ # # |.H . + !.. . . . . + !.. r _.u :.+ <.. + 3.. N + <.[.s . / + % [.@ # # |.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + % N $.! m . . [.@ # # |.H N ( $@1.P.N [.@ # # |.H . + !.. . :.# G '@%.. [.@ # # |.H . . . . + ) . R + 8 . + !.. . + % . + s . % + F . + % [.@ # # |.H . + !.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + % . . . )@E.. . + % . ' g !@+ . !.X+a.. . s ~@& . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . c.d.. . . . .` . . + % . . {@]@^@. . + % . . . . . . . /@(@. . . . . _ =@. . . . % + . . + s . / + a.. _ =@. . . . % + . . . . . + % . . _@l.:@y . . + % ` :.] 9.+ % . + % . . + % [.0.. 8 + % . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + % . + % . . + % . + % . . + % ).9.. . b.8 . + % . . . . . + % . ` :.] 9.+ % . + % . . + % ).s . R + % ).9.. . b.8 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + % . . {@]@^@. ).9.. . b.8 . u <@^.d.. ).9.. . b.8 . + % . . . _@l.:@y . ).9.. . b.8 . . . . + s . / + a.. + % . . + % . + % . % + . . + % ).9.. . b.8 . + % . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + % . . _@N+_.. . + % . . L+]@+ . u H . . . . y m . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . !.- u.N . v.^ a . . + % . . . f @@{ . + % . . . . . . . f X . . . . . s ! l.a.. ) p [@. . + u . 0 p.. . s ! l.a.. ) p [@. . . . . + % / |. @. A.w.. . + % t k.. l.+ 3.. + % . . + % m.n.. o.+ % . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + % . + % . . + % . + % . . + % q.f { r.s.U . + % . . . . . + % . t k.. l.+ 3.. + % . . + % = u . z.+ <.q.f { r.s.U . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + % . . . f @@{ q.f { r.s.U . D # # 2.. q.f { r.s.U . + % . / |. @. A.w.. q.f { r.s.U . . . . + u . 0 p.. . + % . . + % . + % . % + . . + % q.f { r.s.U . + % . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + @ # @ }@u.. . . + % . . . n.+ . ~.6 . . . . |@g . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.= ! - > , . . . + % . . . 3 w z.. + % . . . . . . . g ' . . . . . . s !@# - P.<@s . . + _ F.e G.. . . s !@# - P.<@s . . . . . + % . `+F.@ ~.1@. . + % ].c C.d ~.D.. + % . . + % 2.E.# O + % . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + % . + % . . + % . + % . . + % % m.! L n { . + % . . . . . + % . ].c C.d ~.D.. + % . . + % s e @ :.+ r.% m.! L n { . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + % . . . 3 w z.% m.! L n { . . q.[ . . % m.! L n { . + % . . `+F.@ ~.1@. % m.! L n { . . . . + _ F.e G.. . + % . . + % . + % . % + . . + % % m.! L n { . + % . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + % . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . L.M.. 5 @ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + % . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + % . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . l.P.F.Q.R.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + % . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . "};
end_of_pixmap
}
# And here endeth the incredibly convoluted code ...
# Can I just say that seven years on, I'm amazed at how well this software has
# held its own in the primer-design-verse. PerlPrimer started its life back in
# 2003 as a quick project to help a labmate; I never expected it to be useful
# for so long. Many thanks to all who have written to me over the years with
# thanks, suggestions and bugfixes; maybe one day I'll finish off the
# unequal-loop dimer code ...
#
# Cheers and best wishes,
# Owen
#
# (17 March 2010)
|