File: ChangeLog

package info (click to toggle)
staden 2.0.0%2Bb11-5
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 21,568 kB
  • sloc: ansic: 240,605; tcl: 65,360; cpp: 12,854; makefile: 11,201; sh: 2,952; fortran: 2,033; perl: 63; awk: 46
file content (18860 lines) | stat: -rw-r--r-- 739,716 bytes parent folder | download | duplicates (4)
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
10515
10516
10517
10518
10519
10520
10521
10522
10523
10524
10525
10526
10527
10528
10529
10530
10531
10532
10533
10534
10535
10536
10537
10538
10539
10540
10541
10542
10543
10544
10545
10546
10547
10548
10549
10550
10551
10552
10553
10554
10555
10556
10557
10558
10559
10560
10561
10562
10563
10564
10565
10566
10567
10568
10569
10570
10571
10572
10573
10574
10575
10576
10577
10578
10579
10580
10581
10582
10583
10584
10585
10586
10587
10588
10589
10590
10591
10592
10593
10594
10595
10596
10597
10598
10599
10600
10601
10602
10603
10604
10605
10606
10607
10608
10609
10610
10611
10612
10613
10614
10615
10616
10617
10618
10619
10620
10621
10622
10623
10624
10625
10626
10627
10628
10629
10630
10631
10632
10633
10634
10635
10636
10637
10638
10639
10640
10641
10642
10643
10644
10645
10646
10647
10648
10649
10650
10651
10652
10653
10654
10655
10656
10657
10658
10659
10660
10661
10662
10663
10664
10665
10666
10667
10668
10669
10670
10671
10672
10673
10674
10675
10676
10677
10678
10679
10680
10681
10682
10683
10684
10685
10686
10687
10688
10689
10690
10691
10692
10693
10694
10695
10696
10697
10698
10699
10700
10701
10702
10703
10704
10705
10706
10707
10708
10709
10710
10711
10712
10713
10714
10715
10716
10717
10718
10719
10720
10721
10722
10723
10724
10725
10726
10727
10728
10729
10730
10731
10732
10733
10734
10735
10736
10737
10738
10739
10740
10741
10742
10743
10744
10745
10746
10747
10748
10749
10750
10751
10752
10753
10754
10755
10756
10757
10758
10759
10760
10761
10762
10763
10764
10765
10766
10767
10768
10769
10770
10771
10772
10773
10774
10775
10776
10777
10778
10779
10780
10781
10782
10783
10784
10785
10786
10787
10788
10789
10790
10791
10792
10793
10794
10795
10796
10797
10798
10799
10800
10801
10802
10803
10804
10805
10806
10807
10808
10809
10810
10811
10812
10813
10814
10815
10816
10817
10818
10819
10820
10821
10822
10823
10824
10825
10826
10827
10828
10829
10830
10831
10832
10833
10834
10835
10836
10837
10838
10839
10840
10841
10842
10843
10844
10845
10846
10847
10848
10849
10850
10851
10852
10853
10854
10855
10856
10857
10858
10859
10860
10861
10862
10863
10864
10865
10866
10867
10868
10869
10870
10871
10872
10873
10874
10875
10876
10877
10878
10879
10880
10881
10882
10883
10884
10885
10886
10887
10888
10889
10890
10891
10892
10893
10894
10895
10896
10897
10898
10899
10900
10901
10902
10903
10904
10905
10906
10907
10908
10909
10910
10911
10912
10913
10914
10915
10916
10917
10918
10919
10920
10921
10922
10923
10924
10925
10926
10927
10928
10929
10930
10931
10932
10933
10934
10935
10936
10937
10938
10939
10940
10941
10942
10943
10944
10945
10946
10947
10948
10949
10950
10951
10952
10953
10954
10955
10956
10957
10958
10959
10960
10961
10962
10963
10964
10965
10966
10967
10968
10969
10970
10971
10972
10973
10974
10975
10976
10977
10978
10979
10980
10981
10982
10983
10984
10985
10986
10987
10988
10989
10990
10991
10992
10993
10994
10995
10996
10997
10998
10999
11000
11001
11002
11003
11004
11005
11006
11007
11008
11009
11010
11011
11012
11013
11014
11015
11016
11017
11018
11019
11020
11021
11022
11023
11024
11025
11026
11027
11028
11029
11030
11031
11032
11033
11034
11035
11036
11037
11038
11039
11040
11041
11042
11043
11044
11045
11046
11047
11048
11049
11050
11051
11052
11053
11054
11055
11056
11057
11058
11059
11060
11061
11062
11063
11064
11065
11066
11067
11068
11069
11070
11071
11072
11073
11074
11075
11076
11077
11078
11079
11080
11081
11082
11083
11084
11085
11086
11087
11088
11089
11090
11091
11092
11093
11094
11095
11096
11097
11098
11099
11100
11101
11102
11103
11104
11105
11106
11107
11108
11109
11110
11111
11112
11113
11114
11115
11116
11117
11118
11119
11120
11121
11122
11123
11124
11125
11126
11127
11128
11129
11130
11131
11132
11133
11134
11135
11136
11137
11138
11139
11140
11141
11142
11143
11144
11145
11146
11147
11148
11149
11150
11151
11152
11153
11154
11155
11156
11157
11158
11159
11160
11161
11162
11163
11164
11165
11166
11167
11168
11169
11170
11171
11172
11173
11174
11175
11176
11177
11178
11179
11180
11181
11182
11183
11184
11185
11186
11187
11188
11189
11190
11191
11192
11193
11194
11195
11196
11197
11198
11199
11200
11201
11202
11203
11204
11205
11206
11207
11208
11209
11210
11211
11212
11213
11214
11215
11216
11217
11218
11219
11220
11221
11222
11223
11224
11225
11226
11227
11228
11229
11230
11231
11232
11233
11234
11235
11236
11237
11238
11239
11240
11241
11242
11243
11244
11245
11246
11247
11248
11249
11250
11251
11252
11253
11254
11255
11256
11257
11258
11259
11260
11261
11262
11263
11264
11265
11266
11267
11268
11269
11270
11271
11272
11273
11274
11275
11276
11277
11278
11279
11280
11281
11282
11283
11284
11285
11286
11287
11288
11289
11290
11291
11292
11293
11294
11295
11296
11297
11298
11299
11300
11301
11302
11303
11304
11305
11306
11307
11308
11309
11310
11311
11312
11313
11314
11315
11316
11317
11318
11319
11320
11321
11322
11323
11324
11325
11326
11327
11328
11329
11330
11331
11332
11333
11334
11335
11336
11337
11338
11339
11340
11341
11342
11343
11344
11345
11346
11347
11348
11349
11350
11351
11352
11353
11354
11355
11356
11357
11358
11359
11360
11361
11362
11363
11364
11365
11366
11367
11368
11369
11370
11371
11372
11373
11374
11375
11376
11377
11378
11379
11380
11381
11382
11383
11384
11385
11386
11387
11388
11389
11390
11391
11392
11393
11394
11395
11396
11397
11398
11399
11400
11401
11402
11403
11404
11405
11406
11407
11408
11409
11410
11411
11412
11413
11414
11415
11416
11417
11418
11419
11420
11421
11422
11423
11424
11425
11426
11427
11428
11429
11430
11431
11432
11433
11434
11435
11436
11437
11438
11439
11440
11441
11442
11443
11444
11445
11446
11447
11448
11449
11450
11451
11452
11453
11454
11455
11456
11457
11458
11459
11460
11461
11462
11463
11464
11465
11466
11467
11468
11469
11470
11471
11472
11473
11474
11475
11476
11477
11478
11479
11480
11481
11482
11483
11484
11485
11486
11487
11488
11489
11490
11491
11492
11493
11494
11495
11496
11497
11498
11499
11500
11501
11502
11503
11504
11505
11506
11507
11508
11509
11510
11511
11512
11513
11514
11515
11516
11517
11518
11519
11520
11521
11522
11523
11524
11525
11526
11527
11528
11529
11530
11531
11532
11533
11534
11535
11536
11537
11538
11539
11540
11541
11542
11543
11544
11545
11546
11547
11548
11549
11550
11551
11552
11553
11554
11555
11556
11557
11558
11559
11560
11561
11562
11563
11564
11565
11566
11567
11568
11569
11570
11571
11572
11573
11574
11575
11576
11577
11578
11579
11580
11581
11582
11583
11584
11585
11586
11587
11588
11589
11590
11591
11592
11593
11594
11595
11596
11597
11598
11599
11600
11601
11602
11603
11604
11605
11606
11607
11608
11609
11610
11611
11612
11613
11614
11615
11616
11617
11618
11619
11620
11621
11622
11623
11624
11625
11626
11627
11628
11629
11630
11631
11632
11633
11634
11635
11636
11637
11638
11639
11640
11641
11642
11643
11644
11645
11646
11647
11648
11649
11650
11651
11652
11653
11654
11655
11656
11657
11658
11659
11660
11661
11662
11663
11664
11665
11666
11667
11668
11669
11670
11671
11672
11673
11674
11675
11676
11677
11678
11679
11680
11681
11682
11683
11684
11685
11686
11687
11688
11689
11690
11691
11692
11693
11694
11695
11696
11697
11698
11699
11700
11701
11702
11703
11704
11705
11706
11707
11708
11709
11710
11711
11712
11713
11714
11715
11716
11717
11718
11719
11720
11721
11722
11723
11724
11725
11726
11727
11728
11729
11730
11731
11732
11733
11734
11735
11736
11737
11738
11739
11740
11741
11742
11743
11744
11745
11746
11747
11748
11749
11750
11751
11752
11753
11754
11755
11756
11757
11758
11759
11760
11761
11762
11763
11764
11765
11766
11767
11768
11769
11770
11771
11772
11773
11774
11775
11776
11777
11778
11779
11780
11781
11782
11783
11784
11785
11786
11787
11788
11789
11790
11791
11792
11793
11794
11795
11796
11797
11798
11799
11800
11801
11802
11803
11804
11805
11806
11807
11808
11809
11810
11811
11812
11813
11814
11815
11816
11817
11818
11819
11820
11821
11822
11823
11824
11825
11826
11827
11828
11829
11830
11831
11832
11833
11834
11835
11836
11837
11838
11839
11840
11841
11842
11843
11844
11845
11846
11847
11848
11849
11850
11851
11852
11853
11854
11855
11856
11857
11858
11859
11860
11861
11862
11863
11864
11865
11866
11867
11868
11869
11870
11871
11872
11873
11874
11875
11876
11877
11878
11879
11880
11881
11882
11883
11884
11885
11886
11887
11888
11889
11890
11891
11892
11893
11894
11895
11896
11897
11898
11899
11900
11901
11902
11903
11904
11905
11906
11907
11908
11909
11910
11911
11912
11913
11914
11915
11916
11917
11918
11919
11920
11921
11922
11923
11924
11925
11926
11927
11928
11929
11930
11931
11932
11933
11934
11935
11936
11937
11938
11939
11940
11941
11942
11943
11944
11945
11946
11947
11948
11949
11950
11951
11952
11953
11954
11955
11956
11957
11958
11959
11960
11961
11962
11963
11964
11965
11966
11967
11968
11969
11970
11971
11972
11973
11974
11975
11976
11977
11978
11979
11980
11981
11982
11983
11984
11985
11986
11987
11988
11989
11990
11991
11992
11993
11994
11995
11996
11997
11998
11999
12000
12001
12002
12003
12004
12005
12006
12007
12008
12009
12010
12011
12012
12013
12014
12015
12016
12017
12018
12019
12020
12021
12022
12023
12024
12025
12026
12027
12028
12029
12030
12031
12032
12033
12034
12035
12036
12037
12038
12039
12040
12041
12042
12043
12044
12045
12046
12047
12048
12049
12050
12051
12052
12053
12054
12055
12056
12057
12058
12059
12060
12061
12062
12063
12064
12065
12066
12067
12068
12069
12070
12071
12072
12073
12074
12075
12076
12077
12078
12079
12080
12081
12082
12083
12084
12085
12086
12087
12088
12089
12090
12091
12092
12093
12094
12095
12096
12097
12098
12099
12100
12101
12102
12103
12104
12105
12106
12107
12108
12109
12110
12111
12112
12113
12114
12115
12116
12117
12118
12119
12120
12121
12122
12123
12124
12125
12126
12127
12128
12129
12130
12131
12132
12133
12134
12135
12136
12137
12138
12139
12140
12141
12142
12143
12144
12145
12146
12147
12148
12149
12150
12151
12152
12153
12154
12155
12156
12157
12158
12159
12160
12161
12162
12163
12164
12165
12166
12167
12168
12169
12170
12171
12172
12173
12174
12175
12176
12177
12178
12179
12180
12181
12182
12183
12184
12185
12186
12187
12188
12189
12190
12191
12192
12193
12194
12195
12196
12197
12198
12199
12200
12201
12202
12203
12204
12205
12206
12207
12208
12209
12210
12211
12212
12213
12214
12215
12216
12217
12218
12219
12220
12221
12222
12223
12224
12225
12226
12227
12228
12229
12230
12231
12232
12233
12234
12235
12236
12237
12238
12239
12240
12241
12242
12243
12244
12245
12246
12247
12248
12249
12250
12251
12252
12253
12254
12255
12256
12257
12258
12259
12260
12261
12262
12263
12264
12265
12266
12267
12268
12269
12270
12271
12272
12273
12274
12275
12276
12277
12278
12279
12280
12281
12282
12283
12284
12285
12286
12287
12288
12289
12290
12291
12292
12293
12294
12295
12296
12297
12298
12299
12300
12301
12302
12303
12304
12305
12306
12307
12308
12309
12310
12311
12312
12313
12314
12315
12316
12317
12318
12319
12320
12321
12322
12323
12324
12325
12326
12327
12328
12329
12330
12331
12332
12333
12334
12335
12336
12337
12338
12339
12340
12341
12342
12343
12344
12345
12346
12347
12348
12349
12350
12351
12352
12353
12354
12355
12356
12357
12358
12359
12360
12361
12362
12363
12364
12365
12366
12367
12368
12369
12370
12371
12372
12373
12374
12375
12376
12377
12378
12379
12380
12381
12382
12383
12384
12385
12386
12387
12388
12389
12390
12391
12392
12393
12394
12395
12396
12397
12398
12399
12400
12401
12402
12403
12404
12405
12406
12407
12408
12409
12410
12411
12412
12413
12414
12415
12416
12417
12418
12419
12420
12421
12422
12423
12424
12425
12426
12427
12428
12429
12430
12431
12432
12433
12434
12435
12436
12437
12438
12439
12440
12441
12442
12443
12444
12445
12446
12447
12448
12449
12450
12451
12452
12453
12454
12455
12456
12457
12458
12459
12460
12461
12462
12463
12464
12465
12466
12467
12468
12469
12470
12471
12472
12473
12474
12475
12476
12477
12478
12479
12480
12481
12482
12483
12484
12485
12486
12487
12488
12489
12490
12491
12492
12493
12494
12495
12496
12497
12498
12499
12500
12501
12502
12503
12504
12505
12506
12507
12508
12509
12510
12511
12512
12513
12514
12515
12516
12517
12518
12519
12520
12521
12522
12523
12524
12525
12526
12527
12528
12529
12530
12531
12532
12533
12534
12535
12536
12537
12538
12539
12540
12541
12542
12543
12544
12545
12546
12547
12548
12549
12550
12551
12552
12553
12554
12555
12556
12557
12558
12559
12560
12561
12562
12563
12564
12565
12566
12567
12568
12569
12570
12571
12572
12573
12574
12575
12576
12577
12578
12579
12580
12581
12582
12583
12584
12585
12586
12587
12588
12589
12590
12591
12592
12593
12594
12595
12596
12597
12598
12599
12600
12601
12602
12603
12604
12605
12606
12607
12608
12609
12610
12611
12612
12613
12614
12615
12616
12617
12618
12619
12620
12621
12622
12623
12624
12625
12626
12627
12628
12629
12630
12631
12632
12633
12634
12635
12636
12637
12638
12639
12640
12641
12642
12643
12644
12645
12646
12647
12648
12649
12650
12651
12652
12653
12654
12655
12656
12657
12658
12659
12660
12661
12662
12663
12664
12665
12666
12667
12668
12669
12670
12671
12672
12673
12674
12675
12676
12677
12678
12679
12680
12681
12682
12683
12684
12685
12686
12687
12688
12689
12690
12691
12692
12693
12694
12695
12696
12697
12698
12699
12700
12701
12702
12703
12704
12705
12706
12707
12708
12709
12710
12711
12712
12713
12714
12715
12716
12717
12718
12719
12720
12721
12722
12723
12724
12725
12726
12727
12728
12729
12730
12731
12732
12733
12734
12735
12736
12737
12738
12739
12740
12741
12742
12743
12744
12745
12746
12747
12748
12749
12750
12751
12752
12753
12754
12755
12756
12757
12758
12759
12760
12761
12762
12763
12764
12765
12766
12767
12768
12769
12770
12771
12772
12773
12774
12775
12776
12777
12778
12779
12780
12781
12782
12783
12784
12785
12786
12787
12788
12789
12790
12791
12792
12793
12794
12795
12796
12797
12798
12799
12800
12801
12802
12803
12804
12805
12806
12807
12808
12809
12810
12811
12812
12813
12814
12815
12816
12817
12818
12819
12820
12821
12822
12823
12824
12825
12826
12827
12828
12829
12830
12831
12832
12833
12834
12835
12836
12837
12838
12839
12840
12841
12842
12843
12844
12845
12846
12847
12848
12849
12850
12851
12852
12853
12854
12855
12856
12857
12858
12859
12860
12861
12862
12863
12864
12865
12866
12867
12868
12869
12870
12871
12872
12873
12874
12875
12876
12877
12878
12879
12880
12881
12882
12883
12884
12885
12886
12887
12888
12889
12890
12891
12892
12893
12894
12895
12896
12897
12898
12899
12900
12901
12902
12903
12904
12905
12906
12907
12908
12909
12910
12911
12912
12913
12914
12915
12916
12917
12918
12919
12920
12921
12922
12923
12924
12925
12926
12927
12928
12929
12930
12931
12932
12933
12934
12935
12936
12937
12938
12939
12940
12941
12942
12943
12944
12945
12946
12947
12948
12949
12950
12951
12952
12953
12954
12955
12956
12957
12958
12959
12960
12961
12962
12963
12964
12965
12966
12967
12968
12969
12970
12971
12972
12973
12974
12975
12976
12977
12978
12979
12980
12981
12982
12983
12984
12985
12986
12987
12988
12989
12990
12991
12992
12993
12994
12995
12996
12997
12998
12999
13000
13001
13002
13003
13004
13005
13006
13007
13008
13009
13010
13011
13012
13013
13014
13015
13016
13017
13018
13019
13020
13021
13022
13023
13024
13025
13026
13027
13028
13029
13030
13031
13032
13033
13034
13035
13036
13037
13038
13039
13040
13041
13042
13043
13044
13045
13046
13047
13048
13049
13050
13051
13052
13053
13054
13055
13056
13057
13058
13059
13060
13061
13062
13063
13064
13065
13066
13067
13068
13069
13070
13071
13072
13073
13074
13075
13076
13077
13078
13079
13080
13081
13082
13083
13084
13085
13086
13087
13088
13089
13090
13091
13092
13093
13094
13095
13096
13097
13098
13099
13100
13101
13102
13103
13104
13105
13106
13107
13108
13109
13110
13111
13112
13113
13114
13115
13116
13117
13118
13119
13120
13121
13122
13123
13124
13125
13126
13127
13128
13129
13130
13131
13132
13133
13134
13135
13136
13137
13138
13139
13140
13141
13142
13143
13144
13145
13146
13147
13148
13149
13150
13151
13152
13153
13154
13155
13156
13157
13158
13159
13160
13161
13162
13163
13164
13165
13166
13167
13168
13169
13170
13171
13172
13173
13174
13175
13176
13177
13178
13179
13180
13181
13182
13183
13184
13185
13186
13187
13188
13189
13190
13191
13192
13193
13194
13195
13196
13197
13198
13199
13200
13201
13202
13203
13204
13205
13206
13207
13208
13209
13210
13211
13212
13213
13214
13215
13216
13217
13218
13219
13220
13221
13222
13223
13224
13225
13226
13227
13228
13229
13230
13231
13232
13233
13234
13235
13236
13237
13238
13239
13240
13241
13242
13243
13244
13245
13246
13247
13248
13249
13250
13251
13252
13253
13254
13255
13256
13257
13258
13259
13260
13261
13262
13263
13264
13265
13266
13267
13268
13269
13270
13271
13272
13273
13274
13275
13276
13277
13278
13279
13280
13281
13282
13283
13284
13285
13286
13287
13288
13289
13290
13291
13292
13293
13294
13295
13296
13297
13298
13299
13300
13301
13302
13303
13304
13305
13306
13307
13308
13309
13310
13311
13312
13313
13314
13315
13316
13317
13318
13319
13320
13321
13322
13323
13324
13325
13326
13327
13328
13329
13330
13331
13332
13333
13334
13335
13336
13337
13338
13339
13340
13341
13342
13343
13344
13345
13346
13347
13348
13349
13350
13351
13352
13353
13354
13355
13356
13357
13358
13359
13360
13361
13362
13363
13364
13365
13366
13367
13368
13369
13370
13371
13372
13373
13374
13375
13376
13377
13378
13379
13380
13381
13382
13383
13384
13385
13386
13387
13388
13389
13390
13391
13392
13393
13394
13395
13396
13397
13398
13399
13400
13401
13402
13403
13404
13405
13406
13407
13408
13409
13410
13411
13412
13413
13414
13415
13416
13417
13418
13419
13420
13421
13422
13423
13424
13425
13426
13427
13428
13429
13430
13431
13432
13433
13434
13435
13436
13437
13438
13439
13440
13441
13442
13443
13444
13445
13446
13447
13448
13449
13450
13451
13452
13453
13454
13455
13456
13457
13458
13459
13460
13461
13462
13463
13464
13465
13466
13467
13468
13469
13470
13471
13472
13473
13474
13475
13476
13477
13478
13479
13480
13481
13482
13483
13484
13485
13486
13487
13488
13489
13490
13491
13492
13493
13494
13495
13496
13497
13498
13499
13500
13501
13502
13503
13504
13505
13506
13507
13508
13509
13510
13511
13512
13513
13514
13515
13516
13517
13518
13519
13520
13521
13522
13523
13524
13525
13526
13527
13528
13529
13530
13531
13532
13533
13534
13535
13536
13537
13538
13539
13540
13541
13542
13543
13544
13545
13546
13547
13548
13549
13550
13551
13552
13553
13554
13555
13556
13557
13558
13559
13560
13561
13562
13563
13564
13565
13566
13567
13568
13569
13570
13571
13572
13573
13574
13575
13576
13577
13578
13579
13580
13581
13582
13583
13584
13585
13586
13587
13588
13589
13590
13591
13592
13593
13594
13595
13596
13597
13598
13599
13600
13601
13602
13603
13604
13605
13606
13607
13608
13609
13610
13611
13612
13613
13614
13615
13616
13617
13618
13619
13620
13621
13622
13623
13624
13625
13626
13627
13628
13629
13630
13631
13632
13633
13634
13635
13636
13637
13638
13639
13640
13641
13642
13643
13644
13645
13646
13647
13648
13649
13650
13651
13652
13653
13654
13655
13656
13657
13658
13659
13660
13661
13662
13663
13664
13665
13666
13667
13668
13669
13670
13671
13672
13673
13674
13675
13676
13677
13678
13679
13680
13681
13682
13683
13684
13685
13686
13687
13688
13689
13690
13691
13692
13693
13694
13695
13696
13697
13698
13699
13700
13701
13702
13703
13704
13705
13706
13707
13708
13709
13710
13711
13712
13713
13714
13715
13716
13717
13718
13719
13720
13721
13722
13723
13724
13725
13726
13727
13728
13729
13730
13731
13732
13733
13734
13735
13736
13737
13738
13739
13740
13741
13742
13743
13744
13745
13746
13747
13748
13749
13750
13751
13752
13753
13754
13755
13756
13757
13758
13759
13760
13761
13762
13763
13764
13765
13766
13767
13768
13769
13770
13771
13772
13773
13774
13775
13776
13777
13778
13779
13780
13781
13782
13783
13784
13785
13786
13787
13788
13789
13790
13791
13792
13793
13794
13795
13796
13797
13798
13799
13800
13801
13802
13803
13804
13805
13806
13807
13808
13809
13810
13811
13812
13813
13814
13815
13816
13817
13818
13819
13820
13821
13822
13823
13824
13825
13826
13827
13828
13829
13830
13831
13832
13833
13834
13835
13836
13837
13838
13839
13840
13841
13842
13843
13844
13845
13846
13847
13848
13849
13850
13851
13852
13853
13854
13855
13856
13857
13858
13859
13860
13861
13862
13863
13864
13865
13866
13867
13868
13869
13870
13871
13872
13873
13874
13875
13876
13877
13878
13879
13880
13881
13882
13883
13884
13885
13886
13887
13888
13889
13890
13891
13892
13893
13894
13895
13896
13897
13898
13899
13900
13901
13902
13903
13904
13905
13906
13907
13908
13909
13910
13911
13912
13913
13914
13915
13916
13917
13918
13919
13920
13921
13922
13923
13924
13925
13926
13927
13928
13929
13930
13931
13932
13933
13934
13935
13936
13937
13938
13939
13940
13941
13942
13943
13944
13945
13946
13947
13948
13949
13950
13951
13952
13953
13954
13955
13956
13957
13958
13959
13960
13961
13962
13963
13964
13965
13966
13967
13968
13969
13970
13971
13972
13973
13974
13975
13976
13977
13978
13979
13980
13981
13982
13983
13984
13985
13986
13987
13988
13989
13990
13991
13992
13993
13994
13995
13996
13997
13998
13999
14000
14001
14002
14003
14004
14005
14006
14007
14008
14009
14010
14011
14012
14013
14014
14015
14016
14017
14018
14019
14020
14021
14022
14023
14024
14025
14026
14027
14028
14029
14030
14031
14032
14033
14034
14035
14036
14037
14038
14039
14040
14041
14042
14043
14044
14045
14046
14047
14048
14049
14050
14051
14052
14053
14054
14055
14056
14057
14058
14059
14060
14061
14062
14063
14064
14065
14066
14067
14068
14069
14070
14071
14072
14073
14074
14075
14076
14077
14078
14079
14080
14081
14082
14083
14084
14085
14086
14087
14088
14089
14090
14091
14092
14093
14094
14095
14096
14097
14098
14099
14100
14101
14102
14103
14104
14105
14106
14107
14108
14109
14110
14111
14112
14113
14114
14115
14116
14117
14118
14119
14120
14121
14122
14123
14124
14125
14126
14127
14128
14129
14130
14131
14132
14133
14134
14135
14136
14137
14138
14139
14140
14141
14142
14143
14144
14145
14146
14147
14148
14149
14150
14151
14152
14153
14154
14155
14156
14157
14158
14159
14160
14161
14162
14163
14164
14165
14166
14167
14168
14169
14170
14171
14172
14173
14174
14175
14176
14177
14178
14179
14180
14181
14182
14183
14184
14185
14186
14187
14188
14189
14190
14191
14192
14193
14194
14195
14196
14197
14198
14199
14200
14201
14202
14203
14204
14205
14206
14207
14208
14209
14210
14211
14212
14213
14214
14215
14216
14217
14218
14219
14220
14221
14222
14223
14224
14225
14226
14227
14228
14229
14230
14231
14232
14233
14234
14235
14236
14237
14238
14239
14240
14241
14242
14243
14244
14245
14246
14247
14248
14249
14250
14251
14252
14253
14254
14255
14256
14257
14258
14259
14260
14261
14262
14263
14264
14265
14266
14267
14268
14269
14270
14271
14272
14273
14274
14275
14276
14277
14278
14279
14280
14281
14282
14283
14284
14285
14286
14287
14288
14289
14290
14291
14292
14293
14294
14295
14296
14297
14298
14299
14300
14301
14302
14303
14304
14305
14306
14307
14308
14309
14310
14311
14312
14313
14314
14315
14316
14317
14318
14319
14320
14321
14322
14323
14324
14325
14326
14327
14328
14329
14330
14331
14332
14333
14334
14335
14336
14337
14338
14339
14340
14341
14342
14343
14344
14345
14346
14347
14348
14349
14350
14351
14352
14353
14354
14355
14356
14357
14358
14359
14360
14361
14362
14363
14364
14365
14366
14367
14368
14369
14370
14371
14372
14373
14374
14375
14376
14377
14378
14379
14380
14381
14382
14383
14384
14385
14386
14387
14388
14389
14390
14391
14392
14393
14394
14395
14396
14397
14398
14399
14400
14401
14402
14403
14404
14405
14406
14407
14408
14409
14410
14411
14412
14413
14414
14415
14416
14417
14418
14419
14420
14421
14422
14423
14424
14425
14426
14427
14428
14429
14430
14431
14432
14433
14434
14435
14436
14437
14438
14439
14440
14441
14442
14443
14444
14445
14446
14447
14448
14449
14450
14451
14452
14453
14454
14455
14456
14457
14458
14459
14460
14461
14462
14463
14464
14465
14466
14467
14468
14469
14470
14471
14472
14473
14474
14475
14476
14477
14478
14479
14480
14481
14482
14483
14484
14485
14486
14487
14488
14489
14490
14491
14492
14493
14494
14495
14496
14497
14498
14499
14500
14501
14502
14503
14504
14505
14506
14507
14508
14509
14510
14511
14512
14513
14514
14515
14516
14517
14518
14519
14520
14521
14522
14523
14524
14525
14526
14527
14528
14529
14530
14531
14532
14533
14534
14535
14536
14537
14538
14539
14540
14541
14542
14543
14544
14545
14546
14547
14548
14549
14550
14551
14552
14553
14554
14555
14556
14557
14558
14559
14560
14561
14562
14563
14564
14565
14566
14567
14568
14569
14570
14571
14572
14573
14574
14575
14576
14577
14578
14579
14580
14581
14582
14583
14584
14585
14586
14587
14588
14589
14590
14591
14592
14593
14594
14595
14596
14597
14598
14599
14600
14601
14602
14603
14604
14605
14606
14607
14608
14609
14610
14611
14612
14613
14614
14615
14616
14617
14618
14619
14620
14621
14622
14623
14624
14625
14626
14627
14628
14629
14630
14631
14632
14633
14634
14635
14636
14637
14638
14639
14640
14641
14642
14643
14644
14645
14646
14647
14648
14649
14650
14651
14652
14653
14654
14655
14656
14657
14658
14659
14660
14661
14662
14663
14664
14665
14666
14667
14668
14669
14670
14671
14672
14673
14674
14675
14676
14677
14678
14679
14680
14681
14682
14683
14684
14685
14686
14687
14688
14689
14690
14691
14692
14693
14694
14695
14696
14697
14698
14699
14700
14701
14702
14703
14704
14705
14706
14707
14708
14709
14710
14711
14712
14713
14714
14715
14716
14717
14718
14719
14720
14721
14722
14723
14724
14725
14726
14727
14728
14729
14730
14731
14732
14733
14734
14735
14736
14737
14738
14739
14740
14741
14742
14743
14744
14745
14746
14747
14748
14749
14750
14751
14752
14753
14754
14755
14756
14757
14758
14759
14760
14761
14762
14763
14764
14765
14766
14767
14768
14769
14770
14771
14772
14773
14774
14775
14776
14777
14778
14779
14780
14781
14782
14783
14784
14785
14786
14787
14788
14789
14790
14791
14792
14793
14794
14795
14796
14797
14798
14799
14800
14801
14802
14803
14804
14805
14806
14807
14808
14809
14810
14811
14812
14813
14814
14815
14816
14817
14818
14819
14820
14821
14822
14823
14824
14825
14826
14827
14828
14829
14830
14831
14832
14833
14834
14835
14836
14837
14838
14839
14840
14841
14842
14843
14844
14845
14846
14847
14848
14849
14850
14851
14852
14853
14854
14855
14856
14857
14858
14859
14860
14861
14862
14863
14864
14865
14866
14867
14868
14869
14870
14871
14872
14873
14874
14875
14876
14877
14878
14879
14880
14881
14882
14883
14884
14885
14886
14887
14888
14889
14890
14891
14892
14893
14894
14895
14896
14897
14898
14899
14900
14901
14902
14903
14904
14905
14906
14907
14908
14909
14910
14911
14912
14913
14914
14915
14916
14917
14918
14919
14920
14921
14922
14923
14924
14925
14926
14927
14928
14929
14930
14931
14932
14933
14934
14935
14936
14937
14938
14939
14940
14941
14942
14943
14944
14945
14946
14947
14948
14949
14950
14951
14952
14953
14954
14955
14956
14957
14958
14959
14960
14961
14962
14963
14964
14965
14966
14967
14968
14969
14970
14971
14972
14973
14974
14975
14976
14977
14978
14979
14980
14981
14982
14983
14984
14985
14986
14987
14988
14989
14990
14991
14992
14993
14994
14995
14996
14997
14998
14999
15000
15001
15002
15003
15004
15005
15006
15007
15008
15009
15010
15011
15012
15013
15014
15015
15016
15017
15018
15019
15020
15021
15022
15023
15024
15025
15026
15027
15028
15029
15030
15031
15032
15033
15034
15035
15036
15037
15038
15039
15040
15041
15042
15043
15044
15045
15046
15047
15048
15049
15050
15051
15052
15053
15054
15055
15056
15057
15058
15059
15060
15061
15062
15063
15064
15065
15066
15067
15068
15069
15070
15071
15072
15073
15074
15075
15076
15077
15078
15079
15080
15081
15082
15083
15084
15085
15086
15087
15088
15089
15090
15091
15092
15093
15094
15095
15096
15097
15098
15099
15100
15101
15102
15103
15104
15105
15106
15107
15108
15109
15110
15111
15112
15113
15114
15115
15116
15117
15118
15119
15120
15121
15122
15123
15124
15125
15126
15127
15128
15129
15130
15131
15132
15133
15134
15135
15136
15137
15138
15139
15140
15141
15142
15143
15144
15145
15146
15147
15148
15149
15150
15151
15152
15153
15154
15155
15156
15157
15158
15159
15160
15161
15162
15163
15164
15165
15166
15167
15168
15169
15170
15171
15172
15173
15174
15175
15176
15177
15178
15179
15180
15181
15182
15183
15184
15185
15186
15187
15188
15189
15190
15191
15192
15193
15194
15195
15196
15197
15198
15199
15200
15201
15202
15203
15204
15205
15206
15207
15208
15209
15210
15211
15212
15213
15214
15215
15216
15217
15218
15219
15220
15221
15222
15223
15224
15225
15226
15227
15228
15229
15230
15231
15232
15233
15234
15235
15236
15237
15238
15239
15240
15241
15242
15243
15244
15245
15246
15247
15248
15249
15250
15251
15252
15253
15254
15255
15256
15257
15258
15259
15260
15261
15262
15263
15264
15265
15266
15267
15268
15269
15270
15271
15272
15273
15274
15275
15276
15277
15278
15279
15280
15281
15282
15283
15284
15285
15286
15287
15288
15289
15290
15291
15292
15293
15294
15295
15296
15297
15298
15299
15300
15301
15302
15303
15304
15305
15306
15307
15308
15309
15310
15311
15312
15313
15314
15315
15316
15317
15318
15319
15320
15321
15322
15323
15324
15325
15326
15327
15328
15329
15330
15331
15332
15333
15334
15335
15336
15337
15338
15339
15340
15341
15342
15343
15344
15345
15346
15347
15348
15349
15350
15351
15352
15353
15354
15355
15356
15357
15358
15359
15360
15361
15362
15363
15364
15365
15366
15367
15368
15369
15370
15371
15372
15373
15374
15375
15376
15377
15378
15379
15380
15381
15382
15383
15384
15385
15386
15387
15388
15389
15390
15391
15392
15393
15394
15395
15396
15397
15398
15399
15400
15401
15402
15403
15404
15405
15406
15407
15408
15409
15410
15411
15412
15413
15414
15415
15416
15417
15418
15419
15420
15421
15422
15423
15424
15425
15426
15427
15428
15429
15430
15431
15432
15433
15434
15435
15436
15437
15438
15439
15440
15441
15442
15443
15444
15445
15446
15447
15448
15449
15450
15451
15452
15453
15454
15455
15456
15457
15458
15459
15460
15461
15462
15463
15464
15465
15466
15467
15468
15469
15470
15471
15472
15473
15474
15475
15476
15477
15478
15479
15480
15481
15482
15483
15484
15485
15486
15487
15488
15489
15490
15491
15492
15493
15494
15495
15496
15497
15498
15499
15500
15501
15502
15503
15504
15505
15506
15507
15508
15509
15510
15511
15512
15513
15514
15515
15516
15517
15518
15519
15520
15521
15522
15523
15524
15525
15526
15527
15528
15529
15530
15531
15532
15533
15534
15535
15536
15537
15538
15539
15540
15541
15542
15543
15544
15545
15546
15547
15548
15549
15550
15551
15552
15553
15554
15555
15556
15557
15558
15559
15560
15561
15562
15563
15564
15565
15566
15567
15568
15569
15570
15571
15572
15573
15574
15575
15576
15577
15578
15579
15580
15581
15582
15583
15584
15585
15586
15587
15588
15589
15590
15591
15592
15593
15594
15595
15596
15597
15598
15599
15600
15601
15602
15603
15604
15605
15606
15607
15608
15609
15610
15611
15612
15613
15614
15615
15616
15617
15618
15619
15620
15621
15622
15623
15624
15625
15626
15627
15628
15629
15630
15631
15632
15633
15634
15635
15636
15637
15638
15639
15640
15641
15642
15643
15644
15645
15646
15647
15648
15649
15650
15651
15652
15653
15654
15655
15656
15657
15658
15659
15660
15661
15662
15663
15664
15665
15666
15667
15668
15669
15670
15671
15672
15673
15674
15675
15676
15677
15678
15679
15680
15681
15682
15683
15684
15685
15686
15687
15688
15689
15690
15691
15692
15693
15694
15695
15696
15697
15698
15699
15700
15701
15702
15703
15704
15705
15706
15707
15708
15709
15710
15711
15712
15713
15714
15715
15716
15717
15718
15719
15720
15721
15722
15723
15724
15725
15726
15727
15728
15729
15730
15731
15732
15733
15734
15735
15736
15737
15738
15739
15740
15741
15742
15743
15744
15745
15746
15747
15748
15749
15750
15751
15752
15753
15754
15755
15756
15757
15758
15759
15760
15761
15762
15763
15764
15765
15766
15767
15768
15769
15770
15771
15772
15773
15774
15775
15776
15777
15778
15779
15780
15781
15782
15783
15784
15785
15786
15787
15788
15789
15790
15791
15792
15793
15794
15795
15796
15797
15798
15799
15800
15801
15802
15803
15804
15805
15806
15807
15808
15809
15810
15811
15812
15813
15814
15815
15816
15817
15818
15819
15820
15821
15822
15823
15824
15825
15826
15827
15828
15829
15830
15831
15832
15833
15834
15835
15836
15837
15838
15839
15840
15841
15842
15843
15844
15845
15846
15847
15848
15849
15850
15851
15852
15853
15854
15855
15856
15857
15858
15859
15860
15861
15862
15863
15864
15865
15866
15867
15868
15869
15870
15871
15872
15873
15874
15875
15876
15877
15878
15879
15880
15881
15882
15883
15884
15885
15886
15887
15888
15889
15890
15891
15892
15893
15894
15895
15896
15897
15898
15899
15900
15901
15902
15903
15904
15905
15906
15907
15908
15909
15910
15911
15912
15913
15914
15915
15916
15917
15918
15919
15920
15921
15922
15923
15924
15925
15926
15927
15928
15929
15930
15931
15932
15933
15934
15935
15936
15937
15938
15939
15940
15941
15942
15943
15944
15945
15946
15947
15948
15949
15950
15951
15952
15953
15954
15955
15956
15957
15958
15959
15960
15961
15962
15963
15964
15965
15966
15967
15968
15969
15970
15971
15972
15973
15974
15975
15976
15977
15978
15979
15980
15981
15982
15983
15984
15985
15986
15987
15988
15989
15990
15991
15992
15993
15994
15995
15996
15997
15998
15999
16000
16001
16002
16003
16004
16005
16006
16007
16008
16009
16010
16011
16012
16013
16014
16015
16016
16017
16018
16019
16020
16021
16022
16023
16024
16025
16026
16027
16028
16029
16030
16031
16032
16033
16034
16035
16036
16037
16038
16039
16040
16041
16042
16043
16044
16045
16046
16047
16048
16049
16050
16051
16052
16053
16054
16055
16056
16057
16058
16059
16060
16061
16062
16063
16064
16065
16066
16067
16068
16069
16070
16071
16072
16073
16074
16075
16076
16077
16078
16079
16080
16081
16082
16083
16084
16085
16086
16087
16088
16089
16090
16091
16092
16093
16094
16095
16096
16097
16098
16099
16100
16101
16102
16103
16104
16105
16106
16107
16108
16109
16110
16111
16112
16113
16114
16115
16116
16117
16118
16119
16120
16121
16122
16123
16124
16125
16126
16127
16128
16129
16130
16131
16132
16133
16134
16135
16136
16137
16138
16139
16140
16141
16142
16143
16144
16145
16146
16147
16148
16149
16150
16151
16152
16153
16154
16155
16156
16157
16158
16159
16160
16161
16162
16163
16164
16165
16166
16167
16168
16169
16170
16171
16172
16173
16174
16175
16176
16177
16178
16179
16180
16181
16182
16183
16184
16185
16186
16187
16188
16189
16190
16191
16192
16193
16194
16195
16196
16197
16198
16199
16200
16201
16202
16203
16204
16205
16206
16207
16208
16209
16210
16211
16212
16213
16214
16215
16216
16217
16218
16219
16220
16221
16222
16223
16224
16225
16226
16227
16228
16229
16230
16231
16232
16233
16234
16235
16236
16237
16238
16239
16240
16241
16242
16243
16244
16245
16246
16247
16248
16249
16250
16251
16252
16253
16254
16255
16256
16257
16258
16259
16260
16261
16262
16263
16264
16265
16266
16267
16268
16269
16270
16271
16272
16273
16274
16275
16276
16277
16278
16279
16280
16281
16282
16283
16284
16285
16286
16287
16288
16289
16290
16291
16292
16293
16294
16295
16296
16297
16298
16299
16300
16301
16302
16303
16304
16305
16306
16307
16308
16309
16310
16311
16312
16313
16314
16315
16316
16317
16318
16319
16320
16321
16322
16323
16324
16325
16326
16327
16328
16329
16330
16331
16332
16333
16334
16335
16336
16337
16338
16339
16340
16341
16342
16343
16344
16345
16346
16347
16348
16349
16350
16351
16352
16353
16354
16355
16356
16357
16358
16359
16360
16361
16362
16363
16364
16365
16366
16367
16368
16369
16370
16371
16372
16373
16374
16375
16376
16377
16378
16379
16380
16381
16382
16383
16384
16385
16386
16387
16388
16389
16390
16391
16392
16393
16394
16395
16396
16397
16398
16399
16400
16401
16402
16403
16404
16405
16406
16407
16408
16409
16410
16411
16412
16413
16414
16415
16416
16417
16418
16419
16420
16421
16422
16423
16424
16425
16426
16427
16428
16429
16430
16431
16432
16433
16434
16435
16436
16437
16438
16439
16440
16441
16442
16443
16444
16445
16446
16447
16448
16449
16450
16451
16452
16453
16454
16455
16456
16457
16458
16459
16460
16461
16462
16463
16464
16465
16466
16467
16468
16469
16470
16471
16472
16473
16474
16475
16476
16477
16478
16479
16480
16481
16482
16483
16484
16485
16486
16487
16488
16489
16490
16491
16492
16493
16494
16495
16496
16497
16498
16499
16500
16501
16502
16503
16504
16505
16506
16507
16508
16509
16510
16511
16512
16513
16514
16515
16516
16517
16518
16519
16520
16521
16522
16523
16524
16525
16526
16527
16528
16529
16530
16531
16532
16533
16534
16535
16536
16537
16538
16539
16540
16541
16542
16543
16544
16545
16546
16547
16548
16549
16550
16551
16552
16553
16554
16555
16556
16557
16558
16559
16560
16561
16562
16563
16564
16565
16566
16567
16568
16569
16570
16571
16572
16573
16574
16575
16576
16577
16578
16579
16580
16581
16582
16583
16584
16585
16586
16587
16588
16589
16590
16591
16592
16593
16594
16595
16596
16597
16598
16599
16600
16601
16602
16603
16604
16605
16606
16607
16608
16609
16610
16611
16612
16613
16614
16615
16616
16617
16618
16619
16620
16621
16622
16623
16624
16625
16626
16627
16628
16629
16630
16631
16632
16633
16634
16635
16636
16637
16638
16639
16640
16641
16642
16643
16644
16645
16646
16647
16648
16649
16650
16651
16652
16653
16654
16655
16656
16657
16658
16659
16660
16661
16662
16663
16664
16665
16666
16667
16668
16669
16670
16671
16672
16673
16674
16675
16676
16677
16678
16679
16680
16681
16682
16683
16684
16685
16686
16687
16688
16689
16690
16691
16692
16693
16694
16695
16696
16697
16698
16699
16700
16701
16702
16703
16704
16705
16706
16707
16708
16709
16710
16711
16712
16713
16714
16715
16716
16717
16718
16719
16720
16721
16722
16723
16724
16725
16726
16727
16728
16729
16730
16731
16732
16733
16734
16735
16736
16737
16738
16739
16740
16741
16742
16743
16744
16745
16746
16747
16748
16749
16750
16751
16752
16753
16754
16755
16756
16757
16758
16759
16760
16761
16762
16763
16764
16765
16766
16767
16768
16769
16770
16771
16772
16773
16774
16775
16776
16777
16778
16779
16780
16781
16782
16783
16784
16785
16786
16787
16788
16789
16790
16791
16792
16793
16794
16795
16796
16797
16798
16799
16800
16801
16802
16803
16804
16805
16806
16807
16808
16809
16810
16811
16812
16813
16814
16815
16816
16817
16818
16819
16820
16821
16822
16823
16824
16825
16826
16827
16828
16829
16830
16831
16832
16833
16834
16835
16836
16837
16838
16839
16840
16841
16842
16843
16844
16845
16846
16847
16848
16849
16850
16851
16852
16853
16854
16855
16856
16857
16858
16859
16860
16861
16862
16863
16864
16865
16866
16867
16868
16869
16870
16871
16872
16873
16874
16875
16876
16877
16878
16879
16880
16881
16882
16883
16884
16885
16886
16887
16888
16889
16890
16891
16892
16893
16894
16895
16896
16897
16898
16899
16900
16901
16902
16903
16904
16905
16906
16907
16908
16909
16910
16911
16912
16913
16914
16915
16916
16917
16918
16919
16920
16921
16922
16923
16924
16925
16926
16927
16928
16929
16930
16931
16932
16933
16934
16935
16936
16937
16938
16939
16940
16941
16942
16943
16944
16945
16946
16947
16948
16949
16950
16951
16952
16953
16954
16955
16956
16957
16958
16959
16960
16961
16962
16963
16964
16965
16966
16967
16968
16969
16970
16971
16972
16973
16974
16975
16976
16977
16978
16979
16980
16981
16982
16983
16984
16985
16986
16987
16988
16989
16990
16991
16992
16993
16994
16995
16996
16997
16998
16999
17000
17001
17002
17003
17004
17005
17006
17007
17008
17009
17010
17011
17012
17013
17014
17015
17016
17017
17018
17019
17020
17021
17022
17023
17024
17025
17026
17027
17028
17029
17030
17031
17032
17033
17034
17035
17036
17037
17038
17039
17040
17041
17042
17043
17044
17045
17046
17047
17048
17049
17050
17051
17052
17053
17054
17055
17056
17057
17058
17059
17060
17061
17062
17063
17064
17065
17066
17067
17068
17069
17070
17071
17072
17073
17074
17075
17076
17077
17078
17079
17080
17081
17082
17083
17084
17085
17086
17087
17088
17089
17090
17091
17092
17093
17094
17095
17096
17097
17098
17099
17100
17101
17102
17103
17104
17105
17106
17107
17108
17109
17110
17111
17112
17113
17114
17115
17116
17117
17118
17119
17120
17121
17122
17123
17124
17125
17126
17127
17128
17129
17130
17131
17132
17133
17134
17135
17136
17137
17138
17139
17140
17141
17142
17143
17144
17145
17146
17147
17148
17149
17150
17151
17152
17153
17154
17155
17156
17157
17158
17159
17160
17161
17162
17163
17164
17165
17166
17167
17168
17169
17170
17171
17172
17173
17174
17175
17176
17177
17178
17179
17180
17181
17182
17183
17184
17185
17186
17187
17188
17189
17190
17191
17192
17193
17194
17195
17196
17197
17198
17199
17200
17201
17202
17203
17204
17205
17206
17207
17208
17209
17210
17211
17212
17213
17214
17215
17216
17217
17218
17219
17220
17221
17222
17223
17224
17225
17226
17227
17228
17229
17230
17231
17232
17233
17234
17235
17236
17237
17238
17239
17240
17241
17242
17243
17244
17245
17246
17247
17248
17249
17250
17251
17252
17253
17254
17255
17256
17257
17258
17259
17260
17261
17262
17263
17264
17265
17266
17267
17268
17269
17270
17271
17272
17273
17274
17275
17276
17277
17278
17279
17280
17281
17282
17283
17284
17285
17286
17287
17288
17289
17290
17291
17292
17293
17294
17295
17296
17297
17298
17299
17300
17301
17302
17303
17304
17305
17306
17307
17308
17309
17310
17311
17312
17313
17314
17315
17316
17317
17318
17319
17320
17321
17322
17323
17324
17325
17326
17327
17328
17329
17330
17331
17332
17333
17334
17335
17336
17337
17338
17339
17340
17341
17342
17343
17344
17345
17346
17347
17348
17349
17350
17351
17352
17353
17354
17355
17356
17357
17358
17359
17360
17361
17362
17363
17364
17365
17366
17367
17368
17369
17370
17371
17372
17373
17374
17375
17376
17377
17378
17379
17380
17381
17382
17383
17384
17385
17386
17387
17388
17389
17390
17391
17392
17393
17394
17395
17396
17397
17398
17399
17400
17401
17402
17403
17404
17405
17406
17407
17408
17409
17410
17411
17412
17413
17414
17415
17416
17417
17418
17419
17420
17421
17422
17423
17424
17425
17426
17427
17428
17429
17430
17431
17432
17433
17434
17435
17436
17437
17438
17439
17440
17441
17442
17443
17444
17445
17446
17447
17448
17449
17450
17451
17452
17453
17454
17455
17456
17457
17458
17459
17460
17461
17462
17463
17464
17465
17466
17467
17468
17469
17470
17471
17472
17473
17474
17475
17476
17477
17478
17479
17480
17481
17482
17483
17484
17485
17486
17487
17488
17489
17490
17491
17492
17493
17494
17495
17496
17497
17498
17499
17500
17501
17502
17503
17504
17505
17506
17507
17508
17509
17510
17511
17512
17513
17514
17515
17516
17517
17518
17519
17520
17521
17522
17523
17524
17525
17526
17527
17528
17529
17530
17531
17532
17533
17534
17535
17536
17537
17538
17539
17540
17541
17542
17543
17544
17545
17546
17547
17548
17549
17550
17551
17552
17553
17554
17555
17556
17557
17558
17559
17560
17561
17562
17563
17564
17565
17566
17567
17568
17569
17570
17571
17572
17573
17574
17575
17576
17577
17578
17579
17580
17581
17582
17583
17584
17585
17586
17587
17588
17589
17590
17591
17592
17593
17594
17595
17596
17597
17598
17599
17600
17601
17602
17603
17604
17605
17606
17607
17608
17609
17610
17611
17612
17613
17614
17615
17616
17617
17618
17619
17620
17621
17622
17623
17624
17625
17626
17627
17628
17629
17630
17631
17632
17633
17634
17635
17636
17637
17638
17639
17640
17641
17642
17643
17644
17645
17646
17647
17648
17649
17650
17651
17652
17653
17654
17655
17656
17657
17658
17659
17660
17661
17662
17663
17664
17665
17666
17667
17668
17669
17670
17671
17672
17673
17674
17675
17676
17677
17678
17679
17680
17681
17682
17683
17684
17685
17686
17687
17688
17689
17690
17691
17692
17693
17694
17695
17696
17697
17698
17699
17700
17701
17702
17703
17704
17705
17706
17707
17708
17709
17710
17711
17712
17713
17714
17715
17716
17717
17718
17719
17720
17721
17722
17723
17724
17725
17726
17727
17728
17729
17730
17731
17732
17733
17734
17735
17736
17737
17738
17739
17740
17741
17742
17743
17744
17745
17746
17747
17748
17749
17750
17751
17752
17753
17754
17755
17756
17757
17758
17759
17760
17761
17762
17763
17764
17765
17766
17767
17768
17769
17770
17771
17772
17773
17774
17775
17776
17777
17778
17779
17780
17781
17782
17783
17784
17785
17786
17787
17788
17789
17790
17791
17792
17793
17794
17795
17796
17797
17798
17799
17800
17801
17802
17803
17804
17805
17806
17807
17808
17809
17810
17811
17812
17813
17814
17815
17816
17817
17818
17819
17820
17821
17822
17823
17824
17825
17826
17827
17828
17829
17830
17831
17832
17833
17834
17835
17836
17837
17838
17839
17840
17841
17842
17843
17844
17845
17846
17847
17848
17849
17850
17851
17852
17853
17854
17855
17856
17857
17858
17859
17860
17861
17862
17863
17864
17865
17866
17867
17868
17869
17870
17871
17872
17873
17874
17875
17876
17877
17878
17879
17880
17881
17882
17883
17884
17885
17886
17887
17888
17889
17890
17891
17892
17893
17894
17895
17896
17897
17898
17899
17900
17901
17902
17903
17904
17905
17906
17907
17908
17909
17910
17911
17912
17913
17914
17915
17916
17917
17918
17919
17920
17921
17922
17923
17924
17925
17926
17927
17928
17929
17930
17931
17932
17933
17934
17935
17936
17937
17938
17939
17940
17941
17942
17943
17944
17945
17946
17947
17948
17949
17950
17951
17952
17953
17954
17955
17956
17957
17958
17959
17960
17961
17962
17963
17964
17965
17966
17967
17968
17969
17970
17971
17972
17973
17974
17975
17976
17977
17978
17979
17980
17981
17982
17983
17984
17985
17986
17987
17988
17989
17990
17991
17992
17993
17994
17995
17996
17997
17998
17999
18000
18001
18002
18003
18004
18005
18006
18007
18008
18009
18010
18011
18012
18013
18014
18015
18016
18017
18018
18019
18020
18021
18022
18023
18024
18025
18026
18027
18028
18029
18030
18031
18032
18033
18034
18035
18036
18037
18038
18039
18040
18041
18042
18043
18044
18045
18046
18047
18048
18049
18050
18051
18052
18053
18054
18055
18056
18057
18058
18059
18060
18061
18062
18063
18064
18065
18066
18067
18068
18069
18070
18071
18072
18073
18074
18075
18076
18077
18078
18079
18080
18081
18082
18083
18084
18085
18086
18087
18088
18089
18090
18091
18092
18093
18094
18095
18096
18097
18098
18099
18100
18101
18102
18103
18104
18105
18106
18107
18108
18109
18110
18111
18112
18113
18114
18115
18116
18117
18118
18119
18120
18121
18122
18123
18124
18125
18126
18127
18128
18129
18130
18131
18132
18133
18134
18135
18136
18137
18138
18139
18140
18141
18142
18143
18144
18145
18146
18147
18148
18149
18150
18151
18152
18153
18154
18155
18156
18157
18158
18159
18160
18161
18162
18163
18164
18165
18166
18167
18168
18169
18170
18171
18172
18173
18174
18175
18176
18177
18178
18179
18180
18181
18182
18183
18184
18185
18186
18187
18188
18189
18190
18191
18192
18193
18194
18195
18196
18197
18198
18199
18200
18201
18202
18203
18204
18205
18206
18207
18208
18209
18210
18211
18212
18213
18214
18215
18216
18217
18218
18219
18220
18221
18222
18223
18224
18225
18226
18227
18228
18229
18230
18231
18232
18233
18234
18235
18236
18237
18238
18239
18240
18241
18242
18243
18244
18245
18246
18247
18248
18249
18250
18251
18252
18253
18254
18255
18256
18257
18258
18259
18260
18261
18262
18263
18264
18265
18266
18267
18268
18269
18270
18271
18272
18273
18274
18275
18276
18277
18278
18279
18280
18281
18282
18283
18284
18285
18286
18287
18288
18289
18290
18291
18292
18293
18294
18295
18296
18297
18298
18299
18300
18301
18302
18303
18304
18305
18306
18307
18308
18309
18310
18311
18312
18313
18314
18315
18316
18317
18318
18319
18320
18321
18322
18323
18324
18325
18326
18327
18328
18329
18330
18331
18332
18333
18334
18335
18336
18337
18338
18339
18340
18341
18342
18343
18344
18345
18346
18347
18348
18349
18350
18351
18352
18353
18354
18355
18356
18357
18358
18359
18360
18361
18362
18363
18364
18365
18366
18367
18368
18369
18370
18371
18372
18373
18374
18375
18376
18377
18378
18379
18380
18381
18382
18383
18384
18385
18386
18387
18388
18389
18390
18391
18392
18393
18394
18395
18396
18397
18398
18399
18400
18401
18402
18403
18404
18405
18406
18407
18408
18409
18410
18411
18412
18413
18414
18415
18416
18417
18418
18419
18420
18421
18422
18423
18424
18425
18426
18427
18428
18429
18430
18431
18432
18433
18434
18435
18436
18437
18438
18439
18440
18441
18442
18443
18444
18445
18446
18447
18448
18449
18450
18451
18452
18453
18454
18455
18456
18457
18458
18459
18460
18461
18462
18463
18464
18465
18466
18467
18468
18469
18470
18471
18472
18473
18474
18475
18476
18477
18478
18479
18480
18481
18482
18483
18484
18485
18486
18487
18488
18489
18490
18491
18492
18493
18494
18495
18496
18497
18498
18499
18500
18501
18502
18503
18504
18505
18506
18507
18508
18509
18510
18511
18512
18513
18514
18515
18516
18517
18518
18519
18520
18521
18522
18523
18524
18525
18526
18527
18528
18529
18530
18531
18532
18533
18534
18535
18536
18537
18538
18539
18540
18541
18542
18543
18544
18545
18546
18547
18548
18549
18550
18551
18552
18553
18554
18555
18556
18557
18558
18559
18560
18561
18562
18563
18564
18565
18566
18567
18568
18569
18570
18571
18572
18573
18574
18575
18576
18577
18578
18579
18580
18581
18582
18583
18584
18585
18586
18587
18588
18589
18590
18591
18592
18593
18594
18595
18596
18597
18598
18599
18600
18601
18602
18603
18604
18605
18606
18607
18608
18609
18610
18611
18612
18613
18614
18615
18616
18617
18618
18619
18620
18621
18622
18623
18624
18625
18626
18627
18628
18629
18630
18631
18632
18633
18634
18635
18636
18637
18638
18639
18640
18641
18642
18643
18644
18645
18646
18647
18648
18649
18650
18651
18652
18653
18654
18655
18656
18657
18658
18659
18660
18661
18662
18663
18664
18665
18666
18667
18668
18669
18670
18671
18672
18673
18674
18675
18676
18677
18678
18679
18680
18681
18682
18683
18684
18685
18686
18687
18688
18689
18690
18691
18692
18693
18694
18695
18696
18697
18698
18699
18700
18701
18702
18703
18704
18705
18706
18707
18708
18709
18710
18711
18712
18713
18714
18715
18716
18717
18718
18719
18720
18721
18722
18723
18724
18725
18726
18727
18728
18729
18730
18731
18732
18733
18734
18735
18736
18737
18738
18739
18740
18741
18742
18743
18744
18745
18746
18747
18748
18749
18750
18751
18752
18753
18754
18755
18756
18757
18758
18759
18760
18761
18762
18763
18764
18765
18766
18767
18768
18769
18770
18771
18772
18773
18774
18775
18776
18777
18778
18779
18780
18781
18782
18783
18784
18785
18786
18787
18788
18789
18790
18791
18792
18793
18794
18795
18796
18797
18798
18799
18800
18801
18802
18803
18804
18805
18806
18807
18808
18809
18810
18811
18812
18813
18814
18815
18816
18817
18818
18819
18820
18821
18822
18823
18824
18825
18826
18827
18828
18829
18830
18831
18832
18833
18834
18835
18836
18837
18838
18839
18840
18841
18842
18843
18844
18845
18846
18847
18848
18849
18850
18851
18852
18853
18854
18855
18856
18857
18858
18859
18860
========================================================================
RELEASED 2.0.0b11-2016

------------------------------------------------------------------------
r4067 | jkbonfield | 2016-04-20 12:04:17 +0100 (Wed, 20 Apr 2016) | 2 lines
Changed paths:
   M /staden/trunk/src/eba/conf.c

Due to io_lib changes, change from min() to MIN().

------------------------------------------------------------------------
r4065 | jkbonfield | 2016-04-19 14:56:02 +0100 (Tue, 19 Apr 2016) | 7 lines
Changed paths:
   M /staden/trunk/src/README.build

Fixed io_lib version number needed.

This may not be absolutely correct (no doubt a few versions before is
also fine), but for certain it doesn't work with the stated version
number and I don't have time to exhaustively check which version is
new enough.

------------------------------------------------------------------------
r4058 | jkbonfield | 2016-03-24 10:26:12 +0000 (Thu, 24 Mar 2016) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/interval_tree.c

Interval_tree and interval_node no longer have typedef twice.
This tripped up early gcc versions (4.4 is fine, 4.1 is not).

Bug reported by Martin Mokrejs.

------------------------------------------------------------------------
r4045 | jkbonfield | 2016-03-21 12:49:04 +0000 (Mon, 21 Mar 2016) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/gap5_cmd.tcl

Fixed broken commit r3930 in gap5_cmd.tcl.  This caused a syntax error.

------------------------------------------------------------------------
r4021 | jkbonfield | 2016-02-23 14:40:25 +0000 (Tue, 23 Feb 2016) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_contig.c
   M /staden/trunk/src/gap5/tg_contig.h
   M /staden/trunk/src/gap5/tg_tcl.c

Fixed tcl_read_depth call to actually compute the depth rather than
use the unfinished tracks.

Added copy_refpos function to C and Tcl.  At present these are unused,
but being present in Tcl means we can use these during debugging or
experimentation within the Tcl console.

------------------------------------------------------------------------
r4020 | jkbonfield | 2016-02-23 12:37:49 +0000 (Tue, 23 Feb 2016) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/ace.c
   M /staden/trunk/src/gap5/baf.c
   M /staden/trunk/src/gap5/fasta.c
   M /staden/trunk/src/gap5/import_gff.c
   M /staden/trunk/src/gap5/tg_index.c
   M /staden/trunk/src/gap5/tg_index_common.c
   D /staden/trunk/src/gap5/zfio.c
   D /staden/trunk/src/gap5/zfio.h

Removed zfio.c in favour of io_lib's copy.

------------------------------------------------------------------------
r4016 | jkbonfield | 2016-02-22 11:43:26 +0000 (Mon, 22 Feb 2016) | 4 lines
Changed paths:
   M /staden/trunk/src/copy_reads/copy_reads.c
   M /staden/trunk/src/gap5/do_fij.c
   M /staden/trunk/src/gap5/tg_index.c
   M /staden/trunk/src/primer3/src/ntdpal_main.c
   M /staden/trunk/src/primer3/src/primer3_lib.c

Applied Debian spelling patch:

https://anonscm.debian.org/viewvc/debian-med/trunk/packages/staden/trunk/debian/patches/spelling.patch?revision=21433&view=markup

------------------------------------------------------------------------
r4015 | jkbonfield | 2016-02-22 11:33:20 +0000 (Mon, 22 Feb 2016) | 6 lines
Changed paths:
   M /staden/trunk/src/gap4/gap-error.c
   M /staden/trunk/src/gap4/show_relationships.c
   M /staden/trunk/src/system.mk.in

Applied debian hardening patch:

https://anonscm.debian.org/viewvc/debian-med/trunk/packages/staden/trunk/debian/patches/hardening.patch?revision=16751&view=markup
https://anonscm.debian.org/viewvc/debian-med/trunk/packages/staden/trunk/debian/patches/hardening_format-security.patch?revision=15859&view=markup


------------------------------------------------------------------------
r4014 | jkbonfield | 2016-02-22 11:29:21 +0000 (Mon, 22 Feb 2016) | 4 lines
Changed paths:
   M /staden/trunk/src/gap4/contig_editor.tcl

Fix to cope with newer window managers.

The contig editor should no longer appear at zero height.

------------------------------------------------------------------------
r4002 | jkbonfield | 2016-02-03 18:08:33 +0000 (Wed, 03 Feb 2016) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/consen.tcl
   M /staden/trunk/src/gap5/contig_id.tcl

Fixed a bug where using the contig selector or contig list to fill out a contig name in a dialogue box, without then doing anything else at all except hitting OK in that dialogue, could cause the contig name validity check to fail.

------------------------------------------------------------------------
r3999 | daviesrob | 2016-01-25 10:20:34 +0000 (Mon, 25 Jan 2016) | 12 lines
Changed paths:
   M /staden/trunk/src/gap5/Makefile
   M /staden/trunk/src/gap5/auto_break.c
   M /staden/trunk/src/gap5/break_contig.c
   M /staden/trunk/src/gap5/consensus.c
   M /staden/trunk/src/gap5/contig_extend.c
   M /staden/trunk/src/gap5/dis_readings.c
   M /staden/trunk/src/gap5/do_fij.c
   M /staden/trunk/src/gap5/editor_join.c
   M /staden/trunk/src/gap5/export_contigs.c
   M /staden/trunk/src/gap5/export_snps.c
   M /staden/trunk/src/gap5/fij.c
   M /staden/trunk/src/gap5/find_haplotypes.c
   M /staden/trunk/src/gap5/gap_canvas_box.c
   M /staden/trunk/src/gap5/interval_tree.c
   M /staden/trunk/src/gap5/interval_tree.h
   M /staden/trunk/src/gap5/newgap5_cmds.c
   M /staden/trunk/src/gap5/sam_index.c
   M /staden/trunk/src/gap5/shuffle_pads.c
   M /staden/trunk/src/gap5/str_finder.c
   M /staden/trunk/src/gap5/tag_plot.c
   M /staden/trunk/src/gap5/template_display.c
   M /staden/trunk/src/gap5/tg_bin.c
   M /staden/trunk/src/gap5/tg_contig.c
   M /staden/trunk/src/gap5/tg_iface_g.c
   M /staden/trunk/src/gap5/tg_tcl.c
   M /staden/trunk/src/gap5/tman_interface.c

Fix some compiler warnings.

Mainly unused variables, plus a couple of missing prototypes.  Includes
two bug fixes:

  join_move_bins now returns non-zero on error.

  sam_export_seq could calculate the wrong index bin number when exporting
  bam if the contig started at position <= 0 dut to the offset being added
  to the sequence end position twice.


------------------------------------------------------------------------
r3998 | daviesrob | 2016-01-20 12:08:13 +0000 (Wed, 20 Jan 2016) | 5 lines
Changed paths:
   A /staden/trunk/src/gap5/replay_log.tcl

Add basic script to allow replaying of events in gap5 log files.

Incomplete, but good enough for tracking down bugs with pair_rec updates
and shuffle_pads.

------------------------------------------------------------------------
r3997 | daviesrob | 2016-01-19 16:41:51 +0000 (Tue, 19 Jan 2016) | 15 lines
Changed paths:
   M /staden/trunk/src/gap5/shuffle_pads.c
   M /staden/trunk/src/gap5/tg_sequence.c

Prevent use of uninitialised values in shuffle_pads.

validate_clip_regions goes through a list of annotation record numbers
that is passed in to it.  It's possible that the annotations have been
removed beforehand, so it needs to check the result of anno_get_position
to ensure that it has set start, end and crec.

Possibly related:  Ensure that sequence_set_left, sequence_set_right
sequence_set_left_no_invalidate and sequence_set_right_no_invalidate
do not set a clip point that is outside the extents of the sequence.
It's unclear if this can be made to happen in normal use of the
contig editor, but it did happen when tracking down the problem in
validate_clip_regions.


------------------------------------------------------------------------
r3996 | daviesrob | 2016-01-19 14:14:48 +0000 (Tue, 19 Jan 2016) | 42 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/editor_view.c
   M /staden/trunk/src/gap5/list_proc.tcl
   M /staden/trunk/src/gap5/tg_bin.c
   M /staden/trunk/src/gap5/tg_cache.c
   M /staden/trunk/src/gap5/tg_gio.c
   M /staden/trunk/src/gap5/tg_gio.h
   M /staden/trunk/src/gap5/tg_sequence.c
   M /staden/trunk/src/gap5/tg_sequence.h
   M /staden/trunk/src/gap5/tg_tcl.c

Fix bin corruption caused by updates to read pairs spanning two contigs.

Updating information on read pairs could lead to bin records being updated
differently in two or more child IOs.  This could cause database corruption
when the child IOs were flushed and the bin data overwritten.

The data being updated were the cached location of read pairs, and pair_rec
which is a pointer to the other read in a pair.  The location information
is fixed by simply not updating it on the paired read (it was only being
invalidated, anyway).  This is safe as sequence_get_range_pair_position
includes sufficient checks to ensure that the information is still valid.

Updates to pair_rec on the paired read are no longer made while editing
but instead deferred until cache_flush is called.  At this point the
changes are applied by new function apply_pair_rec_updates in tg_cache.c.
This function updates any bins affected both in the base IO and also in
child IOs, so all copies of the data should be consistent.  gio_child
and gio_close are updated to maintain a linked list of child IOs to allow
apply_pair_rec_updates to iterate through all of the children.

Between an edit being made and 'save' being pressed, there is a problem
with pair_rec possibly pointing to an unmapped read.  Some other changes
have been made to deal with this possibility:

  * sequence_cmd gains a 'get_mapped' function to allow TCL to check
    for unmapped reads.

  * The contig_editor tcl function was using the base IO to get sequences
    when the -reading or -reading2 options were used.  This was incorrect,
    it now uses the child IO instead.  It also checks that the sequences
    are mapped.

  * sequence_get_pair checks that the paired read is mapped.

  * edSetCursorPos to a sequence position checks that the sequence is mapped.

  * ListEditMultiUpdate ignores unmapped sequences.

It's likely that more edge cases remain, but the changes above fix the ones
seen so far.


------------------------------------------------------------------------
r3959 | jkbonfield | 2015-09-24 17:34:52 +0100 (Thu, 24 Sep 2015) | 14 lines
Changed paths:
   M /staden/trunk/src/gap5/assemble_single.tcl
   M /staden/trunk/src/gap5/fasta.c
   M /staden/trunk/src/gap5/newgap5_cmds.c
   M /staden/trunk/src/gap5/sam_index.c
   M /staden/trunk/src/gap5/tg_index.c
   M /staden/trunk/src/gap5/tg_index.h

Added a default quality to use for bases without quality. This defaults to 3
and is used by fasta and SAM without qual. (Maybe there are other formats to
do.)
In the GUI this is now controllable via an additional entry box.

In the C code, this is -ve to indicate a *default* value and positive to
indicate an override value, used for fastq only at present.  This permits
us to import a fasta/fastq set of consensus sequences and forcibly set
confidence high (even to 100, forcing consensus) or low as desired
irrespective of what the actual fastq qualities claim.  Useful for
manipulating consenusii.

(jkb)

------------------------------------------------------------------------
r3934 | jkbonfield | 2015-07-02 17:06:58 +0100 (Thu, 02 Jul 2015) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_utils.c

Fixed u72intw with the same fix that appears to already be in
s72intw.  When decoding a value > 31bits it wrapped around to become
negative as the shift operator is applying on int and not int64_t.

------------------------------------------------------------------------
r3931 | jkbonfield | 2015-07-02 12:13:10 +0100 (Thu, 02 Jul 2015) | 2 lines
Changed paths:
   M /staden/trunk/src/Makefile.in

Fixed a missing dependency, causing parallel makes to sometimes fail.

------------------------------------------------------------------------
r3930 | jkbonfield | 2015-07-02 12:09:18 +0100 (Thu, 02 Jul 2015) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/gap5_cmd.tcl
   M /staden/trunk/src/gap5/newgap5_cmds.c

Revert accidental commit of shuffle pads changes in the last commit.
These introduced compilation errors due to a partial update.

------------------------------------------------------------------------
r3925 | jkbonfield | 2015-06-04 11:27:40 +0100 (Thu, 04 Jun 2015) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/find_haplotypes.c
   M /staden/trunk/src/gap5/find_haplotypes.h
   M /staden/trunk/src/gap5/gap5_cmd.tcl
   M /staden/trunk/src/gap5/newgap5_cmds.c
   M /staden/trunk/src/gap5/newgap_structs.h
   M /staden/trunk/src/gap5/tg_contig.c

Fixed Find Haplotypes left/right settings when faced with inconsistent
data.

Also made it so that the various parameters are adjustable.

------------------------------------------------------------------------
r3921 | jkbonfield | 2015-05-29 12:07:41 +0100 (Fri, 29 May 2015) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/depth.tcl
   M /staden/trunk/src/gap5/gap5rc

Fixed the template display auto-scrolling. It wasn't taking into
account the contig start location when computing the scrollbar
position.

Also made the margins for when to scroll and how much by adjustable in
the gap5rc.

------------------------------------------------------------------------
r3831 | jkbonfield | 2015-02-23 16:52:09 +0000 (Mon, 23 Feb 2015) | 10 lines
Changed paths:
   M /staden/trunk/src/gap5/cs-object.h
   M /staden/trunk/src/gap5/fij.c

Auto-join now honours the -min_overlap and -max_overlap parameters.

This is important for cases where we have two very long contigs (L1,
L2) both overlapping a short contig S.
We find the two short matches (L1/S and L2/S) and probably didn't even
attempt to detect L1/L2 overlap due to -max_overlap.  After
automatically joining L1+S however we then have L1+S / L2 due to
inheriting the overlaps during merging.  We now recheck max_overlap
before each and every alignment.

------------------------------------------------------------------------
r3830 | jkbonfield | 2015-02-23 11:44:09 +0000 (Mon, 23 Feb 2015) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl

Removal of debugging output

------------------------------------------------------------------------
r3829 | jkbonfield | 2015-02-23 11:28:48 +0000 (Mon, 23 Feb 2015) | 3 lines
Changed paths:
   M /staden/trunk/src/Misc/Makefile
   M /staden/trunk/src/abi/Makefile
   M /staden/trunk/src/alf/Makefile
   M /staden/trunk/src/convert/Makefile
   M /staden/trunk/src/copy_reads/Makefile
   M /staden/trunk/src/eba/Makefile
   M /staden/trunk/src/find_renz/Makefile
   M /staden/trunk/src/g/Makefile
   M /staden/trunk/src/gap4/Makefile
   M /staden/trunk/src/get_scf_field/Makefile
   M /staden/trunk/src/global.mk
   M /staden/trunk/src/haplo/Makefile
   M /staden/trunk/src/init_exp/Makefile
   M /staden/trunk/src/make_weights/Makefile
   M /staden/trunk/src/mutlib/Makefile
   M /staden/trunk/src/polyA_clip/Makefile
   M /staden/trunk/src/prefinish/Makefile
   M /staden/trunk/src/qclip/Makefile
   M /staden/trunk/src/screen_seq/Makefile
   M /staden/trunk/src/seq_utils/Makefile
   M /staden/trunk/src/spin/Makefile
   M /staden/trunk/src/stops/Makefile
   M /staden/trunk/src/text_utils/Makefile
   M /staden/trunk/src/tk_utils/Makefile
   M /staden/trunk/src/tracediff/Makefile
   M /staden/trunk/src/vector_clip/Makefile

Fixed an issue in "make depend" not working in all cases.
Reran to update our local Makefiles.

------------------------------------------------------------------------
r3828 | jkbonfield | 2015-02-23 11:25:53 +0000 (Mon, 23 Feb 2015) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/find_haplotypes.c

Fixed minor compiler warning.

------------------------------------------------------------------------
r3827 | jkbonfield | 2015-02-23 11:25:32 +0000 (Mon, 23 Feb 2015) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/Makefile

Added interval_tree to Makefile.
(Also minor updates caused by make depend)

------------------------------------------------------------------------
r3826 | jkbonfield | 2015-02-20 17:52:19 +0000 (Fri, 20 Feb 2015) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl

Allow for dotter -q NUM -s NUM

------------------------------------------------------------------------
r3825 | jkbonfield | 2015-02-20 16:28:00 +0000 (Fri, 20 Feb 2015) | 8 lines
Changed paths:
   M /staden/trunk/src/gap5/find_haplotypes.c
   A /staden/trunk/src/gap5/interval_tree.c
   A /staden/trunk/src/gap5/interval_tree.h

Find Haplotypes revamp.
- Read pairs are now considered.
- Better merging of haplotype strings. Instead of aggressive merging
at time of collation, we only early-merge exact dups and then merge by
frequency after the full data has been gathered.

Also added an interval tree implementation (used in the new haplotype code).

------------------------------------------------------------------------
r3824 | jkbonfield | 2015-02-20 16:25:25 +0000 (Fri, 20 Feb 2015) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/consensus.c

Improved the consensus discrepancy score by taking into account a
per-base difference rather than joining all together.

------------------------------------------------------------------------
r3823 | jkbonfield | 2015-02-18 17:42:58 +0000 (Wed, 18 Feb 2015) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/tk_utils/init.tcl

Added a <<control-menu>> binding to the contig editor so that it is
considered as a power-click, asking for more dialogue if appropriate.
Ie it is considered the same as using the main menu bar.

For now this only controls read selection and realignment.

------------------------------------------------------------------------
r3822 | jkbonfield | 2015-02-18 17:32:13 +0000 (Wed, 18 Feb 2015) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl

Fixed end range in Realign Selection dialogue.

------------------------------------------------------------------------
r3821 | jkbonfield | 2015-02-18 17:29:48 +0000 (Wed, 18 Feb 2015) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/gap5rc

The Realign Selection option now brings up a user interface if invoked
from the main menu, but not when right clicked via the popup menu.

------------------------------------------------------------------------
r3820 | jkbonfield | 2015-02-17 15:16:36 +0000 (Tue, 17 Feb 2015) | 10 lines
Changed paths:
   M /staden/trunk/src/gap5/shuffle_pads.c
   M /staden/trunk/src/gap5/shuffle_pads.h

Fixed rewrite_soft_clips so it doesn't treat clips that fall partially
outside the current start..end sub-range as scoring 0. This was
causing it to falsely accept some clips.

Fixed a bug in the main loop which chunks the contig into sections.
It now tracks the number of pads added during update_io so it can
validate the soft-clips over the now extended region.  Previously some
reads at the end of the region were not validated if we introduced a
lot of pads.

------------------------------------------------------------------------
r3819 | jkbonfield | 2015-02-17 12:38:31 +0000 (Tue, 17 Feb 2015) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/check_assembly.c

Improved the Show Information output to include the read name, making
it easier to compare two databases.

------------------------------------------------------------------------
r3818 | jkbonfield | 2015-02-17 12:37:43 +0000 (Tue, 17 Feb 2015) | 2 lines
Changed paths:
   M /staden/trunk/src/Misc/array.c
   M /staden/trunk/src/Misc/array.h

Added ArrayConcat() function.

------------------------------------------------------------------------
r3812 | jkbonfield | 2015-02-05 12:42:36 +0000 (Thu, 05 Feb 2015) | 3 lines
Changed paths:
   M /staden/trunk/src/seq_utils/align_lib.c

Minor tweak to get_malign_counts() to persuade any non-N base to be
counted. This avoids issues with sequences full of N.

------------------------------------------------------------------------
r3811 | jkbonfield | 2015-02-05 12:39:26 +0000 (Thu, 05 Feb 2015) | 9 lines
Changed paths:
   M /staden/trunk/src/gap5/gap5rc
   M /staden/trunk/src/gap5/newgap5_cmds.c
   M /staden/trunk/src/gap5/newgap_structs.h
   M /staden/trunk/src/gap5/shuffle_pads.c
   M /staden/trunk/src/gap5/shuffle_pads.tcl

Fixed a bug where we could realign data that we had previously
realigned in an earlier chunk, but against less depth. This caused
misalignments.

We now skip data previously aligned, but it has to be included in the
malign->contigl struct still for the fresh data to align against.

Also added a maximum number of passes field to the GUI.

------------------------------------------------------------------------
r3788 | jkbonfield | 2015-01-14 16:31:34 +0000 (Wed, 14 Jan 2015) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/sam_index.c

Fixed a bug in the tg_index -g mode where it erroneously added extra
columns of pads to the contig if an incoming sequence has an insertion
1 base after a pre-existing gap in the consensus.

------------------------------------------------------------------------
r3787 | jkbonfield | 2015-01-14 16:30:21 +0000 (Wed, 14 Jan 2015) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_sequence.c
   M /staden/trunk/src/seq_utils/dna_utils.c
   M /staden/trunk/src/seq_utils/dna_utils.h

Removed the complementary_base[] and initialisation functions from
tg_sequence.c and exported the version from seq_utils lib.  The
seq_utils copy is now also statically initialised without needed to
call the set_dna_lookup() function so we cannot accidentally forget to
initialise it.

------------------------------------------------------------------------
r3786 | jkbonfield | 2015-01-13 14:39:15 +0000 (Tue, 13 Jan 2015) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_sequence.c

Added a complementary_base_init function to build the
complementary_base[] array and then use this in more places than the
one function it came from.

This fixes a bug with tg_index -a -g not working due to an
complementary_base[] being unset during sequence_insert_bases() call.

------------------------------------------------------------------------
r3778 | daviesrob | 2015-01-06 11:29:22 +0000 (Tue, 06 Jan 2015) | 14 lines
Changed paths:
   M /staden/trunk/src/gap5/quality_plot.c

Fix rounding error in qplot_redraw which triggered an assertion failure.

Inverted the xzoom factor (xz) so that the x coordinate in the plot can
be worked out by multiplying by xz instead of dividing.  This seems to
fix a rounding error that could make the x position go out of bounds
when zoomed out a long way.  Multiplying should also be slightly faster.

In a belt-and-braces approach, also allocated the xs array one bigger
than strictly necessary so any remaining rounding errors shouldn't cause
a problem.  The assertions on x are adjusted to reflect this.

Only one of the xp and xs arrays is used, depending on the value of xz.  So
now only the one that is needed gets allocated.

------------------------------------------------------------------------
r3772 | jkbonfield | 2014-12-15 10:18:27 +0000 (Mon, 15 Dec 2014) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/g-alloc.c

Updated the list of known record types in the debug HeapChecker tool.

------------------------------------------------------------------------
r3767 | jkbonfield | 2014-11-14 11:20:17 +0000 (Fri, 14 Nov 2014) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl

The list size is now shown in the contig editor, giving an indication
of how many fragments are in each haplotype.

------------------------------------------------------------------------
r3766 | jkbonfield | 2014-11-14 10:27:27 +0000 (Fri, 14 Nov 2014) | 13 lines
Changed paths:
   M /staden/trunk/src/gap5/find_haplotypes.c

Reduced complexity in haplotype_str_add(). With long sections this can
become over 100x less cpu, and growing more.  It is still a linear
scan though so needs futher optimisation yet, using a tree instead to
find snp overlaps.

Also amended it to consider sites with too many discrepancies rather
than pure consensus SNP call.

Finally, added a minimum count of 2 seqs to filter most of the
singleton haplotypes. The minimum count figure isn't yet user
adjustable, but should be made so before this becomes production
ready.

------------------------------------------------------------------------
r3765 | jkbonfield | 2014-11-14 10:25:31 +0000 (Fri, 14 Nov 2014) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/tk-io-reg.c

Improve error messages.

------------------------------------------------------------------------
r3764 | jkbonfield | 2014-11-11 12:32:11 +0000 (Tue, 11 Nov 2014) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_view.c

Changed highlight disagreements for cutoff data to always show in
foreground instead of background (if selected), so it is more easily
distinguishable.

------------------------------------------------------------------------
r3762 | jkbonfield | 2014-11-03 09:47:27 +0000 (Mon, 03 Nov 2014) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/gap5_cmd.tcl

Fix typo in the trim command, causing it to fail.

------------------------------------------------------------------------
r3761 | jkbonfield | 2014-10-31 14:45:20 +0000 (Fri, 31 Oct 2014) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl

Delete old haplotype_* lists when creating new ones, so as not to
confuse people as to how many haplotypes are present.

------------------------------------------------------------------------
r3760 | jkbonfield | 2014-10-31 14:21:21 +0000 (Fri, 31 Oct 2014) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl

Added the option to view the readings/haplotype lists on the ednames
right click menu.

------------------------------------------------------------------------
r3759 | jkbonfield | 2014-10-31 12:36:37 +0000 (Fri, 31 Oct 2014) | 3 lines
Changed paths:
   M /staden/trunk/src/tk_utils/xcombobox.tcl

The popup listbox from the combobox now shares the width from the
entry box.

------------------------------------------------------------------------
r3758 | jkbonfield | 2014-10-31 11:20:21 +0000 (Fri, 31 Oct 2014) | 9 lines
Changed paths:
   M /staden/trunk/src/gap5/export_contigs.c

Fixed contig_export_sam (used for SAM, BAM and CRAM formats) to be
much faster in excessively deep regions where soft-clipping is being
used.

Gap5 has to convert from coordinates sorted by object start including
soft-clipped bases, to coordinates sorted by first unclipped site
(SAM).  This sorting could become O(N^2) in the worst case, but is now
O(NlogN) - possibly better if soft-clip lengths co-locate.

------------------------------------------------------------------------
r3757 | daviesrob | 2014-10-29 15:32:53 +0000 (Wed, 29 Oct 2014) | 9 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_cache.c

haplo_hash bug fixes.

In cache_dup, ensure that haplo_hash and haplo_timestamp are initialized
when duplicating a contig.  This prevents a dangling pointer from being left
in the parent if haplo_hash is freed in the child.

In cache_flush, ensure that haplo_hash is freed from the parent where
necessary when flushing a contig block.

------------------------------------------------------------------------
r3756 | jkbonfield | 2014-10-29 15:13:29 +0000 (Wed, 29 Oct 2014) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_check.c

Fixed a crash when being unable to load an annotation.

------------------------------------------------------------------------
r3755 | jkbonfield | 2014-10-29 15:12:42 +0000 (Wed, 29 Oct 2014) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/Makefile

Removed zfio.[ch] as these have been in io_lib for some time and
causes compilation problems if attempting to link against a static
build of io_lib.

------------------------------------------------------------------------
r3754 | jkbonfield | 2014-10-21 17:24:22 +0100 (Tue, 21 Oct 2014) | 9 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_contig.c

Rewrote the fix for r->end - r->start + 1 == ABS(s->len).  Previously
I modified s->len, but this breaks all sorts of other things, most
notably it makes s->conf - s->seq not equal to s->len, then leading to
broken confidence values and also to sequence insertion possibly
calling memmove off the end of the buffer. (Oddly not detected by
valgrind.)

We now fix the far more likely error; r->end instead.

------------------------------------------------------------------------
r3753 | jkbonfield | 2014-10-17 17:01:49 +0100 (Fri, 17 Oct 2014) | 16 lines
Changed paths:
   M /staden/trunk/src/gap5/consensus.c

Work around for a bug where some bins are not covered by child
bins. Ie:

:-----------------------------------: Parent

                      :-------------: Left
           :------------------------: Right

I don't know what causes this yet, but it makes
calculate_consensus_simple sometiems find very large bins (the parent)
on which to compute the cached consensus, taking a lot of time.  For
now we simply reject an attempt to compute a very long cached
consensus as it is probably not the write thing to do.

(This really needs a total rewrite.)

------------------------------------------------------------------------
r3752 | jkbonfield | 2014-10-17 16:43:05 +0100 (Fri, 17 Oct 2014) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_contig.c

Removal of debugging info.

------------------------------------------------------------------------
r3751 | jkbonfield | 2014-10-16 17:40:58 +0100 (Thu, 16 Oct 2014) | 13 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_contig.c

Made contig_insert_base2() more robust with respect to corrupted data
or other sources of errors.

Previously it just bailed out of the recursion, leaving a half
inserted column. This is complicated to deal with and often turns a
small problem into a bigger problem.

Now it boldly carries on regardless, completing as much as it can,
before then returning -1 to the calling function to indicate the
failure.  Ideally the calling function would execute this in a child
io so it can be backed out of to revert the change, but in the absence
of this we have at least maintained consistency where able.

------------------------------------------------------------------------
r3750 | jkbonfield | 2014-10-16 16:48:56 +0100 (Thu, 16 Oct 2014) | 13 lines
Changed paths:
   M /staden/trunk/src/gap5/Makefile
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/dis_readings.tcl
   M /staden/trunk/src/gap5/editor_view.c
   A /staden/trunk/src/gap5/find_haplotypes.c
   A /staden/trunk/src/gap5/find_haplotypes.h
   M /staden/trunk/src/gap5/gap5rc_menu_full
   M /staden/trunk/src/gap5/list_proc.tcl
   M /staden/trunk/src/gap5/newgap5_cmds.c
   M /staden/trunk/src/gap5/tclIndex
   M /staden/trunk/src/gap5/tg_cache.c
   M /staden/trunk/src/gap5/tg_contig.c
   M /staden/trunk/src/gap5/tg_iface_g.c
   M /staden/trunk/src/gap5/tg_struct.h
   M /staden/trunk/src/gap5/tkEditor.c
   M /staden/trunk/src/gap5/tkEditor.h

First draft of a new haplotype finder.  It replaces the Sort By
Sequence mode in the contig editor as well as generating lists of read
IDs per haplotype and creating a master "haplotypes" list of lists.

Disassemble readings now knows how to handle list of lists, so that it
disassembles each sub-list into its own set of contigs.

There is more to do on this to tidy it up: handling read-pairs,
optimising it for larger contigs, improving the consensus algorithm to
label more things as SNPs by avoiding the dominance of depth.  However
it's a good starting point and users are already wanting to use it so
we'll see how it goes in the current state.

------------------------------------------------------------------------
r3749 | jkbonfield | 2014-10-13 12:38:17 +0100 (Mon, 13 Oct 2014) | 9 lines
Changed paths:
   A /staden/trunk/src/tk_utils/func_edit.tcl
   M /staden/trunk/src/tk_utils/tclIndex

A new debugging tool: func_edit

From the console (type "con" into the Gap5 Error window) you will be
able to type "func_edit UpdateReadingDisplays", for example, to
locally change the function definition without needing to quit and
restart the program.

All changes are temporary.

------------------------------------------------------------------------
r3748 | jkbonfield | 2014-10-07 17:45:30 +0100 (Tue, 07 Oct 2014) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/import_contigs.tcl
   M /staden/trunk/src/gap5/tclIndex

Same fix as previous: Import Reads no longer clears "readings" list.

------------------------------------------------------------------------
r3747 | jkbonfield | 2014-10-07 13:58:37 +0100 (Tue, 07 Oct 2014) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/assemble_single.tcl

Replace the call to PostLoadSetup with a lighter-weight setup, so we
don't clear "readings" list on loading new contigs.

------------------------------------------------------------------------
r3741 | jkbonfield | 2014-09-22 15:13:56 +0100 (Mon, 22 Sep 2014) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/dis_readings.c
   M /staden/trunk/src/gap5/hash_lib.c

More compiler warning removal; this time clang.

------------------------------------------------------------------------
r3740 | jkbonfield | 2014-09-22 14:55:49 +0100 (Mon, 22 Sep 2014) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/actf.c
   M /staden/trunk/src/gap5/auto_break.c
   M /staden/trunk/src/gap5/b+tree2.c
   M /staden/trunk/src/gap5/editor_search.c
   M /staden/trunk/src/gap5/export_contigs.c
   M /staden/trunk/src/gap5/export_snps.c
   M /staden/trunk/src/gap5/fij.c
   M /staden/trunk/src/gap5/g-alloc.c
   M /staden/trunk/src/gap5/qualIO.c
   M /staden/trunk/src/gap5/sam_index.c
   M /staden/trunk/src/gap5/str_finder.c
   M /staden/trunk/src/gap5/tg_iface_g.c
   M /staden/trunk/src/gap5/tg_index_common.c
   M /staden/trunk/src/gap5/tg_library.c
   M /staden/trunk/src/gap5/zfio.c
   M /staden/trunk/src/seq_utils/align_lib.h

Various compiler warnings removed. Most are of the form "variable x
may be used uninitialised" and most of the time it is untrue, however
there are a few legitimate coding errors fixed too.

------------------------------------------------------------------------
r3739 | jkbonfield | 2014-09-22 14:02:43 +0100 (Mon, 22 Sep 2014) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/sam_index.c

Removed append_int as this is now exported from libstaden-read (bam.c).

------------------------------------------------------------------------
r3730 | jkbonfield | 2014-09-11 18:26:02 +0100 (Thu, 11 Sep 2014) | 9 lines
Changed paths:
   M /staden/trunk/src/gap5/shuffle_pads.c

Fixed memory leak and slow down caused by last patch to STR finder
calling.

Added seed_malign_region() to perform a rudimentary screen on the
heterozygous consensus to only request realignment in regions that are
heterozygous in nature.

TODO: Make this an optional 3 way - all regions, all hets, het indel only.

------------------------------------------------------------------------
r3729 | jkbonfield | 2014-09-11 18:07:41 +0100 (Thu, 11 Sep 2014) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/str_finder.c

TEST_MAIN2 version of main() for testing on larger inputs, read from
stdin rather than argv[1] as a string.

------------------------------------------------------------------------
r3727 | jkbonfield | 2014-09-10 17:35:40 +0100 (Wed, 10 Sep 2014) | 10 lines
Changed paths:
   M /staden/trunk/src/gap5/str_finder.c

Fixed the STR finder to not step forward by 'extra' bytes as an
optimisation.  It was causing overlapping repeats to sometimes be
missed by 1 bp. Eg:

$ ./a.out CTAAATAAATAAAC
 2 .. 12 AAATAAATAAA

(Should be 1 .. 12)


------------------------------------------------------------------------
r3726 | jkbonfield | 2014-09-10 16:56:35 +0100 (Wed, 10 Sep 2014) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_tcl.c

Fixed a crash introduced in r3497, triggered when using control-left
or right arrows in the editor to move a sequence location.

------------------------------------------------------------------------
r3725 | jkbonfield | 2014-09-10 11:25:50 +0100 (Wed, 10 Sep 2014) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/str_finder.c

Fixed buffer underrun.

------------------------------------------------------------------------
r3724 | jkbonfield | 2014-09-09 15:29:18 +0100 (Tue, 09 Sep 2014) | 8 lines
Changed paths:
   M /staden/trunk/src/gap5/shuffle_pads.c

Fixed rewrite_soft_clips() to correctly trim when handling overlapping
STRs.  Previously it could reset s->left/right multiple times,
overwriting the result each time, instead of taking the inner-most
union of the values.

Also tidied up the code to not needlessly compute consensus and STRs
on the first pass.

------------------------------------------------------------------------
r3723 | jkbonfield | 2014-09-08 16:24:07 +0100 (Mon, 08 Sep 2014) | 39 lines
Changed paths:
   M /staden/trunk/src/gap5/Makefile
   M /staden/trunk/src/gap5/shuffle_pads.c
   A /staden/trunk/src/gap5/str_finder.c
   A /staden/trunk/src/gap5/str_finder.h
   A /staden/trunk/src/gap5/utlist.h

Added a short tandem read detector. This looks for repeated strings
between 1 and 8 bases long and returns a utlist of start..end ranges.
These may be overlapping in some situations. Eg:

$ ./a.out TGCAGAGCAGAGAGAGGGT
 1 .. 11 GCAGAGCAGAG
 8 .. 15 AGAGAGAG
15 .. 17 GGG

Compile str_finder.c with TEST_MAIN to get a command line tool.

Within Shuffle Pads this is used to identify STRs that overlap a
heterozygous indel region and then in turn to adjust the soft-clipping
of any reads that do not span that region as they cannot be relied
upon to indicate the copy number. Eg:

S1 GATCGGACGAGAG
S2 GATCGGACGAGAGAGAGAGAGT
S3 GATCGGACGAGAGAGAGAG**TCGGAC
S4     GGACGAGAGAGAGAGAGTCGGAC
S5        CGAGAGAGAGAG**TCGGAC
S6              AGAGAGAGTCGGAC

We have subseq of GAGAGAGAGAG** vs GAGAGAGAGAGAG. The first and last
(S1 and S6) sequences do not span and so we do not know which allele they
match. Specifically as the pad is at the right hand end, the alignment of
S6 gives incorrect weight to the consensus as it is stating AG when it
may actually be ** at that point.

By identifying the repeats we can soft clip as follows:

S1 GATCGGACgagag
S2 GATCGGACGAGAGAGAGAGAGT
S3 GATCGGACGAGAGAGAGAG**TCGGAC
S4     GGACGAGAGAGAGAGAGTCGGAC
S5        CGAGAGAGAGAG**TCGGAC
S6              agagagagTCGGAC


------------------------------------------------------------------------
r3722 | jkbonfield | 2014-09-05 15:31:51 +0100 (Fri, 05 Sep 2014) | 8 lines
Changed paths:
   M /staden/trunk/src/gap5/consensus.c

Switched to using older method of handling ONT consensus (based on a
one-liner perl/awk combo).  It just has a single parameter for how
much more likely it is to have overcall vs undercall. This is simple
to understand and more robust.

It corrects issues with the old system, which was causing * in
columns of illumina data to be downweighted too much.

------------------------------------------------------------------------
r3721 | jkbonfield | 2014-09-05 15:29:36 +0100 (Fri, 05 Sep 2014) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/qualIO.c

Bug fixes the insertion/deletion counting in List Base Confidence
(they were reversed). Also updated it to report percentages.

------------------------------------------------------------------------
r3719 | jkbonfield | 2014-09-05 12:01:38 +0100 (Fri, 05 Sep 2014) | 9 lines
Changed paths:
   M /staden/trunk/src/gap5/consensus.c

Changed the simple consensus qualities to be Phred scores instead of
log-odds scores.  This fixes a bug where negative consensus qualities
were appearing in CAF and ACE outputs.

The change also impacts some other code, such as searching for
consensus quality in the editor and fastq outputs, but only at the
very low end as log-odds and phred scales rapidly converge. It is only
very poor quality data that changes.

------------------------------------------------------------------------
r3718 | jkbonfield | 2014-09-01 09:37:22 +0100 (Mon, 01 Sep 2014) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/gap5_cmd.tcl

Added Contig Extend/Trim options to gap5_cmd

------------------------------------------------------------------------
r3717 | jkbonfield | 2014-08-29 15:51:26 +0100 (Fri, 29 Aug 2014) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/configure.tcl
   M /staden/trunk/src/gap5/gap_globals.tcl

Fixed configuring consenus mode when in read only mode.

Fixed using File->Open to swap databases, ensuring it now correctly
sets the default_seq_tech back to Illumina.

------------------------------------------------------------------------
r3716 | jkbonfield | 2014-08-29 15:42:53 +0100 (Fri, 29 Aug 2014) | 30 lines
Changed paths:
   M /staden/trunk/src/gap5/configure.tcl
   M /staden/trunk/src/gap5/gap5.tcl
   M /staden/trunk/src/gap5/gap5_cmd.tcl
   M /staden/trunk/src/gap5/gap5rc_menu_full
   A /staden/trunk/src/gap5/gap_globals.tcl
   M /staden/trunk/src/gap5/ng_fb_cmds.tcl
   M /staden/trunk/src/gap5/tclIndex
   M /staden/trunk/src/gap5/tg_anno.c
   M /staden/trunk/src/gap5/tg_iface_g.c
   M /staden/trunk/src/gap5/tg_struct.h
   M /staden/trunk/src/gap5/tg_tcl.c

Allowed the default_seq_tech parameter to be modified from Gap5 GUI.

To do this required several things.

1) The cached consensus may be incorrect after changing this, so it
has to be purged. 

2) The parameter needs to be remembered in the database itself so it
can be set the next time we open a database.  I tidied up the setting
of default parameters in multiple locations and put them into
gap_globals.tcl.

3) To store an arbitrary variable without modifying the database
format required some lateral thinking. WARNING: ugliness ahead. Those
of a nervous disposition should look away now.

We create an anno_ele object with parent_type of GT_Database; ie an
annotation on the database rather than a contig or sequence. 
A scaffold of name __g5::CONFIG is created whose record number points
to this annotation instead of a scaffold.  The annotation contains
a series of 'set key val' tuples, which are carefully checked for
validty so we don't blindly trust everything.

We can extend this with other __g5::* fields for different types of
data, replacing the old Gap4 "Notes" mechanism as tags attached to a
database are essentially the same thing as notes.

4) Added various C/Tcl interfaces to set and get the config_anno
field.

------------------------------------------------------------------------
r3715 | jkbonfield | 2014-08-29 15:35:02 +0100 (Fri, 29 Aug 2014) | 12 lines
Changed paths:
   M /staden/trunk/src/gap5/consensus.c
   M /staden/trunk/src/gap5/gap_globals.c
   M /staden/trunk/src/gap5/gap_globals.h

Updated the consensus algorithm to cope with different overcall and
undercall probabilities per machine platform, permitting mixing of
different technologies to form a single consensus.

At present these are complete guesses with only a minimal nod to
reality and have no measurements backing them up (yet).  Expect them
to be tuned in the future. However they act as a good proof of
concept.

The Tcl variable default_seq_tech may be modified to change what the
Unknown sequencing tech is treated as.

------------------------------------------------------------------------
r3714 | jkbonfield | 2014-08-28 17:20:08 +0100 (Thu, 28 Aug 2014) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/fasta.c

Fasta data now has a default quality of 3 instead of 0, as this was
causing problems with my experimental consensus algorithm.  It makes
more sense at 3 anyway. Confidence 0 implies it is 100% chance of
being incorrect.

------------------------------------------------------------------------
r3713 | jkbonfield | 2014-08-28 17:19:17 +0100 (Thu, 28 Aug 2014) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/hash_lib.c

Further tweakage of the align_blocks function. This was necessary in
order to get alignments scoring positive when using very weakly
aligning data.

It doesn't seem to overly harm my other tests for Illumina.

------------------------------------------------------------------------
r3712 | jkbonfield | 2014-08-28 17:18:11 +0100 (Thu, 28 Aug 2014) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/sam_index.c

Prevent treatment of confidence 255 ("*" in qual field for BAM) as
confidence -1 (or 255). Instead set it to a minimal confidence of 3.

------------------------------------------------------------------------
r3711 | jkbonfield | 2014-08-26 17:35:51 +0100 (Tue, 26 Aug 2014) | 9 lines
Changed paths:
   M /staden/trunk/src/gap5/depth.tcl

Fixed the mapping quality filter range from 0-80 to 0-255 as we are
seeing data with >80 as mquals.

Fixed the use of TEMPLATE_DISPLAY.SETTINGS_$i library records. These
could be for another database, so it already attempted to blank out
the libraries-list when they don't match up, but it failed to clear
the undo versions causing the filter window to possibly blank the data
when it's invoked.

------------------------------------------------------------------------
r3710 | jkbonfield | 2014-08-26 15:20:32 +0100 (Tue, 26 Aug 2014) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/gap_range.c

Fixed spacing

------------------------------------------------------------------------
r3709 | jkbonfield | 2014-08-26 11:58:00 +0100 (Tue, 26 Aug 2014) | 32 lines
Changed paths:
   M /staden/trunk/src/gap5/libraries.tcl
   M /staden/trunk/src/gap5/sam_index.c
   M /staden/trunk/src/gap5/tg_iface_g.c
   M /staden/trunk/src/gap5/tg_library.c
   M /staden/trunk/src/gap5/tg_library.h
   M /staden/trunk/src/gap5/tg_struct.h
   M /staden/trunk/src/gap5/tg_tcl.c

Further work on read-group machine types.

1) Bug fix to the tg_index process so that it looks up "PL"atform RG
tag correctly.  Previously it was doing something bizarre with
attempting to find the library name as a 2 character key.

2) Changed seq_tech to be an int instead of int:3 in the seq_t struct
as it has 9 possible values now.

3) Changed the on-disk format, which also packs 3 bits, to steal 2
bits from the parent_type field and use these for seq_tech.  This is
backwards compatible as these top bits have always been zero and we've
also never needed more than 7 for seq_tech either.

This limits the available number of GT_* types to 64, but we're only
using 18 at the moment and I don't see us adding that many more table
types to gap5. It gives us up to 32 instrument types.

4) Added set_name and set_machine_type methods to the library tcl
object.

5) The List Libraries window now allows editing of the library name
too, also also saves both this and edits to library machine type.


Note that editing the machine type here does not actually modify all
the sequence structures as the library type has been cached in both
seq and range structures during tg_index. I do not know how to prevent
that in an efficient manner, so for now editing the type is purely for
informational purposes.


------------------------------------------------------------------------
r3708 | jkbonfield | 2014-08-22 17:17:51 +0100 (Fri, 22 Aug 2014) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_view.c
   M /staden/trunk/src/gap5/libraries.tcl
   M /staden/trunk/src/gap5/sam_index.c
   M /staden/trunk/src/gap5/tg_struct.h
   M /staden/trunk/src/tk_utils/xcombobox.tcl

Updated Gap5 to support a richer list of machine platforms in the SAM
@RG tag.

(Ongoing: the platform type can also now be edited, but not yet saved,
in the ListLibraries window.)

------------------------------------------------------------------------
r3707 | jkbonfield | 2014-08-21 09:29:53 +0100 (Thu, 21 Aug 2014) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/export_contigs.c

Removed memory leak in sam_refbased_cigar().

Also removed debugging output from the output GFF function.

------------------------------------------------------------------------
r3706 | jkbonfield | 2014-08-21 09:28:56 +0100 (Thu, 21 Aug 2014) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_contig.c

Removed memory leak in padded_to_reference_array().

------------------------------------------------------------------------
r3705 | jkbonfield | 2014-08-01 14:45:41 +0100 (Fri, 01 Aug 2014) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/Makefile

Added code to provide an export_snps command. This is *PURELY TEST
ONLY*.  It has hard coded names (like "chr20") and has a few bugs too,
but it serves as a useful starting point for if/when we want to do
proper VCF output at some stage.

For now it is not supported by the GUI.

------------------------------------------------------------------------
r3704 | jkbonfield | 2014-08-01 14:45:22 +0100 (Fri, 01 Aug 2014) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/consen.tcl
   A /staden/trunk/src/gap5/export_snps.c
   A /staden/trunk/src/gap5/export_snps.h
   M /staden/trunk/src/gap5/newgap5_cmds.c

Added code to provide an export_snps command. This is *PURELY TEST
ONLY*.  It has hard coded names (like "chr20") and has a few bugs too,
but it serves as a useful starting point for if/when we want to do
proper VCF output at some stage.

For now it is not supported by the GUI.

------------------------------------------------------------------------
r3703 | jkbonfield | 2014-07-31 11:28:25 +0100 (Thu, 31 Jul 2014) | 8 lines
Changed paths:
   M /staden/trunk/src/gap5/check_assembly.c
   M /staden/trunk/src/gap5/fij.c
   M /staden/trunk/src/gap5/find_oligo.c
   M /staden/trunk/src/gap5/find_repeats.c

Fixed the buffer size for the OBJ_GET_BRIEF callback to be 160 instead
of 80. This fixes buffer overruns when dealing with large databases
and long record numbers.

Worked it out on paper the maximum length is around 120 for FIJ, and
a few bytes more for the others (but under 130). Set the new buffer
size to 160.

------------------------------------------------------------------------
r3702 | jkbonfield | 2014-07-16 10:31:55 +0100 (Wed, 16 Jul 2014) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/export_contigs.c

Put back the line of code to output BAM_FPROPER_PAIR flag for reads in
---> <--- paired orientation.

While this isn't strictly correct for all library types, making this
assumption is still usually correct and far better than simply never
setting this flag at all.

------------------------------------------------------------------------
r3701 | jkbonfield | 2014-07-08 17:49:20 +0100 (Tue, 08 Jul 2014) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_struct.h

Added explanatory note to GRANGE_FLAG_REFPOS_HAVE_* fields so we don't
accidentally recreate the same bug as before. (Fake warnings from
Check Database.)

------------------------------------------------------------------------
r3700 | jkbonfield | 2014-07-08 17:44:14 +0100 (Tue, 08 Jul 2014) | 10 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_contig.c

Remove the code attempting to set GRANGE_FLAG_REFPOS_HAVE_* fields.

These are used internally in tg_iface_g.c to determine whether we need
to store the Position, Size or ID fields via a simplistic delta
mechanism.  Outside of that file they should never be set or queried.

This fix removes a warning about the in-memory and on-disc
representations differing, which is bogus as these bit fields are
zeroed after reading anyway.

------------------------------------------------------------------------
r3699 | jkbonfield | 2014-07-08 16:31:10 +0100 (Tue, 08 Jul 2014) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/consen.tcl
   M /staden/trunk/src/gap5/consensus.c
   M /staden/trunk/src/gap5/consensus.h
   M /staden/trunk/src/gap5/gap5rc
   M /staden/trunk/src/gap5/newgap5_cmds.c

Added an interface to save heterozygous bases in the consensus.

Internally there are some new functions for this too (eg
calculate_consensus_simple_het) as well as some experimental only
functions for evaluation of SNP calling. (It is not expected that Gap5
will perform well here.)

------------------------------------------------------------------------
r3698 | jkbonfield | 2014-07-08 15:29:41 +0100 (Tue, 08 Jul 2014) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_contig.c

Fixed a bug in r3655 caused by failure to save bin ranges after
modifying.  This causes thousands of errors after inserting columns of
bases (eg via shuffle_pads).

------------------------------------------------------------------------
r3697 | jkbonfield | 2014-07-02 15:31:59 +0100 (Wed, 02 Jul 2014) | 7 lines
Changed paths:
   M /staden/trunk/course/data/shotgun_data/DEMO.0.log
   M /staden/trunk/course/data/shotgun_data/xb54f3.s1ta.exp
   M /staden/trunk/course/data/shotgun_data/xb56a5.s1.exp
   M /staden/trunk/demo/gap4/DEMO.0
   M /staden/trunk/demo/gap4/DEMO.0.aux
   M /staden/trunk/doc/Makefile
   A /staden/trunk/doc/manual/test.texi
   M /staden/trunk/src/gap5/gap5rc
   M /staden/trunk/src/gap5/shuffle_pads.c
   M /staden/trunk/src/seq_utils/align_lib.c

Tweaks to the shuffle pads scoring system, in particular what tables
it uses for the non-linear transforms (sinh vs log) as both have their
particular strengths and weaknesses.

The default is now to use soft-clips in the editor too for
realignment.

------------------------------------------------------------------------
r3696 | jkbonfield | 2014-07-02 15:17:33 +0100 (Wed, 02 Jul 2014) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/fij.tcl

Added back Mask/Mark consensus filtering modes to Find Internal Joins.

------------------------------------------------------------------------
r3683 | jkbonfield | 2014-06-27 14:02:07 +0100 (Fri, 27 Jun 2014) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/consen.c
   M /staden/trunk/src/gap5/consen.h
   M /staden/trunk/src/gap5/consen.tcl
   M /staden/trunk/src/gap5/gap5_cmd.tcl
   M /staden/trunk/src/gap5/gap_globals.c

Fixed Mask/Mark consensus and also updated the gap5_cmd consensus
function to allow specifying of arbitrary maps for masking purposes.

------------------------------------------------------------------------
r3674 | jkbonfield | 2014-06-11 16:28:22 +0100 (Wed, 11 Jun 2014) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/Makefile

Sanitise TGILIBS to use GAP5_LIBS and also removed the duplicate
SEQUTILS_LIBS from GAP5_LIBS.

This fix will also prevent the explicit -L/usr/lib64 -ltcl8.5 link
line on Fedora from capturing a system libstaden-read.so in preference
to the one we attempted to link against.

------------------------------------------------------------------------
r3661 | daviesrob | 2014-05-28 15:15:35 +0100 (Wed, 28 May 2014) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl

Stop undo list from being converted to a string, just to see if it's empty.

------------------------------------------------------------------------
r3658 | daviesrob | 2014-05-22 09:40:29 +0100 (Thu, 22 May 2014) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_contig.c

Rewrite of contig_insert_base2.

The new version is much shorter and less byzantine than the previous one.


------------------------------------------------------------------------
r3657 | jkbonfield | 2014-05-21 12:35:46 +0100 (Wed, 21 May 2014) | 34 lines
Changed paths:
   M /staden/trunk/src/gap5/shuffle_pads.c
   M /staden/trunk/src/seq_utils/align_lib.c
   M /staden/trunk/src/seq_utils/align_lib.h

Many changes to shuffle pads implementation.

The malign code in align_lib now copes with start/end range being
something other than 1..length. This makes it far more efficient at
dealing with sub-sections of a contig.

Added a EDGE_GAPS_MAXY cost to block shifting the consensus to match
the sequence (vice versa is OK). In essence this is moving the
sequence beyond the end of the consensus, which can cause problems in
BAM world if we get coordinates < 1.

Adjusted the malign scores. It's now hard coded for DNA only, but it
was never used on proteins anyway. The scaling of scores is still 0 to
128, but now it is nonlinear and not in direct proportion to the
fraction of base type in the consensus vector. This was arrived at by
experimentation.

There is also an optional second scoring method for pads, which works
in some cases and not in others. This is selected by specifying
gap_extend to be 0 (gap_extend has been ignored for years, since we
switched from affine alignments). The shuffle pads code now executes
both modes in an attempt to find the best alignments.

When evaluating our realigned soft-clips we first undo the clipped
before recomputing the new consensus vector. This avoids a circular
argument and means we can only extend into heterozygous cutoffs when
there was already the same heterozygosity in the originally clipped
data.

Finally, adjusted the soft clipped scoring method to promote more
extension before realignment, but harsher when validating whether to
keep the alignments.


------------------------------------------------------------------------
r3656 | jkbonfield | 2014-05-21 12:17:34 +0100 (Wed, 21 May 2014) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_index.c

Rename g_index to tg_index in usage output.

------------------------------------------------------------------------
r3655 | daviesrob | 2014-05-20 16:30:34 +0100 (Tue, 20 May 2014) | 85 lines
Changed paths:
   M /staden/trunk/src/gap5/Makefile
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/gap5_del_test.tcl
   M /staden/trunk/src/gap5/tg_check.c
   M /staden/trunk/src/gap5/tg_contig.c
   M /staden/trunk/src/gap5/tg_contig.h
   M /staden/trunk/src/gap5/tg_sequence.c
   M /staden/trunk/src/gap5/tg_sequence.h
   M /staden/trunk/src/gap5/tg_tcl.c

More reworking of contig insertion / deletion code.

The tcl code to undo consensus base deletion has been simplified by creating a
contig insert_column interface, which takes the list of reads and base calls in
the undo stack and applies it to the column being inserted.  This allows the C
code to do a much more complete job than the old insert_base code, so the tcl
part does not need to do as much cleaning up.  This also means there is less
need to iterate around the bin tree.

Consensus base deletion now also stores undo information for reference position
markers.  As deleting a base may cause markers to be merged, the only way to
get them back when undoing is to know what markers were present in the first
place.

Various edge cases and problems with complemented bins have been fixed.

tg_tcl.c
  Added contig insert_column, find_refpos_marker, set_refpos_marker and
delete_refpos_marker interfaces.

tg_contig.c
tg_contig.h
  Made it easier to turn debugging code on and off.

  Added new contig_insert_column() function.  This is like contig_insert_base,
but can be passed an array listing the base and confidence value to be inserted
into each read in the column.  This is used to make a hash table which is
passed to contig_insert_base_common and then contig_insert_base2 so the updates
can be made reasonably efficiently without having to do too many traverses of
the bin tree.

  Update contig_insert_base2 to take the pileup hash, and to fix more edge
case and complemented bin issues.

  Ensure bin_incr_nseq() is only called for sequences in contig_delete_base2.

  Improved calculation of moved_left, moved_right and fixed_right in
contig_delete_base2.

  Allow deletion of the first base of the contig in contig_delete_base_common.

  Reworked refpos marker code to simplify it and to fix a bug where some
deletion markers were not removed in contig_delete_base_common causing them
to pile up.

  Added set_refpos_marker() and delete_refpos_marker() functions.  These are
called from the tcl interfaces in tg_tcl.c

tg_sequence.c
tg_sequence.h

  Pass in comp to sequence_insert_bases, which should be 1 if the current bin
is complemented.  This means it's possible to work out if the base call should
be complemented or not when inserting in bin orientation.  The value passed in
is ignored if in contig_orientation.

tg_check.c

  In bin_walk, when an incorrect nseqs or nanno count is found, print out what
the stored and actual values were.

contig_editor.tcl

  C_INS undo code now uses $contig insert_column instead of insert_base.  This
allowed a lot of code that was fixing eveything $contig insert_base had not
done correctly to be removed.

  Added RP_SET and RP_DEL undo commands.

  Made editor_delete_cons_base store undo for any reference position markers
that could be affected.  This is the only way to guarantee that the undo
operation can get them back as they were before.

gap5_del_test.tcl

  Made the basic test run on a complemented bin as well as an uncomplemented
one.

  Make do_test compare sam files for the before and after complemented case.

Makefile

  Recalculated dependencies.


------------------------------------------------------------------------
r3651 | jkbonfield | 2014-05-08 15:25:15 +0100 (Thu, 08 May 2014) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/shuffle_pads.c

Bug fix to bounds checking of cons[p]. Remember it's not start..end
but 0..end-start.

Inconsequential update to the scoring functions; the match and
mismatch costs are now #defines (but the same as before).

------------------------------------------------------------------------
r3650 | jkbonfield | 2014-05-06 17:10:18 +0100 (Tue, 06 May 2014) | 8 lines
Changed paths:
   M /staden/trunk/src/gap5/shuffle_pads.c

Now more rigorous bounds checking in rewrite_soft_clips(), curing some
crashes.

concordant_soft_clips() is now more liberal with the scoring when
extending into cutoff, to allow for misalignments of the cutoff data.
The final assessment post re-alignment within rewrite_soft_clips() is
still using the original scores so this shouldn't cause problems.

------------------------------------------------------------------------
r3649 | jkbonfield | 2014-05-06 17:07:14 +0100 (Tue, 06 May 2014) | 7 lines
Changed paths:
   M /staden/trunk/src/seq_utils/align_lib.c

Cull some of the old malign scoring methods in scale_malign_scores().

Switched to a new version that scores based on log(count) instead of
count. This allows for better multiple sequence alignments within
heterozygous regions, so that we don't overly penalise the rare allele
but still prefer to align correctly.

------------------------------------------------------------------------
r3648 | jkbonfield | 2014-05-02 14:20:48 +0100 (Fri, 02 May 2014) | 10 lines
Changed paths:
   M /staden/trunk/src/gap5/shuffle_pads.c

Bug fix to the recent update to look at consensus heterozygous bases
(typo leading to crash).

Make the concordant clip detection more liberal to start with (it'll
filter out those with turn out to be incorrect).

Remove pad columns both both and after rewriting the clips, as
series of pads left in the consensus was causing the seq-matches-cons
check to fail early.

------------------------------------------------------------------------
r3647 | jkbonfield | 2014-05-02 12:26:52 +0100 (Fri, 02 May 2014) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/shuffle_pads.c
   M /staden/trunk/src/gap5/shuffle_pads.h

Renamed coherent to concordant for the soft-clipping strategy. This is
the more appropriate English word.

------------------------------------------------------------------------
r3646 | jkbonfield | 2014-05-02 12:20:38 +0100 (Fri, 02 May 2014) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/shuffle_pads.c

Fixed missing output of print_malign (unused unless uncommented out).

Changed the cutoff evaluation and extension to align against
heterozygous calls rather than single base consensus call. This allows
it to extend reads into cutoffs in more situations.

------------------------------------------------------------------------
r3645 | jkbonfield | 2014-05-02 09:46:53 +0100 (Fri, 02 May 2014) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/export_contigs.c

Fixed @SQ line LN: field to use the clipped contig length instead of
unclipped.

------------------------------------------------------------------------
r3644 | jkbonfield | 2014-05-01 16:52:07 +0100 (Thu, 01 May 2014) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/export_contigs.c

Further improvements to samtools output with fixmates.

------------------------------------------------------------------------
r3643 | jkbonfield | 2014-05-01 14:59:20 +0100 (Thu, 01 May 2014) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/shuffle_pads.c

When realigning including cutoffs, the trim and re-extend process at
the end extends the sequence for as far as it matches the consensus.

We now have a small caveat on this such that it will backtrack to the
first non-pad character after the extension, to avoid leaving trailing
pads on the ends of reads.

------------------------------------------------------------------------
r3642 | jkbonfield | 2014-05-01 14:57:59 +0100 (Thu, 01 May 2014) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/export_contigs.c

Attempt to improve mate pos when using fix-mates output of SAM in
conjunction with refpos depadding.

------------------------------------------------------------------------
r3641 | jkbonfield | 2014-05-01 11:50:26 +0100 (Thu, 01 May 2014) | 26 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_view.c
   M /staden/trunk/src/gap5/export_contigs.c
   M /staden/trunk/src/gap5/export_contigs.tcl
   M /staden/trunk/src/gap5/gap5_cmd.tcl
   M /staden/trunk/src/gap5/sam_index.c
   M /staden/trunk/src/gap5/sam_pileup.h
   M /staden/trunk/src/gap5/tg_contig.c
   M /staden/trunk/src/gap5/tg_contig.h

1. Added an extra depadding option to Export Contigs; reference sequence
positions (in addition to the old padded and unpadded consensus mode).
The purpose of this is to allow tg_index to import a sam/bam/cram, run
tools like Shuffle Pads on it, and then export back in the same
coordinate system as the original BAM.

It is not expected to work after joining and breaking has been
applied, although it needs better error handling to cope with this
more gracefully.

Updated the padded_to_reference_array() function to aid this work.


2. Fixed a bug in create_ref_seq(). It was producing incorrect .fai
files for contigs that do not start at base 1.


3. Fixed memory corruption in sam_add_seq() caused when using
excessive padding in CIGAR ops during tg_index.


4. Bug fix to contig_insert_base_common() when manipulating the
REF_POS markers.  It wasn't coping correctly with this in some
complemented scenarios and with nbases > 1.


------------------------------------------------------------------------
r3640 | daviesrob | 2014-04-29 10:16:55 +0100 (Tue, 29 Apr 2014) | 38 lines
Changed paths:
   M /staden/trunk/src/gap5/gap5_del_test.tcl
   M /staden/trunk/src/gap5/tg_bin.c
   M /staden/trunk/src/gap5/tg_check.c
   M /staden/trunk/src/gap5/tg_contig.c
   M /staden/trunk/src/gap5/tg_sequence.c

Various fixes to keep contig start/end correct.

tg_check.c
  In check_contig, print out start and end positions in the contig and those
from the bin walk when they disagree.

tg_bin.c
  Fixed bug in bin_remove_item_from_bin where used start/end were not swapped
for complemented bins when mapping to the position in the parent.  This could
lead to the contig unclipped start/end not being recalculated when they should
have been.

tg_sequence.c
  Add code to update contig used start/end and clipped_timestamp when
necessary in sequence_move.

tg_contig.c
  Altered the way that contig_insert_base and contig_delete_base keep track of
which ends of the contig may have changed.  This fixes several cases where the
contig start/end were not updated as they should have been.
  Modified read shifting code in contig_insert_base2 and contig_delete_base2. 
The new version moves the same reads for both complemented and uncomplemented
bins.
  Renamed some variables to make the operation of the code less obscure,
e.g. r_start, r_end to v_start,v_end in contig_insert_base2 and
contig_delete_base2; ins,no_ins to del,no_del in contig_delete_base2.
  Added some comments.

gap5_del_test.tcl
  Added test to ensure cutoff data at the start/end of the contig is handled
correctly.
  Made the test script stop but not exit on failure.  This allows the
situation to be checked manually.
  Made some tests run on complemented contigs as well.
  Temporarily disabled the pattern tests to allow a faster iteration through
the random ones.


------------------------------------------------------------------------
r3639 | jkbonfield | 2014-04-28 12:23:03 +0100 (Mon, 28 Apr 2014) | 9 lines
Changed paths:
   M /staden/trunk/src/tracediff/main.cpp

Replaced the potentially ambiguous copyright notice with the full root
copyright notice (although we don't actually bother to have any in
most of the files).

When MRC open-sourced the software they sent me the original
(LICENCE.txt) copyright notice for it to be applied to all the
software.  Any internal MRC specific copyrights left in place are an
accidental and  superceded.

------------------------------------------------------------------------
r3636 | jkbonfield | 2014-04-14 11:29:30 +0100 (Mon, 14 Apr 2014) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_cache.c

Minor comment tidyup

------------------------------------------------------------------------
r3622 | daviesrob | 2014-04-07 12:45:07 +0100 (Mon, 07 Apr 2014) | 8 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_bin.c

Made bin_add_to_range explicitly check for sequences beyond clipped_start/end

bin_add_to_range would fail to set (*c)->clipped_timestamp = 0 if a sequence
being added was within the existing contig used start/end but caused the
clipped_start/end to change.  Added a check to see if the new range may
go beyond clipped_start or clipped_end, and reset clipped_timestamp if
this is the case.

------------------------------------------------------------------------
r3616 | daviesrob | 2014-04-04 13:43:20 +0100 (Fri, 04 Apr 2014) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/gap5_del_test.tcl

Debugging aids for contig deletion/insertion
------------------------------------------------------------------------
r3615 | daviesrob | 2014-04-04 13:40:08 +0100 (Fri, 04 Apr 2014) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_contig.c

Fixed occasional incorrect update of contig used end position.

Put in check that seq_end has actually been set in contig_insert_base2
before using the value.

Removed some dead code.

------------------------------------------------------------------------
r3612 | daviesrob | 2014-04-02 12:44:48 +0100 (Wed, 02 Apr 2014) | 12 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/tg_check.c
   M /staden/trunk/src/gap5/tg_sequence.c
   M /staden/trunk/src/gap5/tg_sequence.h
   M /staden/trunk/src/gap5/tg_tcl.c

Remove duplicate move_seq code and ensure annotations are in same bin as seq.

The code for MOVE_SEQ in contig_cmd could move sequences to new bins without
ensuring that the annotations were moved as well.  The version in
sequence_move did fix the annotations, so made contig_cmd call this instead
of using its own code.

sequence_move now takes a contig_t ** so it can update the location of
the contig record in the caller should it get checked out.  It also gets a
prototype in tg_sequence.h


------------------------------------------------------------------------
r3611 | daviesrob | 2014-04-02 12:43:45 +0100 (Wed, 02 Apr 2014) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/tg_contig.c

Stop tags from extending at the contig end when inserting consensus bases
------------------------------------------------------------------------
r3600 | daviesrob | 2014-03-19 16:33:20 +0000 (Wed, 19 Mar 2014) | 8 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_check.c

Disabled fix for annotations that do not overlap the annotated object.

Trying to move the annotation to a new bin causes problems in bin_walk which
expects the items in the bins to remain stable.  This leads it to try to
fix problems that aren't really there resulting in a database that is in
a much worse state that it was to start with.  Disabling the annotation
fix prevents this.

------------------------------------------------------------------------
r3598 | daviesrob | 2014-03-14 17:02:32 +0000 (Fri, 14 Mar 2014) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/auto_break.c
   M /staden/trunk/src/gap5/contig_extend.c
   M /staden/trunk/src/gap5/sam_index.c
   M /staden/trunk/src/gap5/shuffle_pads.c
   M /staden/trunk/src/gap5/template_display.c
   M /staden/trunk/src/gap5/template_draw.c
   M /staden/trunk/src/gap5/tg_index.h
   M /staden/trunk/src/gap5/tg_index_common.c

Fix compiler warnings.

Mainly missing prototypes, a few char subscripts and some missing braces.

------------------------------------------------------------------------
r3597 | daviesrob | 2014-03-14 15:10:31 +0000 (Fri, 14 Mar 2014) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_iface_g.c
   M /staden/trunk/src/gap5/tg_struct.h

Changed flags in contig_t struct from tg_rec to uint32_t

Done to match what is stored in the database.

------------------------------------------------------------------------
r3596 | daviesrob | 2014-03-14 12:28:38 +0000 (Fri, 14 Mar 2014) | 8 lines
Changed paths:
   A /staden/trunk/src/gap5/test
   A /staden/trunk/src/gap5/test/test_tg_utils.c
   M /staden/trunk/src/gap5/tg_utils.c

Fixed handling of INT32_MIN in s72int and INT64_MIN in s72intw

int2s7 and intw2s7 both encode the lowest possible integer value with the
output code 1, which was converted to 0 by s72int and s72intw.  Fixed the
latter so they output the correct value instead.  Also added some test code
to exercise these functions, including testing all the extreme values.


------------------------------------------------------------------------
r3595 | jkbonfield | 2014-03-11 14:46:58 +0000 (Tue, 11 Mar 2014) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/export_contigs.c

Fixed exporting CRAM in padded mode. It was outputting a depadded
consensus, causing CRAM to work excessively hard in encoding reference
differences.

------------------------------------------------------------------------
r3594 | jkbonfield | 2014-03-11 09:35:36 +0000 (Tue, 11 Mar 2014) | 13 lines
Changed paths:
   M /staden/trunk/src/gap5/g-request.c

Added back fsync of main .g5d file when flushing.

This will slow things down slightly, depending on how often flushes
occur, but resolves some database corruptions we've been seeing.

Specifically if a user has gap5 open on one machine, makes changes and
saves the DB, then creates a backup of the database on the command
line on a different machine[1] then there is a chance that NFS hasn't
correctrly synced the changes yet. This call forces that to happen.

[1] This happens a lot here due to using load-sharing to launch gap5
on one of several nodes in a cluster.

------------------------------------------------------------------------
r3591 | jkbonfield | 2014-03-04 17:17:20 +0000 (Tue, 04 Mar 2014) | 8 lines
Changed paths:
   M /staden/trunk/src/gap5/shuffle_pads.c
   M /staden/trunk/src/gap5/shuffle_pads.h

Added an automatic adapter detector. This works by hashing the
soft-clip and hashing the used data (FIXME: need to strip pads) and
then comparing the distributions.

Also reduced memory and potentially sped up on very long contigs by
doing shuffle pads in 32Kb windows. This avoids purging of memory
cache.

------------------------------------------------------------------------
r3590 | jkbonfield | 2014-03-04 14:35:38 +0000 (Tue, 04 Mar 2014) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_view.c

Fixed bug in ed_set_sequence_sort(). It wasn't correctly handling the
variation of selection end < start.

------------------------------------------------------------------------
r3588 | jkbonfield | 2014-02-28 15:30:34 +0000 (Fri, 28 Feb 2014) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/shuffle_pads.c

Improvements to Shuffle Pads's validate_clip() function. Using a
similar method to rewrite_soft_clips (possibly the validation should
be merged into that code), it now counts differences to the
consensus.  This is often more reliable than counting SNP consensus
bases when faced with highly varying read depth.

------------------------------------------------------------------------
r3587 | jkbonfield | 2014-02-28 12:44:58 +0000 (Fri, 28 Feb 2014) | 3 lines
Changed paths:
   M /staden/trunk/src/gap4/edMutations.c

Fixed a bug in showing the reading-frame translations. It's a 1 byte
buffer overrun that has existed since ~2002.

------------------------------------------------------------------------
r3583 | jkbonfield | 2014-02-27 11:19:20 +0000 (Thu, 27 Feb 2014) | 19 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/gap5_cmd.tcl
   M /staden/trunk/src/gap5/gap5_thrash.tcl
   M /staden/trunk/src/gap5/gap5rc
   M /staden/trunk/src/gap5/newgap5_cmds.c
   M /staden/trunk/src/gap5/newgap_structs.h
   M /staden/trunk/src/gap5/shuffle_pads.c
   M /staden/trunk/src/gap5/shuffle_pads.h
   M /staden/trunk/src/gap5/shuffle_pads.tcl

Added an option to Shuffle Pads to use the cutoff/soft-clip data.

This is quite complex as it performs multiple passes. Firstly it looks
for "coherent soft-clips"; regions with multiple sequences
soft-clipped with the cutoffs in agreement with one another. Then it
extends sequences into the cutoffs before running shuffle pads.

Once realigned, it then inspects the data to check that the unclipped
reads align. If so then they are kept, if not then they are tagged
with CLIP and the clips are trimmed back to where they agree with the
consensus.

Finally special care is taken around consensus Ns. These are included
in local conventions by faking scaffolds, placing contigs next to each
other in the same "contig". Sometimes the realignment will resolve and
join them together, but often it produces unaligned data. In that case
we attempt to unclip and recreate the N as a internal scaffold marker,
but it's not bullet proof.

------------------------------------------------------------------------
r3582 | jkbonfield | 2014-02-26 12:10:55 +0000 (Wed, 26 Feb 2014) | 9 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_contig.c

Optimised contig_insert_base2 and contig_delete_base2.  The main
change is avoiding recomputing contig ends all the while. Often we can
work out what the change will be (eg we're in a bin in the middle of
the contig) and it's only at the boundary bins where it gets more
complex. So we avoid brute force calculations where possible.

Also updated contig_shift_base to accept +N and -N to shift by more
than 1 bp.

------------------------------------------------------------------------
r3581 | jkbonfield | 2014-02-26 12:08:33 +0000 (Wed, 26 Feb 2014) | 3 lines
Changed paths:
   M /staden/trunk/src/Misc/array.h

Added an ArrayPush macro. Basically it's just a short-hand for
appending to the end of an array.

------------------------------------------------------------------------
r3580 | jkbonfield | 2014-02-24 17:33:57 +0000 (Mon, 24 Feb 2014) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_struct.h

Fix to ANNO_DIR_REV, but apparently it is unused.

------------------------------------------------------------------------
r3565 | awhitwham | 2014-01-24 10:16:04 +0000 (Fri, 24 Jan 2014) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_index.c
   M /staden/trunk/src/gap5/tg_index.h
   M /staden/trunk/src/gap5/tg_index_common.c

Changed the name index sorting mechanism of tg_index.  Should be faster.

------------------------------------------------------------------------
r3564 | jkbonfield | 2014-01-17 09:45:44 +0000 (Fri, 17 Jan 2014) | 16 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_cache.c
   M /staden/trunk/src/gap5/tg_gio.h
   M /staden/trunk/src/gap5/tg_index_common.c

Reduced the volume of read-pair entries dumped to the /tmp file.

Previously when we saw Read.1st we recorded it in a hash table and then
when we found Read.2nd we linked it back to Read.1st and recorded in
the temporary file a request to link Read.1st to Read.2nd in a second
pass. (As doing this immediately causes a lot of disk thrashing due to
chimeras, mismatches, genome shuffling etc.)

Now we also make the forward link of Read.1st to Read.2nd if it is
within a bin that is still held in the in-memory cache and is still
locked for read-write (meaning it is yet to be saved/flushed).

On a 3Gb bam file test this reduced the number of entries stored in
the tmp file for 2nd pass from 15.9 million down to 0.6 million. The
effect on speed was slight - only 3% quicker overall.

------------------------------------------------------------------------
r3563 | jkbonfield | 2014-01-16 16:19:54 +0000 (Thu, 16 Jan 2014) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_view.c
   M /staden/trunk/src/gap5/list_proc.tcl
   M /staden/trunk/src/gap5/tg_tcl.c

Added Template Status and Library Name to the multi-column list
viewer.

Also fixed a bug discovered in edview_items_between() which could
return record numbers for cached consensus.

------------------------------------------------------------------------
r3562 | jkbonfield | 2014-01-16 14:10:04 +0000 (Thu, 16 Jan 2014) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/depth.tcl

Changed the click and drag bindings to check whether the initial press
came from a double-1 binding to move the editor cursor. If so drag the
cursor, otherwise do the old plot-drag code.

------------------------------------------------------------------------
r3561 | jkbonfield | 2014-01-16 11:53:37 +0000 (Thu, 16 Jan 2014) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/depth.tcl
   M /staden/trunk/src/gap5/gap5rc_menu_full

Added Shift-Function-key and Function-key bindings to the template
display to store and restore the current configuration. Additionally
this can be saved to ~/.gap5rc via the File->Save Settings option.



========================================================================
RELEASED 2.0.0b10

------------------------------------------------------------------------
r3554 | jkbonfield | 2013-12-18 16:36:35 +0000 (Wed, 18 Dec 2013) | 8 lines
Changed paths:
   M /staden/trunk/src/seq_utils/Makefile

Use text_utils instead of tk_utils as vector_clip was inheriting a
dependency on tk86.dll which bizarrely then crashes on program exit.

The reason we switched to tk_utils instead of text_utils was, I think,
originally due to inanities of the macosx linker disallowing linking
against seq_utils and tk_utils within, say, gap4. But both that and
windows now work.

------------------------------------------------------------------------
r3553 | jkbonfield | 2013-12-18 16:33:41 +0000 (Wed, 18 Dec 2013) | 2 lines
Changed paths:
   M /staden/trunk/src/pregap4/modules/interactive_clip.p4m

Fixed launching of Trev to avoid knowing the wish executable name.

------------------------------------------------------------------------
r3552 | jkbonfield | 2013-12-18 12:37:05 +0000 (Wed, 18 Dec 2013) | 2 lines
Changed paths:
   M /staden/trunk/auto_build/remote.windows-i386
   M /staden/trunk/auto_build/remote.windows-x86_64

Bug fix to Gap4 - it's gap.exe and not gap4.exe that we need.

------------------------------------------------------------------------
r3551 | jkbonfield | 2013-12-18 12:28:28 +0000 (Wed, 18 Dec 2013) | 2 lines
Changed paths:
   M /staden/trunk/src/windows/inno_setup/staden_config.iss

Minor updates to windows setup: icon file locations; Start menu contents.

------------------------------------------------------------------------
r3550 | jkbonfield | 2013-12-18 12:27:28 +0000 (Wed, 18 Dec 2013) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/g-files.c

Bug fix for Windows - force opening in O_BINARY mode.

------------------------------------------------------------------------
r3545 | jkbonfield | 2013-12-16 14:31:51 +0000 (Mon, 16 Dec 2013) | 3 lines
Changed paths:
   M /staden/trunk/auto_build/Makefile
   M /staden/trunk/auto_build/local.lucid-i386
   M /staden/trunk/auto_build/local.macosx
   M /staden/trunk/auto_build/local.precise-x86_64
   M /staden/trunk/auto_build/local.windows-i386
   M /staden/trunk/auto_build/local.windows-x86_64
   M /staden/trunk/auto_build/remote.lucid-i386
   M /staden/trunk/auto_build/remote.macosx
   M /staden/trunk/auto_build/remote.precise-x86_64
   M /staden/trunk/auto_build/remote.windows-i386
   M /staden/trunk/auto_build/remote.windows-x86_64

Added documentation to the generated tarballs.
Also produce lzma versions for linux.

------------------------------------------------------------------------
r3544 | jkbonfield | 2013-12-16 11:35:02 +0000 (Mon, 16 Dec 2013) | 2 lines
Changed paths:
   M /staden/trunk/auto_build/Makefile
   M /staden/trunk/auto_build/config
   M /staden/trunk/auto_build/local.macosx
   M /staden/trunk/auto_build/local.windows-i386
   M /staden/trunk/auto_build/local.windows-x86_64

Fixes to cope with moving the auto_build directory.

------------------------------------------------------------------------
r3543 | jkbonfield | 2013-12-16 11:28:11 +0000 (Mon, 16 Dec 2013) | 2 lines
Changed paths:
   A /staden/trunk/auto_build/README
   A /staden/trunk/auto_build/README.linux
   A /staden/trunk/auto_build/README.macosx
   A /staden/trunk/auto_build/README.windows

Docs for local machines.

------------------------------------------------------------------------
r3542 | jkbonfield | 2013-12-16 11:08:55 +0000 (Mon, 16 Dec 2013) | 6 lines
Changed paths:
   A /staden/trunk/auto_build
   A /staden/trunk/auto_build/Makefile
   A /staden/trunk/auto_build/config
   A /staden/trunk/auto_build/local.lucid-i386
   A /staden/trunk/auto_build/local.macosx
   A /staden/trunk/auto_build/local.precise-x86_64
   A /staden/trunk/auto_build/local.windows-i386
   A /staden/trunk/auto_build/local.windows-x86_64
   A /staden/trunk/auto_build/remote.lucid-i386
   A /staden/trunk/auto_build/remote.macosx
   A /staden/trunk/auto_build/remote.precise-x86_64
   A /staden/trunk/auto_build/remote.windows-i386
   A /staden/trunk/auto_build/remote.windows-x86_64

Added auto_build directory. This contains Makefiles and shell scripts
for local use in Sanger to build distributions on a variety of
platforms.  It is designed to speed up the release cycle.

(Still a work in progress.)

------------------------------------------------------------------------
r3541 | jkbonfield | 2013-12-13 17:56:44 +0000 (Fri, 13 Dec 2013) | 2 lines
Changed paths:
   A /staden/trunk/src/windows/inno_setup
   A /staden/trunk/src/windows/inno_setup/splash.bmp
   A /staden/trunk/src/windows/inno_setup/staden_config.iss

Added InnoSetup configuration for building windows installations.

------------------------------------------------------------------------
r3539 | jkbonfield | 2013-12-13 16:55:30 +0000 (Fri, 13 Dec 2013) | 3 lines
Changed paths:
   M /staden/trunk/src/ac_stubs/tcl.m4
   M /staden/trunk/src/configure.in
   M /staden/trunk/src/staden_config.h.in

Updated to newer version of tcl.m4 to better support cross-compiling
for windows.

------------------------------------------------------------------------
r3538 | jkbonfield | 2013-12-13 14:18:15 +0000 (Fri, 13 Dec 2013) | 2 lines
Changed paths:
   M /staden/trunk/src/tk_utils/tkTraceDisp.c

Renamed Winport to WinPort as case matters when cross-compiling from linux.

------------------------------------------------------------------------
r3537 | jkbonfield | 2013-12-13 14:17:42 +0000 (Fri, 13 Dec 2013) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/fasta.c

Added staden_config.h for belt and braces. I don't think it's needed
now that I fixed an issue elsewhere, but it ought to have it
explicitly included anyway.

------------------------------------------------------------------------
r3536 | jkbonfield | 2013-12-13 14:16:56 +0000 (Fri, 13 Dec 2013) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/Makefile

Removed tg_view. It doesn't work on windows (unless we build our own
curses) and is pretty pointless now anyway.

------------------------------------------------------------------------
r3535 | jkbonfield | 2013-12-13 14:16:28 +0000 (Fri, 13 Dec 2013) | 3 lines
Changed paths:
   M /staden/trunk/src/windows/run/main.cpp

Updated to work with tcl8.6 and also now adds lib directory to PATH so
dlls don't need to be in the main bin directory.

------------------------------------------------------------------------
r3534 | jkbonfield | 2013-12-13 14:15:36 +0000 (Fri, 13 Dec 2013) | 3 lines
Changed paths:
   M /staden/trunk/src/windows/run/Makefile

Added $(COMPILER) to Makefile as a command prefix so we can override
it for cross-compilers.

------------------------------------------------------------------------
r3527 | jkbonfield | 2013-11-29 10:13:20 +0000 (Fri, 29 Nov 2013) | 2 lines
Changed paths:
   M /staden/trunk/src/pregap4/modules/interactive_clip.p4m
   M /staden/trunk/src/tk_utils/stash

Fixes to cope with spaces in filenames.

------------------------------------------------------------------------
r3526 | jkbonfield | 2013-11-21 15:36:07 +0000 (Thu, 21 Nov 2013) | 9 lines
Changed paths:
   M /staden/trunk/src/gap5/template_draw.c

Fixed a bizarre red/blue colour swap on Windows. It seems to have been
there several years. I'm not sure of the reason for it, but also see
http://sourceforge.net/p/tktoolkit/bugs/1049/ for further discussion
on the matter.

That bug was rejected, but I do wonder if it's still there. Tested
against Windows Server 2008 R2 and Win XP, both had the error and both
now display correctly.

------------------------------------------------------------------------
r3525 | jkbonfield | 2013-11-21 15:34:16 +0000 (Thu, 21 Nov 2013) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/b+tree2.h

Fix when cross-compiling. (Missing int*_t)

------------------------------------------------------------------------
r3524 | jkbonfield | 2013-11-21 14:15:26 +0000 (Thu, 21 Nov 2013) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/template_draw.c

A better fix to the template X Image handling. Blinding calling
ckalloc and ckfree works for Windows, but then causes crashes on Unix
for the same reasons we had crashes on Windows when using malloc/free.

We now pick and choose which functions to use based on the OS.

------------------------------------------------------------------------
r3523 | jkbonfield | 2013-11-21 10:44:50 +0000 (Thu, 21 Nov 2013) | 3 lines
Changed paths:
   M /staden/trunk/src/eba/conf.c
   M /staden/trunk/src/gap5/tg_tcl.c
   M /staden/trunk/src/hetins/hetins.c
   M /staden/trunk/src/init_exp/init_exp.c

Minor compilation warnings removed, particularly with respect to
Windows building.

------------------------------------------------------------------------
r3522 | jkbonfield | 2013-11-20 17:29:17 +0000 (Wed, 20 Nov 2013) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/depth.tcl

Fixed mouse wheel bindings for Windows in template display and contig
editor.

------------------------------------------------------------------------
r3521 | jkbonfield | 2013-11-20 16:32:07 +0000 (Wed, 20 Nov 2013) | 2 lines
Changed paths:
   M /staden/trunk/src/gap4/IO1.h

Renamed #ifdef _IO_H_ guard. Forgot this in io to io1 rename.

------------------------------------------------------------------------
r3520 | jkbonfield | 2013-11-20 15:36:21 +0000 (Wed, 20 Nov 2013) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/template_draw.c

Switched to using ckalloc and ckfree for image->buf as this is copied
into the XImage and sometimes freed by Tcl. (On windows if tcl frees it
we must allocate it using ckalloc.)

------------------------------------------------------------------------
r3519 | jkbonfield | 2013-11-20 15:33:35 +0000 (Wed, 20 Nov 2013) | 3 lines
Changed paths:
   M /staden/trunk/src/tk_utils/tkWinX.c

Renamed tkpWinRopModes to a static sp_tkpWinRopModes to avoid clashes
with the same named variable in tk8.6 distribution.

------------------------------------------------------------------------
r3518 | jkbonfield | 2013-11-20 15:32:25 +0000 (Wed, 20 Nov 2013) | 9 lines
Changed paths:
   M /staden/trunk/src/Misc/Makefile
   M /staden/trunk/src/Misc/os.h
   M /staden/trunk/src/abi/Makefile
   M /staden/trunk/src/alf/Makefile
   M /staden/trunk/src/convert/Makefile
   M /staden/trunk/src/convert/gapDB.c
   M /staden/trunk/src/copy_reads/Makefile
   M /staden/trunk/src/eba/Makefile
   M /staden/trunk/src/find_renz/Makefile
   M /staden/trunk/src/g/Makefile
   D /staden/trunk/src/gap4/IO.c
   D /staden/trunk/src/gap4/IO.h
   A /staden/trunk/src/gap4/IO1.c (from /staden/trunk/src/gap4/IO.c:3509)
   A /staden/trunk/src/gap4/IO1.h (from /staden/trunk/src/gap4/IO.h:3509)
   M /staden/trunk/src/gap4/IO2.c
   M /staden/trunk/src/gap4/IO3.c
   M /staden/trunk/src/gap4/Makefile
   M /staden/trunk/src/gap4/alter_rel.c
   M /staden/trunk/src/gap4/alter_rel.h
   M /staden/trunk/src/gap4/assemble_direct.c
   M /staden/trunk/src/gap4/assemble_direct.h
   M /staden/trunk/src/gap4/auto_assemble.c
   M /staden/trunk/src/gap4/auto_break.c
   M /staden/trunk/src/gap4/break_contig.c
   M /staden/trunk/src/gap4/break_contig.h
   M /staden/trunk/src/gap4/check_assembly.c
   M /staden/trunk/src/gap4/clip.h
   M /staden/trunk/src/gap4/clones.c
   M /staden/trunk/src/gap4/clones.h
   M /staden/trunk/src/gap4/complement.c
   M /staden/trunk/src/gap4/confidence_graph.c
   M /staden/trunk/src/gap4/consen.c
   M /staden/trunk/src/gap4/consen.h
   M /staden/trunk/src/gap4/contigEditor.c
   M /staden/trunk/src/gap4/contig_order.c
   M /staden/trunk/src/gap4/contig_order.h
   M /staden/trunk/src/gap4/contig_selector.c
   M /staden/trunk/src/gap4/copy_db.c
   M /staden/trunk/src/gap4/copy_db.h
   M /staden/trunk/src/gap4/cs-object.h
   M /staden/trunk/src/gap4/dbcheck.c
   M /staden/trunk/src/gap4/dis_readings.c
   M /staden/trunk/src/gap4/edStructs.h
   M /staden/trunk/src/gap4/edUtils.h
   M /staden/trunk/src/gap4/edUtils2.c
   M /staden/trunk/src/gap4/extract.c
   M /staden/trunk/src/gap4/fij.c
   M /staden/trunk/src/gap4/fij.h
   M /staden/trunk/src/gap4/find_fragments.c
   M /staden/trunk/src/gap4/find_oligo.c
   M /staden/trunk/src/gap4/find_repeats.c
   M /staden/trunk/src/gap4/find_repeats.h
   M /staden/trunk/src/gap4/gap-tcl.c
   M /staden/trunk/src/gap4/gap-thrash2.c
   M /staden/trunk/src/gap4/gap-thrash2bug.c
   M /staden/trunk/src/gap4/gap-thrash3.c
   M /staden/trunk/src/gap4/gap-thrash_main.c
   M /staden/trunk/src/gap4/gap_canvas_box.h
   M /staden/trunk/src/gap4/io-reg.c
   M /staden/trunk/src/gap4/io-reg.h
   M /staden/trunk/src/gap4/io_handle.c
   M /staden/trunk/src/gap4/io_utils.h
   M /staden/trunk/src/gap4/join.c
   M /staden/trunk/src/gap4/list_proc.h
   M /staden/trunk/src/gap4/newgap_cmds.c
   M /staden/trunk/src/gap4/newgap_cmds.h
   M /staden/trunk/src/gap4/newgap_structs.h
   M /staden/trunk/src/gap4/notes.c
   M /staden/trunk/src/gap4/oligo.c
   M /staden/trunk/src/gap4/oligo_sel.c
   M /staden/trunk/src/gap4/plot_quality.c
   M /staden/trunk/src/gap4/preass.c
   M /staden/trunk/src/gap4/probe.h
   M /staden/trunk/src/gap4/qualIO.c
   M /staden/trunk/src/gap4/quality_plot.c
   M /staden/trunk/src/gap4/reactions.c
   M /staden/trunk/src/gap4/reading_coverage.c
   M /staden/trunk/src/gap4/readpair.c
   M /staden/trunk/src/gap4/readpair_coverage.c
   M /staden/trunk/src/gap4/restriction_enzymes.h
   M /staden/trunk/src/gap4/ruler_display.c
   M /staden/trunk/src/gap4/ruler_display.h
   M /staden/trunk/src/gap4/seqInfo.c
   M /staden/trunk/src/gap4/shuffle_pads.c
   M /staden/trunk/src/gap4/shuffle_pads.h
   M /staden/trunk/src/gap4/strand_coverage.c
   M /staden/trunk/src/gap4/tagU2.c
   M /staden/trunk/src/gap4/tagUtils.h
   M /staden/trunk/src/gap4/template.c
   M /staden/trunk/src/gap4/template.h
   M /staden/trunk/src/gap4/template_display.h
   M /staden/trunk/src/gap4/text-io-reg.c
   M /staden/trunk/src/gap4/tk-io-reg.c
   M /staden/trunk/src/gap4/tman_display.h
   M /staden/trunk/src/gap4/vseqs.c
   M /staden/trunk/src/gap4/vseqs.h
   M /staden/trunk/src/gap5/Makefile
   M /staden/trunk/src/gap5/gap5_thrash.tcl
   M /staden/trunk/src/get_scf_field/Makefile
   M /staden/trunk/src/haplo/Makefile
   M /staden/trunk/src/haplo/haplo.h
   M /staden/trunk/src/haplo/haplo_cons.c
   M /staden/trunk/src/haplo/haplo_snps.c
   M /staden/trunk/src/haplo/haplo_split.c
   M /staden/trunk/src/haplo/haplo_tcl.c
   M /staden/trunk/src/init_exp/Makefile
   M /staden/trunk/src/make_weights/Makefile
   M /staden/trunk/src/mutlib/Makefile
   M /staden/trunk/src/polyA_clip/Makefile
   M /staden/trunk/src/prefinish/Makefile
   M /staden/trunk/src/prefinish/finish.c
   M /staden/trunk/src/prefinish/finish.h
   M /staden/trunk/src/prefinish/finish_long.c
   M /staden/trunk/src/prefinish/finish_main.c
   M /staden/trunk/src/prefinish/finish_pcr.c
   M /staden/trunk/src/prefinish/finish_pcr.h
   M /staden/trunk/src/prefinish/finish_reverse.c
   M /staden/trunk/src/prefinish/finish_utils.c
   M /staden/trunk/src/prefinish/finish_utils.h
   M /staden/trunk/src/prefinish/finish_walk.c
   M /staden/trunk/src/prefinish/insert_size_dist.c
   M /staden/trunk/src/prefinish/read_conf_dist.c
   M /staden/trunk/src/prefinish/read_size_dist.c
   M /staden/trunk/src/qclip/Makefile
   M /staden/trunk/src/screen_seq/Makefile
   M /staden/trunk/src/seq_utils/Makefile
   M /staden/trunk/src/spin/Makefile
   M /staden/trunk/src/stops/Makefile
   M /staden/trunk/src/text_utils/Makefile
   M /staden/trunk/src/tk_utils/Makefile
   M /staden/trunk/src/tracediff/Makefile
   M /staden/trunk/src/vector_clip/Makefile

Added #include <io.h> to the MINGW part of os.h so the chdir() macro
is applied after the system definition. This avoids errors if we
include os.h before io.h and then get an illegal system head file.

Unfortunately adding this breaks Gap4's IO.h (and .c) as on windows
IO.h and io.h are the same file. So renamed these to IO1.c and IO1.h,
given we have IO2.c and IO3.c already, updated the myriad of places
they were included from and reran make depend too.

------------------------------------------------------------------------
r3517 | daviesrob | 2013-11-20 15:19:00 +0000 (Wed, 20 Nov 2013) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/export_contigs.c

Stopped parse_acd_tag from returning pointers beyond the end of the string.

If parse_acd_tag tag was handed a string that did not end in \n, it would
return a pointer to 1 past the NUL byte on the end.  This would cause it
to attempt to read uninitialized memory when called next time.

------------------------------------------------------------------------
r3516 | jkbonfield | 2013-11-20 15:15:10 +0000 (Wed, 20 Nov 2013) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/readpair.c

Cosmetic code tidyup. Lines longer than 80 characters offend me!

------------------------------------------------------------------------
r3515 | jkbonfield | 2013-11-20 15:14:21 +0000 (Wed, 20 Nov 2013) | 3 lines
Changed paths:
   M /staden/trunk/src/ChangeLog
   M /staden/trunk/src/configure.in

Nearing the next release so updated version and changelog. More to go
still, specifically Windows and a few bugs uncovered.

------------------------------------------------------------------------
r3514 | jkbonfield | 2013-11-20 15:13:41 +0000 (Wed, 20 Nov 2013) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/list_contigs.tcl

Minor optimisation

------------------------------------------------------------------------
r3513 | jkbonfield | 2013-11-20 15:12:00 +0000 (Wed, 20 Nov 2013) | 5 lines
Changed paths:
   M /staden/trunk/src/staden.profile

Added $STADENROOT/lib to LD_LIBRARY_PATH too so we can add any
third-party libraries (ie not part of the staden package) in there to
override any system versions or to ensure libraries exist. This is
particularly relevant to the MacOS X build.

------------------------------------------------------------------------
r3512 | jkbonfield | 2013-11-20 15:10:29 +0000 (Wed, 20 Nov 2013) | 2 lines
Changed paths:
   M /staden/trunk/src/Makefile.in

Make distsrc now also generates a tarball

------------------------------------------------------------------------
r3511 | jkbonfield | 2013-11-20 15:10:05 +0000 (Wed, 20 Nov 2013) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/gap5_cmd.tcl

Make FIJ and Find Read Pairs sub-commands open in read-only mode as
they have no strong need to be read-write.

However possibly we should add a -rw command line option to force
read-write still as some actions of these tools could generate data
which is best cached (eg consensus, read-pair locations).

------------------------------------------------------------------------
r3510 | daviesrob | 2013-11-20 09:34:09 +0000 (Wed, 20 Nov 2013) | 13 lines
Changed paths:
   M /staden/trunk/src/gap5/readpair.c

Fix bugs in spanning_pairs when run in end_all mode.

When spanning_pairs had to use sequence_get_position to look up pair positions,
it was not filling in all the needed parts of r2, leading to the use of
uninitialized values later on.  It now fills in everything that is needed,
which makes the results much more deterministic.  This only affected end_all
mode, as none of the others needed to look up pairs by this method.

Using sequence_get_position could also bring back links to contigs that were
not in the original list passed to spanning_pairs.  These are now filtered
out.  This also fixes a failed assertion in Find Internal Joins that was
triggered by spanning_pairs returning such unexpected links.

------------------------------------------------------------------------
r3508 | jkbonfield | 2013-11-07 16:53:38 +0000 (Thu, 07 Nov 2013) | 7 lines
Changed paths:
   M /staden/trunk/src/MacOSX/Gap4.app/Contents/Info.plist
   A /staden/trunk/src/MacOSX/Gap4.app/Contents/MacOS/gap4 (from /staden/trunk/src/MacOSX/Gap4.app/Contents/MacOS/run.sh:3506)
   D /staden/trunk/src/MacOSX/Gap4.app/Contents/MacOS/run.sh
   M /staden/trunk/src/MacOSX/Gap5.app/Contents/Info.plist
   A /staden/trunk/src/MacOSX/Gap5.app/Contents/MacOS/gap5 (from /staden/trunk/src/MacOSX/Gap5.app/Contents/MacOS/run.sh:3506)
   D /staden/trunk/src/MacOSX/Gap5.app/Contents/MacOS/run.sh
   M /staden/trunk/src/MacOSX/Makefile
   M /staden/trunk/src/MacOSX/Pregap4.app/Contents/Info.plist
   A /staden/trunk/src/MacOSX/Pregap4.app/Contents/MacOS/pregap4 (from /staden/trunk/src/MacOSX/Pregap4.app/Contents/MacOS/run.sh:3506)
   D /staden/trunk/src/MacOSX/Pregap4.app/Contents/MacOS/run.sh
   M /staden/trunk/src/MacOSX/Spin.app/Contents/Info.plist
   D /staden/trunk/src/MacOSX/Spin.app/Contents/MacOS/run.sh
   A /staden/trunk/src/MacOSX/Spin.app/Contents/MacOS/spin (from /staden/trunk/src/MacOSX/Spin.app/Contents/MacOS/run.sh:3506)
   M /staden/trunk/src/MacOSX/Trev.app/Contents/Info.plist
   D /staden/trunk/src/MacOSX/Trev.app/Contents/MacOS/run.sh
   A /staden/trunk/src/MacOSX/Trev.app/Contents/MacOS/trev (from /staden/trunk/src/MacOSX/Trev.app/Contents/MacOS/run.sh:3506)
   M /staden/trunk/src/MacOSX/wrapper.c

Replaced the wrapper script with a shell script now I figured out what
was causing the failures in the past (Launch Service changes
Contents/MacOS/gap5 to Contents/MacOS/Gap5 and then caused the sed
part to fail).

This avoids the whole 32-bit vs 64-bit Carbon woes.

------------------------------------------------------------------------
r3507 | jkbonfield | 2013-11-06 17:38:19 +0000 (Wed, 06 Nov 2013) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_index_common.c

Fixed the merge sorting of the sequence name index when only one file
is needed. In this case it was closing the file descriptor early and
then attempting to read it.

------------------------------------------------------------------------
r3506 | jkbonfield | 2013-11-06 17:03:39 +0000 (Wed, 06 Nov 2013) | 2 lines
Changed paths:
   A /staden/trunk/src/MacOSX/Gap4.app/Contents/MacOS/run.sh
   A /staden/trunk/src/MacOSX/Gap5.app/Contents/MacOS/run.sh
   A /staden/trunk/src/MacOSX/Makefile
   A /staden/trunk/src/MacOSX/Pregap4.app/Contents/MacOS/run.sh
   A /staden/trunk/src/MacOSX/Spin.app/Contents/MacOS/run.sh
   A /staden/trunk/src/MacOSX/Trev.app/Contents/MacOS/run.sh
   M /staden/trunk/src/MacOSX/wrapper.c

Added code to help build and update the application bundles.

------------------------------------------------------------------------
r3505 | jkbonfield | 2013-11-06 09:19:24 +0000 (Wed, 06 Nov 2013) | 2 lines
Changed paths:
   M /staden/trunk/src/README.build
   M /staden/trunk/src/staden.profile

MacOS X updates for building and running.

------------------------------------------------------------------------
r3504 | jkbonfield | 2013-10-31 09:32:16 +0000 (Thu, 31 Oct 2013) | 2 lines
Changed paths:
   M /staden/trunk/src/eba/qual.c

Removed CTF support as it's been purged from io_lib.

------------------------------------------------------------------------
r3497 | daviesrob | 2013-10-24 15:33:32 +0100 (Thu, 24 Oct 2013) | 54 lines
Changed paths:
   M /staden/trunk/src/gap5/consensus.c
   M /staden/trunk/src/gap5/contig_editor.tcl
   A /staden/trunk/src/gap5/gap5_del_test.tcl
   M /staden/trunk/src/gap5/tg_bin.c
   M /staden/trunk/src/gap5/tg_contig.c
   M /staden/trunk/src/gap5/tg_sequence.c
   M /staden/trunk/src/gap5/tg_struct.h
   M /staden/trunk/src/gap5/tg_tcl.c

Much work on base deletion and associated undo.  Added flag for unmapped seqs.

Re-factor edit_delete_base to pull consensus and sequence cases into
separate functions.

Remove reads when the last base is deleted, unless it's the last base of the
last read in the contig, in which case do nothing.
Add undo command to add removed reads back to the assembly.

Break link with pair for sequences that have been removed.
When adding reads (for undo), restore pair link for paired reads.

Reset orientation for removed sequences to the original one so that
undo can get them the right way round.

Set a flag on sequences that get unmapped, and set the bin number to -1.
Upgrade various routines to sensibly handle sequences that are unmapped.

Correctly handle shrinking and removing annotations, and replacing or
growing them for undo.
Make anno_ele move tcl function use anno_get_range to get the object record
number.

Contig delete base/insert base only delete/insert to visible parts of
reads, so remove cut-off bases from the pileup stored in the undo array.

Allow contig_insert_base and contig_delete_base to insert/delete the
first visible base.

When inserting bases (for undo), ensure sequences get promoted to a
new bin if they exceed the boundaries on the one that they are in.  Added
new sequence_move function to tg_sequence.c to do this.

Get the correct object record number when moving contig annotations.

Made delete consensus base move the entire contig left when removing the
leftmost base.

Rewrote sequence_range_length (used to fix sequence position in a contig
after it has changed length).  The new version is simpler and does a better
job of fixing the contig start/end positions (both clipped and unclipped).

Make consensus_valid_range better at handling completely clipped reads.

Set clipped_timestamp to zero in bin_add_to_range and bin_remove_item_from_bin
to force recalculation of clipped start/end.

Recalculate contig start/end earlier in contig_insert_base_common so
contig iterators used later start from the correct point.

Included somewhat dodgy gap5_del_test.tcl script to exercise the delete and
undo code.  Currently only really tests the consensus case.


------------------------------------------------------------------------
r3496 | awhitwham | 2013-10-23 14:35:08 +0100 (Wed, 23 Oct 2013) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/newgap5_cmds.c
   M /staden/trunk/src/gap5/sam_index.c
   M /staden/trunk/src/gap5/tg_index.c
   M /staden/trunk/src/gap5/tg_index.h
   M /staden/trunk/src/gap5/tg_index_common.c
   M /staden/trunk/src/gap5/tg_index_common.h

Made the name sorting code more efficient.  Should now work with larger numbers of names.  Still needs work.

------------------------------------------------------------------------
r3491 | jkbonfield | 2013-10-17 09:49:12 +0100 (Thu, 17 Oct 2013) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_extend.c

Fixed Extend Contigs to cope with columns containing pads.

------------------------------------------------------------------------
r3490 | jkbonfield | 2013-10-16 12:34:21 +0100 (Wed, 16 Oct 2013) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_extend.c
   M /staden/trunk/src/gap5/contig_extend.h
   M /staden/trunk/src/gap5/contig_extend.tcl
   M /staden/trunk/src/gap5/gap5rc
   M /staden/trunk/src/gap5/gap5rc_menu_full
   M /staden/trunk/src/gap5/newgap5_cmds.c

Fixed a bug in the Contig Extend code, where extensions containing
zero base matches would sometimes trim the sequence rather than extend
it.

Also added Contig Trim, to clip back straggly low-depth contig ends.

------------------------------------------------------------------------
r3488 | jkbonfield | 2013-10-14 16:56:14 +0100 (Mon, 14 Oct 2013) | 8 lines
Changed paths:
   M /staden/trunk/src/gap5/depth.tcl
   M /staden/trunk/src/gap5/gap_range.c

Changed the min/max mapping quality sliders to be the actual mapping
quality instead of 3*mqual. (That was an error, multiplied up purely
for obtaining a colour.)

Also changed the default colour mode to be minimum mapping quality
instead of average, as minimum is typically what we want when
evaluating the reliability of an assembly.

------------------------------------------------------------------------
r3487 | jkbonfield | 2013-10-11 14:45:07 +0100 (Fri, 11 Oct 2013) | 5 lines
Changed paths:
   M /staden/trunk/src/Misc/misc.h
   M /staden/trunk/src/gap5/consensus.c
   M /staden/trunk/src/gap5/consensus.h
   M /staden/trunk/src/gap5/tg_sequence.c

Added a consensus_pileup() function to iterate through a contig in
column by column order instead of sequence by sequence.

This reuses the MIN4 macro from tg_sequence, so I moved this to misc.h

------------------------------------------------------------------------
r3486 | jkbonfield | 2013-10-11 11:33:47 +0100 (Fri, 11 Oct 2013) | 3 lines
Changed paths:
   M /staden/trunk/src/ac_stubs/ax_lib_samtools.m4

Even though we no longer use samtools, here are the corrected M4 macros
that work with Ubuntu Precise and with multi-threaded samtools.

------------------------------------------------------------------------
r3485 | jkbonfield | 2013-10-10 12:48:31 +0100 (Thu, 10 Oct 2013) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/auto_break.c
   M /staden/trunk/src/gap5/auto_break.h
   M /staden/trunk/src/gap5/gap5_cmd.tcl
   M /staden/trunk/src/gap5/newgap5_cmds.c
   M /staden/trunk/src/gap5/newgap_structs.h

Split the singleton and spanning read pair categories/scores into
uniquely and non-uniquely mapping sets.

------------------------------------------------------------------------
r3484 | jkbonfield | 2013-10-09 11:19:36 +0100 (Wed, 09 Oct 2013) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/do_fij.c

Removal of debugging output.

------------------------------------------------------------------------
r3483 | jkbonfield | 2013-10-09 11:19:08 +0100 (Wed, 09 Oct 2013) | 10 lines
Changed paths:
   M /staden/trunk/src/gap5/do_fij.c

Corrected check_overlap_pairs() to only count failed pairs in the
overlap region specified.

This isn't ideal, but at least it's the same count used for good
pairs, so it doesn't artificially think the worst about all joins.

Ideally we should switch to the pair analysis used in auto-break, on a
simulated joined up contig. (Or maybe just make the join in a child io,
evaluate it, and then destroy the io). 

------------------------------------------------------------------------
r3482 | jkbonfield | 2013-10-08 15:11:40 +0100 (Tue, 08 Oct 2013) | 10 lines
Changed paths:
   M /staden/trunk/src/gap5/sam_index.c
   M /staden/trunk/src/gap5/tg_cache.c

Switch to allocating sequence record numbers at the time of finding
the last base in a sequence rather than the first base. This means we
can correct estimate the sequence of the SeqBlock. Also updated the
maximum SeqBlock size to 1Mb (was 250Kb).

Flush more often if the total number of bases added is high. This is
useful when dealing with technologies using very long sequence lengths
as it writes data more often (although it doesn't yet purge from the
cache, as that also needs knowledge of object size - TO DO).

------------------------------------------------------------------------
r3481 | jkbonfield | 2013-10-08 12:27:37 +0100 (Tue, 08 Oct 2013) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/export_contigs.c

When exporting in SAM, don't just take any foo/bar to mean foo, but
explicitly check for foo/1 and foo/2 as they are the only forms where
we have historically meant "foo" and not foo/bar as a name.

This was tripping up on PacBio generated read names.

------------------------------------------------------------------------
r3480 | jkbonfield | 2013-10-07 15:21:34 +0100 (Mon, 07 Oct 2013) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/gap5_cmd.tcl

Changed default parameters to be less severe. These have been tuned
for a few specific datasets on known problems.

------------------------------------------------------------------------
r3479 | jkbonfield | 2013-10-07 15:20:58 +0100 (Mon, 07 Oct 2013) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/auto_break.c

Bug fix to correct buffer underrun on clip_depth[]

------------------------------------------------------------------------
r3478 | jkbonfield | 2013-10-07 15:20:25 +0100 (Mon, 07 Oct 2013) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/gap_range.c

Protect against potentially corrupted databases leading to crashes.

------------------------------------------------------------------------
r3477 | jkbonfield | 2013-10-04 17:11:07 +0100 (Fri, 04 Oct 2013) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_view.c
   M /staden/trunk/src/gap5/tg_library.c

Various fixes to prevent crashes when dealing with inconsistent data.

------------------------------------------------------------------------
r3476 | jkbonfield | 2013-10-04 17:10:48 +0100 (Fri, 04 Oct 2013) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/gap5_cmd.tcl

Exposed -end_skip param to command line interface too.

------------------------------------------------------------------------
r3475 | jkbonfield | 2013-10-04 17:09:40 +0100 (Fri, 04 Oct 2013) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/auto_break.c
   M /staden/trunk/src/gap5/auto_break.h
   M /staden/trunk/src/gap5/newgap5_cmds.c
   M /staden/trunk/src/gap5/newgap_structs.h

Added the option to skip problems near the ends of contigs, as these
are often poor quality.

------------------------------------------------------------------------
r3474 | jkbonfield | 2013-10-04 15:02:43 +0100 (Fri, 04 Oct 2013) | 24 lines
Changed paths:
   M /staden/trunk/src/gap5/auto_break.c

Many auto_break tidyups.

* Don't break on every negative issue. Instead look for lowest -ve
  issue within a short span and break that, under the assumption that
  the other neighbouring ones will get fixed in the process (we don't
  yet check this so it'd require a second pass).

* Searches for soft clipping errors where more than a certain
  percentage of reads are clipped at the same base position.

* Be more rigid in the dinucleotide repeat screening to try and speed
  up the program. It didn't add to much I think.

* Improved detection of library insertion size so that we don't count
  reads too distant from the problem as verifying or conflicting
  against a candidate break. This is particularly necessary when
  dealing with mixed libraries of differing sizes.

* (Debugging tool: gc() function to compute GC content over a given
  region. It was used in investigations of whether GC biases insertion
  size.)

* Gap merging now applies to contig end gaps too.

------------------------------------------------------------------------
r3473 | jkbonfield | 2013-09-27 15:59:25 +0100 (Fri, 27 Sep 2013) | 10 lines
Changed paths:
   M /staden/trunk/src/gap5/g-alloc.c

Added some debugging code, now #ifdefed out, to time how long the
heap_allocate function takes and how many iterations looking for
blocks.

The intention is to bail out after a fixed number of iterations incase
of pathologically bad conditions.

Also bumped up the assertion size in the (debug) heap checker as we
were hitting it on real data.

------------------------------------------------------------------------
r3472 | jkbonfield | 2013-09-27 15:57:12 +0100 (Fri, 27 Sep 2013) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/dis_readings.c

Delete Contigs now flushes per contig. This seems excessive, but it
reduces the memory usage of the B+Tree name index (at the expense of
slowing things down as we may rewrite the same nodes).

[This was causing Delete Contigs on HAEM to use 32Gb of memory up.]

------------------------------------------------------------------------
r3471 | jkbonfield | 2013-09-27 15:56:08 +0100 (Fri, 27 Sep 2013) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/b+tree2.c

Fixed a reference count leak in the B+Tree code.

Also modified the TEST_MAIN debugging code to check for reference
counting errors.

------------------------------------------------------------------------
r3469 | jkbonfield | 2013-09-23 10:03:42 +0100 (Mon, 23 Sep 2013) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/depth_track.c

Removed the -5 adjustment from Y position depth tracks.

I'm not sure why it was there and it made the plot incorrect, implying
we don't hit zero when we do.

------------------------------------------------------------------------
r3465 | jkbonfield | 2013-09-19 13:39:49 +0100 (Thu, 19 Sep 2013) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/auto_break.c
   M /staden/trunk/src/gap5/auto_break.h
   M /staden/trunk/src/gap5/gap5_cmd.tcl
   M /staden/trunk/src/gap5/newgap5_cmds.c
   M /staden/trunk/src/gap5/newgap_structs.h

Updated auto_break.

It now has more categories of read pair, breaking them down into ones
with uniquely mapping reads and non-unique. There is now also the
option to detect conesnsus repeat words and filter by them.

------------------------------------------------------------------------
r3464 | jkbonfield | 2013-09-16 12:14:38 +0100 (Mon, 16 Sep 2013) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/depth.tcl
   M /staden/trunk/src/gap5/depth_track.c
   M /staden/trunk/src/gap5/gap_range.c
   M /staden/trunk/src/gap5/gap_range.h
   M /staden/trunk/src/gap5/template_display.c

The average template insert size is now drawn superimposed on top of
the template display.

------------------------------------------------------------------------
r3463 | jkbonfield | 2013-09-16 10:29:13 +0100 (Mon, 16 Sep 2013) | 3 lines
Changed paths:
   M /staden/trunk/src/gap4/GTAGDB
   M /staden/trunk/src/gap5/Makefile
   M /staden/trunk/src/gap5/gap5_cmd.tcl

Minor tweaks to auto-break; adding the correct tag type and an option
to prevent breakage (just tagging).

------------------------------------------------------------------------
r3462 | jkbonfield | 2013-09-16 10:24:24 +0100 (Mon, 16 Sep 2013) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/newgap5_cmds.c

Fixed Import Reads to work with the newer bttmp_sort_t structures. (It
was crashing before.)

------------------------------------------------------------------------
r3459 | jkbonfield | 2013-09-11 12:21:37 +0100 (Wed, 11 Sep 2013) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/auto_break.c

Tags are now addwed to the contigs prior to breaking.

------------------------------------------------------------------------
r3458 | jkbonfield | 2013-09-11 11:55:53 +0100 (Wed, 11 Sep 2013) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/break_contig.c

Break contig now duplicates consensus tags when they overlap both the
left and right contig. This was the gap4 behaviour and also what we
need for auto_break.

------------------------------------------------------------------------
r3457 | jkbonfield | 2013-09-11 10:10:00 +0100 (Wed, 11 Sep 2013) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl

Added run_cons_command function. It's unused in the existing code, but
allows for local invocation from gap5rc.local menus. Eg to run Dotter
on an underlined section of the sequence.

------------------------------------------------------------------------
r3456 | jkbonfield | 2013-09-11 10:08:53 +0100 (Wed, 11 Sep 2013) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_anno.c

Improved error checking in anno_ele_add()

------------------------------------------------------------------------
r3455 | jkbonfield | 2013-09-11 10:08:16 +0100 (Wed, 11 Sep 2013) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/sam_index.c
   M /staden/trunk/src/gap5/tg_index_common.c

Call contig_visible_start/end after importing each contig so it can
correct for any mistakes in the SAM file where annotations overlap the
visible end of the contig. This helps to make gap5->sam->gap5 round
trips a better auto-fix mechanism.

------------------------------------------------------------------------
r3454 | jkbonfield | 2013-09-09 11:38:01 +0100 (Mon, 09 Sep 2013) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/map_reads.tcl

Type of bam vs bwa.
See https://sourceforge.net/p/staden/patches/10/

------------------------------------------------------------------------
r3451 | jkbonfield | 2013-09-06 17:04:27 +0100 (Fri, 06 Sep 2013) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/depth.tcl
   M /staden/trunk/src/gap5/depth_track.c
   M /staden/trunk/src/gap5/gap5rc
   M /staden/trunk/src/gap5/gap_range.c
   M /staden/trunk/src/gap5/gap_range.h
   M /staden/trunk/src/gap5/tclIndex
   M /staden/trunk/src/gap5/template_display.c

The template display can now filter by libraries.

Also a lot of the template display options now come from the gap5rc
file.  There is still more to be done here though, such as allowing
the startup list of tracks.

------------------------------------------------------------------------
r3450 | jkbonfield | 2013-09-06 17:02:56 +0100 (Fri, 06 Sep 2013) | 2 lines
Changed paths:
   D /staden/trunk/src/gap5/template_display.tcl

Removed defunct gap4 code.

------------------------------------------------------------------------
r3449 | daviesrob | 2013-09-06 11:28:47 +0100 (Fri, 06 Sep 2013) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/g-files.c

Fix double free if the database doesn't exist.

find_db_files passed values back in *fndb and *fnaux even if it failed, and
had therefore called free on them.  This cause a segfault when an invalid
database name was given on the command line.  Now it only sets them if it
succeeds.

------------------------------------------------------------------------
r3448 | daviesrob | 2013-09-05 12:26:32 +0100 (Thu, 05 Sep 2013) | 19 lines
Changed paths:
   M /staden/trunk/src/gap5/actf.c
   M /staden/trunk/src/gap5/g-files.c
   M /staden/trunk/src/gap5/g-files.h
   M /staden/trunk/src/gap5/g-struct.c
   M /staden/trunk/src/gap5/g-struct.h
   M /staden/trunk/src/gap5/tg_gio.c

Fix bug where g_check_header used the wrong .aux filename.

g_check_header constructed the wrong name for the .g5x file when the
database name was given with a suffix on the command-line.  This caused it
to incorrectly complain about the database being renamed, and (due to it not
stopping then and checking for the wrong value from gfile->low_level_vector)
also that the timestamp had changed.

g_open_file now stores the actual aux file name in the GFile struct, so
g_check_header can use it later.  g_check_header now calls panic_shutdown()
immediately on failure, and also checks for the right return value from
gfile->low_level_vector.

Took the opportunity to remove various fixed-size buffers when dealing with
filenames, especially in find_db_files and actf_lock.

Fixed an invalid read in open_log_file when log files are enabled and the
database name is very short.

------------------------------------------------------------------------
r3447 | jkbonfield | 2013-09-05 12:20:37 +0100 (Thu, 05 Sep 2013) | 17 lines
Changed paths:
   M /staden/trunk/src/gap5/auto_break.c
   M /staden/trunk/src/gap5/auto_break.h
   M /staden/trunk/src/gap5/gap5_cmd.tcl
   M /staden/trunk/src/gap5/newgap5_cmds.c
   M /staden/trunk/src/gap5/newgap_structs.h

Split the unknown score into (sligtly too) large and (contig) spanning
scores.

Tweaks to the auto-break parameters:
    - Increased MIN_OVERLAP
    - Valid read pairs need to span the region by at least MIN_OVERLAP
      rather than just 1 bp. We may wish to improve this further by more
      than that amount; eg based on library insert size.
    - Read mapping quality is taken into account for the good score.
      Low mapping still counts, but at about 1/3rd benefit.

Added some currently unusued code for dump_template_dist(). This is an
experiment to see whether sampling the insert size distribution at a
specific consensus base is accurate enough to predict small indels. [It
seems yes, if small is >20bp or so.]


------------------------------------------------------------------------
r3446 | jkbonfield | 2013-09-05 12:15:12 +0100 (Thu, 05 Sep 2013) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_contig.c
   M /staden/trunk/src/gap5/tg_contig.h

Added a CITER_PAIR option to the contig iterators to call the
read-pairing code to update COMP1/2 flags. This isn't perfect as it's
done in blocks, but for the reads that get their pairs recomputed the
timestamp is updated meaning code that explicitly calls
sequence_get_range_pair_position will now be far faster.

------------------------------------------------------------------------
r3445 | jkbonfield | 2013-09-05 12:13:51 +0100 (Thu, 05 Sep 2013) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_sequence.c

sequence_get_range_pair_position() now also updates
GRANGE_FLAG_COMP[12] flags for this range (but not the pair) if the
contig is known.

------------------------------------------------------------------------
r3444 | jkbonfield | 2013-09-05 12:12:29 +0100 (Thu, 05 Sep 2013) | 10 lines
Changed paths:
   M /staden/trunk/src/seq_utils/filter_words.c

Fix to the various filter functions. Previously they struck out up to
the maximum score whenever the running total crossed zero, but that
means a match like ...==========.....=====.. would only strike out the
first match as the bit between the two isn't enough to reduce the
score to zero while the aggregate score still isn't higher than the
peak score after the first match.

It now resets the score to -1 (and strikes out the previous match if
appropriate) whenever the drop is higher than the minimum score for a match.

------------------------------------------------------------------------
r3443 | daviesrob | 2013-08-16 12:18:18 +0100 (Fri, 16 Aug 2013) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/gap5rc_menu_full

Make selecting highlight disagreements mode also turn it on.

Saves having to open the menu twice - once to turn H.D. on, and again to
select the mode.

------------------------------------------------------------------------
r3442 | daviesrob | 2013-08-15 11:05:00 +0100 (Thu, 15 Aug 2013) | 12 lines
Changed paths:
   M /staden/trunk/src/gap5/auto_break.c

Fixed reference count on libraries in auto break.

compute_lib_type was not calling cache_incr on the library_t pointers
that it stored in a hash table.  This meant the pointers could go stale
if the library information later got pushed out of the cache, leading to
a segmentation fault.

compute_lib_type now calls cache_incr on the library_t pointer to prevent this.
confirm_gaps calls cache_decr on all of the items in the hash table when it
has finished with them.


------------------------------------------------------------------------
r3441 | jkbonfield | 2013-08-09 16:41:31 +0100 (Fri, 09 Aug 2013) | 10 lines
Changed paths:
   M /staden/trunk/src/gap5/auto_break.c
   M /staden/trunk/src/gap5/auto_break.h
   M /staden/trunk/src/gap5/do_fij.c
   M /staden/trunk/src/gap5/gap5_cmd.tcl
   M /staden/trunk/src/gap5/gap_range.c
   M /staden/trunk/src/gap5/newgap5_cmds.c
   M /staden/trunk/src/gap5/newgap_structs.h
   M /staden/trunk/src/gap5/tg_sequence.c
   M /staden/trunk/src/gap5/tg_sequence.h
   M /staden/trunk/src/gap5/tg_tcl.c

More auto-break updates.
- Weightings for scores are now adjustable external and are gap5_cmd
  parameters.
- Tweaks to default scores
- Allow for a minimum score (so not just 0).

Also updated sequence_get_range_pair_position() to take extra argument
indicating the contigs to check timestamps on. This is useful if we
know both ends for the pair already.

------------------------------------------------------------------------
r3440 | jkbonfield | 2013-08-09 12:22:21 +0100 (Fri, 09 Aug 2013) | 9 lines
Changed paths:
   M /staden/trunk/src/gap5/auto_break.c

More rigorous calculation of invalid read-pairs.

We ensure contig-spanning pairs have an sequence pointing towards the
problem rather than away from it, and also that it's not close to the
contig end and pointing off it as it may then be a real join.

Singletons for reads from paired end libraries now also get their own
scoring category (currently set to 0 while I test they're worth).

------------------------------------------------------------------------
r3436 | jkbonfield | 2013-08-07 12:16:56 +0100 (Wed, 07 Aug 2013) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/auto_break.c

Removal of debugging output.

------------------------------------------------------------------------
r3435 | jkbonfield | 2013-08-07 11:59:20 +0100 (Wed, 07 Aug 2013) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/auto_break.c

Fixed the calculation of insert size for swapped fwd/rev pairs:
rev-->   <--fwd.

Also adjusted the min/max to be 3*sd instead of 2*sd.

------------------------------------------------------------------------
r3434 | jkbonfield | 2013-08-07 11:24:50 +0100 (Wed, 07 Aug 2013) | 2 lines
Changed paths:
   M /staden/trunk/src/ChangeLog
   M /staden/trunk/src/NEWS
   M /staden/trunk/src/ReleaseNotes

Collated changes since the last official release.

------------------------------------------------------------------------
r3433 | jkbonfield | 2013-08-06 11:19:32 +0100 (Tue, 06 Aug 2013) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_cache.c
   M /staden/trunk/src/gap5/tg_contig.c
   M /staden/trunk/src/gap5/tg_struct.h

Deleted contigs now get flagged specifically as DELETED. Calling
cache_search on a deleted contig now returns NULL.

This fixes crashes where people could delete a contig and then attempt
to edit the contig via the old #record_number.

------------------------------------------------------------------------
r3432 | jkbonfield | 2013-08-06 10:17:36 +0100 (Tue, 06 Aug 2013) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/auto_break.c

Fix minor printf formatting error.

------------------------------------------------------------------------
r3431 | jkbonfield | 2013-08-06 10:15:48 +0100 (Tue, 06 Aug 2013) | 2 lines
Changed paths:
   A /staden/trunk/src/gap5/auto_break.c
   A /staden/trunk/src/gap5/auto_break.h

Adding auto_break code itself (forgot to svn add it).

------------------------------------------------------------------------
r3430 | jkbonfield | 2013-08-06 10:08:57 +0100 (Tue, 06 Aug 2013) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/Makefile
   M /staden/trunk/src/gap5/consensus.c
   M /staden/trunk/src/gap5/gap5_cmd.tcl
   M /staden/trunk/src/gap5/newgap5_cmds.c

Implemented auto_break command for gap5_cmd. This is similar to Gap4's
auto-splitter, but primarily uses mapping qualities over word
uniqueness analysis (although it still contains low complexity
checking).

It identifies suspicious joins and then verifies them via read pairs.

------------------------------------------------------------------------
r3429 | jkbonfield | 2013-08-06 10:01:55 +0100 (Tue, 06 Aug 2013) | 2 lines
Changed paths:
   M /staden/trunk/src/seq_utils/dna_utils.c
   M /staden/trunk/src/seq_utils/dna_utils.h
   M /staden/trunk/src/seq_utils/filter_words.c
   M /staden/trunk/src/seq_utils/filter_words.h

Optimised ambiguity2basebit and filter_words_local functions.

------------------------------------------------------------------------
r3428 | jkbonfield | 2013-08-01 17:49:08 +0100 (Thu, 01 Aug 2013) | 12 lines
Changed paths:
   M /staden/trunk/src/gap5/g-files.c
   M /staden/trunk/src/gap5/g-request.c

Improved on the g_check_header() and related functions.

This attempts to spot when the global .g5x aux timestamp changes under
the feet of the current process, indicating that someone was naughty
and either removed the BUSY file to open up a second r/w gap5 or
copied another database version over the top of our own one.

Unfortunately due to filesystem caching it was too slow to spot a lot
of errors. We now use a new filedescriptor each time to do the disk vs
memory comparison and we also explicitly call fsync after updating
this to ensure the time is flushed out.

------------------------------------------------------------------------
r3427 | daviesrob | 2013-07-30 14:31:45 +0100 (Tue, 30 Jul 2013) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/hash_lib.c

Ensure min_match is always at least word_length in init_hash8n.  Prevents a segfault in reps_nocount.
------------------------------------------------------------------------
r3426 | awhitwham | 2013-07-29 10:26:53 +0100 (Mon, 29 Jul 2013) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_index.c
   M /staden/trunk/src/gap5/tg_index.h
   M /staden/trunk/src/gap5/tg_index_common.c
   M /staden/trunk/src/gap5/tg_index_common.h

Now able to control where tmp files go using either TMP_DIR or TEMP
environment variables.  Also changed the sorting routine for the name
index so it does not use the standard unix sort.  This is an interim
release as there is too much code duplication in the sorting
functions.

------------------------------------------------------------------------
r3424 | jkbonfield | 2013-07-18 17:53:37 +0100 (Thu, 18 Jul 2013) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/do_fij.c

Updated FIJ calculation of percentage good read-pairs.

It was only counting the number of read-pairs between contig A and B
(for efficiency), but we needed to know the number of read-pairs
between contigs A+B and any other contig. We now also compute this
when necessary.

------------------------------------------------------------------------
r3423 | jkbonfield | 2013-07-18 17:51:35 +0100 (Thu, 18 Jul 2013) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/gap_range.c

Be more aggressive in the clearing of r->pair_contig if the timestamp
is invalid.

We were seeing strange effects when data has been joined into the same
contig.

------------------------------------------------------------------------
r3422 | daviesrob | 2013-07-12 12:24:20 +0100 (Fri, 12 Jul 2013) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/import_contigs.tcl

Set repad to 0 if not merging contigs, and ensure the names are indexed
------------------------------------------------------------------------
r3417 | jkbonfield | 2013-07-05 12:22:17 +0100 (Fri, 05 Jul 2013) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/tk_utils/tclIndex
   M /staden/trunk/src/tk_utils/utils.tcl

Added a mechanism to swallow auto-repeat generated keypresses (under
Unix X11 only) where the program is lagging and failing to keep up.  
This is utilised in the contig editor.


------------------------------------------------------------------------
r3416 | jkbonfield | 2013-07-05 12:20:45 +0100 (Fri, 05 Jul 2013) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/find_oligo.c

Add "#number name" to seq_hits instead of "name", as name may not be unique.

------------------------------------------------------------------------
r3415 | jkbonfield | 2013-07-05 12:16:09 +0100 (Fri, 05 Jul 2013) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_view.c

Code layout tidyness.

------------------------------------------------------------------------
r3414 | jkbonfield | 2013-07-04 17:19:43 +0100 (Thu, 04 Jul 2013) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl

Try to fix cases of lost focus, where the user clicking in the
toplevel window grants focus to the toplevel window (eg .e1) but we
require it to be given to the internal sheet component.

------------------------------------------------------------------------
r3413 | jkbonfield | 2013-07-04 17:14:21 +0100 (Thu, 04 Jul 2013) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/fij.tcl

Fixed a bug where trying to bring up a second FIJ window when one
already existed was clearing the $w.ops() states.

------------------------------------------------------------------------
r3412 | jkbonfield | 2013-07-04 12:26:01 +0100 (Thu, 04 Jul 2013) | 2 lines
Changed paths:
   M /staden/trunk/src/seq_utils/dna_utils.c

Added the length to the alignment pretty-printer.

------------------------------------------------------------------------
r3411 | jkbonfield | 2013-07-04 12:17:06 +0100 (Thu, 04 Jul 2013) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/fij.tcl

Changed keybindings for tab traversal as straight arrow keys prevents
editing within entry fields.

------------------------------------------------------------------------
r3410 | jkbonfield | 2013-07-04 12:07:23 +0100 (Thu, 04 Jul 2013) | 12 lines
Changed paths:
   M /staden/trunk/src/gap5/fij.tcl

Fixed issues with the FIJ GUI:

- The cancel button now correctly destroys the window.

- Selecting libraries works again.

- Updating the contig identifier by clicking in the contig list or
  contig selector no longer errors. (In some cases it still only
  updates 1 of the 2 Ids, which I am still investigating.)



------------------------------------------------------------------------
r3409 | jkbonfield | 2013-07-02 16:55:22 +0100 (Tue, 02 Jul 2013) | 15 lines
Changed paths:
   M /staden/trunk/src/gap5/fij.c
   M /staden/trunk/src/gap5/fij.tcl
   M /staden/trunk/src/gap5/gap5rc

Minor tweaks to new FIJ:

- %age mismatch is back to 30 by default as users suggested that they
  like the high default as it allows spotting joins that were missed
  due to misassembly errors (requiring manual editing before making of
  course).

- The FIJ parameters are now listed at the start of FIJ rather than
  the end, meaning the end line still contains the summary of number
  of joins found.

- Fixed a bug where the last edited parameters were being used as the
  defaults for the next FIJ window.


------------------------------------------------------------------------
r3408 | jkbonfield | 2013-07-02 14:57:29 +0100 (Tue, 02 Jul 2013) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_id.tcl
   M /staden/trunk/src/gap5/do_fij.c
   M /staden/trunk/src/gap5/fij.c
   M /staden/trunk/src/gap5/fij.tcl
   M /staden/trunk/src/gap5/gap5_cmd.tcl
   M /staden/trunk/src/gap5/gap5rc
   M /staden/trunk/src/gap5/newgap5_cmds.c
   M /staden/trunk/src/gap5/newgap_structs.h
   M /staden/trunk/src/gap5/readpair.c

Added min/max (joined) depth, max overlap length, containment vs end,
minimum valid read-pair percentage and unique-ends filters to Find
Internal Joins.

Also updated the gap5_cmd tool and reorganised the FIJ GUI to be
smaller, using a tabbed notebook.

------------------------------------------------------------------------
r3407 | jkbonfield | 2013-07-02 14:55:17 +0100 (Tue, 02 Jul 2013) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/check_assembly.c
   M /staden/trunk/src/gap5/consen.c
   M /staden/trunk/src/gap5/consen.h
   M /staden/trunk/src/gap5/find_oligo.c
   M /staden/trunk/src/gap5/find_repeats.c
   M /staden/trunk/src/gap5/restriction_enzymes.c

Removed the use of io_clnbr() in various plots. These just caused the
"Information" query to take excessively long while gaining nothing
important.

------------------------------------------------------------------------
r3404 | jkbonfield | 2013-06-26 12:24:22 +0100 (Wed, 26 Jun 2013) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/dis_readings.c

Fixed a bug with uninitialised memory in unlink_read. It sometimes
failed when it should have succeeded, but didn't corrupt data.

The error seen by the user was "failure to unlink sequence #"...

------------------------------------------------------------------------
r3393 | jkbonfield | 2013-06-24 09:39:44 +0100 (Mon, 24 Jun 2013) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/fij.c

Flush auto-join joins every contig rather than only at the end.

------------------------------------------------------------------------
r3385 | jkbonfield | 2013-06-20 11:17:31 +0100 (Thu, 20 Jun 2013) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/consensus.c

Fixed a cache ref count bug in consensus code, when faced with
inconsistent consensus records.

Added further checks for inconsistent cached consensus sequences, now
checking that range length matches seq length. I do not know why this
differs at times, but this works around such data corruptions.

------------------------------------------------------------------------
r3384 | daviesrob | 2013-06-19 15:30:38 +0100 (Wed, 19 Jun 2013) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_view.c

Clear the selection in edview_renumber if it is the contig id that is changing.

------------------------------------------------------------------------
r3382 | awhitwham | 2013-06-19 15:25:18 +0100 (Wed, 19 Jun 2013) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl

Set panedwindow opaqueresize to resolve the different defaults between Tk 8.4 and 8.5.  Removed the proxy sync_panes code as it is no longer needed.

------------------------------------------------------------------------
r3373 | daviesrob | 2013-06-13 17:17:17 +0100 (Thu, 13 Jun 2013) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/check_assembly.c
   M /staden/trunk/src/gap5/cs-object.c
   M /staden/trunk/src/gap5/cs-object.h
   M /staden/trunk/src/gap5/editor_join.c
   M /staden/trunk/src/gap5/editor_join.h
   M /staden/trunk/src/gap5/export_contigs.c
   M /staden/trunk/src/gap5/fij.c
   M /staden/trunk/src/gap5/fij.h
   M /staden/trunk/src/gap5/find_oligo.c
   M /staden/trunk/src/gap5/find_repeats.c
   M /staden/trunk/src/gap5/find_repeats.h
   M /staden/trunk/src/gap5/readpair.c
   M /staden/trunk/src/gap5/readpair.h
   M /staden/trunk/src/gap5/sam_index.c
   M /staden/trunk/src/gap5/shuffle_pads.c
   M /staden/trunk/src/gap5/tg_anno.c
   M /staden/trunk/src/gap5/tg_cache.c
   M /staden/trunk/src/gap5/tg_sequence.h

Fixed compiler warnings and bug in cache_item_remove.

Sorted several compiler warnings, mainly due to missing prototypes.
Fixed bug in cache_item_remove where it attempted to cache_rw the wrong
pointer for GT_Scaffold objects.


------------------------------------------------------------------------
r3371 | daviesrob | 2013-06-13 15:07:04 +0100 (Thu, 13 Jun 2013) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/tg_sequence.c

Fixed reference count leak in sequence_get_clipped_position
------------------------------------------------------------------------
r3370 | jkbonfield | 2013-06-13 15:00:48 +0100 (Thu, 13 Jun 2013) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_selector.tcl

Removed object reference count leak in PopUpCSContigMenu().

------------------------------------------------------------------------
r3365 | jkbonfield | 2013-06-10 16:24:14 +0100 (Mon, 10 Jun 2013) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/consen.tcl

Also fixed the contig names output from get_consensus to use
[$c get_name] instead of the original identifier (which is possibly
a reading name of #number).

------------------------------------------------------------------------
r3364 | jkbonfield | 2013-06-10 11:13:18 +0100 (Mon, 10 Jun 2013) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/consen.tcl

get_consensus no longer outputs the same contig multiple times if it
is specified by a reading list with multiple seqs per contig.

------------------------------------------------------------------------
r3363 | jkbonfield | 2013-06-03 16:50:05 +0100 (Mon, 03 Jun 2013) | 16 lines
Changed paths:
   M /staden/trunk/src/gap5/g-request.c

Observed a database corruption where the same record had been freed
twice in a row, forming a tight loop in the free list.
This then subsequently causes the same record to be allocated twice in
a row, causing mayhem.

This workaround is in two parts.

1) g_free_rec_ (which returns a free record, not frees it) now checks
for the tight loop and corrects the free list if it finds this case,
returning G_NO_REC too (ie create a new record as none are free).

2) g_unlock_views with a view of flag G_VIEW_DELETED now does an
assertion for attempting to delete it twice in a row. I've no idea
where this happens, but if it happens again then the assert should
help to pinpoint where.

------------------------------------------------------------------------
r3361 | jkbonfield | 2013-05-31 11:35:53 +0100 (Fri, 31 May 2013) | 2 lines
Changed paths:
   M /staden/trunk/src/copy_reads/Makefile
   M /staden/trunk/src/gap4/Makefile
   M /staden/trunk/src/gap5/Makefile
   M /staden/trunk/src/prefinish/Makefile
   M /staden/trunk/src/pregap4/Makefile
   M /staden/trunk/src/spin/Makefile
   M /staden/trunk/src/trev/Makefile

Bug fixes to "make distsrc".

------------------------------------------------------------------------
r3360 | jkbonfield | 2013-05-31 11:24:28 +0100 (Fri, 31 May 2013) | 3 lines
Changed paths:
   M /staden/trunk/src/Makefile.in
   M /staden/trunk/src/gap4/tkAppInit.c
   M /staden/trunk/src/gap5/editor_search.c
   M /staden/trunk/src/gap5/tkAppInit.c
   M /staden/trunk/src/prefinish/tkMain.c
   M /staden/trunk/src/spin2/tkAppInit.c
   A /staden/trunk/src/tcl-license.terms
   M /staden/trunk/src/tk_utils/html_library.tcl
   M /staden/trunk/src/tk_utils/tclAppInit.c

Added copy of the Tcl license.terms file, to comply with their
licencing policy.

------------------------------------------------------------------------
r3359 | jkbonfield | 2013-05-31 11:16:29 +0100 (Fri, 31 May 2013) | 2 lines
Changed paths:
   D /staden/trunk/LICENCE.txt
   A /staden/trunk/src/LICENCE.txt (from /staden/trunk/LICENCE.txt:3358)

Moved to source tree so it can be including in "make dist"

------------------------------------------------------------------------
r3358 | jkbonfield | 2013-05-31 11:16:11 +0100 (Fri, 31 May 2013) | 2 lines
Changed paths:
   D /staden/trunk/LICENCE.rtf
   A /staden/trunk/src/LICENCE.rtf (from /staden/trunk/LICENCE.rtf:3357)

Moved to source tree so it can be including in "make dist"

------------------------------------------------------------------------
r3348 | jkbonfield | 2013-05-28 17:46:03 +0100 (Tue, 28 May 2013) | 11 lines
Changed paths:
   M /staden/trunk/src/gap5/check_assembly.c
   M /staden/trunk/src/gap5/check_assembly.h
   M /staden/trunk/src/gap5/check_assembly.tcl
   M /staden/trunk/src/gap5/contig_selector.c
   M /staden/trunk/src/gap5/contig_selector.tcl
   M /staden/trunk/src/gap5/cs-object.c
   M /staden/trunk/src/gap5/fij.c
   M /staden/trunk/src/gap5/find_oligo.c
   M /staden/trunk/src/gap5/find_oligo.h
   M /staden/trunk/src/gap5/find_repeats.c
   M /staden/trunk/src/gap5/find_repeats.tcl
   M /staden/trunk/src/gap5/gap5_cmd.tcl
   M /staden/trunk/src/gap5/gap5rc_menu_full
   M /staden/trunk/src/gap5/newgap5_cmds.c
   M /staden/trunk/src/gap5/readpair.c
   M /staden/trunk/src/gap5/readpair.tcl
   M /staden/trunk/src/gap5/result_manager.tcl
   M /staden/trunk/src/gap5/tk-io-reg.c

Added the ability to split apart Contig Comparator plot generation
from the actual plotting. This works for Find Internal Joins, Find
Repeats, Find Oligos (Sequence Search), Find Read Pairs and Check
Assembly.

Plots can now also be saved and loaded from the comparator window.

Combined this means we can also generate plots off-line, although they
become out of date very quickly - on the first contig edit. The
gap5_cmd script has an interface to these 5 plotting methods.

------------------------------------------------------------------------
r3347 | jkbonfield | 2013-05-24 15:11:03 +0100 (Fri, 24 May 2013) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/export_contigs.c
   M /staden/trunk/src/gap5/export_contigs.tcl
   M /staden/trunk/src/gap5/gap5rc

Added CRAM to the list of export formats.

When writing to cram it also writes a consensus fasta and fasta.fai
file to use as the reference, although it embeds this in the CRAM file
so it does not need to be preserved.

------------------------------------------------------------------------
r3342 | jkbonfield | 2013-05-22 14:50:26 +0100 (Wed, 22 May 2013) | 8 lines
Changed paths:
   M /staden/trunk/src/gap5/fij.c

Bug fix to updating join overlap regions for previously joined
contigs.

Also added some belt and braces code after this to double check for
possible local alignments, forcing them to be global alignments
instead, just incase we still have lurking bugs in the overlap
computation.

------------------------------------------------------------------------
r3341 | jkbonfield | 2013-05-22 14:18:59 +0100 (Wed, 22 May 2013) | 6 lines
Changed paths:
   M /staden/trunk/src/gap4/GTAGDB
   M /staden/trunk/src/gap5/cs-object.c
   M /staden/trunk/src/gap5/fij.c

Fixed setting the OBJ_FLAG_JOINED to mark contigs involved in
joins.  It was only detecting one of the two contigs.

Auto-join now creates a JOIN tag to mark the region spanning automatic
joins.

------------------------------------------------------------------------
r3340 | jkbonfield | 2013-05-22 12:27:36 +0100 (Wed, 22 May 2013) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/sam_index.c
   M /staden/trunk/src/gap5/sam_index.h
   M /staden/trunk/src/gap5/sam_pileup.c
   M /staden/trunk/src/gap5/sam_pileup.h
   M /staden/trunk/src/gap5/tg_index.c
   M /staden/trunk/src/gap5/tg_index_common.c

Switched from bam_open function to scram_open and ancillary
methods. This means we can now read CRAM too.

Also fixed a bug in PT/CT handling of multiple tags. It was missing
the first character on 2nd tag onwards due to the str++ but - this is
now outside the function rather than inside and per-tag.

------------------------------------------------------------------------
r3335 | jkbonfield | 2013-05-21 14:43:48 +0100 (Tue, 21 May 2013) | 6 lines
Changed paths:
   M /staden/trunk/src/configure.in
   M /staden/trunk/src/gap5/Makefile
   D /staden/trunk/src/gap5/gap5_check.in
   D /staden/trunk/src/gap5/gap5_check.tcl
   A /staden/trunk/src/gap5/gap5_cmd.in
   A /staden/trunk/src/gap5/gap5_cmd.tcl
   D /staden/trunk/src/gap5/gap5_command.tcl
   D /staden/trunk/src/gap5/gap5_consensus.in
   D /staden/trunk/src/gap5/gap5_consensus.tcl
   D /staden/trunk/src/gap5/gap5_export.in
   D /staden/trunk/src/gap5/gap5_export.tcl
   D /staden/trunk/src/gap5/gap5_shuffle_pads.in
   D /staden/trunk/src/gap5/gap5_shuffle_pads.tcl
   M /staden/trunk/src/staden_config.h.in

Replaced the gap5_{export,shuffle_pads,check,consensus} with a
generic gap5_cmd tool (this replaces the previous and unfinished
gap5_command program).

Also included in gap5_cmd is the interface to auto_join.

------------------------------------------------------------------------
r3334 | jkbonfield | 2013-05-20 17:26:43 +0100 (Mon, 20 May 2013) | 14 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_selector.c
   M /staden/trunk/src/gap5/contig_selector.h
   M /staden/trunk/src/gap5/cs-object.c
   M /staden/trunk/src/gap5/cs-object.h
   M /staden/trunk/src/gap5/editor_join.c
   M /staden/trunk/src/gap5/editor_join.h
   M /staden/trunk/src/gap5/fij.c
   M /staden/trunk/src/gap5/fij.h
   M /staden/trunk/src/gap5/fij.tcl
   M /staden/trunk/src/gap5/find_oligo.c
   M /staden/trunk/src/gap5/find_oligo.tcl
   M /staden/trunk/src/gap5/newgap5_cmds.c
   M /staden/trunk/src/gap5/readpair.c
   M /staden/trunk/src/gap5/tg_contig.c
   M /staden/trunk/src/gap5/tg_register.c
   M /staden/trunk/src/gap5/tg_register.h
   M /staden/trunk/src/gap5/tk-io-reg.c

Updated the FIJ and Find Oligos (more to come) to be split into
searching and plotting methods at the scripting level. The search
function now returns a registration ID and we then send a method to
this to plot (task TASK_CS_PLOT).

Experimented with task TASK_CS_SAVE (but no load implemented yet).

Added TASK_CS_AUTO_JOIN. This is the bulk of this commit.  It runs the
join editor Align button code (now also split up into separate
algorithms to avoid needing the editor up) and if it finds a high
enough quality alignment it'll run the joining code.

The command line script to perform auto-join will follow.

------------------------------------------------------------------------
r3332 | jkbonfield | 2013-05-17 17:38:44 +0100 (Fri, 17 May 2013) | 8 lines
Changed paths:
   M /staden/trunk/src/gap5/shuffle_pads.c

Bug fix to tag shifting.

It wasn't correctly taking into account the s->left value in the
position.

It also wasn't allowing for entire reads to be shifting, also
requiring tags to shift.

------------------------------------------------------------------------
r3328 | jkbonfield | 2013-05-15 11:23:11 +0100 (Wed, 15 May 2013) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/result_manager.tcl

Fixed display to show #ID instead of #0 (contig number).

------------------------------------------------------------------------
r3326 | daviesrob | 2013-05-13 15:23:44 +0100 (Mon, 13 May 2013) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/import_contigs.tcl

Fixed New->From Imported File
------------------------------------------------------------------------
r3325 | daviesrob | 2013-05-13 13:51:39 +0100 (Mon, 13 May 2013) | 18 lines
Changed paths:
   M /staden/trunk/src/gap5/assemble_single.tcl
   M /staden/trunk/src/gap5/editor_view.c
   M /staden/trunk/src/gap5/fasta.c
   M /staden/trunk/src/gap5/import_contigs.tcl
   M /staden/trunk/src/gap5/map_reads.tcl
   M /staden/trunk/src/gap5/tg_index_common.c
   M /staden/trunk/src/tk_utils/text_output.c

Reworked fasta/fastq import; map reads fixes.

Unified fasta and fastq reading code.  The new code works out which sort of
file is being read, so it's no longer necessary to specify the file type.
Improved error detection and handing of out of memory conditions.  Messages
are now output using vmessage/verror so they go to the gap5 GUI and not the
user's terminal.

Wrapped tcl calls to import_reads in catch blocks to stop the GUI from being
left in busy mode if the import fails.

Made MapReads_tidyup actually tidy up the temporary files.

Fixed bwa sampe map_reads so that it actually completes.

Made UpdateTextOutput flush stdout in text mode.


------------------------------------------------------------------------
r3324 | jkbonfield | 2013-05-13 13:46:50 +0100 (Mon, 13 May 2013) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/gap5.tcl

Added citation to startup text.

------------------------------------------------------------------------
r3323 | jkbonfield | 2013-05-13 12:11:48 +0100 (Mon, 13 May 2013) | 13 lines
Changed paths:
   M /staden/trunk/src/gap5/gap_range.c
   M /staden/trunk/src/gap5/tg_contig.c

Without accurate mode on, the template display takes the pair
start/end values as gospel even with the timestamps indicate they are
out of date.

This is fine, but a couple fixes rationalise it further:

- Make sure we set timestamp in tg_contig so fewer are considerdd out
  of date. (This was just an omission.)

- When the read pair is in this same contig but beyond the contig
  extents due to Break Contig, it's obviously not correct. Mark these
  as spanning instead.

------------------------------------------------------------------------
r3322 | jkbonfield | 2013-05-13 11:47:47 +0100 (Mon, 13 May 2013) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/Makefile

Removed rogue dependency, put there by accidentally running "make depend"
on a configuration using a local lzma dependency.

------------------------------------------------------------------------
r3320 | jkbonfield | 2013-05-10 14:35:05 +0100 (Fri, 10 May 2013) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/g-alloc.c
   M /staden/trunk/src/gap5/gap-error.c
   M /staden/trunk/src/gap5/newgap5_cmds.c
   M /staden/trunk/src/gap5/sam_pileup.h
   M /staden/trunk/src/gap5/tg_gio.c

Various minor compilation warning fixes (ok and sam_pileup.h which I
forgot to add to the previous commit).

In the case of the error functions this removes potential crashes
if the error message contained percent-codes.

------------------------------------------------------------------------
r3319 | jkbonfield | 2013-05-10 14:28:54 +0100 (Fri, 10 May 2013) | 3 lines
Changed paths:
   M /staden/trunk/src/Misc/os.h
   M /staden/trunk/src/gap5/Makefile
   D /staden/trunk/src/gap5/bam.c
   D /staden/trunk/src/gap5/bam.h
   M /staden/trunk/src/gap5/export_contigs.c
   M /staden/trunk/src/gap5/sam_index.c
   M /staden/trunk/src/gap5/tg_index.c

Removed Gap5's own SAM/BAM reading code and made it use the latest
io_lib version.

------------------------------------------------------------------------
r3318 | jkbonfield | 2013-05-09 15:02:54 +0100 (Thu, 09 May 2013) | 8 lines
Changed paths:
   M /staden/trunk/src/gap5/hash_lib.c

Fixed an error causing FIJ to miss some joins consisting of only one
hash hit.

Also substantially modified the block-stitching heuristics. Typically
it's finding ~2% more joins now and generally at a better percentage
mismatch (averaging 4% better).


------------------------------------------------------------------------
r3317 | daviesrob | 2013-05-07 17:57:45 +0100 (Tue, 07 May 2013) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/tg_gio.c

Reverted accidental commit of tg_gio.c
------------------------------------------------------------------------
r3316 | daviesrob | 2013-05-07 17:55:41 +0100 (Tue, 07 May 2013) | 14 lines
Changed paths:
   M /staden/trunk/src/gap5/find_repeats.c
   M /staden/trunk/src/gap5/gap_hash.c
   M /staden/trunk/src/gap5/hash_lib.c
   M /staden/trunk/src/gap5/tg_gio.c

Find Repeats fixes - malloc error handling and incorrectly recorded matches.

Improved handling of out-of-memory conditions in repeat_search,
repeat_search_depadded and gap_realloc_matches.

Stopped match_fwd_back from running beyond the end of a sequence.  This could
lead to matches being allocated to the wrong contigs.

Removed call to remdup in reps_nocount.  The duplicates shouldn't be there
anyway, and it seemed to remove some reverse matches that were not duplicates.

Fixed off-by-one errors in find_repeats, caused by confusion between counting
positions from 1 and zero.  The new version appears to give the right answer.

------------------------------------------------------------------------
r3315 | jkbonfield | 2013-05-07 15:05:59 +0100 (Tue, 07 May 2013) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_selector.c

This time testing it builds! Ooops

------------------------------------------------------------------------
r3314 | jkbonfield | 2013-05-07 14:27:12 +0100 (Tue, 07 May 2013) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_selector.c

Speed up - no need to compute the total contig length twice.

------------------------------------------------------------------------
r3313 | jkbonfield | 2013-05-07 12:50:17 +0100 (Tue, 07 May 2013) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/gap_range.c
   M /staden/trunk/src/gap5/template_display.c

Bug fix to template display drawing, fixing a crash. Occasionally it
could attempt to draw in an unallocated colour, caused by zooming up
in Y and then selecting the uninitialised fwd/rev_col3.

------------------------------------------------------------------------
r3272 | daviesrob | 2013-04-12 14:27:59 +0100 (Fri, 12 Apr 2013) | 8 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_register.c

Fixed iteration on wrong contig number in contig_register_join.

Iterator hit searches on cto, but the next search incorrectly used cfrom.
This could lead to hit returning entries for cfrom if cto and cfrom happened
to hash into the same bin.  If it did, they were incorrectly deleted which
could lead to a crash later on in contig_reg_remove when it tries to
access the deleted item.  Changing HacheTableNext to use cto fixes this.

------------------------------------------------------------------------
r3271 | jkbonfield | 2013-04-11 14:46:25 +0100 (Thu, 11 Apr 2013) | 11 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_contig.c

Bug fix to r3240 which added contig_insert_bases() function to perform
multi-base insertions. This was used by shuffle pads and join editor
align button.

MAJOR ERROR: It produced alignment errors downstream where the next
bin started as that was still ch->pos++ instead of ch->pos += nbases.

Also tidied up the logic surrounding reference base coordinates,
although less of a major issue. I'm still not 100% certain refpos
updates are correct though.

------------------------------------------------------------------------
r3267 | daviesrob | 2013-04-10 11:24:19 +0100 (Wed, 10 Apr 2013) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/find_oligo.c

Speed up OBJ_GET_BRIEF by showing contig numbers instead of leftmost read
------------------------------------------------------------------------
r3266 | daviesrob | 2013-04-09 09:39:07 +0100 (Tue, 09 Apr 2013) | 16 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_view.c
   M /staden/trunk/src/gap5/editor_view.h
   M /staden/trunk/src/gap5/tkEditor.c

Fixed cache look-up of edview structs.

edview_hash now allows duplicate keys so that it can handle the same contig
being open in multiple views.  edview_destroy has been updated so that it
searches for the correct edview struct when removing items.

Added edview_renumber, which changes the contig record number associated
with an editor (e.g. when joining).  It also updates edview_hash so
that the edview struct is refiled under the new record number.  This fixes
a crash caused by an old edview	being used after a join as it wasn't cleaned
up correctly.

Simplified edview_find.  It can only return one edview pointer, so it returns
the first one it finds for the contig record number.  This is likely to be
the last one that was opened.

------------------------------------------------------------------------
r3240 | jkbonfield | 2013-03-25 16:25:28 +0000 (Mon, 25 Mar 2013) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_join.c
   M /staden/trunk/src/gap5/shuffle_pads.c
   M /staden/trunk/src/gap5/tg_contig.c
   M /staden/trunk/src/gap5/tg_contig.h
   M /staden/trunk/src/gap5/tg_sequence.c
   M /staden/trunk/src/gap5/tg_sequence.h

Added contig_insert_bases() and sequence_insert_bases() functions to
insert multiple bases of the same base/conf. Practically speaking that
just means runs of pads, however it sometimes has a major speed
improvement to the join editor and possibly shuffle pads.

------------------------------------------------------------------------
r3231 | daviesrob | 2013-03-21 12:03:02 +0000 (Thu, 21 Mar 2013) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl

Fixed handling of JOIN_TO registration events.

Calls io_detach for the old contig number.
Properly sets opt(io), opt(io2), opt(contig), opt(contig2) depending on
which contig(s) have been joined.

------------------------------------------------------------------------
r3210 | daviesrob | 2013-03-19 09:28:36 +0000 (Tue, 19 Mar 2013) | 33 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/depth.tcl
   M /staden/trunk/src/gap5/gap5.tcl
   M /staden/trunk/src/gap5/list_proc.tcl
   M /staden/trunk/src/gap5/ng_fb_cmds.tcl

Clean up windows when closing the database; various list editor improvements.

Stop Gap_Open from trying to exit if the user presses cancel when asked to
save contig changes.

Clean up old windows when closing the database.  This prevents crashes
caused by stale $io references in the old windows.

Raise the contig editor window before asking if changes should be saved.
Reduces the chance of the save changes dialogue from being obscured by
other windows.  Also makes it easier to see which contig editor is being
referred to.

List editor windows are now tracked using an array variable instead of
by creating unmapped child windows of the main window.  List editor toplevel
windows are now direct children of the main window, which allows the window
clean-up code to find them more easily.

Only bring up the extended reads list view for lists that have the appropriate
magic enabled.  Normal lists, along with the contigs and allcontigs lists,
get the standard list editor instead.

Prevent the pop-up menu from appearing in the extended read list view if the
user right clicks on an entry that is not a valid read identifier.

When outputting to another list from the extended reads list, properly filter
out entries that are not valid reads.

Fixed a couple of contig reference leaks in list_proc.tcl

Try to speed up saving long read lists when closing the list editor.


------------------------------------------------------------------------
r3197 | daviesrob | 2013-03-12 15:12:14 +0000 (Tue, 12 Mar 2013) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_join.c
   M /staden/trunk/src/gap5/import_gff.tcl

Added more logging.

Log calls to import_gff, and edJoinAlign.  edJoinAlign logging includes the
positions of the two contig editor windows.

------------------------------------------------------------------------
r3196 | daviesrob | 2013-03-12 15:09:19 +0000 (Tue, 12 Mar 2013) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/tg_index_common.c

Set r.y in save_range_sequence
------------------------------------------------------------------------
r3194 | jkbonfield | 2013-03-11 11:18:41 +0000 (Mon, 11 Mar 2013) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_cache.c

Fixed a memory error where I accessed a pointer immediately after
freeing it in cache_flush().

------------------------------------------------------------------------
r3193 | daviesrob | 2013-03-11 10:08:33 +0000 (Mon, 11 Mar 2013) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/assemble_single.tcl

Enable menus after loading single reads from a fasta file.
------------------------------------------------------------------------
r3190 | daviesrob | 2013-03-08 11:30:44 +0000 (Fri, 08 Mar 2013) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/tg_gio.c

Remove .g5d/.g5x suffix when making log file name
------------------------------------------------------------------------
r3189 | daviesrob | 2013-03-07 17:15:10 +0000 (Thu, 07 Mar 2013) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/select_contig.tcl

Stop UpdateContigLimits from complaining about an empty entrybox.

Makes deleting whatever is there and then going to find something to paste
in much less annoying.

------------------------------------------------------------------------
r3188 | daviesrob | 2013-03-07 14:19:42 +0000 (Thu, 07 Mar 2013) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/contig_extend.tcl

Added SetBusy/ClearBusy around contig_extend
------------------------------------------------------------------------
r3187 | daviesrob | 2013-03-07 14:13:07 +0000 (Thu, 07 Mar 2013) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/consensus.c
   M /staden/trunk/src/gap5/contig_extend.c
   M /staden/trunk/src/gap5/gap4_compat.c
   M /staden/trunk/src/gap5/select_contig.tcl

Improved handling of invalid contig/read record numbers entered by the user
------------------------------------------------------------------------
r3186 | daviesrob | 2013-03-07 11:39:18 +0000 (Thu, 07 Mar 2013) | 31 lines
Changed paths:
   M /staden/trunk/src/gap5/assemble_single.tcl
   M /staden/trunk/src/gap5/break_contig.tcl
   M /staden/trunk/src/gap5/check_assembly.tcl
   M /staden/trunk/src/gap5/check_database.tcl
   M /staden/trunk/src/gap5/complement.tcl
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/contig_extend.tcl
   M /staden/trunk/src/gap5/contig_selector.tcl
   M /staden/trunk/src/gap5/dis_readings.tcl
   M /staden/trunk/src/gap5/editor_join.c
   M /staden/trunk/src/gap5/fij.tcl
   M /staden/trunk/src/gap5/find_oligo.tcl
   M /staden/trunk/src/gap5/find_repeats.tcl
   M /staden/trunk/src/gap5/gap4_compat.c
   M /staden/trunk/src/gap5/gap_cli_arg.c
   M /staden/trunk/src/gap5/import_contigs.tcl
   M /staden/trunk/src/gap5/list_contigs.tcl
   M /staden/trunk/src/gap5/list_proc.tcl
   M /staden/trunk/src/gap5/map_reads.tcl
   M /staden/trunk/src/gap5/shuffle_pads.tcl
   M /staden/trunk/src/gap5/tag_checklist.tcl
   M /staden/trunk/src/gap5/tag_editor.tcl
   M /staden/trunk/src/gap5/tg_gio.c
   M /staden/trunk/src/gap5/tg_register.c
   M /staden/trunk/src/text_utils/text_output.h
   M /staden/trunk/src/text_utils/text_output_stubs.c
   M /staden/trunk/src/tk_utils/text_output.c
   M /staden/trunk/src/tk_utils/text_output.h

Added logging and improved list handling.

Added code to create .log files, in a similar manner to gap4.  Currently
disabled, but can be turned on by uncommenting #define DO_LOGGING in
tg_gio.c.

Improved logging code in tk_utils/text_output.c, including adding new
tcl interfaces log_str, log_call and log_vmessage.  log_str writes its
parameters to the log file.  log_call does the same, but then calls
Tcl_EvalObjv on the parameter list.  This allows tcl function calls to be
logged by simply putting 'log_call' in front of them. log_vmessage is
a tcl interface to the C log_vmessage function.  It controls whether
messages written to the gap5 message window are also written to the log file.
log_vmessage now returns the previous setting.

Put logging statements everywhere so pretty much anything the user does
that changes the database gets recorded when logging is enabled.

Made some improvements to handling of unusual contig names.  Gave up on
ones with spaces in, and just prevented the contig rename dialogues from
allowing you to put a space in a contig name.  They are not allowed in most
other formats anyway.

Simplified lget_contig_num_base.  It now uses tcl list handling functions
and removes duplicates while building the list instead of filtering them
out later.

The extended reads list now checks that the items in the list really are
reads.  Stops get_sequence from throwing an error if the user tries to
get an extended view of the contig list.

------------------------------------------------------------------------
r3183 | daviesrob | 2013-03-05 17:36:26 +0000 (Tue, 05 Mar 2013) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/shuffle_pads.c

Fixed crash in shuffle pads caused by out-of-bounds read clip points
------------------------------------------------------------------------
r3157 | daviesrob | 2013-02-21 09:42:47 +0000 (Thu, 21 Feb 2013) | 11 lines
Changed paths:
   M /staden/trunk/src/gap5/gap5.tcl
   M /staden/trunk/src/gap5/gap5rc_menu_full
   A /staden/trunk/src/gap5/import_contigs.tcl
   M /staden/trunk/src/gap5/ng_fb_cmds.tcl
   M /staden/trunk/src/gap5/tclIndex

Added user interface to import_reads and to make an empty database.

Added menu items and interfaces to allow users to import reads without
having to use tg_index.  Also allow them to create an empty database.

Fixed bitmap values for the main menus so that items are enabled and disabled
correctly as the state changes from started to database open but empty to
open with data in it.

Prevented divide by zero in DatabaseInfo when run on an empty database.

------------------------------------------------------------------------
r3152 | daviesrob | 2013-02-19 15:04:54 +0000 (Tue, 19 Feb 2013) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_anno.c
   M /staden/trunk/src/gap5/tg_tcl.c

Fixed attempt to remove GT_AnnoEle range records twice.

GT_AnnoEle were being removed by bin_remove_item, and then again by
anno_ele_destroy.  The latter couldn't find them, so returned an error code
which caused delete_tag_single_contig to stop after only removing one tag.
Fixed by declaring anno_ele_destroy obsolete and not calling it any more.

------------------------------------------------------------------------
r3149 | daviesrob | 2013-02-14 15:36:21 +0000 (Thu, 14 Feb 2013) | 37 lines
Changed paths:
   M /staden/trunk/src/gap5/Makefile
   M /staden/trunk/src/gap5/ace.c
   M /staden/trunk/src/gap5/actf.c
   M /staden/trunk/src/gap5/afg.c
   M /staden/trunk/src/gap5/baf.c
   M /staden/trunk/src/gap5/bam.c
   M /staden/trunk/src/gap5/bam.h
   M /staden/trunk/src/gap5/break_contig.c
   M /staden/trunk/src/gap5/caf.c
   M /staden/trunk/src/gap5/check_assembly.c
   M /staden/trunk/src/gap5/consen.c
   M /staden/trunk/src/gap5/consensus.c
   M /staden/trunk/src/gap5/contig_extend.c
   M /staden/trunk/src/gap5/contig_selector.c
   M /staden/trunk/src/gap5/dis_readings.c
   M /staden/trunk/src/gap5/editor_search.c
   M /staden/trunk/src/gap5/editor_view.c
   M /staden/trunk/src/gap5/export_contigs.c
   M /staden/trunk/src/gap5/fasta.c
   M /staden/trunk/src/gap5/gap4_compat.c
   M /staden/trunk/src/gap5/gap_range.c
   M /staden/trunk/src/gap5/import_gff.c
   M /staden/trunk/src/gap5/list_proc.c
   M /staden/trunk/src/gap5/maq.c
   M /staden/trunk/src/gap5/newgap5_cmds.c
   M /staden/trunk/src/gap5/qualIO.c
   M /staden/trunk/src/gap5/sam_index.c
   M /staden/trunk/src/gap5/sam_pileup.c
   M /staden/trunk/src/gap5/shuffle_pads.c
   M /staden/trunk/src/gap5/tg_anno.c
   M /staden/trunk/src/gap5/tg_bin.c
   M /staden/trunk/src/gap5/tg_cache.c
   M /staden/trunk/src/gap5/tg_contig.c
   M /staden/trunk/src/gap5/tg_gio.h
   M /staden/trunk/src/gap5/tg_iface_g.c
   M /staden/trunk/src/gap5/tg_index.c
   M /staden/trunk/src/gap5/tg_register.c
   M /staden/trunk/src/gap5/tg_scaffold.c
   M /staden/trunk/src/gap5/tg_scaffold.h
   M /staden/trunk/src/gap5/tg_sequence.c
   M /staden/trunk/src/gap5/tg_sequence.h
   M /staden/trunk/src/gap5/tg_struct.h
   M /staden/trunk/src/gap5/tg_tcl.c
   M /staden/trunk/src/gap5/tg_view.c
   M /staden/trunk/src/gap5/tk-io-reg.c
   M /staden/trunk/src/gap5/tkAppInit.c
   M /staden/trunk/src/gap5/tkEdNames.c
   M /staden/trunk/src/gap5/zfio.c

Fix compiler warnings and few bugs.

Fixes for lots of compiler warnings, make compilation with -Wall much less
chatty.  Also fix some bugs that were flagged up by the warnings.

The changes to remove warnings are:
  * Added missing include files and prototypes.
  * Fixed lots of signed / unsigned issues, especially for char types.
  * Ensure indexes into look-up tables are unsigned
  * Removed redundant variables.
  * Assignments used as truth values.

A notable change is that confidence values are now type int8_t instead
of char.  They need to be signed as log-odds scores can be negative.

The other fixes are:

caf.c            - removed use of isblank (requires C99)

consensus.c      - misplaced bracket in get_uniqueness.

export_contigs.c - in sam_depadded_cigar, fix use of & instead of &&

newgap5_cmds.c   - In tcl_reformat_sequence, set default max cut-off to 127.
                   This is consistent with using signed confidence values.

tg_anno.c        - delete_tag_single_contig no longer tries to carry on in
                   the fact of errors.

tg_tcl.c         - Wrong parameter index used for l.score in ADD_LINK case of
                   contig_cmd
                 - sequence_cmd cases GET_CONF and GET_CONF4 now return
                   a ByteArrayObj instead of a StringObj.  This stops Tcl
                   from trying to interpret negative confidence values as
                   UTF-8 characters.


------------------------------------------------------------------------
r3146 | daviesrob | 2013-02-13 17:21:08 +0000 (Wed, 13 Feb 2013) | 16 lines
Changed paths:
   M /staden/trunk/src/gap5/consensus.c
   M /staden/trunk/src/gap5/map_reads.tcl
   M /staden/trunk/src/gap5/newgap5_cmds.c
   M /staden/trunk/src/gap5/sam_index.c

Fixes for bugs in map_reads, import_reads and calculate_consensus_bit_het.

Fix various bugs:

 Attempt to read a closed filehandle in MapReads_run (map_reads.tcl).

 Not setting link_pairs parameter in tcl_import_reads (newgap5_cmds.c).

 Failure to resize s->pad in sam_add_seq, leading to a buffer overflow if
 enough pads get added (sam_index.c).

 Reading past the end of a sequence in calculate_consensus_bit_het if the
 right clip point is past the end.  This shouldn't happen, but databases do
 exist with clipping broken in this way.


------------------------------------------------------------------------
r3135 | daviesrob | 2013-02-08 12:35:20 +0000 (Fri, 08 Feb 2013) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/editor_view.c

Put in work-around for crash due to edGetSelection being called with a
massive value for offset.  Not sure what the root cause is at the
moment, it needs more investigation.
------------------------------------------------------------------------
r3118 | daviesrob | 2013-02-01 14:42:34 +0000 (Fri, 01 Feb 2013) | 8 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_join.c

Disable rounding up of bin sizes in extend_root_bin

Rounding up the new bin size to a power of 2 gives a more balanced tree
structure.  Unfortunately it also leads to the bins growing in size very
rapidly under certain conditions during long sequences of joins.  In view
of this, the rounding up code has been disabled for now until we come up
with a better solution.

------------------------------------------------------------------------
r3117 | daviesrob | 2013-01-30 11:59:20 +0000 (Wed, 30 Jan 2013) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/tg_iface_g.c

Made off[] array the right size in unpack_rng_array
------------------------------------------------------------------------
r3116 | daviesrob | 2013-01-28 09:29:32 +0000 (Mon, 28 Jan 2013) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/tman_interface.c

Always set edc->dc = NULL in tman_unhighlight

Fixes bug where shutting down the join editor without first closing the
trace display causes a crash the next time an attempt is made to view a
trace.

------------------------------------------------------------------------
r3105 | jkbonfield | 2013-01-07 15:02:05 +0000 (Mon, 07 Jan 2013) | 14 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/gap_utils.tcl
   M /staden/trunk/src/gap5/tg_cache.c
   M /staden/trunk/src/gap5/tg_contig.c
   M /staden/trunk/src/gap5/tg_tcl.c

Fixed an issue with renaming contigs within or outside of the contig
selector while edits are being made.

The contig name is held in two places - the contig name B+Tree
providing name->rec mapping, and the contig_t struct itself.

To avoid clashes when renaming multiple contigs within the contig
editors the B+Tree is not updated until we hit Save. Similarly edits
are now made on the child IO rather than the base I/O. The act of
flushing the child I/O is what performs the B+Tree update.

Also made the Contig List window perform a contig_lock_write call,
forcing any existing editors to prompt for saving.

------------------------------------------------------------------------
r3104 | jkbonfield | 2013-01-07 11:51:45 +0000 (Mon, 07 Jan 2013) | 10 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_iface_g.c

Initialise c->clipped_timestamp when loading single contigs in the
older database format.

Without this we could generate random timestamps and so sometimes use
a cached (zero length) contig size when the cache wasn't valid,
leading to truncated contigs from Save Consensus (and elsewhere).

This only happened when using the newer gap5 on a database built with
the older tg_index.

------------------------------------------------------------------------
r3103 | awhitwham | 2012-12-21 10:12:25 +0000 (Fri, 21 Dec 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_view.c
   M /staden/trunk/src/gap5/editor_view.h
   M /staden/trunk/src/gap5/tg_contig.c
   M /staden/trunk/src/gap5/tg_contig.h
   M /staden/trunk/src/gap5/tg_struct.h

Moved sort settings into the editor view.  Not entirely happy with the behaviour in the Join Editor but at least it should not crash.

------------------------------------------------------------------------
r3102 | jkbonfield | 2012-11-27 10:26:43 +0000 (Tue, 27 Nov 2012) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_bin.c

Fixed a bug with cached consensus lengths and sequence clipping.
Adjusting clip points at left/right end could leave trailing Ns at the
end of the contig.

We now increment the contig timestamp to force the cached size to be
recomputed.

------------------------------------------------------------------------
r3101 | jkbonfield | 2012-11-20 17:16:31 +0000 (Tue, 20 Nov 2012) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/shuffle_pads.c

Implemented a newer resort_contigl() function that uses qsort()
instead of a weak bubble (or even worse!) sort variant.

This was becoming the dominant part of performance in very deep
assemblies, but acted fine elsewhere. The newer code has better worst
case implementation, given that qsort() isn't pure quick-sort.

------------------------------------------------------------------------
r3100 | daviesrob | 2012-11-08 14:35:44 +0000 (Thu, 08 Nov 2012) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/break_contig.c

Update timestamps to prevent contig_visible_start/end from using stale
cached data.


------------------------------------------------------------------------
r3099 | jkbonfield | 2012-11-06 16:15:25 +0000 (Tue, 06 Nov 2012) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/consensus.c

Fixed calculate_consensus_bit_het() to assign confidence for an N call
to all of A,C,G,T but not *.

This fixes issues of N vs * being * while A vs * is A, given equal
quality for all bases (eg after import of a fasta file).


------------------------------------------------------------------------
r3098 | jkbonfield | 2012-11-05 16:28:07 +0000 (Mon, 05 Nov 2012) | 10 lines
Changed paths:
   M /staden/trunk/src/gap5/list_contigs.tcl
   M /staden/trunk/src/gap5/tg_tcl.c

The "$io contig_order" method now permits setting of the order as well
as querying. This can be used interactively to fix broken DBs.

Save Order in the List Contigs window now generates a list based on
=num instead of contig names. This means when a contig name is missing
from the name B+Tree index it doesn't silently throw away contigs.

This doesn't fix the bug that renaming sometimes fails, but it stops
it from causing subsequent data loss.

------------------------------------------------------------------------
r3097 | jkbonfield | 2012-10-30 16:57:54 +0000 (Tue, 30 Oct 2012) | 9 lines
Changed paths:
   M /staden/trunk/src/gap5/gap5rc
   M /staden/trunk/src/gap5/gap_range.c
   M /staden/trunk/src/gap5/gap_range.h
   M /staden/trunk/src/gap5/template_display.c
   M /staden/trunk/src/gap5/template_draw.h

Added 10 alternative colour choices for the template display spanning
contigs.  I'm open to other colours as the 10 chosen are a bit
arbitrary, but I tried to pick things that didn't get confused with
blues, reds and greys already in use.

This doesn't guarantee neighbouring spanning read pairs in two
different contigs come up in two different colours (as to do so would
mean changing colours as we scroll), but it's a good start I think.

------------------------------------------------------------------------
r3096 | jkbonfield | 2012-10-30 12:21:29 +0000 (Tue, 30 Oct 2012) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/consensus.c
   M /staden/trunk/src/gap5/tg_sequence.c

Fixed uninitialised access of pair_contig in sequence_get_rangec().

Also removal of some debugging output.

------------------------------------------------------------------------
r3095 | jkbonfield | 2012-10-29 14:48:57 +0000 (Mon, 29 Oct 2012) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/list_proc.tcl
   M /staden/trunk/src/gap5/tclIndex
   M /staden/trunk/src/gap5/tg_sequence.c
   M /staden/trunk/src/gap5/tg_sequence.h
   M /staden/trunk/src/gap5/tg_tcl.c

Added a multi-column List viewer. It's much like the old Readings list
editor/viewer, but showing the location of boths ends if a
read-pair. The reads are shown in a tablelist widget with sortable
columns, permitting selection of sub-lists for further refinement.

------------------------------------------------------------------------
r3094 | jkbonfield | 2012-10-29 14:46:32 +0000 (Mon, 29 Oct 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/gap4_compat.c

Fix to CalcTotalContigLen to use clipped contig lengths.

------------------------------------------------------------------------
r3093 | jkbonfield | 2012-10-29 14:33:23 +0000 (Mon, 29 Oct 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/list_contigs.tcl

Fix and issue with Scaffold name sorting when a scaffold doesn't exist.

------------------------------------------------------------------------
r3092 | daviesrob | 2012-10-17 11:27:22 +0100 (Wed, 17 Oct 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/configure.in
   M /staden/trunk/src/gap5/tg_gio.h

Added a check for inline to configure.in, and use it in tg_gio.h to remove an
annoying warning about DB_VERS.

------------------------------------------------------------------------
r3091 | jkbonfield | 2012-10-17 11:13:45 +0100 (Wed, 17 Oct 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/Makefile

Dependency updates via "make depend"

------------------------------------------------------------------------
r3090 | jkbonfield | 2012-10-16 17:08:33 +0100 (Tue, 16 Oct 2012) | 8 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_selector.c
   M /staden/trunk/src/gap5/contig_selector.h
   M /staden/trunk/src/gap5/contig_selector.tcl

The contig selector now shows clipped lengths. Note this may be slow
on older format databases, but with the new clipped length caching it
is fast on modern ones and also once it's computed and cached on old
DBs.

Also fixed a bug where the X/Y coords displayed and invoked (editor)
didn't compensate for contigs that start somewhere other than base 1.

------------------------------------------------------------------------
r3089 | jkbonfield | 2012-10-15 17:08:44 +0100 (Mon, 15 Oct 2012) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/consensus.c
   M /staden/trunk/src/gap5/gap4_compat.c
   M /staden/trunk/src/gap5/gap4_compat.h
   M /staden/trunk/src/gap5/list_contigs.tcl
   M /staden/trunk/src/gap5/tg_iface_g.c
   M /staden/trunk/src/gap5/tg_struct.h
   M /staden/trunk/src/gap5/tg_tcl.c

Use the contig timestamp to verify if the cached clipped start/end
positions are valid. In-memory contig structs do this via the
clipped_timestamp value, but to preserve compatibility with the
existing disc format this is convert to a CONTIG_FLAG_CLIPPED_VALID
flag on disc.

------------------------------------------------------------------------
r3088 | jkbonfield | 2012-10-12 17:20:43 +0100 (Fri, 12 Oct 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/gap5rc_menu_full
   M /staden/trunk/src/gap5/tg_contig.c
   M /staden/trunk/src/gap5/tg_contig.h

Added rangec_t sort modes by template status (single, paired, bad,
etc) and by library record number.

------------------------------------------------------------------------
r3087 | jkbonfield | 2012-10-12 15:27:34 +0100 (Fri, 12 Oct 2012) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/list_contigs.tcl
   M /staden/trunk/src/gap5/tg_tcl.c

Fixed the default width of the contig list when faced with
exceptionally long contig names.

Also (commented out for now, as debugging only) added the ability to
show a column of contig timestamps.

------------------------------------------------------------------------
r3086 | jkbonfield | 2012-10-12 15:12:02 +0100 (Fri, 12 Oct 2012) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/ace.c
   M /staden/trunk/src/gap5/afg.c
   M /staden/trunk/src/gap5/baf.c
   M /staden/trunk/src/gap5/caf.c
   M /staden/trunk/src/gap5/maq.c
   M /staden/trunk/src/gap5/sam_index.c
   M /staden/trunk/src/gap5/tg_index.c
   M /staden/trunk/src/gap5/tg_index.h
   M /staden/trunk/src/gap5/tg_index_common.c
   M /staden/trunk/src/gap5/tg_index_common.h

When using tg_index on multiple files (eg tg_index a.bam b.bam c.bam)
or appending to an existing database (tg_index -a) we will now
automatically check for read-pairing between files. Use -L option to
disable this.

------------------------------------------------------------------------
r3085 | jkbonfield | 2012-10-12 12:34:51 +0100 (Fri, 12 Oct 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/sam_index.c

Initialise bio->libs so that "tg_index -a" or "tg_index *.bam" don't
cause duplicate libraries to appear.

------------------------------------------------------------------------
r3084 | jkbonfield | 2012-10-11 16:03:23 +0100 (Thu, 11 Oct 2012) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/depth.tcl

Disabled Accurate mode by default again as it's too slow when run on
older format databases. (Ideally we should make it user controllable
by putting this in the gap5rc file.)

------------------------------------------------------------------------
r3083 | jkbonfield | 2012-10-11 15:33:10 +0100 (Thu, 11 Oct 2012) | 35 lines
Changed paths:
   M /staden/trunk/src/gap5/break_contig.c
   M /staden/trunk/src/gap5/depth.tcl
   M /staden/trunk/src/gap5/dis_readings.c
   M /staden/trunk/src/gap5/editor_join.c
   M /staden/trunk/src/gap5/gap4_compat.c
   M /staden/trunk/src/gap5/gap5_thrash.tcl
   M /staden/trunk/src/gap5/gap_range.c
   M /staden/trunk/src/gap5/hache_table.c
   M /staden/trunk/src/gap5/tg_bin.c
   M /staden/trunk/src/gap5/tg_check.c
   M /staden/trunk/src/gap5/tg_contig.c
   M /staden/trunk/src/gap5/tg_gio.c
   M /staden/trunk/src/gap5/tg_gio.h
   M /staden/trunk/src/gap5/tg_iface_g.c
   M /staden/trunk/src/gap5/tg_index_common.c
   M /staden/trunk/src/gap5/tg_index_common.h
   M /staden/trunk/src/gap5/tg_sequence.c
   M /staden/trunk/src/gap5/tg_struct.h

Major addition (and corresponding database format version change)
involving caching of read pair data.

The Bin GRange arrays now hold pair_{start, end, mqual, contig} in
addition to the previously held pair_rec value. This means the
absolute position of a read-pair can be obtained fast (faster even
than the absolute position of "yourself") without needing to resort to
extra seeks and I/O.

However this data can become outdated if edits occur, such as
breaking/joining, complementing or even just insertion and deletion to
contigs and/or sequences. So every range element also now has a
pair_timestamp indicating when the pair_* records were last validated.

The timestamp is compared against the pair_contig, if it still exists,
and against the main database timestamp. (The timestamps are simply
incremental numbers rather than actual times.)

There is a high chance of an error in this caching code given the
complexity and number of places that we could invalidate the cache,
but it has been well tested.

Benchmarks
==========

After initial tg_index (which sets valid timestamps) I see approx 100x
reduction in seeks and I/O for the template display in "Acc"urate mode
(this is now the default mode). ~1.1k vs 107k seeks.

After editing a contig, scrolling in the template display then
drastically slows down while the data is recomputed, but not by as
much as the old template display was at all times. It's maybe 5-6x
slower than a fully up to date version, and soon speeds up again.


------------------------------------------------------------------------
r3082 | jkbonfield | 2012-10-11 14:38:09 +0100 (Thu, 11 Oct 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_view.c

Switch of xx->edname to xx->seq_win given edname is blank (not filled
out).  I'm not sure why the code didn't fail before.

------------------------------------------------------------------------
r3081 | jkbonfield | 2012-10-11 14:34:41 +0100 (Thu, 11 Oct 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_cache.c

Added #ifdef CACHE_STATS around various debugging options (previously
#if 0). Improved the debugging output a bit too.

------------------------------------------------------------------------
r3080 | daviesrob | 2012-10-10 17:22:05 +0100 (Wed, 10 Oct 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/do_fij.c

Try to make the join editor come up in the right place for joins in cutoff
sequences.  It will also now automatically turn cutoffs on in these cases.

------------------------------------------------------------------------
r3079 | jkbonfield | 2012-10-09 15:35:16 +0100 (Tue, 09 Oct 2012) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/consen.c
   M /staden/trunk/src/gap5/consen.h
   M /staden/trunk/src/gap5/fij.c
   M /staden/trunk/src/gap5/find_repeats.c
   M /staden/trunk/src/gap5/gap4_compat.h

Removed an absent "Make join" option from the FIJ results in the
contig selector.

Also updated the broken entries in gap4_compat.h for io_rdonly and
io_name and removed the unused io_dbsize define.

------------------------------------------------------------------------
r3078 | daviesrob | 2012-10-09 14:21:51 +0100 (Tue, 09 Oct 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/fij.c
   M /staden/trunk/src/gap5/find_repeats.c
   M /staden/trunk/src/gap5/readpair.c

Go back to complementing the shortest contig when bringing up the join
editor, by popular request.

------------------------------------------------------------------------
r3077 | jkbonfield | 2012-10-08 16:31:13 +0100 (Mon, 08 Oct 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/consen.c

Remove minor compilation warning.

------------------------------------------------------------------------
r3076 | jkbonfield | 2012-10-08 16:28:38 +0100 (Mon, 08 Oct 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/qualIO.c

Fixed vmessage format: %d vs %ld

------------------------------------------------------------------------
r3075 | jkbonfield | 2012-10-05 11:55:59 +0100 (Fri, 05 Oct 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl

Shifting sequences now forces that sequence to be visible on screen still.

------------------------------------------------------------------------
r3074 | daviesrob | 2012-10-05 10:26:53 +0100 (Fri, 05 Oct 2012) | 11 lines
Changed paths:
   M /staden/trunk/src/gap5/consen.c
   M /staden/trunk/src/gap5/consensus.c
   M /staden/trunk/src/gap5/dis_readings.c
   M /staden/trunk/src/gap5/editor_view.c
   M /staden/trunk/src/gap5/gap_range.c
   M /staden/trunk/src/gap5/read_depth.c
   M /staden/trunk/src/gap5/tag_plot.c
   M /staden/trunk/src/gap5/tg_contig.c
   M /staden/trunk/src/gap5/tg_sequence.c
   M /staden/trunk/src/gap5/tg_tcl.c
   M /staden/trunk/src/gap5/tg_tracks.c

Made contig_objects_in_range return a valid pointer and zero count when
nothing is found in the desired range.  It still returns NULL if it fails.
Ensured that everything that calls it does something sensible with the
results.

Put in some more checks for NULL return values, mainly from memory
allocations and cache_search.

Fixed bug in get_hidden_end, which was not calculating the correct position
in the cons[] array for the start of the alignment.

------------------------------------------------------------------------
r3073 | jkbonfield | 2012-10-05 10:22:02 +0100 (Fri, 05 Oct 2012) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/shuffle_pads.c

Protect against the range of shuffle pads ending at a position with no
sequences (eg an internal run of Ns in a contig). In this case the
iterator returned no next seq, causing a crash in the range extension logic.

------------------------------------------------------------------------
r3072 | jkbonfield | 2012-10-04 15:17:53 +0100 (Thu, 04 Oct 2012) | 8 lines
Changed paths:
   M /staden/trunk/src/gap5/gap_range.c

Removed triggers for the various "error, start/end do not match
template pos" error messages. These came about for two reasons:

1) Containments, where start>pair_start and end<pair_end or vice
versa.

2) Failure to check for spanning read-pairs.

------------------------------------------------------------------------
r3071 | jkbonfield | 2012-10-04 09:34:11 +0100 (Thu, 04 Oct 2012) | 8 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_cache.c

Use gio_base(io) in various object creation functions. Without this
creating tags (for example) in the editor was crashing as child io->db
is NULL.

Also boosted the default cache from 1024 to 2048 items, based on
experimental evidence of our existing DBs and the number of items in
the typical template display.

------------------------------------------------------------------------
r3070 | jkbonfield | 2012-10-01 11:45:12 +0100 (Mon, 01 Oct 2012) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/export_contigs.c

Fixed bug in SAM/BAM contig export when requesting "fixmates"
mate-pair data. This is a long-standing bug that existing before the
latest updates.

If exporting just one contig, we still needed to output all @SQ lines
incase that one contig has spanning read-pairs.

------------------------------------------------------------------------
r3069 | daviesrob | 2012-09-28 15:53:10 +0100 (Fri, 28 Sep 2012) | 24 lines
Changed paths:
   M /staden/trunk/src/gap5/check_assembly.c
   M /staden/trunk/src/gap5/consen.c
   M /staden/trunk/src/gap5/contig_selector.c
   M /staden/trunk/src/gap5/cs-object.c
   M /staden/trunk/src/gap5/cs-object.h
   M /staden/trunk/src/gap5/do_fij.c
   M /staden/trunk/src/gap5/fij.c
   M /staden/trunk/src/gap5/fij.h
   M /staden/trunk/src/gap5/find_oligo.c
   M /staden/trunk/src/gap5/find_repeats.c
   M /staden/trunk/src/gap5/gap_hash.c
   M /staden/trunk/src/gap5/gap_hash.h
   M /staden/trunk/src/gap5/readpair.c
   M /staden/trunk/src/seq_utils/dna_utils.c
   M /staden/trunk/src/seq_utils/dna_utils.h

Made the join editor open at more sensible positions for each contig,
especially in the case of reverse alignments.  The obj_match, obj_checkass,
obj_read_pair and obj_fij structs have all had end1 and end2 fields added
which store the padded position of the end of the alignment in each contig.
This means the positions can be accurately recalculated when one or other
contig is complemented.

Adjusted the code in FIJ, Find Repeats, Check Assembly, Find Read Pairs and
Sequence Search (find_oligo) to work with the revised data structure.  At
the same time made some efficency improvements to FIJ and Find Repeats.
Those two also now show the contig record number instead of the left read
number in the contig selector when hovering over a match.

The contig selector now draws matches from (pos1,pos2) to (end1,end2) which
means some of the match lines are no longer at exactly 45 degrees.

csmatch_join_to and csmatch_complement in cs-object.c update the pos1/2 and
end1/2 locations as necessary.

Added a new function to dna_utils.c to copy and complement sequences at the
same time.  Also added functions to allocate a complemented sequence, and
allocate a depadded sequence.


------------------------------------------------------------------------
r3068 | jkbonfield | 2012-09-27 17:35:49 +0100 (Thu, 27 Sep 2012) | 13 lines
Changed paths:
   M /staden/trunk/src/gap5/complement.tcl
   M /staden/trunk/src/gap5/gap5rc
   M /staden/trunk/src/gap5/gap5rc_menu_full
   M /staden/trunk/src/gap5/search.tcl
   M /staden/trunk/src/gap5/tclIndex

Added an option to perform bulk contig renaming.

This operates either on a list or on a pattern to check against all
contig names.  The replacement text has a single printf rule to
replace %d by an automatically iterated contig number. Eg replacing
everything with "Contig_%06d" to get Contig_000001 upwards.

If operating in pattern mode it can use filename glob style wildcards
("Node*Contig*"). In this case the replacement pattern can also use
\1, \2 etc regexp matches to utilise whatever the * matched. This
allows for renaming of "Contig*" to "C\1". (Should this be "C*" too
for ease?)

------------------------------------------------------------------------
r3067 | jkbonfield | 2012-09-27 17:31:40 +0100 (Thu, 27 Sep 2012) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/gap_utils.tcl

Fixed Select Readings to operate over the underlined region of the
consensus rather than the current single position.

Also, for use in next commit, changed contig_rename to return the new
name rather than 0 or 1 and for it to optionally try alternative names
(name#%d) when the existing name clashes.

------------------------------------------------------------------------
r3066 | jkbonfield | 2012-09-27 12:31:02 +0100 (Thu, 27 Sep 2012) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/bam.c
   M /staden/trunk/src/gap5/export_contigs.c

Added a SAM header and sort order definition to SAM/BAM export.

Fixed a memory leak when parsing SAM headers containing read-groups
with duplicate IDs. (Shouldn't happen, but can do if we have
duplicated libraries for some reason.)

------------------------------------------------------------------------
r3065 | jkbonfield | 2012-09-27 10:06:23 +0100 (Thu, 27 Sep 2012) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/bam.c
   M /staden/trunk/src/gap5/bam.h
   M /staden/trunk/src/gap5/export_contigs.c
   M /staden/trunk/src/gap5/export_contigs.tcl

Rewrote the SAM exporter and added a BAM exporter. These are all in
bam.c now instead instead of input in bam.c and output in
export_contigs.c.

Now BAM format is an option from gap5_export script and Gap5 Export
Sequences dialogue.

------------------------------------------------------------------------
r3064 | daviesrob | 2012-09-25 09:57:10 +0100 (Tue, 25 Sep 2012) | 39 lines
Changed paths:
   M /staden/trunk/src/gap5/do_fij.c
   M /staden/trunk/src/gap5/fij.c
   M /staden/trunk/src/gap5/fij.h
   M /staden/trunk/src/gap5/fij.tcl
   M /staden/trunk/src/gap5/gap5rc
   M /staden/trunk/src/gap5/hash_lib.c
   M /staden/trunk/src/gap5/hash_lib.h
   M /staden/trunk/src/gap5/newgap5_cmds.c
   M /staden/trunk/src/gap5/newgap_structs.h
   M /staden/trunk/src/gap5/readpair.c
   M /staden/trunk/src/gap5/readpair.h

Added read pair filtering option to Find Internal Joins.  Turning this on
make FIJ check each match to see how many read pairs span between the two
contigs in the neighborhood of the aligned region.  The alignments are only
kept if the number of read pairs exceeds a given threshold.

The read pair screen actually runs in two stages.  In the first stage, fij
calls fij_prefilter_repeats on the combined contig list.  This calls
spanning_pairs (the guts of Find Read Pairs) to get a list of contigs
that are linked by the desired number of pairs.  It uses this list to make
a HashTable of contig_pair structs and also to prune any contigs with no
read pair links from the list being searched.  The idea is that
spanning_pairs is fairly quick, so using it to reduce the search space should
save time later.

do_it_fij, compare_b_bulk and align_blocks_bulk all now take the HashTable
of contig pairs.  Any word matches that do not match an item in the HashTable
are filtered out so they do not have to be aligned later.

The second stage of filtering takes place in check_overlap_pairs which
is called by add_fij_overlap and add_fij_overlap_r.  This scans for read
pairs over the aligned region, plus a little extra to account for templates
that extend beyond the alignment. It ensures that any spanning pairs
found are a reasonable distance apart and in the correct orientation for the
library.

Other minor changes are:

 * In buffij, pos1 and pos2 are no longer swapped

 * The code to convert a list of libraries to a HashTable has moved from
   spanning_pairs to create_lib_hash.  This allows the library HashTable
   to be used later on in check_overlap_pairs.

 * fij and do_it_fij now take a fij_arg * parameter to vastly reduce the
   number of separate parameters passed in.

 * Read pair screening options have been added to the FIJ dialog box.


------------------------------------------------------------------------
r3063 | jkbonfield | 2012-09-18 17:30:37 +0100 (Tue, 18 Sep 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/shuffle_pads.c

Fixed a memory corruption bug.

------------------------------------------------------------------------
r3062 | jkbonfield | 2012-09-18 17:29:43 +0100 (Tue, 18 Sep 2012) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_cache.c
   M /staden/trunk/src/gap5/tg_gio.h

Improvements to the CACHE_REF_DEBUG code (not enabled normally).
It's still not foolproof when using cache_rw on child I/Os, but
cache_incr and cache_decr for child I/Os now works better.

------------------------------------------------------------------------
r3061 | jkbonfield | 2012-09-17 12:29:10 +0100 (Mon, 17 Sep 2012) | 10 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/list_proc.tcl
   M /staden/trunk/src/gap5/search.tcl

Fixed search sequence names to generate a list of "#num name" form
instead of just "name". The text output window is still names though,
but the SEQID tag handler has been updated to also look for
SEQID:<num> to allow numerical IDs to be used instead of name lookup.
These fixes make it possible to click on the read names and bring up
the correct read of a pair.

Likewise also added SEQID tag to the (already #numeric) output of
ContigsToReadings.

------------------------------------------------------------------------
r3060 | jkbonfield | 2012-09-14 16:23:48 +0100 (Fri, 14 Sep 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/find_oligo.c

Fixed a bug in Sequence Search (inexact_pad_match) causing it to find
the same match multiple times if the match starts with a pad.

------------------------------------------------------------------------
r3059 | jkbonfield | 2012-09-14 15:09:25 +0100 (Fri, 14 Sep 2012) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_library.c
   M /staden/trunk/src/gap5/tg_sequence.c

Fix to sequence_get_template_info() for when a library has
insufficient data. Now we just call it paired if it is paired, but
don't pontificate on the whether it is consistent.

Previously it could access uninitialised memory and return
inconsistent results.

------------------------------------------------------------------------
r3058 | jkbonfield | 2012-09-14 15:07:48 +0100 (Fri, 14 Sep 2012) | 10 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_view.c
   M /staden/trunk/src/gap5/tg_cache.c
   M /staden/trunk/src/gap5/tg_contig.c
   M /staden/trunk/src/gap5/tg_gio.c
   M /staden/trunk/src/gap5/tg_gio.h
   M /staden/trunk/src/gap5/tg_scaffold.c
   M /staden/trunk/src/gap5/tg_struct.h
   M /staden/trunk/src/gap5/tg_tcl.c
   M /staden/trunk/src/gap5/tkEditor.c

Updates to the copy-on-write caching layer to allow for the
possibility of child IOs of child IOs (ie grandchild IOs).

In practice it's not finished, but it doesn't harm normal operation
either and the commenting has been improved, with a few extra asserts
too. So we'll keep this variant.

There is also a new gio_base(io) function to return the base io rather
than just using io->base ? io->base : io.

------------------------------------------------------------------------
r3057 | jkbonfield | 2012-09-14 15:03:47 +0100 (Fri, 14 Sep 2012) | 21 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/gap5rc
   M /staden/trunk/src/gap5/newgap5_cmds.c
   M /staden/trunk/src/gap5/newgap_structs.h
   M /staden/trunk/src/gap5/qualIO.c
   M /staden/trunk/src/gap5/qualIO.h
   M /staden/trunk/src/gap5/shuffle_pads.c
   M /staden/trunk/src/gap5/shuffle_pads.h
   M /staden/trunk/src/gap5/shuffle_pads.tcl
   M /staden/trunk/src/seq_utils/align_lib.c
   M /staden/trunk/src/seq_utils/align_lib.h

Shuffle pads can now operate over regions of contigs in addition to an
entire contig. This means it is callable from the contig editor too by
selecting (underlining) a region in the consensus and picking the
Realign Seqs command from the consensus.

Given this shuffle pads was also updated to remember which regions
are modified on pass 1 and supply these regions to the next pass
recursively. This considerably speeds up the algorithm, typically by
4-5x faster. Also increased the default band width, given it's now faster.

The scoring function in align_lib has been updated too. Previously it
purely counted differences, but this meant a better alignment
(matching other common alignment trends) that doesn't alter the number
of differences to the consensus could yield no overall change. Now we
take into account the fractional base matches.

Finally, improved diagnostics from List Base Confidence so we can more
accurately see the impact of shuffle pads. It breaks down the match
and mismatch scores by base types and provides a summary of counts of
substitutions and indels.

------------------------------------------------------------------------
r3056 | jkbonfield | 2012-09-14 14:55:01 +0100 (Fri, 14 Sep 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/consensus.c

Protect against attempting to store cached consensus in child
IOs.  This does not work due to accessing io->db.

------------------------------------------------------------------------
r3055 | daviesrob | 2012-09-11 09:23:01 +0100 (Tue, 11 Sep 2012) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/readpair.c

spanning_pairs now uses the library record in the range structs (if present)
when filtering by library.  This makes it much faster as it no longer
has to read the sequences.  It will fall back to the old method if it finds
any ranges without a library record (e.g. when looking at an old format
database).  Also added more error checking and cleanup code.

------------------------------------------------------------------------
r3054 | daviesrob | 2012-09-07 16:28:23 +0100 (Fri, 07 Sep 2012) | 46 lines
Changed paths:
   M /staden/trunk/src/gap5/template_display.c
   M /staden/trunk/src/gap5/tg_bin.c
   M /staden/trunk/src/gap5/tg_cache.c
   M /staden/trunk/src/gap5/tg_gio.c
   M /staden/trunk/src/gap5/tg_gio.h
   M /staden/trunk/src/gap5/tg_iface_g.c
   M /staden/trunk/src/gap5/tg_library.c
   M /staden/trunk/src/gap5/tg_struct.h

Got rid of various static variables that should really only have the same
lifetime as the GapIO struct instead of that of the program.  The variables
have been moved to either the GapIO, database_t or g_io structs.  The result
is that repeatedly opening and closing databases without restarting gap5
now works as you would expect.  It should also be possible to have two
databases open simultaneously in a single process without them interfering
with each other.

Specific changes follow.

tg_iface_g.c:
* File-level wrstats, wrcounts, rdstats, rdcounts are now in the g_io struct.
* File-level other_record and other_record_start have been removed (not needed).
* In allocate(), record is now in the g_io struct. allocate is also
  much simpler.
* In btree_node_create(), hd did not need to be static.
* io_database_read() and io_database_create() call init_block_record_numbers(),
  see tg_cache.c

tg_cache.c:
tg_struct.h:
* In cache_item_create_{seq,contig,scaffold,anno_ele}, moved brec and sub_rec
  in each function to the database_t struct.  Added a new function
  init_block_record_numbers() to initialize them all.
* cache_flush now checks io->last_bin to see if any outstanding updates
  are needed in bin_add_range().  See tg_bin.c

tg_bin.c:
tg_gio.h:
* File-level last_bin and incr_{s,r,a}value variables moved to the GapIO
  struct.  These are used by bin_add_range().

tg_library.c:
tg_gio.h:
* In template_max_size(), moved max_size to max_template_size in the GapIO
  struct.

tg_gio.c:
* gio_open() initializes io->last_bin, io->incr_{s,r,a}value and
  io->max_template_size.
* gio_child asserts that io_p->last_bin == 0 (i.e. no outstanding updates are
  needed in bin_add_range) and copies io->max_template_size from the base.

template_display.c:
* In redraw_template_image(), removed redundant last_zoom.

------------------------------------------------------------------------
r3053 | daviesrob | 2012-09-06 17:27:45 +0100 (Thu, 06 Sep 2012) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/newgap5_cmds.c

Fixed tcl_import_reads so that it sets more of the parameters in the tg_args
struct args.a - previously these were being used uninitialized.  Added
code to call parse_caf and parse_afg which were supported by tg_index but
not tcl_import_reads.  Also improved the error handling a bit.

------------------------------------------------------------------------
r3052 | jkbonfield | 2012-09-06 12:11:12 +0100 (Thu, 06 Sep 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/configure.in
   M /staden/trunk/src/gap5/Makefile
   A /staden/trunk/src/gap5/gap5_shuffle_pads.in
   A /staden/trunk/src/gap5/gap5_shuffle_pads.tcl
   M /staden/trunk/src/staden_config.h.in

Added a gap5_shuffle_pads command to allow batch execution of the
Shuffle Pads menu item.

------------------------------------------------------------------------
r3051 | jkbonfield | 2012-09-06 12:09:26 +0100 (Thu, 06 Sep 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/gap4_compat.c

Robustness improvements (error handling).

------------------------------------------------------------------------
r3050 | jkbonfield | 2012-09-04 17:24:28 +0100 (Tue, 04 Sep 2012) | 10 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/gap5rc_menu_full
   M /staden/trunk/src/gap5/list_proc.tcl
   M /staden/trunk/src/tk_utils/init.tcl

Added a mode for allowing (de)selection of reads with their
mate-pairs.

In the editor names panel this is by using the Control key, so
click-drag is the reads under cursor only while control-click-drag is
also their mate-pairs.

In the right-click menu this has been split into two menu entries:
with and without mate-pairs.

------------------------------------------------------------------------
r3049 | jkbonfield | 2012-09-04 16:19:31 +0100 (Tue, 04 Sep 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/gap4_compat.h
   M /staden/trunk/src/gap5/gap5rc
   M /staden/trunk/src/gap5/gap5rc_menu_full
   M /staden/trunk/src/gap5/list_proc.c
   M /staden/trunk/src/gap5/list_proc.h
   M /staden/trunk/src/gap5/list_proc.tcl
   M /staden/trunk/src/gap5/newgap5_cmds.c

Added a Pair Reading List menu item. This takes a list of reads and
produces a list containing those reads and their mate-pairs.

------------------------------------------------------------------------
r3048 | jkbonfield | 2012-09-04 14:01:25 +0100 (Tue, 04 Sep 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/gap_utils.tcl

Bug fix to error dialogue in contig_rename. (Nil effect until it gets
an error.)

------------------------------------------------------------------------
r3047 | jkbonfield | 2012-09-04 12:35:07 +0100 (Tue, 04 Sep 2012) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_contig.c

Bug fix to contig_shift_base(). In some cases it was causing bins to
grow beyond their parent boundaries.

The fix was to use the same logic we already have for when inserting
or deleting consensus columns.

------------------------------------------------------------------------
r3046 | jkbonfield | 2012-09-04 12:32:04 +0100 (Tue, 04 Sep 2012) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/tg_scaffold.h

Add missing prototype for complement_scaffold()
------------------------------------------------------------------------
r3045 | jkbonfield | 2012-09-04 12:31:36 +0100 (Tue, 04 Sep 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/readpair.c

Fix potential buffer overrun in the mouse-over text in the read pair plot.

------------------------------------------------------------------------
r3044 | jkbonfield | 2012-09-04 12:30:59 +0100 (Tue, 04 Sep 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/gap5_thrash.tcl

Added contig shift (control+left/right arrows in editor) checking.

------------------------------------------------------------------------
r3043 | jkbonfield | 2012-09-04 09:47:26 +0100 (Tue, 04 Sep 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_bin.c

Additional assert, just to be sure: spotting that the free range list
in bins always contains items that are genuingly tagged as UNUSUED.

------------------------------------------------------------------------
r3042 | jkbonfield | 2012-09-04 09:36:58 +0100 (Tue, 04 Sep 2012) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/gap4_compat.h

Increased the maximum contig name length (largely unused now)
DB_NAMELEN to be 1024. This was causing truncation of display within
the contig editor and I suspect in fasta/fastq output.

I think the scrollbar in the editor name display needs fixing still though.

------------------------------------------------------------------------
r3041 | jkbonfield | 2012-09-04 09:35:24 +0100 (Tue, 04 Sep 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/gap_utils.tcl

Fixed a bug causing contig renaming in the editor to produce a tcl error.

------------------------------------------------------------------------
r3040 | jkbonfield | 2012-08-31 15:22:37 +0100 (Fri, 31 Aug 2012) | 9 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_join.c

Removed an assumption in recursive_grow_bins() that the bin siblings being
recursed down never overlap each other. (I'm not sure what causes this
- likely contig indels.)

Previously this created errors like:

bin 879: used start/end range beyond the bin boundaries (size 2042 vs start=1,end=2042).


------------------------------------------------------------------------
r3039 | daviesrob | 2012-08-31 12:17:15 +0100 (Fri, 31 Aug 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_join.c

Added assertions to ensure that bins never shrink in recursive_grow_bins and
that extend_root_bin always makes a parent bin bigger than the existing one.

------------------------------------------------------------------------
r3038 | jkbonfield | 2012-08-30 11:33:47 +0100 (Thu, 30 Aug 2012) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_index.c

Added an additional cache_flush after the final updating of nseqs, but
before the slow process of updating the name index.

It's not needed, but is a preventative issue incase of errors or
interrupted tg_index later on.

------------------------------------------------------------------------
r3037 | daviesrob | 2012-08-24 16:35:04 +0100 (Fri, 24 Aug 2012) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/hash_lib.c

More tweaks to find internal joins.  Notably the band in align_wrap has been
made wider and shifted slightly when aligning non-square regions.  Also
added code to avoid calling align_bit in trivial cases (1 base against 1 base
or zero bases against anything) which gives a small speed-up.  align_blocks
has also been rearranged a little so that it can avoid doing some pointless
work in fast mode if it is going to bail out anyway.

------------------------------------------------------------------------
r3036 | jkbonfield | 2012-08-23 12:54:18 +0100 (Thu, 23 Aug 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/gap4_compat.c

Improved handling of failure conditions (failure to cache_search()).

------------------------------------------------------------------------
r3035 | jkbonfield | 2012-08-23 12:42:56 +0100 (Thu, 23 Aug 2012) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_view.c

Fixed an uninitialised memory access when working out if the sequences
are visible on screen, triggered when there are zero sequences display
in the editor range.

------------------------------------------------------------------------
r3034 | jkbonfield | 2012-08-23 12:42:21 +0100 (Thu, 23 Aug 2012) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/import_gff.c

Bug fix when importing GFF files that could lead to crashes. It wasn't
correctly incrementing and decrementing the reference count on the
contig, and due to calculate_consensus_simple() this could be pushed out
of scope.

------------------------------------------------------------------------
r3033 | jkbonfield | 2012-08-23 12:41:06 +0100 (Thu, 23 Aug 2012) | 8 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_cache.c
   M /staden/trunk/src/gap5/tg_tcl.c

Major bug fix to contig linking code. The "$c invalidate_consensus"
method had no break statement forcing it to flow into the add_link
code, creating uninitialised links.

Also added some extra initialising of links, just incase of
corruptions anywhere. (Shouldn't ever matter.)


------------------------------------------------------------------------
r3032 | daviesrob | 2012-08-20 17:17:44 +0100 (Mon, 20 Aug 2012) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/do_fij.c

Removed debugging output
------------------------------------------------------------------------
r3031 | daviesrob | 2012-08-20 15:35:03 +0100 (Mon, 20 Aug 2012) | 15 lines
Changed paths:
   M /staden/trunk/src/gap5/do_fij.c
   M /staden/trunk/src/gap5/fij.c
   M /staden/trunk/src/gap5/fij.h
   M /staden/trunk/src/gap5/fij.tcl
   M /staden/trunk/src/gap5/gap5rc
   M /staden/trunk/src/gap5/hash_lib.c
   M /staden/trunk/src/gap5/hash_lib.h
   M /staden/trunk/src/gap5/newgap5_cmds.c
   M /staden/trunk/src/gap5/newgap_structs.h

Updated find internal joins.  Previously it could only compare a single contig
to a list, or all the contigs in a list with each other.  Now it accepts
two contig lists, and compares all the contigs in list 1 with each of the
contigs in list 2.

Also made some improvements to the quick alignment code so that it misses
fewer hits.  Notably align_blocks now works out the best scoring chain after
stitching all of the blocks together instead of trying to keep track on the
way through, and it also adds a penalty for stopping short of the end of the
diagonal.  align_blocks also now sorts the blocks by the manhatten distance
to the end of each match instead of (manhatten distance to the start + length).
Some redundant code has been removed, and the near-duplicate hash_wordXXn
and hash_seqXXn functions have been amalgamated into hash_word_n and
hash_seq_n, although stubs still exist for the old functions for now.

------------------------------------------------------------------------
r3030 | daviesrob | 2012-08-20 13:48:18 +0100 (Mon, 20 Aug 2012) | 4 lines
Changed paths:
   M /staden/trunk/src/seq_utils/align_lib.c

Fixed bug in affine_align.  If the alignment was predicted to use more
than MAX_MEMORY2 bytes, params->band was halved twice, leading to
a segfault in affine_align_bits. 

------------------------------------------------------------------------
r3029 | jkbonfield | 2012-08-17 16:34:59 +0100 (Fri, 17 Aug 2012) | 17 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_iface_g.c

Two fixes.

1) In g_read_alloc check that vi.used is not G_NO_IMAGE before
attempting to read. Our previous assumption that vi.used length is
non-zero is not solely enough as the record may have been re-allocated
from an earlier free record in which case only the image has been
reset. (This is perhaps a bug.)

2) When writing contig links we now forcibly check that data is within
the desired range, in particular that end1, end2 and orientation are
booleans. Failure to be so means we could have underallocated memory
and leads to a corruption.

This is to work around an unknown bug elsehwere which corrupted this
link data. We need to find and fix that too! (On going work.)


------------------------------------------------------------------------
r3028 | jkbonfield | 2012-08-17 12:05:25 +0100 (Fri, 17 Aug 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/tag_editor.tcl

Protect against attempts to use tag-macros on read only databases.

------------------------------------------------------------------------
r3027 | jkbonfield | 2012-08-17 10:15:39 +0100 (Fri, 17 Aug 2012) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/list_contigs.tcl

Bug fix in ListContigsRepopulate().

This is called via an "after idle" handler, but could sometimes be
called after the window has been shut down, producing (harmless) Tk
error messages.

------------------------------------------------------------------------
r3026 | jkbonfield | 2012-08-17 10:14:39 +0100 (Fri, 17 Aug 2012) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_view.c

Bug fix to marking a selection. If we start the selection off the
right hand end of a sequence it was forcing the start point to right+1
instead of right-1.

------------------------------------------------------------------------
r3025 | jkbonfield | 2012-08-17 10:13:52 +0100 (Fri, 17 Aug 2012) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/tkEditor.c

Removed harmless access of uninitialised variable. We check bounds of
f1 when scrolling, even when it hasn't been set. But in the same
situation it hasn't been set we also then never use it again.

------------------------------------------------------------------------
r3024 | jkbonfield | 2012-08-17 10:11:56 +0100 (Fri, 17 Aug 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_check.c

Fixed a bug with check-db when run from a child I/O (ie the hidden
keybinding for checking internal editor state).

------------------------------------------------------------------------
r3023 | jkbonfield | 2012-08-16 09:46:07 +0100 (Thu, 16 Aug 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap4/consen.c

Bug fix to fastq output. Values above 94 were becoming negative and
then rounded up to 0 quality ('!') when printed out.

------------------------------------------------------------------------
r3022 | jkbonfield | 2012-08-15 16:33:50 +0100 (Wed, 15 Aug 2012) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/depth.tcl

Fixed an error causing errors like:

    registration_callback: expected integer but got "-26848.744"

Generated when joining contigs together with the template display up.

------------------------------------------------------------------------
r3021 | jkbonfield | 2012-08-15 15:30:29 +0100 (Wed, 15 Aug 2012) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_iface_g.c

Fixed a bug in writing scaffolds with zero items. It was writing the
scaffold still (with 0 items and name) instead of just 0 only.

This caused failure to read due to corrupted format.

------------------------------------------------------------------------
r3020 | awhitwham | 2012-08-15 14:15:42 +0100 (Wed, 15 Aug 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/depth.tcl
   M /staden/trunk/src/gap5/tag_plot.c

Stop tag code being called when the tag plot is not being displayed.

------------------------------------------------------------------------
r3019 | jkbonfield | 2012-08-15 12:47:08 +0100 (Wed, 15 Aug 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/quality_plot.c

Fixed the XFillRectangle in qual plot to be after the check for
whether the display is drawn. (Minor speed improvement.)

------------------------------------------------------------------------
r3018 | jkbonfield | 2012-08-15 12:32:00 +0100 (Wed, 15 Aug 2012) | 8 lines
Changed paths:
   M /staden/trunk/src/gap5/gap_range.c

Fixed the library type query (--> <-- vs <-- --> vs <-- <--). It
previously called update_library_stats over and over again when using
mixed libraries. We now cache the results in a hash table.

This new code is now much faster, within 5% of the speed of the original 
template display before we took into account the library type field.


------------------------------------------------------------------------
r3017 | jkbonfield | 2012-08-14 10:01:32 +0100 (Tue, 14 Aug 2012) | 15 lines
Changed paths:
   M /staden/trunk/src/Misc/misc.h
   M /staden/trunk/src/Misc/strings.c
   M /staden/trunk/src/gap4/GTAGDB
   M /staden/trunk/src/gap4/acd2tag.tcl
   M /staden/trunk/src/gap5/Makefile
   M /staden/trunk/src/gap5/export_contigs.c
   M /staden/trunk/src/gap5/gap5rc_menu_full
   M /staden/trunk/src/gap5/import_gff.c
   M /staden/trunk/src/gap5/tag_editor.tcl

Major overhaul of GFF import and export in Gap5.

(Some of this changes code in Gap4 as the tag database and ACD parsing
is shared between the two, but in an invisible manner.)

We now have a GUI for GFF tags using the #!acdtag syntax. The ACD tag
code was extended slightly to allow querying of ACD variables so the
unhandled key=value attribute pairs in GFF can be placed inside a
text box.

Also moved the various escaping and unescaping functions out from
export_contigs.c to Misc/strings.c as it's now used in multiple places
- all in gap5 atm, but Misc is the right spot.


------------------------------------------------------------------------
r3016 | jkbonfield | 2012-08-10 17:29:56 +0100 (Fri, 10 Aug 2012) | 8 lines
Changed paths:
   M /staden/trunk/src/gap5/depth.tcl

Zooming with mouse wheel now operates around the cursor position
instead of the centre of the screen.

Also reduced the width of the editor cursor line from 5 to 2. It's
less intrusive, but harder to select. At some stage we should replace
this with a canvas item instead of a frame window and allow for
dragging via canvas closest item selection.

------------------------------------------------------------------------
r3015 | jkbonfield | 2012-08-09 14:38:16 +0100 (Thu, 09 Aug 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/import_gff.c

Use zfopen (etc) instead of fopen to support gzipped GFF files.

------------------------------------------------------------------------
r3014 | jkbonfield | 2012-08-09 11:20:45 +0100 (Thu, 09 Aug 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl

Fixed a typo in the contig renaming code preventing it from working.

------------------------------------------------------------------------
r3013 | jkbonfield | 2012-08-08 14:35:15 +0100 (Wed, 08 Aug 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/afg.c
   M /staden/trunk/src/gap5/caf.c

Fix to resolve crash parsing extremely long lines (32Kb or more).

------------------------------------------------------------------------
r3012 | jkbonfield | 2012-08-08 12:07:36 +0100 (Wed, 08 Aug 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_anno.c

Improved diagnostics while running Delete Tags.

------------------------------------------------------------------------
r3011 | jkbonfield | 2012-08-06 12:16:44 +0100 (Mon, 06 Aug 2012) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/gap4_compat.c
   M /staden/trunk/src/gap5/gap5rc_menu_full
   M /staden/trunk/src/gap5/io_utils.h
   M /staden/trunk/src/gap5/list_proc.c
   M /staden/trunk/src/gap5/list_proc.h
   M /staden/trunk/src/gap5/newgap5_cmds.c
   M /staden/trunk/src/gap5/tag_checklist.tcl
   M /staden/trunk/src/gap5/tclIndex
   M /staden/trunk/src/gap5/tg_anno.c
   M /staden/trunk/src/gap5/tg_anno.h
   M /staden/trunk/src/gap5/tg_gio.h

Added Delete Tags feature. This removes all tags of specific types in
specific contigs. (Warning: with no Undo functionality.)

In the process of this I revamped the rec_list_t used by
active_list_scaffold et al to just use a tg_rec array. This avoids
conflict with rec_list already used elsewhere.

------------------------------------------------------------------------
r3010 | jkbonfield | 2012-08-01 15:25:02 +0100 (Wed, 01 Aug 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/gap5_thrash.tcl

Even more muppetry! Added code for testing random sequence moves.

------------------------------------------------------------------------
r3009 | jkbonfield | 2012-08-01 15:24:04 +0100 (Wed, 01 Aug 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/gap5rc_menu_full
   M /staden/trunk/src/gap5/newgap5_cmds.c
   M /staden/trunk/src/gap5/scaffold.tcl
   M /staden/trunk/src/gap5/tclIndex
   M /staden/trunk/src/gap5/tg_scaffold.c
   M /staden/trunk/src/gap5/tg_scaffold.h

Added Scaffold exporting code.

------------------------------------------------------------------------
r3008 | awhitwham | 2012-07-26 17:17:36 +0100 (Thu, 26 Jul 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/template_draw.c

Fixed potential memory leak.

------------------------------------------------------------------------
r3007 | jkbonfield | 2012-07-25 17:49:04 +0100 (Wed, 25 Jul 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_check.c
   M /staden/trunk/src/gap5/tg_check.h
   M /staden/trunk/src/gap5/tg_tcl.c

Added Check Database code for checking, and sometimes fixing (untested),
scaffolds.

------------------------------------------------------------------------
r3006 | awhitwham | 2012-07-25 17:36:17 +0100 (Wed, 25 Jul 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/depth.tcl

Tidy up adding tracks to the tk grid.  Also, x zoom by mouse wheel now sets x zoom control. 

------------------------------------------------------------------------
r3005 | jkbonfield | 2012-07-25 16:52:40 +0100 (Wed, 25 Jul 2012) | 31 lines
Changed paths:
   M /staden/trunk/src/gap5/complement.tcl
   M /staden/trunk/src/gap5/contig_id.tcl
   M /staden/trunk/src/gap5/gap4_compat.c
   M /staden/trunk/src/gap5/gap5rc_menu_full
   M /staden/trunk/src/gap5/io_utils.h
   M /staden/trunk/src/gap5/list_contigs.tcl
   M /staden/trunk/src/gap5/list_proc.c
   M /staden/trunk/src/gap5/list_proc.h
   M /staden/trunk/src/gap5/newgap5_cmds.c
   M /staden/trunk/src/gap5/newgap_structs.h
   A /staden/trunk/src/gap5/scaffold.tcl
   M /staden/trunk/src/gap5/tclIndex
   M /staden/trunk/src/gap5/tg_iface.h
   M /staden/trunk/src/gap5/tg_iface_g.c
   M /staden/trunk/src/gap5/tg_scaffold.c
   M /staden/trunk/src/gap5/tg_scaffold.h
   M /staden/trunk/src/gap5/tg_struct.h
   M /staden/trunk/src/gap5/tg_tcl.c

More updates involving scaffolds.

- Scaffold names now have their own index instead of abusing the
  contig index.

- Btree index nodes are now forcibly written on creation, rather
  than delaying until subsequent adds and updates. This resolves a
  problem where we create an index but do not enter a single item (as
  it typically for scaffold_index).

- Added code to import an AGP file creating new scaffolds. If contigs
  are already in a scaffold they'll be silently moved to the new
  scaffold, but it does not clear any scaffold IDs for existing
  contigs not mentioned in the AGP file. (Maybe we need a clear
  scaffolds function? or a bulk remove? Via list contigs?)

- contig_id megawidget has a -scaffold option which, when not using
  -range 1, will permit scaffold names to be used.

- Complement Contigs is now Complement Contigs or
  Scaffolds. Complementing a scaffold complements all members of that
  scaffold and also reverses the order of members. At present it can
  only complement a single scaffold.

- Added various C->Tcl interface scaffold bits: $io num_scaffolds, $io
  scaffold_order, db_info get_scaffold_num.

- List Contigs ^ and v (up and down) buttons are now
  autorepeating. They also auto-scroll to keep the data being moved
  visible on screen.

------------------------------------------------------------------------
r3004 | jkbonfield | 2012-07-25 16:44:12 +0100 (Wed, 25 Jul 2012) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/ace.c

We now create a library for all records in an ACE file. Technically
this isn't correct as we should honour the WR{lib:} field, but this
doesn't seem to be present in most ACE files anyway.

------------------------------------------------------------------------
r3003 | daviesrob | 2012-07-25 11:54:14 +0100 (Wed, 25 Jul 2012) | 10 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_join.c

Major rewrite of join_contigs.  Instead of simply overlapping the bin
structures of the two contigs, it now tries to merge them together by
transplanting bins where possible or by moving sequences.  It falls back
to the old method if it looks like this will be too much work.  Most of the
activity now takes place in a child IO, so if anything goes wrong the
changes so far can be abandoned leaving the database unchanged (at least
until it gets to cache_flush).  A small amount of activity still takes
place on the base IO, mainly the contig notifications and removing the
remains of the unwanted contig.

------------------------------------------------------------------------
r3002 | daviesrob | 2012-07-25 11:44:09 +0100 (Wed, 25 Jul 2012) | 8 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_cache.c
   M /staden/trunk/src/gap5/tg_contig.c

Only allow bin_unload and contig_unload to destroy bins/contigs on the base IO.

Made cache debugging messages more detailed.

Fixed various memory leaks in cache_flush.  Also changed contig_destroy to
use cache_deallocate instead of cache_rec_deallocate as the latter also
leaks memory if the caller does not tidy up correctly.

------------------------------------------------------------------------
r3001 | daviesrob | 2012-07-25 11:35:35 +0100 (Wed, 25 Jul 2012) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/tg_bin.c

Stop bin_get_item_position from crashing if a bin is missing
------------------------------------------------------------------------
r3000 | daviesrob | 2012-07-24 16:43:17 +0100 (Tue, 24 Jul 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_iface_g.c

s/ANNO_ELE_BLOCK/CONTIG_BLOCK/ in io_contig_block_read.  Luckily the different
block types were both the same size, so the change is just cosmetic.

------------------------------------------------------------------------
r2999 | awhitwham | 2012-07-24 14:44:33 +0100 (Tue, 24 Jul 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/Makefile
   M /staden/trunk/src/gap5/depth.tcl
   M /staden/trunk/src/gap5/newgap5_cmds.c
   A /staden/trunk/src/gap5/tag_plot.c
   A /staden/trunk/src/gap5/tag_plot.h

Interim check-in.  Add a tag plot to the template display.  Needs some further work.

------------------------------------------------------------------------
r2998 | daviesrob | 2012-07-23 12:41:31 +0100 (Mon, 23 Jul 2012) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_bin.c

Re-wrote the part of bin_for_range that creates child bins.  The new version
is a bit shorter, and removes an assumption about the order of the child
bins that caused the parent to be incorrectly used instead under certain
conditions.


------------------------------------------------------------------------
r2997 | daviesrob | 2012-07-23 11:59:21 +0100 (Mon, 23 Jul 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/hache_table.c

Put #ifdef DEBUG around "Resizing HacheTable..." message.


------------------------------------------------------------------------
r2996 | daviesrob | 2012-07-23 11:52:43 +0100 (Mon, 23 Jul 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_gio.c

Copy debug_level and debug_fp to child io.

------------------------------------------------------------------------
r2995 | daviesrob | 2012-07-23 11:44:50 +0100 (Mon, 23 Jul 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_contig.c

When dumping to postscript, fill rows from right to left.  This helps to keep
each row filled as much as possible.

------------------------------------------------------------------------
r2994 | daviesrob | 2012-07-13 16:54:55 +0100 (Fri, 13 Jul 2012) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/newgap5_cmds.c

Use byte arrays instead of strings in tcl_calc_quality and
tcl_reformat_sequence.  Fixes problems with negative quality values being
misinterpreted as UTF8 character codes.

------------------------------------------------------------------------
r2993 | daviesrob | 2012-07-10 13:45:58 +0100 (Tue, 10 Jul 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/consensus.c

Fixed bug in calculate_consensus_simple that caused the last base to be
missed out if it was immediately after the end of a cached region.

------------------------------------------------------------------------
r2992 | jkbonfield | 2012-07-06 17:04:51 +0100 (Fri, 06 Jul 2012) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/template_display.c

Added support for LENGTH, COMPLEMENT and JOIN_TO registration events.

This fixes crashes where editing and joining data displayed in the
template display is changed by external (to it) edits; eg Join Editor.

------------------------------------------------------------------------
r2991 | jkbonfield | 2012-07-06 13:48:44 +0100 (Fri, 06 Jul 2012) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/depth.tcl

Added support for LENGTH, COMPLEMENT and JOIN_TO registration events.

This fixes crashes where editing and joining data displayed in the
template display is changed by external (to it) edits; eg Join Editor.

------------------------------------------------------------------------
r2990 | jkbonfield | 2012-07-05 15:04:01 +0100 (Thu, 05 Jul 2012) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/gap_range.c
   M /staden/trunk/src/gap5/gap_range.h

Remove the cached contig_t pointer from the gap_range. This can become
out of date after contig editing, causing subsequent crashes in the
template display. It's only accessed once per redraw, so instead we
re-search it every time using the cached record number instead.

------------------------------------------------------------------------
r2989 | jkbonfield | 2012-07-05 15:02:30 +0100 (Thu, 05 Jul 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/gap5rc
   M /staden/trunk/src/gap5/gap5rc_menu_full
   M /staden/trunk/src/gap5/list_proc.tcl
   M /staden/trunk/src/gap5/tclIndex

Added a "Reading #Numbers to Names" list option to convert reading
lists generated as #[0-9]+ into sequence names.

------------------------------------------------------------------------
r2988 | jkbonfield | 2012-07-05 12:14:21 +0100 (Thu, 05 Jul 2012) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/consensus.c

Initialise range_t.library_rec=0 for consensus sequences. This removes
an uninitialised memory access in tg_iface_g.c, although it's largely
irrelevant as the data is never used (it just marginally increased
storage by a few bytes).

------------------------------------------------------------------------
r2987 | jkbonfield | 2012-07-05 11:26:07 +0100 (Thu, 05 Jul 2012) | 8 lines
Changed paths:
   M /staden/trunk/src/gap5/depth_track.c
   M /staden/trunk/src/gap5/gap_range.h
   M /staden/trunk/src/gap5/template_display.c
   M /staden/trunk/src/gap5/tg_library.c
   M /staden/trunk/src/gap5/tg_library.h

Added a function to work out the maximum expected insert size (mean + 3
standard deviations) of all the libraries.

This is used to set the extra query range added to the templay display
searches to improve read-pairing. It has the effect of removing 99% of
the orange mismatched pairs when viewing plots with large insert
libraries.

------------------------------------------------------------------------
r2986 | jkbonfield | 2012-07-04 17:03:45 +0100 (Wed, 04 Jul 2012) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_iface_g.c

Fixed a buffer overflow in pack_rng_array (nparts[] array).

Also removed some debugging output.

------------------------------------------------------------------------
r2985 | jkbonfield | 2012-07-04 16:47:48 +0100 (Wed, 04 Jul 2012) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/list_contigs.tcl
   M /staden/trunk/src/gap5/tg_scaffold.c

Correction for List Contigs dialogue when using an older database
version.  We no longer display the scaffold name, permit changing
scaffold or attempt to adjust the scaffold order when saving.

------------------------------------------------------------------------
r2984 | jkbonfield | 2012-07-04 16:40:47 +0100 (Wed, 04 Jul 2012) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_search.c
   M /staden/trunk/src/gap5/editor_search.tcl

Code for a basic search by edit. It's incomplete as it only finds
confidence 0 or 100. The users deemed this insufficient, so for now it
is commented out of the search dialogue, but the code exists and may
be extended to provide full edit searching at a later stage.

------------------------------------------------------------------------
r2983 | jkbonfield | 2012-07-04 16:27:37 +0100 (Wed, 04 Jul 2012) | 30 lines
Changed paths:
   M /staden/trunk/src/gap5/Makefile
   M /staden/trunk/src/gap5/contig_editor.tcl
   A /staden/trunk/src/gap5/contig_graph.tcl
   M /staden/trunk/src/gap5/gap_range.c
   M /staden/trunk/src/gap5/gap_utils.tcl
   M /staden/trunk/src/gap5/list_contigs.tcl
   M /staden/trunk/src/gap5/newgap5_cmds.c
   M /staden/trunk/src/gap5/tclIndex
   M /staden/trunk/src/gap5/tg_cache.c
   M /staden/trunk/src/gap5/tg_contig.c
   M /staden/trunk/src/gap5/tg_contig.h
   M /staden/trunk/src/gap5/tg_gio.c
   M /staden/trunk/src/gap5/tg_gio.h
   M /staden/trunk/src/gap5/tg_iface_g.c
   M /staden/trunk/src/gap5/tg_index_common.c
   A /staden/trunk/src/gap5/tg_scaffold.c
   A /staden/trunk/src/gap5/tg_scaffold.h
   M /staden/trunk/src/gap5/tg_struct.h
   M /staden/trunk/src/gap5/tg_tcl.c

First draft: major addition of scaffolding structures. The GUI support
is minimal at present, being limited purely to the List Contigs
dialogue, but the underlying data structures seem to be OK.

We can now rename contigs from the List Contigs window too (using a
new rename_contig proc rather than the old code in the contig editor),
in addition to moving contigs between scaffolds. The order can now
also be changed using the up and down arrow buttons. (These are
unicode - if we get display issues we can change them to bitmaps.) The
order of contigs within scaffolds is desired from the main contig
order.

Part of the implementation adds a scaffold object to Tcl, created by
e.g. "set f [$io get_scaffold [$c get_scaffold]]"

Also added contig links, although these are currently unused. These
provide the ability to form a full graph (eg like FASTG) rather than
just a linear scaffold. It is expected that we can use these to store
hits from find read pairs, find repeats and find internal joins, with
suitable functions to cull or recompute as desired. A noddy and
currently unused contig_graph.tcl implementation experiments with ways
to draw these graphs. This needs much more work still.

The library record is now also stored in the range_t structure. This
means that it is fast to detect the correct orientation of sequences
in the template display (now implemented) and also in future to
provide fast filtering by library methods. Todo: update find read
pairs filtering to use this too.


------------------------------------------------------------------------
r2982 | jkbonfield | 2012-07-04 15:21:50 +0100 (Wed, 04 Jul 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/tk_utils/tclIndex
   M /staden/trunk/src/tk_utils/utils.tcl

Added lreverse for when using tcl8.4 or below. Tcl 8.5 or higher uses
the builtin version.

------------------------------------------------------------------------
r2981 | jkbonfield | 2012-07-04 15:21:08 +0100 (Wed, 04 Jul 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_check.c

Unprintable characters in sequences can now be fixed too.

------------------------------------------------------------------------
r2980 | jkbonfield | 2012-07-04 15:19:07 +0100 (Wed, 04 Jul 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/break_contig.c

A tidier implementation of Rob's fix to Break Contig. There already
existed a function to update the contig cached nseq/nanno values.

------------------------------------------------------------------------
r2979 | jkbonfield | 2012-07-04 15:18:27 +0100 (Wed, 04 Jul 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/sam_index.c

Fixed missing prototype.

------------------------------------------------------------------------
r2978 | jkbonfield | 2012-07-04 15:18:04 +0100 (Wed, 04 Jul 2012) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_join.c

Fixed potential issue with using add_pads(). This can modify the
contig and so change the contig pointer (via cache_rw), but the
calling function (align) was using cache_decr on the original pointer.

------------------------------------------------------------------------
r2977 | jkbonfield | 2012-07-04 15:16:30 +0100 (Wed, 04 Jul 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_selector.c
   M /staden/trunk/src/gap5/tg_sequence.c

Fixed minor compiler warnings.

------------------------------------------------------------------------
r2976 | daviesrob | 2012-06-22 09:18:07 +0100 (Fri, 22 Jun 2012) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/break_contig.c

Ensure contig seq/refpos/anno counts are up to date in break_contig.
------------------------------------------------------------------------
r2975 | jkbonfield | 2012-06-21 12:47:21 +0100 (Thu, 21 Jun 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_check.c

Typo in error report for nrefpos.

------------------------------------------------------------------------
r2974 | daviesrob | 2012-06-21 12:24:25 +0100 (Thu, 21 Jun 2012) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_cache.c

Fixed bug in cache_dup.  It was returning the wrong pointer for sub-records
that has already been duplicated if the pointer to the original was passed in.
It now returns the pointer to the copy instead.

------------------------------------------------------------------------
r2973 | jkbonfield | 2012-06-20 12:35:21 +0100 (Wed, 20 Jun 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_check.c

Added memory cache vs disk checks for GT_ContigBlock type.
This avoids the "rec %d of type 26 mismatches" error messages.

------------------------------------------------------------------------
r2972 | awhitwham | 2012-06-18 14:59:44 +0100 (Mon, 18 Jun 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/gap5rc

Save "Group By" settings added. 

------------------------------------------------------------------------
r2971 | awhitwham | 2012-06-15 12:21:24 +0100 (Fri, 15 Jun 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_contig.c
   M /staden/trunk/src/gap5/tg_struct.h

Added a hash value to the group by sequence function in order to group
the non matching similar sequences together.

------------------------------------------------------------------------
r2970 | awhitwham | 2012-06-14 12:42:53 +0100 (Thu, 14 Jun 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_contig.c

More group by selection.  On a right to left selection the start is
now before the end.  Stops the program trying to allocate negative
memory.

------------------------------------------------------------------------
r2969 | awhitwham | 2012-06-14 12:20:32 +0100 (Thu, 14 Jun 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl

Changed the group by selection to act like the other options and no
longer needs to be chosen from the selection right click menu. Should
have been added to the last commit.

------------------------------------------------------------------------
r2968 | awhitwham | 2012-06-14 12:16:39 +0100 (Thu, 14 Jun 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_contig.c

Changed the group by selection to act like the other options and no
longer needs to be chosen from the selection right click menu.

------------------------------------------------------------------------
r2967 | daviesrob | 2012-06-11 17:19:29 +0100 (Mon, 11 Jun 2012) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/tg_bin.c

Remember to check incr_avalue when testing if bin seq/repos/anno
counts need to be updated
------------------------------------------------------------------------
r2966 | jkbonfield | 2012-05-30 12:32:44 +0100 (Wed, 30 May 2012) | 22 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_join.c
   M /staden/trunk/src/gap5/tg_bin.c
   M /staden/trunk/src/gap5/tg_cache.c
   M /staden/trunk/src/gap5/tg_contig.c
   M /staden/trunk/src/gap5/tg_iface.h
   M /staden/trunk/src/gap5/tg_iface_g.c
   M /staden/trunk/src/gap5/tg_struct.h
   M /staden/trunk/src/gap5/tg_tcl.c

Merged multiple GT_Contig records into a single GT_ContigBlock.
Internally contigs are still fetched by individual cache_search(io,
GT_Contig, crec) calls but like SeqBlock and AnnoEleBlock this
populates 1024 entries at a time.

For backwards compatibility reasons this is only done on databases
with version 5 or higher (previous was v4). To create databases
compatible with the old gap5 use "tg_index -v 4".

This dramatically reduces the I/O load on bringing up the contig
selector. To further reduce I/O for the List Contigs window I also
copied the nseqs, nanno and nrefpos fields from the root bin into the
contig_t struct too.

At the same time I also added placeholders for future work so the
format doesn't (hopefully) change too much. [Be warned: even if it
does I won't boost the database version number unless I've pushed a
new public release out since the initial v5 mods.]  These include
adding flags and clipped_start/end to contigs (currently flag is never
set to indicate validity) and parent scaffold records to contigs and a
scaffold order to database_t.

------------------------------------------------------------------------
r2965 | jkbonfield | 2012-05-30 12:16:15 +0100 (Wed, 30 May 2012) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/g-request.c

Removed bogus seek calls to pos -4 caused by image being zero instead
of G_NO_IMAGE. I'm not sure when this occurs, but we know 0 is invalid
too as that will be the file header.

------------------------------------------------------------------------
r2964 | jkbonfield | 2012-05-24 17:51:13 +0100 (Thu, 24 May 2012) | 10 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_contig.c

Added code to range_populate() when sorting by clipped sequence
end. If a sequence overlaps the start..end range but after clipping it
does not, throw it away so we deal with it later.

The reason for this is it was providing out of order sorting between
one bucket of data in from range_populate and the next bucket of data
in range_populate, causing iterators to give incorrect ordering. This
in turn shows up as contig holes leading to erroneous contig
breaking around sequences with long cutoff regions.

------------------------------------------------------------------------
r2963 | jkbonfield | 2012-05-15 16:48:39 +0100 (Tue, 15 May 2012) | 11 lines
Changed paths:
   M /staden/trunk/src/gap5/gap_range.c
   M /staden/trunk/src/gap5/tg_contig.c
   M /staden/trunk/src/gap5/tg_sequence.c

Fixed analysis of template status.

For the contig editor, via sequence_get_template_info(), we now
consider TEMPLATE_ORIENT as a valid return status.

For the template display, fixed a bug where assumptions were that
r1->comp and r2->comp would be identical. This meant templates
spanning bins could sometimes be considered in the wrong
orientation. We now correct the COMP1 and COMP2 flags taking this into
account.

------------------------------------------------------------------------
r2962 | jkbonfield | 2012-05-15 16:43:44 +0100 (Tue, 15 May 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/tkEditor.c

Cosmetic improvements to template status colours, to make the contrast
easier for those with poor colour vision.

------------------------------------------------------------------------
r2961 | jkbonfield | 2012-05-14 15:29:09 +0100 (Mon, 14 May 2012) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/gap5rc
   M /staden/trunk/src/gap5/gap5rc_menu_full
   M /staden/trunk/src/gap5/map_reads.tcl
   M /staden/trunk/src/gap5/tclIndex

Renamed bwa dbwtsw as bwa bwasw, in accordance with the renaming in
bwa itself (thank goodness!).

Also added an option to specify an output filename. When set this
outputs unmapped sequences to a new fasta or fastq file to allow
subsequent analysis or import as single-read contigs,.

------------------------------------------------------------------------
r2960 | jkbonfield | 2012-05-10 17:46:47 +0100 (Thu, 10 May 2012) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/sam_index.c

Fixed tg_index -g mode. This loads a SAM file that has been aligned
against a depadded consensus sequence. It didn't take into
consideration that the contig may not start at base 1. (It now does.)

------------------------------------------------------------------------
r2958 | jkbonfield | 2012-04-20 17:21:15 +0100 (Fri, 20 Apr 2012) | 12 lines
Changed paths:
   M /staden/trunk/src/gap5/dis_readings.c
   M /staden/trunk/src/gap5/tg_bin.c
   M /staden/trunk/src/gap5/tg_bin.h

Sped up Disassemble Readings by delaying a lot of the consistency
updates until after all the reads have been removed.

This involved creating a replacement for bin_remove_item_from_bin()
called fast_remove_item_from_bin() as well as bulk identifying
annotations for sets of reads instead of individual reads and delaying
of fixing contig start/end values.

Also sped up the bin_get_item_position() function when sequences are
used; it can utilise the seq->bin_index field to prevent a full bin
search.

------------------------------------------------------------------------
r2957 | jkbonfield | 2012-04-20 17:14:52 +0100 (Fri, 20 Apr 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/Misc/vlen.c

Support for long long via %lld. This is automatically generated on
32-bit machines when using %"PRId64".

------------------------------------------------------------------------
r2956 | awhitwham | 2012-04-20 12:04:04 +0100 (Fri, 20 Apr 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/editor_view.c
   M /staden/trunk/src/gap5/editor_view.h
   M /staden/trunk/src/gap5/gap5rc_menu_full
   M /staden/trunk/src/gap5/tg_contig.c
   M /staden/trunk/src/gap5/tg_contig.h
   M /staden/trunk/src/gap5/tg_struct.h
   M /staden/trunk/src/gap5/tkEditor.c

Added group by sequence.  This uses niave match scoring but should be good enough for proof of concept.

------------------------------------------------------------------------
r2955 | jkbonfield | 2012-04-19 16:34:41 +0100 (Thu, 19 Apr 2012) | 8 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_selector.c
   M /staden/trunk/src/gap5/contig_selector.tcl
   M /staden/trunk/src/gap5/gap5rc_menu_full
   M /staden/trunk/src/gap5/newgap5_cmds.c
   M /staden/trunk/src/gap5/tg_tcl.c

Added the ability to show tags in the contig selector.

Performance is adequate, but not great. On a database with ~1000
contigs and ~1000 tags it adds 6-7s. With ~400,000 tags it adds 12s or
so. (The initial bulk time is due to scanning bins.)

By default tags are not shown.

------------------------------------------------------------------------
r2954 | daviesrob | 2012-04-19 12:22:35 +0100 (Thu, 19 Apr 2012) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/tg_contig.c
   M /staden/trunk/src/gap5/tg_contig.h
   M /staden/trunk/src/gap5/tg_tcl.c

Rewrote code to dump the bin structure as a postscript file.  Also added a dump_graph version that outputs graphviz format.
------------------------------------------------------------------------
r2953 | jkbonfield | 2012-04-17 15:21:00 +0100 (Tue, 17 Apr 2012) | 11 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/editor_view.c
   M /staden/trunk/src/gap5/list_proc.tcl
   M /staden/trunk/src/gap5/tkEditor.c
   M /staden/trunk/src/gap5/tkEditor.h
   M /staden/trunk/src/tk_utils/xcombobox.tcl

Added the ability to switch between multiple lists for selecting reads
in the contig editor. For fast use, the list name and number of
elements in the list are visible in the editor tool bar. New lists can
be created simply by typing in a new name.

A little oddly, the displayed list size is also a menubutton allowing
actions to load, save, delete and clear. I'm open to ideas on more
conventional UI wisdom for how to manage this in a compact manner.

Also added a -postcommand to the emulated combobox, needed for this UI.

------------------------------------------------------------------------
r2952 | jkbonfield | 2012-04-16 12:34:38 +0100 (Mon, 16 Apr 2012) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/editor_view.c
   M /staden/trunk/src/gap5/editor_view.h
   M /staden/trunk/src/gap5/tkEdNames.c

Added Shift+B1 binding for the contig editor names panel for bulk
selection of sequences.

This only acts in the vertical orientation. An attempt to select,
scroll in X and then shift+click will be ignored as this is an
altogether trickier operation (if not impossible) to complete.

------------------------------------------------------------------------
r2951 | jkbonfield | 2012-04-13 15:11:53 +0100 (Fri, 13 Apr 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl

Bug fix to editor_return function. It wasn't changing the status line
due to non-global variable access.

------------------------------------------------------------------------
r2950 | jkbonfield | 2012-04-13 14:56:05 +0100 (Fri, 13 Apr 2012) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/depth.tcl
   M /staden/trunk/src/gap5/gap5rc_menu_full

Added a "Template Display" entry to the Commands menu in the contig
editor. This brings up the standard template display centred on the
current editor x-view location.

------------------------------------------------------------------------
r2949 | jkbonfield | 2012-04-13 11:53:30 +0100 (Fri, 13 Apr 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/tag_editor.tcl

Fixed an issue with copy/move tags when no region has been selected.
This now follows gap4 behaviour and copies or moves to a single bp tag.

------------------------------------------------------------------------
r2948 | jkbonfield | 2012-04-13 10:55:31 +0100 (Fri, 13 Apr 2012) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/tg_tcl.c
   M /staden/trunk/src/tk_utils/tclIndex
   M /staden/trunk/src/tk_utils/utils.tcl

Fixed insertion and deletion impact on tags, with correctly working
Undo too.

This also involved adding an lprepend analogue to the lappend function.

------------------------------------------------------------------------
r2947 | jkbonfield | 2012-04-11 12:45:08 +0100 (Wed, 11 Apr 2012) | 17 lines
Changed paths:
   M /staden/trunk/src/gap5/consensus.c

Found a cause of consensus caching to sometimes use different bins,
causing unnecessary work.

Even when we have a fully cached consensus, updated by doing "Save
consensus" for all contigs, asking for smaller ranges of consensus (eg
search by consensus quality) would sometimes return a different set of
bins to hold the cached consensus, causing recomputation of the
consensus again.

The cause is that the function returns the first (ie largest) bins
within a range smaller than a fixed size (100Kb). If we have a bin
with only one child node to the right, then on a full range query that
child node may be returned, but on a smaller range query it may be
excluded and the parent node is instead returned.

The code now explictly checks for this case and filters such bins.

------------------------------------------------------------------------
r2946 | jkbonfield | 2012-04-10 17:41:36 +0100 (Tue, 10 Apr 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/tk_utils/xentry.tcl

Fixed missing brace in xentry (sorry for not checking the KP_Enter
binding fix).

------------------------------------------------------------------------
r2945 | jkbonfield | 2012-04-10 12:36:10 +0100 (Tue, 10 Apr 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/tg_bin.c

Improvements to editor delete vs backspace code. Also fixed a
rare data consistency error when removing data from bins.

------------------------------------------------------------------------
r2944 | jkbonfield | 2012-04-05 14:08:10 +0100 (Thu, 05 Apr 2012) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl

Added several key bindings for inserting and deleting while keeping
the right side of the alignment stationary. These are Shift + key, eg
shift-Backspace, shift-Delete, shift-Insert.

Also added a control-z binding for Undo.

------------------------------------------------------------------------
r2943 | jkbonfield | 2012-04-05 09:58:55 +0100 (Thu, 05 Apr 2012) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/tag_editor.tcl
   M /staden/trunk/src/gap5/tg_tcl.c

Added Copy and Move functionality to the Tag Editor, as in Gap4.

These even allow moving and copying of tags between editors.

------------------------------------------------------------------------
r2942 | jkbonfield | 2012-04-03 16:59:52 +0100 (Tue, 03 Apr 2012) | 10 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl

Added KP_Enter binding for position panel (in addition to existing
Return key binding).

Changed Delete key to delete under the cursor and not move, vs remove
from left of cursor and move for Backspace.

Added functionality to move pads left and right with Control-L and
Control-R.  For those that like to live dangerously, bases can also be
moved if you use Alt-L and Alt-R bindings.

------------------------------------------------------------------------
r2941 | jkbonfield | 2012-04-03 16:57:55 +0100 (Tue, 03 Apr 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/tk_utils/entrybox.tcl
   M /staden/trunk/src/tk_utils/xentry.tcl

Added keypad Enter key bindings where we bound to Return key.

------------------------------------------------------------------------
r2940 | jkbonfield | 2012-04-03 09:56:21 +0100 (Tue, 03 Apr 2012) | 4 lines
Changed paths:
   M /staden/trunk/src/gap4/editor_search.tcl

https://sourceforge.net/tracker/?func=detail&aid=3276158&group_id=100316&atid=627060

Added patch from Bastien to bind Control-S "next search" in search window.

------------------------------------------------------------------------
r2939 | jkbonfield | 2012-04-02 14:44:41 +0100 (Mon, 02 Apr 2012) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/find_oligo.tcl

Use =rec syntax for All Contigs list to work around broken contig indices
------------------------------------------------------------------------
r2938 | jkbonfield | 2012-04-02 14:44:12 +0100 (Mon, 02 Apr 2012) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/export_contigs.c
   M /staden/trunk/src/gap5/sam_index.c
   M /staden/trunk/src/gap5/sam_pileup.c

Changes to handle nasties with SAM cigar strings starting in I or P
operators (or I/P after S/H).

Also fixed output to cope with these cases too.

------------------------------------------------------------------------
r2937 | jkbonfield | 2012-03-29 17:52:01 +0100 (Thu, 29 Mar 2012) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/bam.c
   M /staden/trunk/src/gap5/export_contigs.c
   M /staden/trunk/src/gap5/fasta.c

Fixed issues with zero length template names. These were used in FASTA
import, but they caused oddities in SAM export and some other formats
where we ended up with a blank read name and the entire name being
fitted into the FS:Z: field. (Fixed in both import and export code.)

Also changed the default SAM/BAM quality values to be 2, from 0.

------------------------------------------------------------------------
r2936 | jkbonfield | 2012-03-28 09:44:49 +0100 (Wed, 28 Mar 2012) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/consensus.c

Fixed an issue with consensus caching. We identify that a specific bin
misses a cached consensus sequence and compute it, but then use
bin_add_range to add it instead of bin_add_to_range. This meant that
after joining where we can have multiple bins spanning the same
physical coordinates that we could be piling up duplicate consensus
sequences in one bin due to failing to find them in another.

------------------------------------------------------------------------
r2935 | jkbonfield | 2012-03-27 16:40:05 +0100 (Tue, 27 Mar 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_contig.c

More bin_set_used_range() calls - missed out in the earlier commit?

------------------------------------------------------------------------
r2934 | jkbonfield | 2012-03-27 16:39:23 +0100 (Tue, 27 Mar 2012) | 10 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_view.c
   M /staden/trunk/src/gap5/export_contigs.c

Fixed sequence orientation bugs.

One is in the editor view where "<<" and ">>" were reported in the
information line incorrectly on complemented contigs.

The other is more serious and in the export to SAM code. It was
incorrectly setting the orientation flags. This mean exporting a
"--> <--" pair in a complemented contig and re-importing turned them
into a "<-- -->" pair, showing up as red in the template display.

------------------------------------------------------------------------
r2933 | jkbonfield | 2012-03-27 16:37:31 +0100 (Tue, 27 Mar 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl

Fixed some editor cursor starting positions. When bringing up the
editor on a specific sequence, it should now be visible.

------------------------------------------------------------------------
r2932 | jkbonfield | 2012-03-27 10:28:29 +0100 (Tue, 27 Mar 2012) | 12 lines
Changed paths:
   M /staden/trunk/src/gap5/break_contig.c
   M /staden/trunk/src/gap5/dis_readings.c
   M /staden/trunk/src/gap5/editor_join.c
   M /staden/trunk/src/gap5/gap5_thrash.tcl
   M /staden/trunk/src/gap5/tg_anno.c
   M /staden/trunk/src/gap5/tg_bin.c
   M /staden/trunk/src/gap5/tg_bin.h

Further bug fixes to reference position handling, discovered by the
million monkeys script. We now have a new function
bin_set_used_range() that brute force iterates through bin contents
and sets start_used and end_used fields. We call this any time we
remove something from the bin that also happens to be at the current
start_used or end_used boundaries (meaning it *may* require a
change).

Also fixed a bug in contig_delete_base_fix(). It needed to recurse
down with +1 on the bin extents, as this corresponds to the refpos
edits applied elsewhere.

------------------------------------------------------------------------
r2931 | jkbonfield | 2012-03-23 16:12:59 +0000 (Fri, 23 Mar 2012) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_join.c
   M /staden/trunk/src/gap5/tg_bin.c

More refpos & bin range bug fixes, including a fix to the last
fix. (Checking nrefpos==0 is not sufficient as it is hierarchical - an
empty bin may has full child bins.)

------------------------------------------------------------------------
r2930 | jkbonfield | 2012-03-23 11:52:26 +0000 (Fri, 23 Mar 2012) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_join.c

Further fix to contig_remove_refpos_markers() called when making
joins.  As per previous fix, but note that removing a refpos marker
that is the first or last thing in a bin also means we have to adjust
the start_used and end_used too.

------------------------------------------------------------------------
r2929 | jkbonfield | 2012-03-23 11:24:57 +0000 (Fri, 23 Mar 2012) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_join.c

Fix for a bug causing "bin 1741: used start/end range are incorrect"
style errors from Check Database.

When we remove the last reference position marker from a bin and there
is nothing else in the bin either, we now zero the start/end range to
mark the bin as empty.

------------------------------------------------------------------------
r2928 | jkbonfield | 2012-03-23 11:24:00 +0000 (Fri, 23 Mar 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_contig.c

Improvements to cope with data corruptions better.

------------------------------------------------------------------------
r2927 | jkbonfield | 2012-03-23 11:23:20 +0000 (Fri, 23 Mar 2012) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/gap5_thrash.tcl

Minor output tidyup
------------------------------------------------------------------------
r2926 | jkbonfield | 2012-03-22 17:51:32 +0000 (Thu, 22 Mar 2012) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/dis_readings.c

Fixed tag corruption in disassemble readings. Consensus annotations
that are shared between original and new contigs had their tag type
and direction fields swapped, causing errors.

------------------------------------------------------------------------
r2925 | jkbonfield | 2012-03-22 09:28:54 +0000 (Thu, 22 Mar 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/b+tree2.c
   M /staden/trunk/src/gap5/fij.c

A couple more minor tweaks to stop compiler whinges - shouldn't affect
any actual code paths.

------------------------------------------------------------------------
r2924 | jkbonfield | 2012-03-21 16:33:40 +0000 (Wed, 21 Mar 2012) | 16 lines
Changed paths:
   M /staden/trunk/src/gap5/ace.c
   M /staden/trunk/src/gap5/consen.c
   M /staden/trunk/src/gap5/consensus.c
   M /staden/trunk/src/gap5/dis_readings.c
   M /staden/trunk/src/gap5/editor_join.c
   M /staden/trunk/src/gap5/editor_view.c
   M /staden/trunk/src/gap5/export_contigs.c
   M /staden/trunk/src/gap5/fasta.c
   M /staden/trunk/src/gap5/find_repeats.c
   M /staden/trunk/src/gap5/gap-error.c
   M /staden/trunk/src/gap5/gap_hash.c
   M /staden/trunk/src/gap5/hache_table.c
   M /staden/trunk/src/gap5/hash_lib.c
   M /staden/trunk/src/gap5/qual.c
   M /staden/trunk/src/gap5/sam_index.c
   M /staden/trunk/src/gap5/tg_anno.c
   M /staden/trunk/src/gap5/tg_cache.c
   M /staden/trunk/src/gap5/tg_contig.c
   M /staden/trunk/src/gap5/tg_gio.h
   M /staden/trunk/src/gap5/tg_iface_g.c
   M /staden/trunk/src/gap5/tg_sequence.c
   M /staden/trunk/src/gap5/tg_tcl.c
   M /staden/trunk/src/gap5/tk-io-reg.c

Code tidy up, looking at various gcc -W warning output and complaints
from the \
clang static analyser.

Most are warnings about things that cannot happen, incorrect
handling of error cases that "should not" happen, or just warnings
about pointless code and unused variables. A few are genuine:

- The (currently unused) uniqueness plot access uninitialised memory
  in var W.

- Various verror calls using strings which could contain %s and fail
  (but I don't think they were exploitable and under user control).



------------------------------------------------------------------------
r2923 | daviesrob | 2012-03-20 17:34:02 +0000 (Tue, 20 Mar 2012) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_cache.c

Sort cached_items forwards by record_number instead of backwards by view
in cache_flush.  This puts the file contents in a more sensible order when
building the database.

------------------------------------------------------------------------
r2922 | jkbonfield | 2012-03-20 17:31:44 +0000 (Tue, 20 Mar 2012) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/zfio.h

Fixed an error with using gzFile* instead of gzFile. This didn't
matter in zlib 1.2.5 and before as all function prototypes took a void
pointer for this argument. With zlib-1.2.6 this is now a structure and
so now producing errors.

------------------------------------------------------------------------
r2921 | jkbonfield | 2012-03-16 17:19:08 +0000 (Fri, 16 Mar 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/seq_utils/align_lib.c

Protect against alignments of nul data.

------------------------------------------------------------------------
r2920 | jkbonfield | 2012-03-16 17:18:46 +0000 (Fri, 16 Mar 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/shuffle_pads.c

Protect against zero length reads.

------------------------------------------------------------------------
r2919 | jkbonfield | 2012-03-16 17:18:29 +0000 (Fri, 16 Mar 2012) | 12 lines
Changed paths:
   M /staden/trunk/src/gap5/ace.c

Bug fixes to the ACE format reading code.

It now handles (ie ignores instead of choking) WR{} records.

It also now spots left/right clip points as both -1 and discards such
entries and unaligned data.

Finally it handles the lack of DS lines. Previously it added reads
when seeing a DS line. Now it adds reads when it sees either a new CO
or RD line so the lack of DS lines does not mean a total lack of
imported data.

------------------------------------------------------------------------
r2918 | jkbonfield | 2012-03-16 17:14:30 +0000 (Fri, 16 Mar 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/consensus.c

Removal of debugging.

------------------------------------------------------------------------
r2917 | jkbonfield | 2012-03-16 12:31:49 +0000 (Fri, 16 Mar 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/maq.c

Removed a rogue free statement. I'm not sure why this didn't die
before, but we haven't tested maq support for a couple of years.

------------------------------------------------------------------------
r2916 | jkbonfield | 2012-03-16 12:31:25 +0000 (Fri, 16 Mar 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/restriction_enzymes.c
   M /staden/trunk/src/gap5/shuffle_pads.c
   M /staden/trunk/src/gap5/tg_cache.c

Fixed various %d vs %"PRIrec" issues.

------------------------------------------------------------------------
r2915 | jkbonfield | 2012-03-16 12:30:41 +0000 (Fri, 16 Mar 2012) | 13 lines
Changed paths:
   M /staden/trunk/src/gap5/b+tree2.c
   M /staden/trunk/src/gap5/dis_readings.c
   M /staden/trunk/src/gap5/tg_contig.c
   M /staden/trunk/src/gap5/tg_iface.h
   M /staden/trunk/src/gap5/tg_iface_g.c
   M /staden/trunk/src/gap5/tg_sequence.c
   M /staden/trunk/src/gap5/tg_struct.h

Fixed various losses in the name and contig indices. The bug was that
when creating a new root node, we did not always spot this and left
the old db->contig_index and db->seq_name_index pointing to the
original root node. This has the effect of removing data from the
tree. Both insert and delete could cause this. 

Note we did sometimes update correctly, it was just omitted in a few
places.

Related to this was the fact that deletion never returned the root
correctly (but it's a rare issue) and both insert/delete were
returning int instead of tg_rec.

------------------------------------------------------------------------
r2914 | jkbonfield | 2012-03-12 16:42:10 +0000 (Mon, 12 Mar 2012) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/consensus.c
   M /staden/trunk/src/gap5/gap4_compat.tcl

Fixed a minor memory leak in the consensus algorithm.

Fixed another memory leak (potentially very large) in the Tcl code
for cname2crec when faced with a database with a corrupted B-Tree.

------------------------------------------------------------------------
r2913 | jkbonfield | 2012-03-12 10:23:20 +0000 (Mon, 12 Mar 2012) | 11 lines
Changed paths:
   M /staden/trunk/src/gap5/b+tree2.c

Fixed some B+Tree update errors when dealing with large numbers of
duplicate strings (more than an entire nodes worth).

Fixed a tree error when updating the parent after a deletion of the
right-most entry in a node. I'm not sure if this was capable of
recreating the issues users sometimes see (entries going missing from
the tree), but it's an inconsistency which may lead to more errors
downstream.

Also improved debugging with -DTEST_MAIN.

------------------------------------------------------------------------
r2912 | jkbonfield | 2012-03-12 10:20:11 +0000 (Mon, 12 Mar 2012) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/shuffle_pads.c

Fixed potential uninitialise memory access in update_io(). The effect
was harmless though - it would sometimes write data back to disc that
didn't need to be written as it had not changed.

------------------------------------------------------------------------
r2911 | jkbonfield | 2012-03-08 11:23:47 +0000 (Thu, 08 Mar 2012) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_view.c

Fixed an illegal cache_decr call if edGetBriefSeq() is called with a
nul format string (not really a valid case).

Also fixed the %*.*c printf argument case. Precision (the .* bit) is
not permitted in %c expansion.

------------------------------------------------------------------------
r2910 | jkbonfield | 2012-03-08 10:32:44 +0000 (Thu, 08 Mar 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_contig.c

Fixed simple_sort_by_base() error when given broken input (if the
records are not sequences it accessed uninitialised memory).

------------------------------------------------------------------------
r2909 | jkbonfield | 2012-03-08 10:15:59 +0000 (Thu, 08 Mar 2012) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/shuffle_pads.c

Fixed a bug spotted by Rob, via clang.

In build_malign, the recent code to handle zero length sequences was
using an uninitialised variable in the fix-up.

------------------------------------------------------------------------
r2908 | jkbonfield | 2012-03-07 15:21:50 +0000 (Wed, 07 Mar 2012) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_search.c

Fixed a bug in the editor Sequence Search. It was failing to correctly
record the best match position for sequences that overlapped the
starting position of the search range.

Similarly fixed reverse searches.

------------------------------------------------------------------------
r2907 | jkbonfield | 2012-03-02 16:26:59 +0000 (Fri, 02 Mar 2012) | 10 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_cache.c

Warning: I'm not *100%* certain this is correct!

Swapped the unlock and commit calls during the flush procedure.
Previously this was causing B+Tree writes to be auto-flushed giving
lots of index updates. Now they'll also be appended on the "to flush"
list due to the lock and updated in one step along with the other
records recently written. The theory was to improve performance, but
I'm not sure it makes much difference.


------------------------------------------------------------------------
r2906 | jkbonfield | 2012-03-02 16:25:14 +0000 (Fri, 02 Mar 2012) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/tg_index.c

More frequent flushing of B+Tree to reduce max memory usage
------------------------------------------------------------------------
r2905 | jkbonfield | 2012-03-02 16:24:13 +0000 (Fri, 02 Mar 2012) | 3 lines
Changed paths:
   A /staden/trunk/src/tk_utils/console.tcl
   M /staden/trunk/src/tk_utils/tclIndex
   M /staden/trunk/src/tk_utils/text_output.tcl

Replaced the Console mode with newer code (triggered by typing "con"
into the error window).

------------------------------------------------------------------------
r2904 | jkbonfield | 2012-03-02 16:23:23 +0000 (Fri, 02 Mar 2012) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_id.tcl
   M /staden/trunk/src/gap5/select_contig.tcl
   M /staden/trunk/src/tk_utils/scalebox.tcl

Fixed the setting of the contig start/end range in the contig ID
selector. This sometimes worked, but not in all cases. Now it should
always use the visible start/end coordinates.

------------------------------------------------------------------------
r2903 | jkbonfield | 2012-03-02 16:21:41 +0000 (Fri, 02 Mar 2012) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/gap4_compat.c

Improved warning messages to the user
------------------------------------------------------------------------
r2902 | jkbonfield | 2012-03-02 16:21:25 +0000 (Fri, 02 Mar 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/consen.c

Fixed illegal cache_decr in error handling code (so not normally
triggered). 

------------------------------------------------------------------------
r2901 | jkbonfield | 2012-03-02 16:20:46 +0000 (Fri, 02 Mar 2012) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/dis_readings.c

Faster implementation of Delete Contig. The code to unlink other
sequences from ones we have deleted has an additional sort step to
iterate through sequences in order, to reduce disc thrashing. It also
periodically flushes and reports progress.


------------------------------------------------------------------------
r2900 | jkbonfield | 2012-03-02 16:17:59 +0000 (Fri, 02 Mar 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/gap5_export.tcl

Protect against broken name B+Tree by operating on =number contig
list by default.

------------------------------------------------------------------------
r2899 | daviesrob | 2012-03-02 13:59:46 +0000 (Fri, 02 Mar 2012) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/break_contig.c
   M /staden/trunk/src/gap5/check_assembly.c
   M /staden/trunk/src/gap5/consen.c
   M /staden/trunk/src/gap5/contig_extend.c
   M /staden/trunk/src/gap5/dis_readings.c
   M /staden/trunk/src/gap5/editor_join.c
   A /staden/trunk/src/gap5/editor_join.h
   M /staden/trunk/src/gap5/editor_search.c
   M /staden/trunk/src/gap5/editor_view.h
   M /staden/trunk/src/gap5/find_oligo.c
   M /staden/trunk/src/gap5/gap4_compat.h
   M /staden/trunk/src/gap5/gap_canvas_box.c
   M /staden/trunk/src/gap5/init.c
   M /staden/trunk/src/gap5/newgap5_cmds.c
   M /staden/trunk/src/gap5/restriction_enzymes.c
   M /staden/trunk/src/gap5/restriction_enzymes.h
   M /staden/trunk/src/gap5/shuffle_pads.c
   M /staden/trunk/src/gap5/stack_dump.c
   M /staden/trunk/src/gap5/tg_bin.c
   M /staden/trunk/src/gap5/tg_check.c
   M /staden/trunk/src/gap5/tg_contig.c
   M /staden/trunk/src/gap5/tg_contig.h
   M /staden/trunk/src/gap5/tg_sequence.c
   M /staden/trunk/src/gap5/tg_tcl.c
   M /staden/trunk/src/gap5/tg_tcl.h
   M /staden/trunk/src/gap5/tk-io-reg.c
   M /staden/trunk/src/gap5/tkAppInit.c

Fixed lots of implicit function declarations
------------------------------------------------------------------------
r2898 | daviesrob | 2012-03-01 17:13:51 +0000 (Thu, 01 Mar 2012) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/caf.c

Fixed accidental assignment in if statement
------------------------------------------------------------------------
r2897 | jkbonfield | 2012-02-24 17:28:57 +0000 (Fri, 24 Feb 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/shuffle_pads.c

Protect against negative or zero length sequences. The assertion has
simply been replaced by code that fixes the errors.

------------------------------------------------------------------------
r2896 | jkbonfield | 2012-02-16 12:12:59 +0000 (Thu, 16 Feb 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/search.tcl

Now with improved error reporting.

------------------------------------------------------------------------
r2895 | jkbonfield | 2012-02-16 12:08:19 +0000 (Thu, 16 Feb 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/search.tcl

Protect against crashes when trying to bring double click on a
hyperlinked contig that no longer exists.

------------------------------------------------------------------------
r2894 | jkbonfield | 2012-02-16 12:07:18 +0000 (Thu, 16 Feb 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_gio.c

Protect against attempts to read contigs via location in contig order
when using a child I/O.

------------------------------------------------------------------------
r2893 | jkbonfield | 2012-02-16 12:06:43 +0000 (Thu, 16 Feb 2012) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/consen.c
   M /staden/trunk/src/gap5/fij.tcl

Implemented the hidden data search mode of FIJ.

Removed from the GUI the unimplemented mask/mark parameters.

------------------------------------------------------------------------
r2892 | jkbonfield | 2012-02-13 16:23:23 +0000 (Mon, 13 Feb 2012) | 9 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/dis_readings.c
   M /staden/trunk/src/gap5/gap5rc

Fixed a bug in remove_contig_holes() called by Break Contig and
Disassemble Readings. When remove_contig_holes() found a hole and
called break_contig it was incorrectly checking the return code,
causing falsely reported failures.

On a related topic I also changed Break Contig in the contig editor to
default to not removing holes. This can be overridden by modifying the
CONTIG_EDITOR.REMOVE_HOLES setting in ~/.gap5rc.

------------------------------------------------------------------------
r2891 | jkbonfield | 2012-02-09 15:29:43 +0000 (Thu, 09 Feb 2012) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/import_gff.c

Made the GFF import more liberal when facing percent escaping that is
invalid. Ie %xx where x are not hex digits will just treat it as
unescaped text instead (which is typically output from a badly coded
GFF generator).

------------------------------------------------------------------------
r2890 | jkbonfield | 2012-02-08 17:29:26 +0000 (Wed, 08 Feb 2012) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/Makefile
   A /staden/trunk/src/gap5/contig_extend.c
   A /staden/trunk/src/gap5/contig_extend.h
   A /staden/trunk/src/gap5/contig_extend.tcl
   M /staden/trunk/src/gap5/gap5rc
   M /staden/trunk/src/gap5/gap5rc_menu_full
   M /staden/trunk/src/gap5/newgap5_cmds.c
   M /staden/trunk/src/gap5/tclIndex

Added the implementation of the Extend Contigs function.

This looks into the cutoff data at the ends of contigs and where the
bulk of cutoff data aligns with each other it is unclipped and the
contig extended.

------------------------------------------------------------------------
r2889 | jkbonfield | 2012-02-03 12:39:33 +0000 (Fri, 03 Feb 2012) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/export_contigs.c

Export to fastq now automatically strips pads. If users request then
this could be made optional, but it seems logical that the use of
fastq export is to realign data again so pad stripped makes most
sense.

------------------------------------------------------------------------
r2888 | jkbonfield | 2012-02-03 12:38:39 +0000 (Fri, 03 Feb 2012) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_check.c

Bug fix to the fix mode of Check Contig. It was failing to correct
contig annotations that overlapped the end of the consensus, due to
changing the bin to uninitialised values.

------------------------------------------------------------------------
r2887 | jkbonfield | 2012-02-03 12:37:46 +0000 (Fri, 03 Feb 2012) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/break_contig.c

Fixed typo in error message
------------------------------------------------------------------------
r2886 | jkbonfield | 2012-02-03 12:37:27 +0000 (Fri, 03 Feb 2012) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_view.c
   M /staden/trunk/src/gap5/gap5rc
   M /staden/trunk/src/gap5/tg_sequence.c
   M /staden/trunk/src/gap5/tg_sequence.h

Fixed the %d operator in the editor sequence information line.

This is for the direction of a read, but it was giving the same data
as sense (ie complemented or not). Now we can get +>> -<< as well as
->> +<< combinations to indicate whether a sequence is the 1st or 2nd
in a pair.

------------------------------------------------------------------------
r2885 | jkbonfield | 2012-01-31 17:26:59 +0000 (Tue, 31 Jan 2012) | 8 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/gap5rc_menu_full
   M /staden/trunk/src/gap5/newgap5_cmds.c

First draft of editor Realign Selection function.

This takes a region of a sequence and realigns it against the
consensus, editing sequence and/or consensus accordingly. It also
adjusts the cutoff regions to make any selection visible if
appropriate.


------------------------------------------------------------------------
r2884 | jkbonfield | 2012-01-27 14:44:17 +0000 (Fri, 27 Jan 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_view.c

Robustness improvement - handle more cases of xx->r == NULL. (Why is
this happening?)

------------------------------------------------------------------------
r2883 | jkbonfield | 2012-01-27 14:43:57 +0000 (Fri, 27 Jan 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/b+tree2.c

Improved debugging and thrash/test code.

------------------------------------------------------------------------
r2882 | jkbonfield | 2012-01-24 12:32:11 +0000 (Tue, 24 Jan 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/README.build

Information to help those on broken RedHat based systems.

------------------------------------------------------------------------
r2881 | jkbonfield | 2012-01-23 17:27:35 +0000 (Mon, 23 Jan 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/mutscan/Makefile
   M /staden/trunk/src/tracediff/Makefile

Fixed the order of library linking so that these programs link on
Ubuntu 11.10.

------------------------------------------------------------------------
r2880 | jkbonfield | 2012-01-20 11:28:09 +0000 (Fri, 20 Jan 2012) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_search.c

edview_search_position() on a contig position failed if the cursor was
not on the consensus as it thought the contigs mismatched.

We now correctly check against xx->cnum instead xx->cursor_rec.

------------------------------------------------------------------------
r2879 | jkbonfield | 2012-01-19 09:10:36 +0000 (Thu, 19 Jan 2012) | 7 lines
Changed paths:
   M /staden/trunk/src/staden.profile

Allow for GTAGDB to be specified before sourcing staden.profile
instead of simply overriding it.

[The change of the wrapper scripts to call this file directly instead
of each replicating parts of each removed the ability to override
several variables.]

------------------------------------------------------------------------
r2878 | jkbonfield | 2012-01-18 14:52:38 +0000 (Wed, 18 Jan 2012) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_index_common.c

Protect against tmpnam + open failing. (Race condition?).

I've seen this happen, but cannot explain why.

------------------------------------------------------------------------
r2877 | jkbonfield | 2012-01-18 14:51:56 +0000 (Wed, 18 Jan 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/export_contigs.c

Improved reliability in the face of contigs that fail to be read. This
is important as gap5_export + tg_index together form a database fixer.

------------------------------------------------------------------------
r2876 | jkbonfield | 2012-01-18 14:45:27 +0000 (Wed, 18 Jan 2012) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/fasta.c
   M /staden/trunk/src/gap5/maq.c
   M /staden/trunk/src/gap5/tg_iface_g.c

Added code to initialise template name length in maq and fasta
import. This was giving random values which caused exports to die.

We now check for sane values when loading a seq_block and reinitialise
if appropriate to recover from past mistakes.

------------------------------------------------------------------------
r2875 | jkbonfield | 2012-01-16 11:56:34 +0000 (Mon, 16 Jan 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/break_contig.c
   M /staden/trunk/src/gap5/tg_contig.c

Improved error handling for when sequence records fail to load.

------------------------------------------------------------------------
r2874 | jkbonfield | 2012-01-16 11:40:32 +0000 (Mon, 16 Jan 2012) | 12 lines
Changed paths:
   M /staden/trunk/src/gap5/export_contigs.tcl
   M /staden/trunk/src/gap5/gap4_compat.c
   M /staden/trunk/src/gap5/list_proc.tcl
   M /staden/trunk/src/gap5/tclIndex

Fixed export contigs to cope with a broken contig name B+Tree. I'm not
sure what is corrupting this tree, but when faced with a large number
of contigs not in the tree two main issues occured:

1) We couldn't export all contigs. We now generate a contig list of
"=rec ..." instead of "name ...", completely avoiding the lookup to
the index.

2) The contig uniqness part in lget_contig_num ironically introduced a
duplicate if any contigs returned 0 for their name lookup.


------------------------------------------------------------------------
r2873 | jkbonfield | 2012-01-12 12:28:53 +0000 (Thu, 12 Jan 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_check.c

Added code to fix tags that are extended beyond the bounds of the item
they annotate.

------------------------------------------------------------------------
r2872 | jkbonfield | 2012-01-12 12:05:16 +0000 (Thu, 12 Jan 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/tk_utils/init.c

Further fix needed to make tg_index work after the "new_contigs" list
addition.

------------------------------------------------------------------------
r2871 | jkbonfield | 2012-01-12 12:04:52 +0000 (Thu, 12 Jan 2012) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/export_contigs.c
   M /staden/trunk/src/gap5/sam_index.c

Added bounds checking for tags on both import and exported. This
prevents crashes when faced with invalid data and also means that
export+import can act as a way to tidy up inconsistencies.

------------------------------------------------------------------------
r2870 | jkbonfield | 2012-01-12 12:03:44 +0000 (Thu, 12 Jan 2012) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/editor_view.c

Added a comment to explain some rather obfuscated looking code
------------------------------------------------------------------------
r2869 | jkbonfield | 2012-01-12 12:03:16 +0000 (Thu, 12 Jan 2012) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/list_proc.c

Bug fix to recent addition of "new_contigs" list in gap5. It was
breaking tg_index, which runs without a Tcl interpreter and therefore
generated errors when attempting to append to a list.

------------------------------------------------------------------------
r2868 | jkbonfield | 2012-01-10 17:00:45 +0000 (Tue, 10 Jan 2012) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_search.c
   M /staden/trunk/src/gap5/editor_search.tcl
   M /staden/trunk/src/gap5/gap5rc
   M /staden/trunk/src/seq_utils/search_utils.c
   M /staden/trunk/src/seq_utils/search_utils.h

Added a new sequence search to the contig editor in gap5. This is like
the consensus search, but on sequences instead (and correspondingly
slower of course).

------------------------------------------------------------------------
r2867 | jkbonfield | 2012-01-10 16:45:19 +0000 (Tue, 10 Jan 2012) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_contig.c

Added a list named "new_contigs". This is automatically appended to
every time the contig_new() function is called, so Break Contig,
Disassemble Readings, Assembly etc all append the new contig names to
this list. It can be cleared at any time to reset it.

------------------------------------------------------------------------
r2866 | jkbonfield | 2012-01-10 16:44:17 +0000 (Tue, 10 Jan 2012) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/dis_readings.c

Changed by user request: disassembling a set of reads where some reads
in the set do not exist in the database will no longer terminate the
disassembly process. Instead it continues and disassembles the ones
that do exist.

------------------------------------------------------------------------
r2865 | jkbonfield | 2012-01-10 15:25:30 +0000 (Tue, 10 Jan 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/break_contig.c

Improve debugging output for Break Contig so we can distinguish which
error case is which.

------------------------------------------------------------------------
r2864 | jkbonfield | 2012-01-09 15:29:47 +0000 (Mon, 09 Jan 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/editor_view.c
   M /staden/trunk/src/gap5/tman_interface.c

Fixed crashes in join editor when making a join with the trace display
open.

------------------------------------------------------------------------
r2863 | jkbonfield | 2012-01-09 09:34:14 +0000 (Mon, 09 Jan 2012) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_tcl.c

Improved error handling (report err instead of crash).

------------------------------------------------------------------------
r2862 | jkbonfield | 2012-01-06 17:41:17 +0000 (Fri, 06 Jan 2012) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/depth.tcl

Fixed a bug with the initial placement of data in the template
display.

------------------------------------------------------------------------
r2861 | jkbonfield | 2012-01-04 12:28:12 +0000 (Wed, 04 Jan 2012) | 4 lines
Changed paths:
   M /staden/trunk/src/system.mk.in

Removed ^ from expr BRE. It was generating warnings on some systems,
and it's not needed either as all BREs are anchored from the start of
the string anyway in expr.

------------------------------------------------------------------------
r2860 | jkbonfield | 2012-01-04 11:58:03 +0000 (Wed, 04 Jan 2012) | 8 lines
Changed paths:
   M /staden/trunk/src/copy_reads/Makefile
   M /staden/trunk/src/copy_reads/copy_reads.in
   M /staden/trunk/src/gap4/Makefile
   M /staden/trunk/src/gap4/gap4.in
   M /staden/trunk/src/gap5/Makefile
   M /staden/trunk/src/gap5/gap5.in
   M /staden/trunk/src/gap5/gap5_check.in
   M /staden/trunk/src/gap5/gap5_consensus.in
   M /staden/trunk/src/gap5/gap5_export.in
   M /staden/trunk/src/gap5/tg_index.in
   M /staden/trunk/src/gap5/tg_view.in
   M /staden/trunk/src/prefinish/Makefile
   M /staden/trunk/src/prefinish/prefinish.in
   M /staden/trunk/src/pregap4/Makefile
   M /staden/trunk/src/pregap4/pregap4.in
   M /staden/trunk/src/spin/Makefile
   M /staden/trunk/src/spin/spin.in
   M /staden/trunk/src/system.mk.in
   M /staden/trunk/src/trev/Makefile
   M /staden/trunk/src/trev/trev.in

Fixed the wrapper scripts to handle STADENROOT having spaces in the
path name.

Added use of the BSD install program instead of cp for the wrapper
scripts. When they're generated from .in they don't automatically get
the execute bit set, so we need to explictly do this while
installing. See system.mk.in for an alternative solution.

------------------------------------------------------------------------
r2859 | jkbonfield | 2012-01-04 11:53:09 +0000 (Wed, 04 Jan 2012) | 1 line
Changed paths:
   M /staden/trunk/src/README.macosx


------------------------------------------------------------------------
r2858 | jkbonfield | 2011-12-15 16:52:16 +0000 (Thu, 15 Dec 2011) | 6 lines
Changed paths:
   A /staden/trunk/src/MacOSX
   A /staden/trunk/src/MacOSX/Gap4.app
   A /staden/trunk/src/MacOSX/Gap4.app/Contents
   A /staden/trunk/src/MacOSX/Gap4.app/Contents/Info.plist
   A /staden/trunk/src/MacOSX/Gap4.app/Contents/MacOS
   A /staden/trunk/src/MacOSX/Gap4.app/Contents/Resources
   A /staden/trunk/src/MacOSX/Gap4.app/Contents/Resources/appIcon.icns
   A /staden/trunk/src/MacOSX/Gap5.app
   A /staden/trunk/src/MacOSX/Gap5.app/Contents
   A /staden/trunk/src/MacOSX/Gap5.app/Contents/Info.plist
   A /staden/trunk/src/MacOSX/Gap5.app/Contents/MacOS
   A /staden/trunk/src/MacOSX/Gap5.app/Contents/Resources
   A /staden/trunk/src/MacOSX/Gap5.app/Contents/Resources/appIcon.icns
   A /staden/trunk/src/MacOSX/Pregap4.app
   A /staden/trunk/src/MacOSX/Pregap4.app/Contents
   A /staden/trunk/src/MacOSX/Pregap4.app/Contents/Info.plist
   A /staden/trunk/src/MacOSX/Pregap4.app/Contents/MacOS
   A /staden/trunk/src/MacOSX/Pregap4.app/Contents/Resources
   A /staden/trunk/src/MacOSX/Pregap4.app/Contents/Resources/appIcon.icns
   A /staden/trunk/src/MacOSX/Spin.app
   A /staden/trunk/src/MacOSX/Spin.app/Contents
   A /staden/trunk/src/MacOSX/Spin.app/Contents/Info.plist
   A /staden/trunk/src/MacOSX/Spin.app/Contents/MacOS
   A /staden/trunk/src/MacOSX/Spin.app/Contents/Resources
   A /staden/trunk/src/MacOSX/Spin.app/Contents/Resources/appIcon.icns
   A /staden/trunk/src/MacOSX/Trev.app
   A /staden/trunk/src/MacOSX/Trev.app/Contents
   A /staden/trunk/src/MacOSX/Trev.app/Contents/Info.plist
   A /staden/trunk/src/MacOSX/Trev.app/Contents/MacOS
   A /staden/trunk/src/MacOSX/Trev.app/Contents/Resources
   A /staden/trunk/src/MacOSX/Trev.app/Contents/Resources/appIcon.icns
   A /staden/trunk/src/MacOSX/wrapper.c

Added additional components for MacOS X.

Each .app needs a program name in the Contents/MacOS directory (eg
Contents/MacOS/gap5). This will then be redirected to bin/gap5
instead. The source for the program is wrapper.c

------------------------------------------------------------------------
r2857 | jkbonfield | 2011-12-14 16:58:21 +0000 (Wed, 14 Dec 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/tk_utils/tkTrace.c

Fixed use of setjmp for libpng (required for newer libpng versions).

------------------------------------------------------------------------
r2856 | awhitwham | 2011-12-14 09:38:24 +0000 (Wed, 14 Dec 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/windows/wix/splash.bmp

Changed for version b9.

------------------------------------------------------------------------
r2855 | jkbonfield | 2011-12-13 13:54:59 +0000 (Tue, 13 Dec 2011) | 7 lines
Changed paths:
   M /staden/trunk/src/configure.in
   M /staden/trunk/src/copy_reads/Makefile
   D /staden/trunk/src/copy_reads/copy_reads
   A /staden/trunk/src/copy_reads/copy_reads.in (from /staden/trunk/src/copy_reads/copy_reads:2849)
   M /staden/trunk/src/gap4/Makefile
   D /staden/trunk/src/gap4/gap4
   A /staden/trunk/src/gap4/gap4.in (from /staden/trunk/src/gap4/gap4:2849)
   M /staden/trunk/src/gap5/Makefile
   D /staden/trunk/src/gap5/gap5
   A /staden/trunk/src/gap5/gap5.in (from /staden/trunk/src/gap5/gap5:2849)
   D /staden/trunk/src/gap5/gap5_check
   A /staden/trunk/src/gap5/gap5_check.in (from /staden/trunk/src/gap5/gap5_check:2849)
   D /staden/trunk/src/gap5/gap5_consensus
   A /staden/trunk/src/gap5/gap5_consensus.in (from /staden/trunk/src/gap5/gap5_consensus:2849)
   D /staden/trunk/src/gap5/gap5_export
   A /staden/trunk/src/gap5/gap5_export.in (from /staden/trunk/src/gap5/gap5_export:2849)
   D /staden/trunk/src/gap5/tg_index
   A /staden/trunk/src/gap5/tg_index.in (from /staden/trunk/src/gap5/tg_index:2849)
   D /staden/trunk/src/gap5/tg_view
   A /staden/trunk/src/gap5/tg_view.in (from /staden/trunk/src/gap5/tg_view:2849)
   M /staden/trunk/src/prefinish/Makefile
   D /staden/trunk/src/prefinish/prefinish
   A /staden/trunk/src/prefinish/prefinish.in (from /staden/trunk/src/prefinish/prefinish:2849)
   M /staden/trunk/src/pregap4/Makefile
   D /staden/trunk/src/pregap4/pregap4
   A /staden/trunk/src/pregap4/pregap4.in (from /staden/trunk/src/pregap4/pregap4:2849)
   M /staden/trunk/src/spin/Makefile
   D /staden/trunk/src/spin/spin
   A /staden/trunk/src/spin/spin.in (from /staden/trunk/src/spin/spin:2849)
   M /staden/trunk/src/staden.profile
   M /staden/trunk/src/trev/Makefile
   D /staden/trunk/src/trev/trev
   A /staden/trunk/src/trev/trev.in (from /staden/trunk/src/trev/trev:2849)

Replaced tclsh in the wrapper scripts with @TCLSH_PROG@ coming from
tcl.m4 via autoconf.

Also changed the tg_view and tg_index binaries to be .bin, so as not
to conflict with the wrapper scripts when configuring and building in
the main source directory rather than a subdirectory (recommended).

------------------------------------------------------------------------
r2854 | jkbonfield | 2011-12-13 10:22:06 +0000 (Tue, 13 Dec 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/gap4/template_display.c

Removal of debugging data.

------------------------------------------------------------------------
r2853 | jkbonfield | 2011-12-13 10:09:28 +0000 (Tue, 13 Dec 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/system.mk.in

Improvements to use of svnversion: quoting the result and also a check
for it looking legitimate (starting with a numeric value).

========================================================================
RELEASED 2.0.0b9	

r2852 | jkbonfield | 2011-12-05 12:26:04 +0000 (Mon, 05 Dec 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_gio.c

Changed the Open Database error message to be classified as an error
instead of text output. This means it goes to stderr and/or the error
window.

------------------------------------------------------------------------
r2850 | jkbonfield | 2011-12-05 10:31:10 +0000 (Mon, 05 Dec 2011) | 1 line
Changed paths:
   M /staden/trunk/src/NEWS
   M /staden/trunk/src/ReleaseNotes

------------------------------------------------------------------------
r2849 | awhitwham | 2011-12-01 16:32:45 +0000 (Thu, 01 Dec 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/gap4/list_contigs.tcl

Changed to work with tk8.5.

------------------------------------------------------------------------
r2848 | jkbonfield | 2011-12-01 14:14:21 +0000 (Thu, 01 Dec 2011) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_bin.c

Changed bin_invalidate_consensus() to invalidate more bins rather than
just leaf nodes at a fixed size.

This is partly because sometimes contig_bins_in_range returns other
sets of leaf nodes (I'm not sure why), but also because it's safer
this way given bins can and do change size due to edits.

------------------------------------------------------------------------
r2847 | awhitwham | 2011-12-01 12:34:42 +0000 (Thu, 01 Dec 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/list_contigs.tcl

Removed subscript from global that is now illegal in tk8.5

------------------------------------------------------------------------
r2846 | awhitwham | 2011-11-30 16:21:31 +0000 (Wed, 30 Nov 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/caf.c

Put in code to deal with DOS text format and file opening changes for Windows.

------------------------------------------------------------------------
r2845 | jkbonfield | 2011-11-29 09:47:58 +0000 (Tue, 29 Nov 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_contig.c

Fixed illegal memory access in contig_set_name().

------------------------------------------------------------------------
r2844 | jkbonfield | 2011-11-28 13:55:24 +0000 (Mon, 28 Nov 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/Makefile

Added gap5_check to distsrc target.

------------------------------------------------------------------------
r2843 | jkbonfield | 2011-11-28 13:55:01 +0000 (Mon, 28 Nov 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/fasta.c

Set maping qual to zero. Previously it was undefined and resulted in
"mapping_qual disagrees with range" from check database.

------------------------------------------------------------------------
r2842 | jkbonfield | 2011-11-28 13:54:33 +0000 (Mon, 28 Nov 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/break_contig.c
   M /staden/trunk/src/gap5/dis_readings.c
   M /staden/trunk/src/gap5/tg_index_common.c

Removed contig_index_update calls as contig_set_name, called by
contig_new, now does this. It was causing double entries in the contig
index.

------------------------------------------------------------------------
r2841 | jkbonfield | 2011-11-25 15:23:41 +0000 (Fri, 25 Nov 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl

Removed "default" as the default tag comment.

------------------------------------------------------------------------
r2840 | jkbonfield | 2011-11-25 15:00:32 +0000 (Fri, 25 Nov 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/configure.in

Update to 2.0.0b9

------------------------------------------------------------------------
r2839 | jkbonfield | 2011-11-25 14:58:27 +0000 (Fri, 25 Nov 2011) | 8 lines
Changed paths:
   M /staden/trunk/src/gap5/export_contigs.c
   M /staden/trunk/src/gap5/sam_index.c

Improved SAM tag format handling. Previously we ignored all key=value
syntax and just read the data as-is. This is fine for Gap5 given we
don't actually use key=value pairing yet, however it meant gap5 could
output data which other programs may not understand.

Now we always prepend Note= to the annotations so that other tools
aren't confused.

------------------------------------------------------------------------
r2838 | jkbonfield | 2011-11-25 10:44:20 +0000 (Fri, 25 Nov 2011) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/caf.c

Added code to remove quotes from (for example) template lines in CAF
files, which was causing failure messages.

Also added some experimental code to trim template suffixes, where
MIRA's templates almost but not quite match a prefix of the sequence
name.

------------------------------------------------------------------------
r2837 | jkbonfield | 2011-11-24 17:47:08 +0000 (Thu, 24 Nov 2011) | 5 lines
Changed paths:
   D /staden/trunk/src/gap5/IO.h
   D /staden/trunk/src/gap5/IO2.h
   M /staden/trunk/src/gap5/Makefile
   M /staden/trunk/src/gap5/check_assembly.c
   M /staden/trunk/src/gap5/consen.c
   M /staden/trunk/src/gap5/consen.h
   M /staden/trunk/src/gap5/contig_selector.c
   M /staden/trunk/src/gap5/contig_selector.h
   M /staden/trunk/src/gap5/cs-object.h
   M /staden/trunk/src/gap5/fij.c
   M /staden/trunk/src/gap5/fij.h
   M /staden/trunk/src/gap5/find_oligo.c
   M /staden/trunk/src/gap5/find_oligo.h
   M /staden/trunk/src/gap5/find_repeats.c
   M /staden/trunk/src/gap5/find_repeats.h
   D /staden/trunk/src/gap5/gap-dbstruct.h
   M /staden/trunk/src/gap5/gap_canvas_box.h
   M /staden/trunk/src/gap5/io_utils.h
   M /staden/trunk/src/gap5/list_proc.h
   M /staden/trunk/src/gap5/newgap5_cmds.c
   M /staden/trunk/src/gap5/newgap_cmds.h
   M /staden/trunk/src/gap5/newgap_structs.h
   M /staden/trunk/src/gap5/qualIO.c
   M /staden/trunk/src/gap5/readpair.c
   M /staden/trunk/src/gap5/restriction_enzymes.h

Removed defunct Gap4 copies of header files and replaced where
included with appropriate tg_gio or io_utils.h includes.

Removed: IO.h, IO2.h, gap-dbstruct.h

------------------------------------------------------------------------
r2836 | jkbonfield | 2011-11-23 16:51:57 +0000 (Wed, 23 Nov 2011) | 2 lines
Changed paths:
   M /staden/trunk/ChangeLog
   M /staden/trunk/doc/Makefile
   M /staden/trunk/doc/manual/dependencies
   M /staden/trunk/doc/manual/gap5-t.texi
   M /staden/trunk/doc/manual/gap5_break_contig.png
   A /staden/trunk/doc/manual/gap5_check_ass.png
   A /staden/trunk/doc/manual/gap5_check_database.png
   A /staden/trunk/doc/manual/gap5_check_db-t.texi
   M /staden/trunk/doc/manual/gap5_contig_editor-t.texi
   M /staden/trunk/doc/manual/gap5_contig_editor.names1.png
   M /staden/trunk/doc/manual/gap5_contig_editor.names2.png
   M /staden/trunk/doc/manual/gap5_contig_editor.search.png
   A /staden/trunk/doc/manual/gap5_delete_contigs.png
   M /staden/trunk/doc/manual/gap5_disassembly-t.texi
   M /staden/trunk/doc/manual/gap5_export-t.texi
   M /staden/trunk/doc/manual/gap5_export_sequences.png
   M /staden/trunk/doc/manual/gap5_fij-t.texi
   A /staden/trunk/doc/manual/gap5_fij.dialogue.png
   M /staden/trunk/doc/manual/gap5_list_libraries.png
   A /staden/trunk/doc/manual/gap5_org-t.texi
   A /staden/trunk/doc/manual/gap5_remove_contig_holes.png
   A /staden/trunk/doc/manual/gap5_remove_pad_columns.png
   A /staden/trunk/doc/manual/gap5_shuffle-t.texi
   A /staden/trunk/doc/manual/gap5_shuffle_pads.png
   M /staden/trunk/doc/manual/list_libraries-t.texi
   M /staden/trunk/doc/manual/lists-t.texi
   M /staden/trunk/doc/manual/restrict_enzymes-t.texi
   M /staden/trunk/src/gap5/check_database.tcl
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/dis_readings.tcl
   M /staden/trunk/src/gap5/gap5rc_menu_full
   M /staden/trunk/src/gap5/shuffle_pads.tcl

Updated documentation for gap5.

------------------------------------------------------------------------
r2835 | jkbonfield | 2011-11-22 14:44:49 +0000 (Tue, 22 Nov 2011) | 1 line
Changed paths:
   M /staden/trunk/src/ReleaseNotes


------------------------------------------------------------------------
r2834 | jkbonfield | 2011-11-22 14:42:18 +0000 (Tue, 22 Nov 2011) | 1 line
Changed paths:
   M /staden/trunk/src/NEWS


------------------------------------------------------------------------
r2833 | jkbonfield | 2011-11-22 14:17:14 +0000 (Tue, 22 Nov 2011) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/gap4_compat.c

Protect against invalid contig in get_contig_name().

This showed up as a crash when highlighting a sequence name where the
sequence is paired with one that is no longer attached to a contig -
itself a bug in the delete contig code (now fixed).

------------------------------------------------------------------------
r2832 | jkbonfield | 2011-11-22 12:40:23 +0000 (Tue, 22 Nov 2011) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/dis_readings.tcl
   M /staden/trunk/src/gap5/gap5rc_menu_full

Reordered entries in the Edit menu to group contig oriented and
sequence oriented functions. Also renamed Disassemble Contigs as
Delete Contigs and put a warning message in it too as some users
accidentally used this in place of Disassemble Readings.

------------------------------------------------------------------------
r2831 | jkbonfield | 2011-11-22 12:36:30 +0000 (Tue, 22 Nov 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_search.c

Fixed a bug in backward sequence search. It was failing to handle
block overlaps when scanning backwards meaning a 65 base pattern would
fail to be spotted 1 in 1000 times due to spanning blocks.

------------------------------------------------------------------------
r2830 | jkbonfield | 2011-11-22 12:35:25 +0000 (Tue, 22 Nov 2011) | 5 lines
Changed paths:
   M /staden/trunk/src/gap4/consen.tcl
   M /staden/trunk/src/gap5/consen.tcl
   M /staden/trunk/src/gap5/export_contigs.tcl
   M /staden/trunk/src/gap5/gap5rc_menu_full

Fixed a broken error window in various dialogues that save files.

Also simplified the save consensus option for gap5: no need to select
from the pointless sub-menu.

------------------------------------------------------------------------
r2829 | jkbonfield | 2011-11-17 16:16:19 +0000 (Thu, 17 Nov 2011) | 10 lines
Changed paths:
   M /staden/trunk/src/gap5/hash_lib.c
   M /staden/trunk/src/gap5/hash_lib.h

Fixed a bug in align_blocks(). It wasn't resetting gap_pen correctly
in one step.

Also tweaked this to downgrade scores when stitching blocks together,
based on a rough heuristic on the number of mismatches in inter-block
regions.

Reduced the MINMAT parameter from 20 to 12, allowing the sensitive
algorithm to potentially find more hits.

------------------------------------------------------------------------
r2828 | jkbonfield | 2011-11-16 17:11:11 +0000 (Wed, 16 Nov 2011) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/gap5rc_menu_full
   M /staden/trunk/src/gap5/gap_restriction_enzymes.tcl
   M /staden/trunk/src/gap5/list_contigs.tcl
   M /staden/trunk/src/gap5/tg_contig.c
   M /staden/trunk/src/gap5/tg_contig.h
   M /staden/trunk/src/gap5/tg_tcl.c
   M /staden/trunk/src/gap5/tkEditor.c

Added the ability to rename contigs and change the contig start
location.

This is available by the scripting interface in tg_tcl, and exposed to
the users by Contig editor dialogues.

------------------------------------------------------------------------
r2827 | jkbonfield | 2011-11-16 16:47:13 +0000 (Wed, 16 Nov 2011) | 12 lines
Changed paths:
   M /staden/trunk/src/gap5/Makefile
   M /staden/trunk/src/gap5/check_assembly.c
   M /staden/trunk/src/gap5/contig_selector.c
   M /staden/trunk/src/gap5/cs-object.h
   M /staden/trunk/src/gap5/fij.c
   M /staden/trunk/src/gap5/gap_canvas_box.c
   M /staden/trunk/src/gap5/gap_canvas_box.h
   D /staden/trunk/src/gap5/io-reg.h
   M /staden/trunk/src/gap5/restriction_enzymes.c
   M /staden/trunk/src/gap5/restriction_enzymes.h
   R /staden/trunk/src/gap5/tg_register.h
   M /staden/trunk/src/gap5/tk-io-reg.c

Removed the defunct io-reg.h, which in most places was being included
but ignored due to the correct tg_register.h having replaced it
already.

The exception to this is in restriction_enzymes.c which was only
including the old io-reg.h, and it turns out in doing so was making
some registration handling bugs due to int vs tg_rec on for record
IDs.

Also added RENAME as a registration type. This is sent when a contig
changes name.

------------------------------------------------------------------------
r2826 | jkbonfield | 2011-11-16 10:32:27 +0000 (Wed, 16 Nov 2011) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_search.c

Fixed edview_search_position to check contig number matches.

(This has the effect of fixing the From File search to skip matches in
other contigs.)

------------------------------------------------------------------------
r2825 | jkbonfield | 2011-11-16 10:03:03 +0000 (Wed, 16 Nov 2011) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_anno.c

More error checking, this time in anno_ele_add() for when
bin_add_to_range() fails.

I can't yet figure out why this function would fail though, so for now
it just emits a suitable error to aid in bug reporting.

------------------------------------------------------------------------
r2824 | jkbonfield | 2011-11-16 09:57:46 +0000 (Wed, 16 Nov 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_view.c

Attempt to avoid crashes when running out of memory in edview_visible_items().

------------------------------------------------------------------------
r2823 | jkbonfield | 2011-11-16 09:39:03 +0000 (Wed, 16 Nov 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_index_common.c

Additional check in bttmp_file_open() to see if fdopen fails.  It
appears to have done based on a core dump, but maybe it was simply
malloc failure. Unknown at present.

------------------------------------------------------------------------
r2822 | awhitwham | 2011-11-09 16:35:20 +0000 (Wed, 09 Nov 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/depth_track.c

Fixed bug in template depth display due to the inconsistant colour being set to zero.

------------------------------------------------------------------------
r2821 | jkbonfield | 2011-11-07 16:31:04 +0000 (Mon, 07 Nov 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/sam_index.c

Added back the count of the number of sequences indexed in SAM.
Somehow this got lost in a recent update.

------------------------------------------------------------------------
r2820 | jkbonfield | 2011-11-07 12:02:13 +0000 (Mon, 07 Nov 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/consensus.c

More unpadded coordinate fixes - this time to consensus_padded_pos()
so it's now the correct analogue to consensus_unpadded_pos().

------------------------------------------------------------------------
r2819 | jkbonfield | 2011-11-04 17:34:04 +0000 (Fri, 04 Nov 2011) | 11 lines
Changed paths:
   M /staden/trunk/src/gap5/export_contigs.c
   M /staden/trunk/src/gap5/import_gff.c

Changed unpadded GFF coordinates to agree with the new unpadded coords
in the editor: base 1 is the left base, regardless of where the contig
start coordinate is.

This works well for local users and it matches up with coordinates in
a FASTA file, but may cause issues for people using gap5 in a
reference coordinate system. (Right now this isn't common, if at all,
given there are better viewers for such things. If it becomes a
problem we can revisit this and make the unpadded coordinate start
point optional.)

------------------------------------------------------------------------
r2818 | jkbonfield | 2011-11-04 17:31:28 +0000 (Fri, 04 Nov 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_contig.c

Improved error recovery.

------------------------------------------------------------------------
r2817 | jkbonfield | 2011-11-04 16:31:16 +0000 (Fri, 04 Nov 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_check.c

Check Database now correctly fixes bin parenting issues. It was
failing to set BIN_BIN_UPDATED flag so the previous fix was silently
being dropped when flushing to disk.

------------------------------------------------------------------------
r2816 | jkbonfield | 2011-11-04 12:07:14 +0000 (Fri, 04 Nov 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/export_contigs.c
   M /staden/trunk/src/gap5/sam_index.c

Replaced RT with CT for consensus tags. I thought I'd already done
this, but it seems I'd merely updated the format and not the type
code. 

------------------------------------------------------------------------
r2815 | jkbonfield | 2011-11-04 10:41:27 +0000 (Fri, 04 Nov 2011) | 1 line
Changed paths:
   A /staden/trunk/src/ReleaseNotes

Don't get too excited - but it's on the way
------------------------------------------------------------------------
r2814 | jkbonfield | 2011-11-03 17:20:20 +0000 (Thu, 03 Nov 2011) | 1 line
Changed paths:
   M /staden/trunk/src/NEWS


------------------------------------------------------------------------
r2813 | jkbonfield | 2011-11-03 17:00:37 +0000 (Thu, 03 Nov 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/consensus.c

Better error handling in consensus_valid_range when faced with
corrupted data.

------------------------------------------------------------------------
r2812 | jkbonfield | 2011-11-03 16:37:29 +0000 (Thu, 03 Nov 2011) | 8 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_check.c
   M /staden/trunk/src/gap5/tg_check.h
   M /staden/trunk/src/gap5/tg_tcl.c

Updated to Check Database to fix an observed problem where failure
part way through joining a contig could leave a residual contig
behind, but containing data already corrected linked in to another
contig.

When fixing this we now destroy the contig if we can determine that
the root bin has a two-way linkage with the true parent.

------------------------------------------------------------------------
r2811 | jkbonfield | 2011-11-03 15:15:47 +0000 (Thu, 03 Nov 2011) | 12 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_join.c

Fixed reference count handling in join_contigs().

A user was rarely seeing the right hand contig not being destroyed
after a contig join. The only possible code route I can see for this
happening is cr being freed during one of the plots redrawing via
contig_notify callbacks, and cr memory being reused to point to, say,
a bin object. Then contig_destroy(io, cr->rec) later on fails as the
object isn't valid.

At least I hope that's the cause of that bug... Whatever the case this
is a bug and it's fixed.

------------------------------------------------------------------------
r2810 | jkbonfield | 2011-11-03 14:44:25 +0000 (Thu, 03 Nov 2011) | 33 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_cache.c

Scary change, but I *think* a correct one... It seems to pass my
gap5_thrash tests anyway.

When doing cache_rw on an object from a derived (aka child) io, we use
copy-on-write methods to duplicate the object from the parent io into
the child io. The address we return to the caller is now the child io
object instead. This is implemented via cache_dup(). This is used
within the contig editor to allow for edits to be not live and also to
allow exit without saving.

When incremementing or decrementing the reference count on a child io
object we were previously just working on that object itself. However
the cache_dup function didn't copy the full reference count from the
parent - this is perhaps a bug. Consequentially it's possible to
perform several cache_incr on a read-only object, call cache_rw to get
a new one (now with ref count 1 again), and then cache_decr on the
read-write object and trigger an error due to negative reference
counts.

Rather than attempt to fix this via copying the master ref count
into the child io object, which itself causes other errors, I now do
all reference counting on the master object instead. Hence a
cache_incr or cache_decr on an object in the child io will update the
ref count in the parent io. (This is perhaps not implemented in the
most efficient manner, using a separate cache_search, but if it has
performance issues consider implementing a master pointer to
cached_item struct.)

I believe this is robust given the child io only contains cache_rw
objects and we'll never be wanting to purge from the child - making it
more hash than hache.


------------------------------------------------------------------------
r2809 | jkbonfield | 2011-11-03 14:23:29 +0000 (Thu, 03 Nov 2011) | 1 line
Changed paths:
   M /staden/trunk/src/tk_utils/filebrowser.tcl

Bug fix to the 'file does not exist' error dialogue
------------------------------------------------------------------------
r2808 | jkbonfield | 2011-11-03 14:23:09 +0000 (Thu, 03 Nov 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_selector.tcl

Protect against some strange case where the bounding box is empty,
perhaps due to firing a scroll event that occurs during redraw.

------------------------------------------------------------------------
r2807 | jkbonfield | 2011-11-03 14:22:32 +0000 (Thu, 03 Nov 2011) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl

Minor cache ref fix
------------------------------------------------------------------------
r2806 | jkbonfield | 2011-11-03 14:22:11 +0000 (Thu, 03 Nov 2011) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/dis_readings.c

Fixed a bug in Disassemble Contigs - it now unpairs paired reads that
point to one of the disassembled readings.

Also added minor speedup to unlink_read().

------------------------------------------------------------------------
r2805 | jkbonfield | 2011-11-03 11:34:06 +0000 (Thu, 03 Nov 2011) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/tg_check.c

Don't report bin memory/disk conflicts when dealing with known issues of older DB formats
------------------------------------------------------------------------
r2804 | jkbonfield | 2011-11-03 11:32:45 +0000 (Thu, 03 Nov 2011) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/dis_readings.c

Added io flush to Disassemble Contigs
------------------------------------------------------------------------
r2803 | jkbonfield | 2011-11-02 17:13:59 +0000 (Wed, 02 Nov 2011) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/shuffle_pads.c
   M /staden/trunk/src/gap5/tg_contig.c

Fixed some shuffle pads bugs where it could produce out of alignment
data (due to incorrectly adjusting clip points) and also trigger
oddities with removing columns of pads when there exists an out of
date cached consensus (having no *).

------------------------------------------------------------------------
r2802 | jkbonfield | 2011-11-02 16:51:05 +0000 (Wed, 02 Nov 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_sequence.c

Comment only. (A question about complementing seqs.)

------------------------------------------------------------------------
r2801 | jkbonfield | 2011-11-02 09:54:51 +0000 (Wed, 02 Nov 2011) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl

Fixed the Join Editor quitting/saving. It was previously only checking
for edits and offering to save in the active contig (with the solid
editor cursor).

This only impacted the join editor where changes were made and then we
decided not to make a join, but to save the changed regardless.

------------------------------------------------------------------------
r2800 | jkbonfield | 2011-11-02 09:53:35 +0000 (Wed, 02 Nov 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_view.c

Fixed edPrevDifference; it was finding a false difference every 1024 bases.

------------------------------------------------------------------------
r2799 | jkbonfield | 2011-11-01 16:48:01 +0000 (Tue, 01 Nov 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_check.c

Check Database in fix mode now clears any consensus cache. This has
been added due to the recent (fortunately short-lived) bug that
sometimes cached Ns in valid consensus bases.

------------------------------------------------------------------------
r2798 | jkbonfield | 2011-11-01 16:47:22 +0000 (Tue, 01 Nov 2011) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/shuffle_pads.tcl

Fix window title for Remove Pad Columns
------------------------------------------------------------------------
r2797 | jkbonfield | 2011-11-01 14:01:47 +0000 (Tue, 01 Nov 2011) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/consensus.c

Fix to consensus calling for N when reads contain only N.
It previously only did this in certain cases (when flags & CONS_COUNTS
is set). This showed up as cut and pasting of consensus giving A
instead of N.

------------------------------------------------------------------------
r2796 | jkbonfield | 2011-11-01 12:26:18 +0000 (Tue, 01 Nov 2011) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/consensus.c

Improved speed of fetching consensus when we're in read-only mode and
no consensus cache exists. (Don't bother trying.)

Bug fix to consensus_unpadded_pos(). Now starts from base 1 in all
cases.

------------------------------------------------------------------------
r2795 | jkbonfield | 2011-10-31 17:08:56 +0000 (Mon, 31 Oct 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/export_contigs.c

Fixed a bug in Export Contigs to SAM format involving the handling of
template names. It could sometimes cause a crash.

------------------------------------------------------------------------
r2794 | jkbonfield | 2011-10-31 17:08:35 +0000 (Mon, 31 Oct 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/break_contig.c
   M /staden/trunk/src/gap5/break_contig.h
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/gap5rc_menu_full
   M /staden/trunk/src/gap5/newgap5_cmds.c
   M /staden/trunk/src/gap5/tg_tcl.c

Added an option to Break Contig at a specific position within the
contig editor.

------------------------------------------------------------------------
r2793 | jkbonfield | 2011-10-26 16:53:16 +0100 (Wed, 26 Oct 2011) | 12 lines
Changed paths:
   M /staden/trunk/src/gap5/baf.c
   M /staden/trunk/src/gap5/caf.c
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/dis_readings.c
   M /staden/trunk/src/gap5/editor_view.c
   M /staden/trunk/src/gap5/export_contigs.c
   M /staden/trunk/src/gap5/gap5rc
   M /staden/trunk/src/gap5/import_gff.c
   M /staden/trunk/src/gap5/sam_index.c
   M /staden/trunk/src/gap5/tag_editor.tcl
   M /staden/trunk/src/gap5/tg_anno.c
   M /staden/trunk/src/gap5/tg_anno.h
   M /staden/trunk/src/gap5/tg_gio.c
   M /staden/trunk/src/gap5/tg_gio.h
   M /staden/trunk/src/gap5/tg_iface.h
   M /staden/trunk/src/gap5/tg_iface_g.c
   M /staden/trunk/src/gap5/tg_index.c
   M /staden/trunk/src/gap5/tg_index.h
   M /staden/trunk/src/gap5/tg_struct.h
   M /staden/trunk/src/gap5/tg_tcl.c

Tag directions are now stored in the database, and can be edited/set
using the Tag Editor within the contig editor.

This required a change of database format, with the master format
number now being 4, meaning that older gap5s will not be able to load
the latest databases (but vice versa is true).

I also added the ability of tg_index to create databases in older
formats. In this case run "tg_index -v 3". However doing so will mean
attempts to set tag strands will silently fail as they cannot be
written back to disc.

------------------------------------------------------------------------
r2792 | jkbonfield | 2011-10-26 12:00:13 +0100 (Wed, 26 Oct 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl

Added n/- bindings for editing sequence. Also Insert key for inserting pads.

------------------------------------------------------------------------
r2791 | jkbonfield | 2011-10-26 10:23:18 +0100 (Wed, 26 Oct 2011) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/export_contigs.c
   M /staden/trunk/src/gap5/sam_index.c
   M /staden/trunk/src/gap5/sam_pileup.c
   M /staden/trunk/src/gap5/sam_pileup.h

Fixed the tag export format to use ; instead of | for field separators
in CT and PT tags.

Fixed parsing of tags in padded SAM files. It now takes note of
whether a base is explicitly added via cigar-P or implicitly added via
another sequences cigar-I.

------------------------------------------------------------------------
r2790 | jkbonfield | 2011-10-25 14:21:42 +0100 (Tue, 25 Oct 2011) | 1 line
Changed paths:
   M /staden/trunk/src/NEWS


------------------------------------------------------------------------
r2789 | jkbonfield | 2011-10-25 14:05:08 +0100 (Tue, 25 Oct 2011) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/consensus.c

Fixed consensus when consisting solely of reads of N. We now force the
consensus to be N too.

Also included some currently unused code for uniqueness testing.

------------------------------------------------------------------------
r2788 | awhitwham | 2011-10-25 11:52:59 +0100 (Tue, 25 Oct 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_contig.c
   M /staden/trunk/src/gap5/tg_sequence.h

Some code tidying on tg_contig.

------------------------------------------------------------------------
r2787 | jkbonfield | 2011-10-24 16:55:13 +0100 (Mon, 24 Oct 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl

Protect against users trying to create annotations off the ends of
contigs (in the cutoff data).

------------------------------------------------------------------------
r2786 | jkbonfield | 2011-10-24 12:31:49 +0100 (Mon, 24 Oct 2011) | 21 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/editor_join.c

Major join editor bug fix.

When making a join, the first thing the editor does is to save both
contigs. This causes a redraw of both editors and in doing so was
causing the editors to adjust the X scrollbar to ensure the editing
cursor is visible on screen. If the join Lock mode wasn't enable and
the editor cursors weren't both visible this would shift one editor
with respect to the other, immediately before making the join. It
happens so fast you can't see it.

The effect was a catastrophically broken join with sequences out of
alignment.

The fix was changing the REG_LENGTH event callback in the editor to
not request the cursor to be visible when calling $ed set_cursor.

I also added an explicit recalculation of xx->link->lockOffset in
edJoin as it assumes this to be valid, but it appears something
already recomputes this (maybe the save). I left that fix there though
for belt-n-braces extra checking.

------------------------------------------------------------------------
r2785 | jkbonfield | 2011-10-21 12:11:46 +0100 (Fri, 21 Oct 2011) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/dis_readings.c
   M /staden/trunk/src/gap5/dis_readings.h
   M /staden/trunk/src/gap5/dis_readings.tcl
   M /staden/trunk/src/gap5/gap5.tcl
   M /staden/trunk/src/gap5/gap5rc
   M /staden/trunk/src/gap5/gap5rc_menu_full
   M /staden/trunk/src/gap5/newgap5_cmds.c
   M /staden/trunk/src/gap5/tclIndex

First draft of Disassemble Contigs.

(It works in the limited testing I have time to do before local site
shutdown.)

------------------------------------------------------------------------
r2784 | jkbonfield | 2011-10-20 15:03:21 +0100 (Thu, 20 Oct 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/tg_sequence.c
   M /staden/trunk/src/gap5/tg_sequence.h
   M /staden/trunk/src/gap5/tg_tcl.c

Added a bulk trimming function using < and > in the contig editor.

------------------------------------------------------------------------
r2783 | awhitwham | 2011-10-20 14:54:20 +0100 (Thu, 20 Oct 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/editor_view.c
   M /staden/trunk/src/gap5/editor_view.h
   M /staden/trunk/src/gap5/gap5rc_menu_full
   M /staden/trunk/src/gap5/tg_contig.c
   M /staden/trunk/src/gap5/tg_contig.h
   M /staden/trunk/src/gap5/tkEditor.c

Added group by base.  Still some tidying to be done on the grouping code. 

------------------------------------------------------------------------
r2782 | jkbonfield | 2011-10-19 16:46:23 +0100 (Wed, 19 Oct 2011) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl

Protect against attempts to join a contig to itself.

This was possible if you deliberately brought up the same pair twice
and then made the join in the first one, leaving the second join
editor still in existance with a still functioning Join button.

------------------------------------------------------------------------
r2781 | jkbonfield | 2011-10-19 16:38:37 +0100 (Wed, 19 Oct 2011) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_view.c

Removed the edview->contig cached contig_t. We now always load on
demand using cache_search. This avoids the need to use incr_contig and
decr_contig methods for keeping it up to date when we modify it
somehow. It's perhaps marginally slower, but more robust.

------------------------------------------------------------------------
r2780 | jkbonfield | 2011-10-19 16:37:59 +0100 (Wed, 19 Oct 2011) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/editor_join.c
   M /staden/trunk/src/gap5/editor_oligo.c
   M /staden/trunk/src/gap5/editor_search.c
   M /staden/trunk/src/gap5/editor_view.h
   M /staden/trunk/src/gap5/tkEdNames.c
   M /staden/trunk/src/gap5/tkEditor.c

Removed the edview->contig cached contig_t. We now always load on
demand using cache_search. This avoids the need to use incr_contig and
decr_contig methods for keeping it up to date when we modify it
somehow. It's perhaps marginally slower, but more robust.

------------------------------------------------------------------------
r2779 | jkbonfield | 2011-10-19 12:28:58 +0100 (Wed, 19 Oct 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/dis_readings.c

Protect against malformed data - no longer crashing when a read-pair
record number fails to load.

------------------------------------------------------------------------
r2778 | jkbonfield | 2011-10-19 11:21:48 +0100 (Wed, 19 Oct 2011) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/editor_join.c

Fixed redrawing bugs when using the Join Editor and having existing
contig editors on screen for the same contig.

This is mainly a problem of cached xx->contig structs, but I will be
removing these soon I think. This patch is simply to mark the best
version so far with using cached contigs.

------------------------------------------------------------------------
r2777 | jkbonfield | 2011-10-19 09:47:28 +0100 (Wed, 19 Oct 2011) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl

fix typo
------------------------------------------------------------------------
r2776 | jkbonfield | 2011-10-19 09:47:18 +0100 (Wed, 19 Oct 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/gap5rc_menu_full
   M /staden/trunk/src/gap5/list_proc.tcl

Added "Contigs to readings" function

------------------------------------------------------------------------
r2775 | jkbonfield | 2011-10-18 16:46:57 +0100 (Tue, 18 Oct 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl

Correct the window title of joined editors.

------------------------------------------------------------------------
r2774 | jkbonfield | 2011-10-18 12:02:45 +0100 (Tue, 18 Oct 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_view.c

Added a %B expansion for the sequence information line. This expands
to the bin record number containing the sequence. It is intended to be
used for debugging purposes.

------------------------------------------------------------------------
r2773 | jkbonfield | 2011-10-18 12:02:04 +0100 (Tue, 18 Oct 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl

Added the ability to copy and paste contig names as well as reading
names from the editor window. Also rebound <2> to be copy by #number,
with <1> still being "name".

------------------------------------------------------------------------
r2772 | jkbonfield | 2011-10-17 18:09:25 +0100 (Mon, 17 Oct 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/dis_readings.c

Fixed a bug where we failed to check for empty contigs properly when
removing readings coming from multiple contigs.

------------------------------------------------------------------------
r2771 | jkbonfield | 2011-10-17 18:08:43 +0100 (Mon, 17 Oct 2011) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/list_contigs.tcl

Added No.Annotations field to the copy buffer
------------------------------------------------------------------------
r2770 | jkbonfield | 2011-10-17 18:08:30 +0100 (Mon, 17 Oct 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/b+tree2.c
   M /staden/trunk/src/gap5/tg_iface_g.c

Fixed some caching bugs with the B+Tree code, showing up as crashes or
corruptions.

------------------------------------------------------------------------
r2769 | jkbonfield | 2011-10-13 17:05:22 +0100 (Thu, 13 Oct 2011) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/export_contigs.c

Bug fix to new SAM exporting:

- Blank tags no longer get an additional '|' character.

- Consensus tags are now sorted correctly, removing the need to use
  samtools sort.

------------------------------------------------------------------------
r2768 | jkbonfield | 2011-10-13 17:04:39 +0100 (Thu, 13 Oct 2011) | 1 line
Changed paths:
   M /staden/trunk/src/NEWS


------------------------------------------------------------------------
r2767 | jkbonfield | 2011-10-13 16:28:10 +0100 (Thu, 13 Oct 2011) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_check.c

Protect against a crash due to a data error.

I don't know how this can happen yet, but it's possible to have old
data in the cache for a record which no longer exists. This causes
Check Database to explode when verifying the cache against the disk
copies. (Now it just complains and keeps going.)

------------------------------------------------------------------------
r2766 | jkbonfield | 2011-10-13 16:26:45 +0100 (Thu, 13 Oct 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/gap4_compat.c

Improved contig_name_to_number() to handle #<sequence_rec>.

------------------------------------------------------------------------
r2765 | jkbonfield | 2011-10-13 14:33:05 +0100 (Thu, 13 Oct 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/Misc/dstring.c
   M /staden/trunk/src/gap5/sam_index.c

Fixes to the new SAM tag encodings and their URL style escaping.

------------------------------------------------------------------------
r2764 | jkbonfield | 2011-10-12 17:44:57 +0100 (Wed, 12 Oct 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/Misc/dstring.c
   M /staden/trunk/src/Misc/dstring.h
   M /staden/trunk/src/gap5/bam.c
   M /staden/trunk/src/gap5/export_contigs.c
   M /staden/trunk/src/gap5/sam_index.c
   M /staden/trunk/src/gap5/sam_pileup.c

Added experimental code for supporting the new tag format within
SAM. Ongoing work - see samtools-devel mailing list.

------------------------------------------------------------------------
r2763 | jkbonfield | 2011-10-12 10:04:58 +0100 (Wed, 12 Oct 2011) | 13 lines
Changed paths:
   M /staden/trunk/src/gap5/Makefile
   A /staden/trunk/src/gap5/check_assembly.c
   A /staden/trunk/src/gap5/check_assembly.h
   A /staden/trunk/src/gap5/check_assembly.tcl
   M /staden/trunk/src/gap5/gap5rc
   M /staden/trunk/src/gap5/gap5rc_menu_full
   M /staden/trunk/src/gap5/newgap5_cmds.c
   M /staden/trunk/src/gap5/newgap_structs.h
   M /staden/trunk/src/gap5/tclIndex

Added Check Assembly to Gap5. It doesn't have the option of Gap4 to
align cutoff data to the consensus, but that is best served in a
different route now. Instead this implementation is simply comparing
used/visible data against the consensus over a window length to find
highly discrepant regions of sequences.

Cutoff plan: I observe lots of places where a whole raft of data
has been clipped back to make it align. For individual sequences this
probably isn't an issue - maybe it's chimeric or poor quality - but if
multiple sequences have been clipped at the same position and the
clipped data matches then it is indicative of a problem such as a
collapsed repeat.

------------------------------------------------------------------------
r2762 | jkbonfield | 2011-10-10 17:16:08 +0100 (Mon, 10 Oct 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl

Extended the read selector/deselector to ask whether we want to select
reads entirely within the range or overlapping the range.

------------------------------------------------------------------------
r2761 | jkbonfield | 2011-10-10 14:32:05 +0100 (Mon, 10 Oct 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/gap5rc
   M /staden/trunk/src/gap5/newgap5_cmds.c
   M /staden/trunk/src/gap5/newgap_structs.h
   M /staden/trunk/src/gap5/readpair.c
   M /staden/trunk/src/gap5/readpair.h
   M /staden/trunk/src/gap5/readpair.tcl

Find Read Pairs now has an option to filter the results to only
display contig pairings spanned by more than a certain number of
read-pairs.

------------------------------------------------------------------------
r2760 | jkbonfield | 2011-10-10 14:30:29 +0100 (Mon, 10 Oct 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/gap5rc_menu_full
   M /staden/trunk/src/gap5/list_proc.tcl

The contig editor now has functions to select and deselect all
sequences at a particular consensus column (or range).

------------------------------------------------------------------------
r2759 | jkbonfield | 2011-10-10 14:29:23 +0100 (Mon, 10 Oct 2011) | 1 line
Changed paths:
   M /staden/trunk/src/NEWS


------------------------------------------------------------------------
r2758 | jkbonfield | 2011-10-07 14:34:25 +0100 (Fri, 07 Oct 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_search.c
   M /staden/trunk/src/gap5/editor_search.tcl
   M /staden/trunk/src/gap5/editor_view.c
   M /staden/trunk/src/gap5/gap5rc

Added "depth <" and "depth >" searches in the contig editor.

------------------------------------------------------------------------
r2757 | jkbonfield | 2011-10-07 12:23:44 +0100 (Fri, 07 Oct 2011) | 12 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_cache.c

When displaying the editor we now call update_library_stats regularly
on reads with libraries in order to check consistency. This in turn
does cache_rw and attempts to cache_dup from base io to child io,
causing a "FIXME: implement library_dup" warning message as this
hadn't been implemented yet.

However it also causes another side effect - the editor thinks we've
modified something and asks if we want to save; annoying too. For now
I just changed the cache_rw on libraries to always work on the base io
even if we're trying to cache_rw on the child io, solving both issues
at once. It's not ideal from a code purist view, but it works.

------------------------------------------------------------------------
r2756 | jkbonfield | 2011-10-07 12:06:15 +0100 (Fri, 07 Oct 2011) | 14 lines
Changed paths:
   M /staden/trunk/src/gap5/g-files.c
   M /staden/trunk/src/gap5/g-files.h
   M /staden/trunk/src/gap5/g-request.c

Scary updates to the low level DB code.

The previous rewrite of g_write_aux_index() had the side effect of
only ever using one pair of the twinned image/time/use arrays in the
index.  Consequentially crashing or killing the program mid-write
could leave an inconsistent database.

We now store the old index values and put those into ind[1] with
ind[0] being the new ones and delay the dheap_free calls until after
the update_header() call.

This means the single transaction and rollback code now works again
and we can recover from partial commits.

------------------------------------------------------------------------
r2755 | jkbonfield | 2011-10-06 16:46:24 +0100 (Thu, 06 Oct 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/consensus.c

Fixed memory corruption in consensus caching. If a bin dramatically
shrinks, the old cached consensus could be larger than the
bstart..bend range which then caused an overflow.

------------------------------------------------------------------------
r2754 | jkbonfield | 2011-10-06 16:14:14 +0100 (Thu, 06 Oct 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/list_contigs.tcl

Control-A keybinding now selects all in the List Contigs window.

------------------------------------------------------------------------
r2753 | jkbonfield | 2011-10-06 15:30:30 +0100 (Thu, 06 Oct 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/list_contigs.tcl

Fixed tcl selection handlers when pasting long strings.

The most significant of this is the Contig List window.

------------------------------------------------------------------------
r2752 | jkbonfield | 2011-10-06 14:58:25 +0100 (Thu, 06 Oct 2011) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/tg_tcl.c

Added a method to determine the effective orientation of a template
from a sequence.

Use this within the contig editor Join To command, so we can reverse
complement the other contig if appropriate.

------------------------------------------------------------------------
r2751 | jkbonfield | 2011-10-06 10:10:24 +0100 (Thu, 06 Oct 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/bam.c
   M /staden/trunk/src/gap5/bam.h
   M /staden/trunk/src/gap5/sam_index.c
   M /staden/trunk/src/gap5/sam_pileup.c

Bug fixes to cope with sequence of "*" in SAM/BAM files.

------------------------------------------------------------------------
r2750 | jkbonfield | 2011-10-05 14:44:59 +0100 (Wed, 05 Oct 2011) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/tag_editor.tcl

- Increased the default size of the tag editor.

- Changed the line wrapping to "none", meaning the horizontal scroll
  bar becomes useful.

------------------------------------------------------------------------
r2749 | jkbonfield | 2011-10-05 14:44:23 +0100 (Wed, 05 Oct 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/bam.c
   M /staden/trunk/src/gap5/bam.h
   M /staden/trunk/src/gap5/sam_index.c
   M /staden/trunk/src/gap5/sam_pileup.c

Improved error handling of SAM/BAM I/O. It can now distinguish between
eof and an early termination due to an error. It also reports the line
number in SAM (or equivalent SAM if reading BAM).

------------------------------------------------------------------------
r2748 | jkbonfield | 2011-10-05 11:57:19 +0100 (Wed, 05 Oct 2011) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl

The join editor now has the top editor being the first contig listed
(in both the initial join editor dialogue and in the "contig1 /
contig2" window header) and the bottom is the second contig.  They
were reversed before.

------------------------------------------------------------------------
r2747 | jkbonfield | 2011-10-03 16:57:40 +0100 (Mon, 03 Oct 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_search.c
   M /staden/trunk/src/gap5/editor_search.tcl

Added the Gap4 "search from file" functionality to Gap5's contig editor.

------------------------------------------------------------------------
r2746 | jkbonfield | 2011-10-03 14:34:16 +0100 (Mon, 03 Oct 2011) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_oligo.c
   M /staden/trunk/src/gap5/primlib.c

Bug fix to the editor Find Primer-walk function. It was adding tags to
the wrong place for reverse strand oligos.

Also removed some debugging output.

------------------------------------------------------------------------
r2745 | jkbonfield | 2011-10-03 14:33:21 +0100 (Mon, 03 Oct 2011) | 1 line
Changed paths:
   M /staden/trunk/src/NEWS


------------------------------------------------------------------------
r2744 | jkbonfield | 2011-10-03 12:29:27 +0100 (Mon, 03 Oct 2011) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_contig.c

Added back compute_ypos_tags() call (accidentally removed in the Group
Readings revamp).

This showed up as an inability to edit tags by pressing F11 in the
contig editor.

------------------------------------------------------------------------
r2743 | jkbonfield | 2011-10-03 11:38:30 +0100 (Mon, 03 Oct 2011) | 15 lines
Changed paths:
   M /staden/trunk/src/tk_utils/entrybox.tcl

Removed the tkwait call in entrybox_get, to remove the wait-forever
idea. I cannot remember why we use this now, so who knows what affects
this will have.

However removing it cures one very strange bug:

1) In Gap5 bring up a contig editor via Edit Contig menu item
2) Go to the Edit Contig menu item again and deliberately type in an
   invalid name, then attempt to hit OK to invoke the editor (does
   nothing).
3) In the first editor, which should still be visible, position the
   editor cursor on a location not covered by a base.

At this point you'll get a Tk error message.

------------------------------------------------------------------------
r2742 | jkbonfield | 2011-09-30 12:34:47 +0100 (Fri, 30 Sep 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_index_common.c

create_new_contig() now checks for duplicate contig names and
automatically renames them to prevent this happening.

------------------------------------------------------------------------
r2741 | jkbonfield | 2011-09-30 12:16:20 +0100 (Fri, 30 Sep 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/gap4_compat.c

Duplicate contig names are now removed in lget_contig_num, meaning FIJ
etc won't find self matches when given duplicates.

------------------------------------------------------------------------
r2740 | awhitwham | 2011-09-30 12:12:03 +0100 (Fri, 30 Sep 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/editor_view.c
   M /staden/trunk/src/gap5/editor_view.h
   M /staden/trunk/src/gap5/gap5rc_menu_full
   M /staden/trunk/src/gap5/tg_contig.c
   M /staden/trunk/src/gap5/tg_contig.h
   M /staden/trunk/src/gap5/tkEditor.c
   M /staden/trunk/src/gap5/tkEditor.h

Initial Group Readings check in.  Gives the option in the editor to order readings in various ways.  Default setting matches current ordering.  Some more work needs to be done.

------------------------------------------------------------------------
r2739 | jkbonfield | 2011-09-30 11:54:54 +0100 (Fri, 30 Sep 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/dis_readings.tcl

Fixed Remove Contig Holes to request read/write lock access before
proceeding and to shut down and restart the contig selector window.

------------------------------------------------------------------------
r2738 | jkbonfield | 2011-09-30 11:08:42 +0100 (Fri, 30 Sep 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_iface_g.c

Removal of B+Tree debugging output.

------------------------------------------------------------------------
r2737 | jkbonfield | 2011-09-29 16:11:08 +0100 (Thu, 29 Sep 2011) | 12 lines
Changed paths:
   M /staden/trunk/src/gap5/b+tree2.c
   M /staden/trunk/src/gap5/b+tree2.h
   M /staden/trunk/src/gap5/consensus.c
   M /staden/trunk/src/gap5/dis_readings.c
   M /staden/trunk/src/gap5/g-alloc.c
   M /staden/trunk/src/gap5/tg_contig.c
   M /staden/trunk/src/gap5/tg_iface.h
   M /staden/trunk/src/gap5/tg_iface_g.c
   M /staden/trunk/src/gap5/tg_sequence.c

Fixed various disassembly issues.
- We now remove the correct reading name entry from the B+Tree when
  there are multiples with the same name. (We check name,rec pairing)

- Fixed an error in the b+tree code when completely removing nodes. It
  was causing errors when flushing later on.

- Better error handling for when faced with a record number that no
  longer exists (due to the bug above).

- Also tidied up some g-alloc debugging info with an extraneous "d".

------------------------------------------------------------------------
r2736 | jkbonfield | 2011-09-29 09:57:39 +0100 (Thu, 29 Sep 2011) | 11 lines
Changed paths:
   M /staden/trunk/src/gap5/shuffle_pads.c
   M /staden/trunk/src/gap5/tg_contig.c
   M /staden/trunk/src/gap5/tg_contig.h
   M /staden/trunk/src/gap5/tg_sequence.c

Fix to severe bug in shuffle pads.

In rare cases it could introduce a column of pads itself, and then
remove it again in the final step. If during this stage it didn't make
any other edits then it did not save the data and so the column being
removed was incorrect - effectively deleting a real column of bases.

This has now been fixed, but also added a contig_delete_pad function
which acts as contig_delete_base but with additional checks to ensure
it doesn't accidentally delete something else.

------------------------------------------------------------------------
r2735 | jkbonfield | 2011-09-28 12:45:12 +0100 (Wed, 28 Sep 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl

Bug fix to recent change for positioning the cursor at 1st used base.

This broke editing with #contig_num (but =contig_num was working).

------------------------------------------------------------------------
r2734 | jkbonfield | 2011-09-28 12:41:34 +0100 (Wed, 28 Sep 2011) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/check_database.tcl
   M /staden/trunk/src/gap5/tg_check.c
   M /staden/trunk/src/gap5/tg_check.h
   M /staden/trunk/src/gap5/tg_tcl.c

Check Database on a single contig now honours the "fix" option - it
was ignored before.

We now also report the number of errors we attempted to fix, given that we
don't yet attempt to fix everything.

------------------------------------------------------------------------
r2733 | jkbonfield | 2011-09-28 12:03:02 +0100 (Wed, 28 Sep 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl

When invoking the editor by a reading name instead of a contig name,
the cursor position is now set to be the first visible base rather
than the first possibly-clipped base.

------------------------------------------------------------------------
r2732 | jkbonfield | 2011-09-28 11:52:44 +0100 (Wed, 28 Sep 2011) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_selector.tcl
   M /staden/trunk/src/gap5/gap_utils.tcl

Fixed the start/end ranges for the Contig ID widget within dialogues.
This was already working when being updated by the contig selector or
contig list windows, but ContigParams called from (say) editing a
contig or the default initial values when opening a database
incorrectly set the range from 1 to $length instead of clipped_start
to clipped_end.

------------------------------------------------------------------------
r2731 | jkbonfield | 2011-09-28 11:51:00 +0100 (Wed, 28 Sep 2011) | 14 lines
Changed paths:
   M /staden/trunk/src/gap5/export_contigs.c
   M /staden/trunk/src/gap5/export_contigs.tcl
   M /staden/trunk/src/gap5/gap5rc
   M /staden/trunk/src/gap5/tg_contig.c
   M /staden/trunk/src/gap5/tg_contig.h

Improvements in Export Contigs:

- It now has entries in gap5rc for changing the default dialogue
  options.

- When outputting subsets of a contig in SAM, CAF or BAF, we now
  ensure we output tags that are outside the requested range but
  attached to readings that overlap the requested range. To implement
  this I added an iterator_expand_range() function.

- Fixed a bug introduced in the last update to this file for padded
  alignment output, involving pads next to soft-clips.


------------------------------------------------------------------------
r2730 | jkbonfield | 2011-09-28 11:46:46 +0100 (Wed, 28 Sep 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/newgap5_cmds.c

Fixed bug when outputting fasta or fastq sequences that are a multiple
of 60 bp. We no longer have an additional newline in the output.

------------------------------------------------------------------------
r2729 | jkbonfield | 2011-09-27 11:53:59 +0100 (Tue, 27 Sep 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/consensus.c

Fixed unpaddec consensus coords to always start from base-pair 1.

------------------------------------------------------------------------
r2728 | jkbonfield | 2011-09-26 11:37:30 +0100 (Mon, 26 Sep 2011) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/break_contig.c

Fixed a recent change to break_check_counts(). It now finds the
left-most read that starts >= cpos and not the right-most overlapping
it.

This bug was introduced in r2715.

------------------------------------------------------------------------
r2727 | jkbonfield | 2011-09-23 17:57:02 +0100 (Fri, 23 Sep 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/export_contigs.c
   M /staden/trunk/src/gap5/export_contigs.tcl
   M /staden/trunk/src/gap5/sam_index.c
   M /staden/trunk/src/gap5/sam_pileup.c
   M /staden/trunk/src/gap5/sam_pileup.h

Added an unpadded mode to the SAM output code.

------------------------------------------------------------------------
r2726 | jkbonfield | 2011-09-23 16:24:36 +0100 (Fri, 23 Sep 2011) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/tclIndex

Added export of CreateAllContigListNumbers
------------------------------------------------------------------------
r2725 | jkbonfield | 2011-09-21 17:34:43 +0100 (Wed, 21 Sep 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/consensus.c
   M /staden/trunk/src/gap5/consensus.h
   M /staden/trunk/src/gap5/gap5rc
   M /staden/trunk/src/gap5/gap5rc_menu_full
   M /staden/trunk/src/gap5/newgap5_cmds.c
   M /staden/trunk/src/gap5/shuffle_pads.c
   M /staden/trunk/src/gap5/shuffle_pads.h
   M /staden/trunk/src/gap5/shuffle_pads.tcl
   M /staden/trunk/src/gap5/tclIndex

Added a "Remove Pad Columns" function to gap5.

Also fixed a potential cache ref count bug in the consensus calculation.

------------------------------------------------------------------------
r2724 | jkbonfield | 2011-09-20 17:45:23 +0100 (Tue, 20 Sep 2011) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl

Fixed sizing of jog control in contig and join editor, to take into
account height of pos entry and pos_type buttons.

This was the cause of Alan's vanishing consensus, caused by the name
and sequence sheet widgets being slightly different sizes due to an
overlarge button and a too-small scalebar (jog).

------------------------------------------------------------------------
r2723 | jkbonfield | 2011-09-20 15:23:42 +0100 (Tue, 20 Sep 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_search.tcl

Added Page Up/Down bindings to the editor Search dialogue for next and
previous search.

------------------------------------------------------------------------
r2722 | jkbonfield | 2011-09-20 15:15:45 +0100 (Tue, 20 Sep 2011) | 11 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/editor_view.c
   M /staden/trunk/src/gap5/editor_view.h
   M /staden/trunk/src/gap5/tkEditor.c
   M /staden/trunk/src/gap5/tman_interface.c
   M /staden/trunk/src/gap5/trace_display.tcl

Fixed the trace display:

1) It now scrolls in the correct orientation when dragging a
   complemented trace.

2) It keeps in sync with edits & pads. It does a sequence alignment
   against the (cached) trace to work out this mapping, although the
   alignment itself isn't cached yet.

3) The Lock button no longer produces errors.

------------------------------------------------------------------------
r2721 | jkbonfield | 2011-09-20 11:58:12 +0100 (Tue, 20 Sep 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_register.c

Remove small memory leak from broadcast_event().

------------------------------------------------------------------------
r2720 | jkbonfield | 2011-09-16 17:35:48 +0100 (Fri, 16 Sep 2011) | 8 lines
Changed paths:
   M /staden/trunk/src/gap5/break_contig.c
   M /staden/trunk/src/gap5/editor_join.c
   M /staden/trunk/src/gap5/tg_anno.c
   M /staden/trunk/src/gap5/tg_cache.c
   M /staden/trunk/src/gap5/tg_contig.c

Added debugging code to tg_cache to blat any unreferenced cached
objects on each and every call to cache_search(). This is a brutal way
of finding places where we make assumptions rather than properly
calling cache_incr and cache_decr. This is enabled by adding
-DCACHE_REF_PURGE to your CFLAGS in the configured system.mk.

Also fixed a few issues discovered via this technique.

------------------------------------------------------------------------
r2719 | jkbonfield | 2011-09-16 17:33:13 +0100 (Fri, 16 Sep 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/gap_range.c

Fixed a bug in the template display where complemented contigs were
often shown as being inconsistent templates.

------------------------------------------------------------------------
r2718 | jkbonfield | 2011-09-16 17:32:38 +0100 (Fri, 16 Sep 2011) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/Makefile
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/gap5rc_menu_full
   A /staden/trunk/src/gap5/gap_canvas_box.c
   A /staden/trunk/src/gap5/gap_canvas_box.h
   M /staden/trunk/src/gap5/gap_canvas_box.tcl
   A /staden/trunk/src/gap5/gap_restriction_enzymes.tcl
   M /staden/trunk/src/gap5/newgap5_cmds.c
   M /staden/trunk/src/gap5/newgap_structs.h
   A /staden/trunk/src/gap5/restriction_enzymes.c
   A /staden/trunk/src/gap5/restriction_enzymes.h
   M /staden/trunk/src/gap5/tclIndex

Added the Gap4 restriction enzymes plot to Gap5. It's pretty warty and
confusing code and would be better off done these days using pure Tcl
for the window and just having a C function purely for finding
restriction enzymes on the consensus. However this was a couple hours
work to port so it'll do for now.

------------------------------------------------------------------------
r2717 | jkbonfield | 2011-09-16 14:16:20 +0100 (Fri, 16 Sep 2011) | 9 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_contig.c

Fudged the iterators to add slack either side of the contig. This
works around catch-22 problems with trying to use the iterators to
work out the next contig extents. We need to replace this hack with a
dedicated function for just this purpose though. (One that doesn't use
the iterators.)

Also fixed contig_insert_base2() to call contig_visible_start/end so
it can double check and correct the contig extents.

------------------------------------------------------------------------
r2716 | jkbonfield | 2011-09-16 11:13:23 +0100 (Fri, 16 Sep 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_bin.c
   M /staden/trunk/src/gap5/tg_bin.h
   M /staden/trunk/src/gap5/tg_check.c

Added a bin_remove_refpos() function. Also fixed Check Database when
facing REFPOS markers so stop producing false warnings.

------------------------------------------------------------------------
r2715 | jkbonfield | 2011-09-16 11:10:06 +0100 (Fri, 16 Sep 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/break_contig.c

Bug fix to contig_visible_start/contig_visible_end. These now also
trim REFPOS items.

------------------------------------------------------------------------
r2714 | jkbonfield | 2011-09-16 11:09:15 +0100 (Fri, 16 Sep 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_view.c

Added extra cache_incr/decr guards around tk_redisplaySeqSequences
code (due to sequence_get_template_info loading a lot of data).

------------------------------------------------------------------------
r2713 | jkbonfield | 2011-09-15 16:52:50 +0100 (Thu, 15 Sep 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/staden.profile

Replaced == with = in 'test' expression. This accidental ksh/bashism
breaks when using a real bourne shell.

------------------------------------------------------------------------
r2712 | jkbonfield | 2011-09-15 11:47:46 +0100 (Thu, 15 Sep 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_view.c
   M /staden/trunk/src/gap5/tg_sequence.c
   M /staden/trunk/src/gap5/tg_tcl.c

Improved robustness when a sequence points to a pair (via r->pair_rec)
which no longer exists. We just whinge instead of crashing now.

------------------------------------------------------------------------
r2711 | jkbonfield | 2011-09-14 17:16:41 +0100 (Wed, 14 Sep 2011) | 1 line
Changed paths:
   M /staden/trunk/src/NEWS


------------------------------------------------------------------------
r2710 | jkbonfield | 2011-09-14 16:53:57 +0100 (Wed, 14 Sep 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/gap5_thrash.tcl

Added support for testing disassemble readings.

------------------------------------------------------------------------
r2709 | jkbonfield | 2011-09-14 16:53:38 +0100 (Wed, 14 Sep 2011) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/dis_readings.c
   M /staden/trunk/src/gap5/tg_bin.c

Reverse previous fix as it broke Break Contig (it calls
bin_remove_item_from_bin during a phase where the data hasn't yet been
tidied up so it's incorrect to try and fix contig length then).

Instead added the consensus_unclipped_range code into disassemble
readings directly. Messy, but sufficient for now.

------------------------------------------------------------------------
r2708 | jkbonfield | 2011-09-14 16:18:52 +0100 (Wed, 14 Sep 2011) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_bin.c

Fixed error bin_remove_item_from_bin called from diasassemble
readings. It wasn't always recomputing the contig extents when it
should. For now I disabled some of the optimisations and recompute this
more often than is strictly necessary.

------------------------------------------------------------------------
r2707 | jkbonfield | 2011-09-14 09:58:15 +0100 (Wed, 14 Sep 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/dis_readings.c

Fixed bug in Disassemble Readings when the set of reads being removed
from a contig have the left-most unclipped read not being the
left-most clipped read.

------------------------------------------------------------------------
r2706 | jkbonfield | 2011-09-13 17:28:10 +0100 (Tue, 13 Sep 2011) | 12 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_search.c
   M /staden/trunk/src/gap5/editor_view.c
   M /staden/trunk/src/gap5/tg_sequence.c
   M /staden/trunk/src/gap5/tg_sequence.h

Improved sequence name searching as per RT#231099

When looking for a sequence name/number we now jump to the first
visible (unclipped) base of the sequence instead of the first clipped
base.  To implement this I've created a new
sequence_get_clipped_position function to replace the
sequence_get_position version.

I also changed the editor X position so that new searches that have to
reposition the scrollbar to make the match visible does so with the
match 10 bases in from the left edge instead of the right edge as before.

------------------------------------------------------------------------
r2705 | jkbonfield | 2011-09-13 15:24:49 +0100 (Tue, 13 Sep 2011) | 16 lines
Changed paths:
   M /staden/trunk/src/gap5/dis_readings.c
   M /staden/trunk/src/gap5/tg_contig.c

Fixed bug when deleting the last base of a sequence (so the sequence
is removed) which is the last base in the contig and there was a hole
between this sequence and the previous, meaning that the contig now
shrinks substantially more than just one base, *and* that we had
annotations between the old last sequence and the new last sequence.

Eg:

Cons: CG....Tag....Tag.....*
Seq1  CG
Seq2                       *


Also removed some debugging output from this code and disassemble
readings.

------------------------------------------------------------------------
r2704 | jkbonfield | 2011-09-13 15:05:48 +0100 (Tue, 13 Sep 2011) | 11 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_contig.c

Further fixes to contig_delete_base2().

1) We now correctly deal with annotations on a sequence that we've
entirely removed due to deleting the last base in it.

2) Fixed < vs <= conditions when deciding whether to move or shrink
tags.

3) Added code to entirely remove tags when the only base they cover is
deleted.

------------------------------------------------------------------------
r2703 | jkbonfield | 2011-09-13 15:03:54 +0100 (Tue, 13 Sep 2011) | 9 lines
Changed paths:
   M /staden/trunk/src/gap5/break_contig.c
   M /staden/trunk/src/gap5/break_contig.h
   M /staden/trunk/src/gap5/dis_readings.c

Fixed a couple more bugs in disassemble readings.

1) Moving a sequence that has been clipped to zero bases (clipped to 1
base, a pad, and then delete that column) no longer produces zero
length contigs and errors.

2) Fixed some more cases of failure to trim tags in consensus cutoff
regions after moving data at the end of contigs.

------------------------------------------------------------------------
r2702 | jkbonfield | 2011-09-13 10:00:10 +0100 (Tue, 13 Sep 2011) | 10 lines
Changed paths:
   M /staden/trunk/src/gap5/dis_readings.c

Further consensus tag handling bug fixes - we now track the clipped
seq coords when tracking which consensus tags to move/clip to.

Fixed an orientation bug when moving data from one contig to
another. Previously we could change the orientation of sequences
sometimes, meaning moving data from a previously joined contig (a
merge of complemented and uncomplemented contigs) could yield out of
alignment data in the newly created contig due to swapping the
sequence orientations back.

------------------------------------------------------------------------
r2701 | jkbonfield | 2011-09-13 09:57:43 +0100 (Tue, 13 Sep 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_check.c

Fixed a reference counting crash in grow_bin() caused when we're
attempting to grow the root bin of the contig.

------------------------------------------------------------------------
r2700 | jkbonfield | 2011-09-12 16:11:31 +0100 (Mon, 12 Sep 2011) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/dis_readings.c

Major overhaul of consensus annotation support in Disassemble
Readings. We now copy consensus tags to new contigs when the used
portion overlaps, and improved trimming of old tags at contig ends or
internal holes.

------------------------------------------------------------------------
r2699 | jkbonfield | 2011-09-12 16:10:29 +0100 (Mon, 12 Sep 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/break_contig.c

Fixed reference count corruption. We failed to cache_incr earlier
enough in contig_visible_start and contig_visible_end functions.

------------------------------------------------------------------------
r2698 | jkbonfield | 2011-09-09 15:25:50 +0100 (Fri, 09 Sep 2011) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/break_contig.c
   M /staden/trunk/src/gap5/tg_check.c
   M /staden/trunk/src/gap5/tg_check.h

Altered the consensus tag clipped code to clip/remove tags based on
the cutoff data. Ie consensus tags should only be kept when they're on
visible consensus sequence and not within clipped regions.

Also added checks in Check Database for this and the "tags in sequence
bins" change.

------------------------------------------------------------------------
r2697 | jkbonfield | 2011-09-09 15:24:13 +0100 (Fri, 09 Sep 2011) | 24 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_contig.c

Major rewrite of contig_insert_base and contig_delete_base.

These now take into account the sequence cutoff data and don't insert
or delete within those portions. The implementation is considerably
trickier to get right however. Eg on insertion:

1) It is no longer the case that all tags to the right get shifted to
the right. If they're right-hand cutoff data they will not.

2) It is no longer the case that all tags to the left will not get
shifted right. If they're in left-hand cutoff data and the read starts
to the right, then the read will be moved right causing the left tags
to move too.

3) Inserting a column of pads may not actually grow the contig
(likewise deleting may not shrink it). If the contig extents were
defined by cutoff data of a sequence and we're inserting a column that
doesn't insert into the sequence that is furhest right (so we're
inserting at a pos covering the right-hand cutoff data of it) then the
contig will not grow.

These and other problems lead to the requirement that tags should no
longer be created within the cutoff regions of the consensus.

------------------------------------------------------------------------
r2696 | jkbonfield | 2011-09-09 15:16:45 +0100 (Fri, 09 Sep 2011) | 23 lines
Changed paths:
   M /staden/trunk/src/gap5/ace.c
   M /staden/trunk/src/gap5/afg.c
   M /staden/trunk/src/gap5/baf.c
   M /staden/trunk/src/gap5/caf.c
   M /staden/trunk/src/gap5/dis_readings.c
   M /staden/trunk/src/gap5/export_contigs.c
   M /staden/trunk/src/gap5/fasta.c
   M /staden/trunk/src/gap5/import_gff.c
   M /staden/trunk/src/gap5/maq.c
   M /staden/trunk/src/gap5/sam_index.c
   M /staden/trunk/src/gap5/shuffle_pads.c
   M /staden/trunk/src/gap5/tg_anno.c
   M /staden/trunk/src/gap5/tg_bin.c
   M /staden/trunk/src/gap5/tg_bin.h
   M /staden/trunk/src/gap5/tg_index_common.c
   M /staden/trunk/src/gap5/tg_index_common.h
   M /staden/trunk/src/gap5/tg_sequence.c
   M /staden/trunk/src/gap5/tg_sequence.h
   M /staden/trunk/src/gap5/tg_tcl.c

Policy change - tags should belong in the same bin as the sequences
they are attached to (unless they're attached to the contig
consensus).  This greatly simplifies many algorithms (although by and
large they haven't been simplified yet) and also fixes some obscure
bugs. Specifically it makes inserting and deleting columns of pads
work easier.

This has been implemented by adding a bin_add_to_range() function
which adds a range to a specific bin rather than finding its own
appropriate bin. Reimplemented bin_add_range() as a special case
variant of the new bin_add_to_range() function.

Also fixed a bug in the tcl interface $contig add_sequence and $contig
move_sequence interfaces. They were incorrectly setting the
complemented status of a sequence when it gets moved from a bin of one
orientation into a bin of the opposite orientation, causing conflicts
between on disc and in memory representations.

Bug fix to bin_plus_children_empty(). It now considers bins that have
no sequence/tags beneath them but *do* contained cached consensus
sequences as empty still. This was preventing disassemble readings
from deleting contigs in some cases.

------------------------------------------------------------------------
r2695 | jkbonfield | 2011-09-09 10:11:54 +0100 (Fri, 09 Sep 2011) | 8 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_view.c

Protect against a crash while joining.

I'm not sure of the circumstances to trigger it, but while handling
the contig registration events for a join, the editor can sometimes
end up trying to run show_cursor on a position where no range data has
been returned. We now gloss over this and refuse to show the cursor
(as we're about to shut down anyway).

------------------------------------------------------------------------
r2694 | jkbonfield | 2011-09-07 10:16:30 +0100 (Wed, 07 Sep 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/gap5rc

Made the editor dimensions and the position of the names/seq pane
configurable in .gap5rc. These values are now also saved when using
Save Settings menu item.

------------------------------------------------------------------------
r2693 | jkbonfield | 2011-09-05 12:46:51 +0100 (Mon, 05 Sep 2011) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/break_contig.tcl

Catch errors in break_contig Tcl-interface and report
appropriately. This avoids leaving a SetBusy on the database, which
previously wasn't being cleared and so blocked out the GUI from the
error onwards.

------------------------------------------------------------------------
r2692 | jkbonfield | 2011-09-05 12:30:38 +0100 (Mon, 05 Sep 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/newgap5_cmds.c

Fixed the handling of the -index_names option of import_reads command.
It was negated in operation.

------------------------------------------------------------------------
r2691 | jkbonfield | 2011-08-18 17:41:06 +0100 (Thu, 18 Aug 2011) | 42 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_cache.c
   M /staden/trunk/src/gap5/tg_tcl.c

Fixed issues with reference counting and making records r/o again.

An earlier commit to fix the issues of contig editors operating on
live data after an initial cache_flush introduced a bug such that
objects shared by multiple editors would erroneously be set back to
read-only copies despite another editor still having a copy-on-write
portion of that data.

This sounds unlikely to happen, but occurs due to seq_blocks being
split between two contigs. The same seq_block can have reads in two
editors, both of which are being actively edited as they form the
halves of a join editor. When we made the join it flushed the changes
to the seq_block from the first editor, making it read-only, and then
died while flushing the changes to the seq_block from the second
editor.

We now keep better track of reference counting when dealing with
multiple child IOs and also changed the cache_rw code to call
cache_dup any time a cached_item is in a parent io rather than simply
relying on a check for ro/rw (which was the original bug I should have
fixed).

In tg_tcl there are also some reference count leaks still. I fixed the
main ones related to sequence editing though with this patch. Consider
the following scenario.

"set s [$io get_sequence 100]" where $io is a child io. This does a
cache_incr(child_io, seq).

"$s replace_base ..." on this object will then call cache_rw() and
replace_base(). The ts->seq pointer gets replaced with a new one as
cache_rw has done a copy-on-write from master to child-io. However the
initial cache_incr from [$io get_sequence] is no longer valid as it's
in another io entirely. I'm not sure what the best general purpose fix
is other than to track which ref count came from where
(messy). Instead I simply cache_decr / cache_rw / cache_incr to move
the $s ref count from master to child i/o.

This fix needs applying to anno and contig objects too, but it's not
so easy as it's unclear whether we'll accidentally lose an object in
the middle.

------------------------------------------------------------------------
r2690 | jkbonfield | 2011-08-18 17:29:09 +0100 (Thu, 18 Aug 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/hash_lib.c

Fixed memory overrun on small contigs.

------------------------------------------------------------------------
r2689 | jkbonfield | 2011-08-17 14:30:12 +0100 (Wed, 17 Aug 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/list_contigs.tcl

Fixed Complement Contig via the list contigs window.

------------------------------------------------------------------------
r2688 | jkbonfield | 2011-08-10 16:39:27 +0100 (Wed, 10 Aug 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_gio.c

Fixed the setting of io->name when opening via full pathname (eg using
the File->Open dialogue). This was also causing errors in Check Database.

------------------------------------------------------------------------
r2687 | jkbonfield | 2011-08-10 12:40:23 +0100 (Wed, 10 Aug 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_cache.c

Smaller cache size when compiled with WAS_CACHE_REF_DEBUG, to further
stress-test the reference counting.

------------------------------------------------------------------------
r2686 | jkbonfield | 2011-08-10 12:39:52 +0100 (Wed, 10 Aug 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/gap5.tcl

Minor version bump to 1.2.14 - long overdue!

------------------------------------------------------------------------
r2685 | jkbonfield | 2011-08-10 12:39:40 +0100 (Wed, 10 Aug 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/ace.c
   M /staden/trunk/src/gap5/baf.c
   M /staden/trunk/src/gap5/caf.c
   M /staden/trunk/src/gap5/export_contigs.c
   M /staden/trunk/src/gap5/newgap5_cmds.c
   M /staden/trunk/src/gap5/sam_index.c
   M /staden/trunk/src/gap5/tg_iface_g.c
   M /staden/trunk/src/gap5/tg_struct.h

Added proper template name support, albeit requiring it to be a prefix
of the read-name.  This then parses/generates the appropriate Template
fields in caf, baf, ace  and the FS aux tag in SAM.

------------------------------------------------------------------------
r2684 | jkbonfield | 2011-08-10 11:54:26 +0100 (Wed, 10 Aug 2011) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_view.c
   M /staden/trunk/src/gap5/tman_display.c

Fixed crash when failing to bring up 1000 traces at one point.

Also no longer attempt to bring up illumina or solid traces when
double clicking on the consensus. You can still bring up individual
ones by clicking on them though.

------------------------------------------------------------------------
r2683 | jkbonfield | 2011-08-08 12:15:23 +0100 (Mon, 08 Aug 2011) | 14 lines
Changed paths:
   M /staden/trunk/src/gap5/consensus.c

I now have a better undertstanding of the causes of bin consensus
sequences being invalid, so removed the warning.

The cached consensus will be correct, just not always spanninig the
entire bin. This can happen when bin_add_range adds the cached cons to
a larger bin than the one we were computing it for. We could of course
force it to only ever add to the bin we expected, and I tried this.
For some reason it caused yet more errors though, so for now I'm
glossing over this by simply gracefully handling the case.

It's not as fficient as it could be therefore as it sometimes has to
recompute the consensus again as the bin has grown, but it's
sufficient and I believe reliable.

------------------------------------------------------------------------
r2682 | jkbonfield | 2011-08-08 11:13:23 +0100 (Mon, 08 Aug 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_join.c
   M /staden/trunk/src/gap5/editor_view.c
   M /staden/trunk/src/gap5/tg_anno.c
   M /staden/trunk/src/gap5/tg_sequence.c

More checks for cached items being purged, primarily fixed by adding
cache_incr/decr calls.

------------------------------------------------------------------------
r2681 | jkbonfield | 2011-08-08 11:11:48 +0100 (Mon, 08 Aug 2011) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/consensus.c

Improved reference counting.

Fixed a bug where failure to call invalidate_consensus could yield a
crash in this code. We now still check whether the cached consequence
sequence spans the correct region when it claims to be up to date, and
recompute if not.

------------------------------------------------------------------------
r2680 | jkbonfield | 2011-08-05 12:12:23 +0100 (Fri, 05 Aug 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/consensus.c

Fixed a bug in caching consensus for read-only mode. It was sometimes
complementing the contig when it didn't need to.

------------------------------------------------------------------------
r2679 | jkbonfield | 2011-08-04 15:29:21 +0100 (Thu, 04 Aug 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/check_database.tcl

Added "$io flush" so changes are written immediately after fixing a database.

------------------------------------------------------------------------
r2678 | jkbonfield | 2011-08-02 17:10:37 +0100 (Tue, 02 Aug 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/find_oligo.c
   M /staden/trunk/src/gap5/list_proc.c
   M /staden/trunk/src/gap5/list_proc.h

Sequence Search now creates a list named "seq_hits" for each sequence
found by the sequence search. (Only when matching vs sequences.)

------------------------------------------------------------------------
r2677 | jkbonfield | 2011-08-02 16:29:34 +0100 (Tue, 02 Aug 2011) | 9 lines
Changed paths:
   M /staden/trunk/src/gap5/cs-object.h
   M /staden/trunk/src/gap5/editor_view.c
   M /staden/trunk/src/gap5/find_oligo.c

Fixed Sequence Search (main menu, not the method inside editor).

It was falsely reporting locatations when searching on complemented
reads instead of the usual mode of looking in consensus.

Also updated it to start the editor on the specific sequence we found
rather than the consensus, and fixed a bug in the edit_contig()
startup function in the process.

------------------------------------------------------------------------
r2676 | jkbonfield | 2011-08-01 17:11:18 +0100 (Mon, 01 Aug 2011) | 1 line
Changed paths:
   M /staden/trunk/src/NEWS


------------------------------------------------------------------------
r2675 | jkbonfield | 2011-08-01 17:08:44 +0100 (Mon, 01 Aug 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/break_contig.c

Fixed out by one error in code to determine whether to move data to
right or left contig.

------------------------------------------------------------------------
r2674 | jkbonfield | 2011-08-01 12:26:22 +0100 (Mon, 01 Aug 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/gap5_thrash.tcl

Added test to compute the consensus, testing cached consensus code.

------------------------------------------------------------------------
r2673 | jkbonfield | 2011-08-01 12:25:56 +0100 (Mon, 01 Aug 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_cache.c

Improved diagnostics in cache ref checking code. We no longer give
false errors in some cases.

------------------------------------------------------------------------
r2672 | jkbonfield | 2011-08-01 10:04:55 +0100 (Mon, 01 Aug 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/consensus.c

Fixed bug in complementing of existing cached consensus. We weren't
setting/clearing the SEQ_COMPLEMENTED flag correctly, meaning on-disk
and in-memory structs became out of sync.

------------------------------------------------------------------------
r2671 | jkbonfield | 2011-07-29 15:02:14 +0100 (Fri, 29 Jul 2011) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/gap5_thrash.tcl

Enabled debugging output.

Prevent clipping of data to 0 base visible sequences (as this is
disallowed in the editor too).

------------------------------------------------------------------------
r2670 | jkbonfield | 2011-07-29 15:00:14 +0100 (Fri, 29 Jul 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/break_contig.c
   M /staden/trunk/src/gap5/dis_readings.c

Protect against cycles in break_contig/remove_contig_holes. This can
happen when a contig starts with a zero length sequence, which is
interpreted as a hole if it doesn't overlap anything else.

------------------------------------------------------------------------
r2669 | jkbonfield | 2011-07-29 12:18:29 +0100 (Fri, 29 Jul 2011) | 19 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_cache.c

Fixed an error caused in the contig editor whereby edits to data
previously edited and then saved could either not be saved correctly
or instead accidentally saved when you exit without saving.

More specifically, when using a child I/O editing uses copy-on-write
to take a local writable version of the master I/O record. Saving
flushed this data out and pushed the child I/O record back to the
master I/O, but it didn't reset the lock from r/w to read-only.
Consequentially the next edit to that record did not perform a
copy-on-write again as the child I/O believed it had a writeable
version already.

Corrected this by adding a cache_upgrade(io, ci, G_LOCK_RO) call.
There still a (new?) bug in that the data is not correctly referenced
counted and so edited data wastes cache, however this is simply a
small memory leak rather than a substantial problem with the
possibility to break data.  I'll submit a new patch with corrected
reference counting when I figure out where that problem comes from.

------------------------------------------------------------------------
r2668 | jkbonfield | 2011-07-29 11:18:04 +0100 (Fri, 29 Jul 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/break_contig.c

Moved the cache_decr lines later down, to after running
remove_contig_holes.  This was occasionally causing crashes.

------------------------------------------------------------------------
r2667 | jkbonfield | 2011-07-29 09:50:10 +0100 (Fri, 29 Jul 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_iface_g.c

Moved free(io) in io_database_disconnect. Likely a harmless change (on
our systems at least), but safer and preventing a valgrind error.

------------------------------------------------------------------------
r2666 | jkbonfield | 2011-07-28 17:28:05 +0100 (Thu, 28 Jul 2011) | 6 lines
Changed paths:
   M /staden/trunk/src/NEWS
   M /staden/trunk/src/gap5/break_contig.c
   M /staden/trunk/src/gap5/consensus.c
   M /staden/trunk/src/gap5/contig_selector.c
   M /staden/trunk/src/gap5/depad_seq_tree.c
   M /staden/trunk/src/gap5/dis_readings.c
   M /staden/trunk/src/gap5/editor_join.c
   M /staden/trunk/src/gap5/g-struct.c
   M /staden/trunk/src/gap5/gap5.tcl
   M /staden/trunk/src/gap5/gap_hash.c
   M /staden/trunk/src/gap5/gap_range.c
   M /staden/trunk/src/gap5/hash_lib.c
   M /staden/trunk/src/gap5/import_gff.c
   M /staden/trunk/src/gap5/newgap5_cmds.c
   M /staden/trunk/src/gap5/ng_fb_cmds.tcl
   M /staden/trunk/src/gap5/template_display.c
   M /staden/trunk/src/gap5/tg_cache.c
   M /staden/trunk/src/gap5/tg_gio.c
   M /staden/trunk/src/gap5/tg_gio.h
   M /staden/trunk/src/gap5/tg_iface.h
   M /staden/trunk/src/gap5/tg_iface_g.c
   M /staden/trunk/src/gap5/tg_register.c
   M /staden/trunk/src/gap5/tg_tcl.c
   M /staden/trunk/src/gap5/tg_view.c

Moved a lot of debugging output to only appear when running
"gap5 -debug 1". This uses a new gio_debug() function to print up the
messages instead of printf, which checks the debug level before
printing. Call gio_debug_level() to set it or "$io debug_level N" in
Tcl.

------------------------------------------------------------------------
r2665 | jkbonfield | 2011-07-28 17:26:36 +0100 (Thu, 28 Jul 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/gap5_thrash.tcl

Added sequence clipping tests too.

------------------------------------------------------------------------
r2664 | jkbonfield | 2011-07-28 15:26:32 +0100 (Thu, 28 Jul 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_cache.c
   M /staden/trunk/src/gap5/tg_gio.h

Fixed false errors from the reference count debugging mode. These
occurred when we ran cache_item_resize() and changed an item pointer,
breaking the hache entry.

------------------------------------------------------------------------
r2663 | jkbonfield | 2011-07-28 12:27:54 +0100 (Thu, 28 Jul 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/gap5_thrash.tcl
   M /staden/trunk/src/gap5/tg_tcl.c

Fixed bug in removing tags via the tcl interface. It wasn't removing
the item from the bin.

------------------------------------------------------------------------
r2662 | jkbonfield | 2011-07-28 12:02:57 +0100 (Thu, 28 Jul 2011) | 9 lines
Changed paths:
   M /staden/trunk/src/gap5/break_contig.c
   M /staden/trunk/src/gap5/dis_readings.c
   M /staden/trunk/src/gap5/tg_anno.c
   M /staden/trunk/src/gap5/tg_bin.c
   M /staden/trunk/src/gap5/tg_bin.h
   M /staden/trunk/src/gap5/tg_check.c
   M /staden/trunk/src/gap5/tg_contig.c

Revamped how I detect for empty bins in various pieces of code. Added
a bin_empty() function to do this now so it's consistent in all
locations.

This cures a bug in bin_add_range fails to set bin->start_used
correctly. This happens when adding data to a bin containing a
bin->rng array with bin->rng->max != 0, but containing only ranges
flagged as UNUSED.

------------------------------------------------------------------------
r2661 | jkbonfield | 2011-07-28 12:00:12 +0100 (Thu, 28 Jul 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/consensus.c

Added protection against contig_iter_new returning NULL. This caused
crashes when trying to open the contig editor on a contig containing
no data. (An error in itself, but it shouldn't crash.)

------------------------------------------------------------------------
r2660 | jkbonfield | 2011-07-28 11:59:26 +0100 (Thu, 28 Jul 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/fasta.c
   M /staden/trunk/src/gap5/newgap5_cmds.c

Fixed crashes when importing malformed fasta files. Also added a
missing cache_flush() call.

------------------------------------------------------------------------
r2659 | jkbonfield | 2011-07-28 09:56:00 +0100 (Thu, 28 Jul 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_cache.c

Made the chksum code optional via an #ifdef. Yet to decide if it's
robust enough to leave in place for all situations.

------------------------------------------------------------------------
r2658 | jkbonfield | 2011-07-28 09:54:00 +0100 (Thu, 28 Jul 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_contig.c

Similar checks to bin->rng being set but empty. I don't believe these
caused bugs, but being extra safe and checking "bin->rng &&
ArrayMax(bin->rng)" now.

------------------------------------------------------------------------
r2657 | jkbonfield | 2011-07-28 09:49:31 +0100 (Thu, 28 Jul 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_bin.c

Fixed a bug in bin_add_range when updating bin start/end used on a bin
with an existing bin->rng array containing zero items (ie it used to
have data).

------------------------------------------------------------------------
r2656 | jkbonfield | 2011-07-27 17:42:33 +0100 (Wed, 27 Jul 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_iface_g.c

Initialise seq_t->sam_aux to NULL when not filled out. Technically
it's not an issue as aux_len is zero in such cases, but it feels tidier.

------------------------------------------------------------------------
r2655 | jkbonfield | 2011-07-27 17:13:42 +0100 (Wed, 27 Jul 2011) | 8 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_check.c

Added code to check that the in-memory cached structures match those
on disk. We do this check by reopening the database and comparing
against it, which may not work if we changed directory. However it's
sufficient for current evaluation purposes.

Unfortunately this also causes a lot of spam to stderr at the moment
too due to close_db, but we should resolve that elsewhere.

------------------------------------------------------------------------
r2654 | jkbonfield | 2011-07-27 17:12:12 +0100 (Wed, 27 Jul 2011) | 11 lines
Changed paths:
   M /staden/trunk/src/gap5/break_contig.c
   M /staden/trunk/src/gap5/dis_readings.c
   M /staden/trunk/src/gap5/shuffle_pads.c
   M /staden/trunk/src/gap5/tg_bin.c
   M /staden/trunk/src/gap5/tg_sequence.c

Fixed wide spread false meme about anno_ele_t struct. The idx field is
an index into the anno_ele_block array, but in many places it was used
in a manner as if it was the bin_index (ie like seq_t->bin_index vs
seq_t->idx).

There is no bin_index in the anno_ele_t struct, rightly or wrongly.
Rather than simply remove the code I changed it to access a->bin_idx
(which doesn't exist yet) and commented it out so I can add the code
back to update this if and when I extend the structure to contain the
bin index.

------------------------------------------------------------------------
r2653 | jkbonfield | 2011-07-27 17:09:23 +0100 (Wed, 27 Jul 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_cache.c

Added check sum code for bin->rng too.

------------------------------------------------------------------------
r2652 | jkbonfield | 2011-07-27 11:25:57 +0100 (Wed, 27 Jul 2011) | 8 lines
Changed paths:
   M /staden/trunk/src/gap5/break_contig.c

Fixed an issue with computing the overlapping extents during break
contig. We now have pos2 and pos3 both and compute these upfront
before breaking. These are the overlap extents for the rightmost edge
of the left contig and the leftmost edge of the right contig
respectively. The latter wasn't being computed before, but is
necessary when determining whether the a bin can be moved left or
whether it needs splitting incase it contains a tag.

------------------------------------------------------------------------
r2651 | jkbonfield | 2011-07-26 16:46:44 +0100 (Tue, 26 Jul 2011) | 7 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_check.c

Added code that's currently #ifdefed out.

When ANNO_LOWER_CHECK is defined we check for tags being in the same
bin or a child bin of the object they are tagging. This turns out to
be an invalid assertion currently unless we fix join contigs to refuse
to create overlapping bins.

------------------------------------------------------------------------
r2650 | jkbonfield | 2011-07-26 16:45:26 +0100 (Tue, 26 Jul 2011) | 8 lines
Changed paths:
   M /staden/trunk/src/gap5/break_contig.c

Added code to cope with overlapping bins. This causes our assumption
that tags will only occur in the same bin or a child bin that contains
sequences to be false. After joining we have overlapping bins, and new
tags added could take a different branch down that tree.

Similarly the incremental setting of pos2 is invalid too for the same
reason, so we compute it upfront.

------------------------------------------------------------------------
r2649 | jkbonfield | 2011-07-26 11:52:35 +0100 (Tue, 26 Jul 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/break_contig.c

Fixed a bug with tags when breaking a contig containing holes and tags
within those holes. They were previously ended up off the ends of
contigs, but now we remove them completely.

------------------------------------------------------------------------
r2648 | jkbonfield | 2011-07-26 10:18:37 +0100 (Tue, 26 Jul 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/gap5_thrash.tcl
   M /staden/trunk/src/gap5/newgap5_cmds.c

Added -break_holes option to the break_contig function. Use this in
the thrash test code.

------------------------------------------------------------------------
r2647 | jkbonfield | 2011-07-26 09:41:45 +0100 (Tue, 26 Jul 2011) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/dis_readings.c

Sorry last version didn't compile! Adding contig_start/end declarations
------------------------------------------------------------------------
r2646 | jkbonfield | 2011-07-26 08:34:35 +0100 (Tue, 26 Jul 2011) | 10 lines
Changed paths:
   M /staden/trunk/src/gap5/break_contig.c
   M /staden/trunk/src/gap5/break_contig.h
   M /staden/trunk/src/gap5/break_contig.tcl
   M /staden/trunk/src/gap5/dis_readings.c
   M /staden/trunk/src/gap5/dis_readings.h
   M /staden/trunk/src/gap5/dis_readings.tcl
   M /staden/trunk/src/gap5/gap5rc
   M /staden/trunk/src/gap5/gap5rc_menu_full
   M /staden/trunk/src/gap5/tclIndex
   M /staden/trunk/src/gap5/tg_contig.c
   M /staden/trunk/src/gap5/tg_contig.h

Fixed the hole detection code in Disassemble Readings to check clipped
visible-only portion of reads rather than the entire thing. This
involved adding new sort modes to the contig iterators.

Added an option to Break Contig to break the right hand contig up
further if holes were introduced.

Also fixed a bug in the Break Contig code that checks whether one of
the contig-portions would contain zero sequences.

------------------------------------------------------------------------
r2645 | jkbonfield | 2011-07-25 14:36:04 +0100 (Mon, 25 Jul 2011) | 12 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_check.c
   M /staden/trunk/src/gap5/tg_iface.h
   M /staden/trunk/src/gap5/tg_iface_g.c

Improvements to the database checking/fixing.

- The database is automatically updated to v2 format if it's v1. This
  is simply a matter of filling out the nanno and nrefpos fields in
  bins.

- Check for and correct various bin boundary issues. It's complex to
  fix, but when a bin extends beyond the parent we adjust the parent
  pos/size and bubble up to the root.

- Also check that bin parent_type/rec are valid.

------------------------------------------------------------------------
r2644 | jkbonfield | 2011-07-25 14:33:29 +0100 (Mon, 25 Jul 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_view.c

Protect against crashes when faced with negative reference
coordinates. (I'm not sure how this happens, but it's more robust now.)

------------------------------------------------------------------------
r2643 | jkbonfield | 2011-07-22 10:21:58 +0100 (Fri, 22 Jul 2011) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_check.c

Improved checking of bins with two new checks:
- That start_used/end_used fits within the bin extents.
- That bin pos/pos+size-1 fits entirely within the parent bin.

As yet no auto-fixes have been implemented though.

------------------------------------------------------------------------
r2642 | awhitwham | 2011-07-21 17:07:50 +0100 (Thu, 21 Jul 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/caf.c

Fixed parsing error where a space at the begining of the line within a qualities block was being interpreted as the end of the qualities.

------------------------------------------------------------------------
r2641 | jkbonfield | 2011-07-21 16:49:20 +0100 (Thu, 21 Jul 2011) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_iface_g.c

Changed some asserts (more to do still) in the low level I/O code to
be g_assert instead. This new macro outputs an error and then returns
an appropriate error code to the calling function, enabling us to
catch low level errors more gracefully than calling abort().

------------------------------------------------------------------------
r2640 | jkbonfield | 2011-07-21 16:48:15 +0100 (Thu, 21 Jul 2011) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/tclIndex


------------------------------------------------------------------------
r2639 | jkbonfield | 2011-07-21 16:37:32 +0100 (Thu, 21 Jul 2011) | 8 lines
Changed paths:
   M /staden/trunk/src/gap4/find_oligo.tcl
   M /staden/trunk/src/gap4/ng_fb_cmds.tcl
   M /staden/trunk/src/gap4/select_contig.tcl
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/gap5/find_oligo.tcl
   M /staden/trunk/src/gap5/gap5.tcl
   M /staden/trunk/src/gap5/list_proc.tcl
   M /staden/trunk/src/gap5/ng_fb_cmds.tcl
   M /staden/trunk/src/gap5/select_contig.tcl
   M /staden/trunk/src/tk_utils/entrybox.tcl
   M /staden/trunk/src/tk_utils/filebrowser.tcl
   M /staden/trunk/src/tk_utils/xentry.tcl
   M /staden/trunk/src/tk_utils/xfilebrowser.tcl

Various tk raise window changes to compensate for issues with Gnome's
metacity window manager woes.

We now try harder to ensure any tk_messageBox dialogues are childs of
the appropriate window. We also make sure the contig editor is raised
when receiving a CURSOR_NOTIFY event from another window, eg the
template display.

------------------------------------------------------------------------
r2638 | jkbonfield | 2011-07-21 10:00:22 +0100 (Thu, 21 Jul 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/Makefile

Added LZMA_LIB to tg_index library list. It's no longer automatically
brought in via libtgap dependencies on MacOS X.

------------------------------------------------------------------------
r2637 | jkbonfield | 2011-07-20 12:29:00 +0100 (Wed, 20 Jul 2011) | 1 line
Changed paths:
   M /staden/trunk/src/NEWS


------------------------------------------------------------------------
r2636 | jkbonfield | 2011-07-20 12:15:27 +0100 (Wed, 20 Jul 2011) | 6 lines
Changed paths:
   A /staden/trunk/src/gap5/gap5_thrash.tcl

Debugging program - thrashes a database with random edits to random
contigs and continuously runs Check Database to ensure we haven't
corrupted things.

A very handy way of spotting errors.

------------------------------------------------------------------------
r2635 | jkbonfield | 2011-07-20 12:10:33 +0100 (Wed, 20 Jul 2011) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/gap5_check

Added execute permission
------------------------------------------------------------------------
r2634 | jkbonfield | 2011-07-20 12:03:30 +0100 (Wed, 20 Jul 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/Makefile
   A /staden/trunk/src/gap5/gap5_check
   M /staden/trunk/src/gap5/gap5_check.tcl

Add gap5_check as a callable program and updated the tcl code to use
the same argument parsing as gap5_consensus / gap5_export.

------------------------------------------------------------------------
r2633 | jkbonfield | 2011-07-20 11:42:46 +0100 (Wed, 20 Jul 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_cache.c

More chksum fixes for libraries - this time when CACHE_REF_DEBUG
debugging mode is enabled.

------------------------------------------------------------------------
r2632 | jkbonfield | 2011-07-20 11:39:40 +0100 (Wed, 20 Jul 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/tg_cache.c

Disable cache checksum for library objects as we tend to update the
insert size and standard deviation figures on-the-fly, even in
read-only mode. So it's expected the struct may differ.

------------------------------------------------------------------------
r2631 | jkbonfield | 2011-07-20 10:38:39 +0100 (Wed, 20 Jul 2011) | 1 line
Changed paths:
   M /staden/trunk/src/staden_config.h.in


------------------------------------------------------------------------
r2630 | jkbonfield | 2011-07-20 10:38:28 +0100 (Wed, 20 Jul 2011) | 8 lines
Changed paths:
   M /staden/trunk/src/gap5/consen.tcl
   M /staden/trunk/src/gap5/contig_id.tcl
   M /staden/trunk/src/gap5/tg_tcl.c

Added get_visible_{start,end,length} methods to the contig
object. They're analogous to the existing start/end/length ones but
return the clipped/visible region of a cotnig.

The contig_id selector now uses these visible versions when setting
the scalebars and the defaults when output contig consensus via the
command-line tool also default to these values too.

------------------------------------------------------------------------
r2629 | jkbonfield | 2011-07-20 09:59:32 +0100 (Wed, 20 Jul 2011) | 8 lines
Changed paths:
   M /staden/trunk/src/ac_stubs/tcl.m4
   M /staden/trunk/src/gap5/gap_range.h
   M /staden/trunk/src/primer3/src/Makefile

Fixed a linking issue on MacOS X due to use of common symbols:
range_option declared in gap_range.h has now been listed as external.

Furthermore adjusted the linker arguments when building under
linux/gcc to use --warn-common. This directs the linux linker to warn
about issues which may cause link errors on other platforms, so
hopefully we'll spot these earlier on.

------------------------------------------------------------------------
r2628 | jkbonfield | 2011-07-20 09:55:15 +0100 (Wed, 20 Jul 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/actf.c
   M /staden/trunk/src/gap5/g-struct.c
   M /staden/trunk/src/gap5/tg_cache.c
   M /staden/trunk/src/gap5/tg_iface_g.c
   M /staden/trunk/src/gap5/tg_view.c

Made the debugging outputs when opening and closing database appear to
stderr instead of stdout. This helps scripts that may want to extract
data and print to stdout.

------------------------------------------------------------------------
r2627 | jkbonfield | 2011-07-18 16:33:00 +0100 (Mon, 18 Jul 2011) | 6 lines
Changed paths:
   A /staden/trunk/src/gap5/gap5_command.tcl

Combined multiple gap5_* commands into a single tool:

gap5_command <sub_cmd> [options ...]

This provides consensus, export and check methods so far.

------------------------------------------------------------------------
r2626 | jkbonfield | 2011-07-18 12:22:07 +0100 (Mon, 18 Jul 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/gap5/init.c

Fixed initialisation of old tgap library.

------------------------------------------------------------------------
r2625 | jkbonfield | 2011-07-18 11:51:34 +0100 (Mon, 18 Jul 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/Makefile.in
   M /staden/trunk/src/Misc/Makefile
   M /staden/trunk/src/NEWS
   M /staden/trunk/src/gap4/Makefile
   M /staden/trunk/src/gap5/Makefile
   A /staden/trunk/src/gap5/ace_reorder.pl (from /staden/trunk/src/tgap/ace_reorder.pl:2608)
   A /staden/trunk/src/gap5/actf.c (from /staden/trunk/src/tgap/actf.c:2608)
   A /staden/trunk/src/gap5/actf.h (from /staden/trunk/src/tgap/actf.h:2608)
   A /staden/trunk/src/gap5/b+tree2.c (from /staden/trunk/src/tgap/b+tree2.c:2608)
   A /staden/trunk/src/gap5/b+tree2.h (from /staden/trunk/src/tgap/b+tree2.h:2608)
   A /staden/trunk/src/gap5/caf2baf.pl (from /staden/trunk/src/tgap/caf2baf.pl:2608)
   M /staden/trunk/src/gap5/depth.tcl
   A /staden/trunk/src/gap5/docs/BAF (from /staden/trunk/src/tgap/BAF:2608)
   A /staden/trunk/src/gap5/g-alloc.c (from /staden/trunk/src/tgap/g-alloc.c:2608)
   A /staden/trunk/src/gap5/g-alloc.h (from /staden/trunk/src/tgap/g-alloc.h:2608)
   A /staden/trunk/src/gap5/g-connect.c (from /staden/trunk/src/tgap/g-connect.c:2608)
   A /staden/trunk/src/gap5/g-connect.h (from /staden/trunk/src/tgap/g-connect.h:2608)
   A /staden/trunk/src/gap5/g-db.c (from /staden/trunk/src/tgap/g-db.c:2608)
   A /staden/trunk/src/gap5/g-db.h (from /staden/trunk/src/tgap/g-db.h:2608)
   A /staden/trunk/src/gap5/g-defs.h (from /staden/trunk/src/tgap/g-defs.h:2608)
   A /staden/trunk/src/gap5/g-error.c (from /staden/trunk/src/tgap/g-error.c:2608)
   A /staden/trunk/src/gap5/g-error.h (from /staden/trunk/src/tgap/g-error.h:2608)
   A /staden/trunk/src/gap5/g-filedefs.h (from /staden/trunk/src/tgap/g-filedefs.h:2608)
   A /staden/trunk/src/gap5/g-files.c (from /staden/trunk/src/tgap/g-files.c:2608)
   A /staden/trunk/src/gap5/g-files.h (from /staden/trunk/src/tgap/g-files.h:2608)
   A /staden/trunk/src/gap5/g-io.c (from /staden/trunk/src/tgap/g-io.c:2608)
   A /staden/trunk/src/gap5/g-io.h (from /staden/trunk/src/tgap/g-io.h:2608)
   A /staden/trunk/src/gap5/g-misc.h (from /staden/trunk/src/tgap/g-misc.h:2608)
   A /staden/trunk/src/gap5/g-os.h (from /staden/trunk/src/tgap/g-os.h:2608)
   A /staden/trunk/src/gap5/g-request.c (from /staden/trunk/src/tgap/g-request.c:2608)
   A /staden/trunk/src/gap5/g-request.h (from /staden/trunk/src/tgap/g-request.h:2608)
   A /staden/trunk/src/gap5/g-struct.c (from /staden/trunk/src/tgap/g-struct.c:2608)
   A /staden/trunk/src/gap5/g-struct.h (from /staden/trunk/src/tgap/g-struct.h:2608)
   A /staden/trunk/src/gap5/g.h (from /staden/trunk/src/tgap/g.h:2608)
   M /staden/trunk/src/gap5/gap5.tcl
   M /staden/trunk/src/gap5/gap5_check.tcl
   M /staden/trunk/src/gap5/gap5_consensus.tcl
   M /staden/trunk/src/gap5/gap5_export.tcl
   A /staden/trunk/src/gap5/gap_cli_arg.c (from /staden/trunk/src/tgap/gap_cli_arg.c:2608)
   A /staden/trunk/src/gap5/gap_cli_arg.h (from /staden/trunk/src/tgap/gap_cli_arg.h:2608)
   A /staden/trunk/src/gap5/hache_table.c (from /staden/trunk/src/tgap/hache_table.c:2608)
   A /staden/trunk/src/gap5/hache_table.h (from /staden/trunk/src/tgap/hache_table.h:2608)
   A /staden/trunk/src/gap5/mkdefs.c (from /staden/trunk/src/tgap/mkdefs.c:2608)
   A /staden/trunk/src/gap5/sam2fai.pl (from /staden/trunk/src/tgap/sam2fai.pl:2608)
   A /staden/trunk/src/gap5/tg_anno.c (from /staden/trunk/src/tgap/tg_anno.c:2608)
   A /staden/trunk/src/gap5/tg_anno.h (from /staden/trunk/src/tgap/tg_anno.h:2608)
   A /staden/trunk/src/gap5/tg_bin.c (from /staden/trunk/src/tgap/tg_bin.c:2620)
   A /staden/trunk/src/gap5/tg_bin.h (from /staden/trunk/src/tgap/tg_bin.h:2608)
   A /staden/trunk/src/gap5/tg_cache.c (from /staden/trunk/src/tgap/tg_cache.c:2616)
   A /staden/trunk/src/gap5/tg_cache_item.h (from /staden/trunk/src/tgap/tg_cache_item.h:2616)
   A /staden/trunk/src/gap5/tg_check.c (from /staden/trunk/src/tgap/tg_check.c:2623)
   A /staden/trunk/src/gap5/tg_check.h (from /staden/trunk/src/tgap/tg_check.h:2608)
   A /staden/trunk/src/gap5/tg_contig.c (from /staden/trunk/src/tgap/tg_contig.c:2621)
   A /staden/trunk/src/gap5/tg_contig.h (from /staden/trunk/src/tgap/tg_contig.h:2608)
   A /staden/trunk/src/gap5/tg_gio.c (from /staden/trunk/src/tgap/tg_gio.c:2608)
   A /staden/trunk/src/gap5/tg_gio.h (from /staden/trunk/src/tgap/tg_gio.h:2611)
   A /staden/trunk/src/gap5/tg_iface.h (from /staden/trunk/src/tgap/tg_iface.h:2608)
   A /staden/trunk/src/gap5/tg_iface_g.c (from /staden/trunk/src/tgap/tg_iface_g.c:2622)
   A /staden/trunk/src/gap5/tg_iface_g.h (from /staden/trunk/src/tgap/tg_iface_g.h:2608)
   A /staden/trunk/src/gap5/tg_library.c (from /staden/trunk/src/tgap/tg_library.c:2608)
   A /staden/trunk/src/gap5/tg_library.h (from /staden/trunk/src/tgap/tg_library.h:2608)
   A /staden/trunk/src/gap5/tg_register.c (from /staden/trunk/src/tgap/tg_register.c:2608)
   A /staden/trunk/src/gap5/tg_register.h (from /staden/trunk/src/tgap/tg_register.h:2608)
   A /staden/trunk/src/gap5/tg_sequence.c (from /staden/trunk/src/tgap/tg_sequence.c:2608)
   A /staden/trunk/src/gap5/tg_sequence.h (from /staden/trunk/src/tgap/tg_sequence.h:2608)
   A /staden/trunk/src/gap5/tg_struct.h (from /staden/trunk/src/tgap/tg_struct.h:2608)
   A /staden/trunk/src/gap5/tg_tcl.c (from /staden/trunk/src/tgap/tg_tcl.c:2608)
   A /staden/trunk/src/gap5/tg_tcl.h (from /staden/trunk/src/tgap/tg_tcl.h:2608)
   A /staden/trunk/src/gap5/tg_track.c (from /staden/trunk/src/tgap/tg_track.c:2608)
   A /staden/trunk/src/gap5/tg_track.h (from /staden/trunk/src/tgap/tg_track.h:2608)
   A /staden/trunk/src/gap5/tg_tracks.c (from /staden/trunk/src/tgap/tg_tracks.c:2608)
   A /staden/trunk/src/gap5/tg_tracks.h (from /staden/trunk/src/tgap/tg_tracks.h:2608)
   A /staden/trunk/src/gap5/tg_utils.c (from /staden/trunk/src/tgap/tg_utils.c:2608)
   A /staden/trunk/src/gap5/tg_utils.h (from /staden/trunk/src/tgap/tg_utils.h:2608)
   A /staden/trunk/src/gap5/xalloc.h (from /staden/trunk/src/tgap/xalloc.h:2608)
   A /staden/trunk/src/gap5/zfio.c (from /staden/trunk/src/tgap/zfio.c:2608)
   A /staden/trunk/src/gap5/zfio.h (from /staden/trunk/src/tgap/zfio.h:2608)
   D /staden/trunk/src/tgap
   M /staden/trunk/src/tk_utils/Makefile

Merged tgap directory into gap5.

------------------------------------------------------------------------
r2624 | jkbonfield | 2011-07-18 10:12:54 +0100 (Mon, 18 Jul 2011) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/newgap5_cmds.c

Allow calc_consensus and calc_quality to request regions outside of
the contig visible extents. This fixes an error in the contig editor
that allows us to remove bases at the extreme left or right of the
contig if the first or last visible consensus base is *.

------------------------------------------------------------------------
r2623 | jkbonfield | 2011-07-18 10:11:59 +0100 (Mon, 18 Jul 2011) | 5 lines
Changed paths:
   M /staden/trunk/src/tgap/tg_check.c

Fixed check for seq left<right. I'm not sure how to handle the case of
removing the last visible base in a sequence, but it causes no
inherent problems in gap5 so for now accept this. Perhaps in future we
should distinguish between warnings vs errors.

------------------------------------------------------------------------
r2622 | jkbonfield | 2011-07-16 14:51:42 +0100 (Sat, 16 Jul 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/tgap/tg_iface_g.c

Reverted to the older group-reorder code when reading and writing seq
blocks. It's slower, but the new code has subtle bugs. I will fix
these later, but for now the SVN trunk needs to be working.

------------------------------------------------------------------------
r2621 | jkbonfield | 2011-07-15 18:11:43 +0100 (Fri, 15 Jul 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/break_contig.c
   M /staden/trunk/src/tgap/tg_contig.c

Removed over-zealous checks of bin->nseqs==0 when setting a bin
start_used/end_used to zero. Empty bins may have children with data,
so the recent assertion is infact sometimes false.

------------------------------------------------------------------------
r2620 | jkbonfield | 2011-07-15 17:21:29 +0100 (Fri, 15 Jul 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/tgap/tg_bin.c

Rewrite of how bin_remove_item_from_bin handles bin start/end used parameters.

------------------------------------------------------------------------
r2619 | jkbonfield | 2011-07-15 16:36:28 +0100 (Fri, 15 Jul 2011) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/break_contig.c

Fixed an issue where cached consensus sequences were sometimes counted
as seqs for the bin->nseq value.

Removed some debugging left in during last commit.

------------------------------------------------------------------------
r2618 | jkbonfield | 2011-07-15 15:22:35 +0100 (Fri, 15 Jul 2011) | 10 lines
Changed paths:
   M /staden/trunk/src/gap5/break_contig.c

Yet more break contig fixes.

1) More issues with single bp tags being the only thing in a contig:
   another < vs <= bug.

2) Fixed an issue where tags were not copied to the right copy. This
   happens when tags start to the left of the break point that are on
   a sequence with visible start to the right of the break point.
   Rechecked all the combinations of this.

------------------------------------------------------------------------
r2617 | jkbonfield | 2011-07-15 15:20:49 +0100 (Fri, 15 Jul 2011) | 7 lines
Changed paths:
   M /staden/trunk/src/tgap/tg_contig.c

Bug fix to contig_insert_bases2(). If we insert in a region containing
no sequences, but still adjust the bin size, then we weren't returning
a status to indicate an insert took place and so didn't update the
contig dimensions.

Now we ensure any time bin->size is increased we will update contig size.

------------------------------------------------------------------------
r2616 | jkbonfield | 2011-07-15 15:19:30 +0100 (Fri, 15 Jul 2011) | 6 lines
Changed paths:
   M /staden/trunk/src/tgap/tg_cache.c
   M /staden/trunk/src/tgap/tg_cache_item.h

Added a checksum to cached items. When we populate the cache we
compute a checksum. When we unload we recompute the checksum and only
permit it to differ if the item was locked for RW at some stage. This
will identify places where we forgot to call cache_rw() causing
in-memory and on-disk structures to potentially differ.

------------------------------------------------------------------------
r2615 | jkbonfield | 2011-07-15 10:06:33 +0100 (Fri, 15 Jul 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/tgap/tg_contig.c

Do a full recalculation of bin start/end used when removing an item at
the boundary of start/end used.

------------------------------------------------------------------------
r2614 | jkbonfield | 2011-07-14 14:51:53 +0100 (Thu, 14 Jul 2011) | 13 lines
Changed paths:
   M /staden/trunk/src/gap5/break_contig.c

Fixed multiple data corruption bugs in break contig.

1) Breaking at a position where the right contig ends before base 0
   (so entirely negative, prior to shifting) was not setting contig
   boundaries correctly.

2) Incorrect computation of annotation start coordinates, meaning we
   could accidentally move them to the right hand contig when they
   overlapped the left hand contig.

3) Was Incorrtly claiming bin is empty when it infact is just 1 base
   long (eg contains only a single bp tag).

------------------------------------------------------------------------
r2613 | jkbonfield | 2011-07-14 11:46:03 +0100 (Thu, 14 Jul 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/break_contig.c

Fixed ref count leak, albeit only in occasions when we have already
met an earlier error.

------------------------------------------------------------------------
r2612 | jkbonfield | 2011-07-14 11:45:33 +0100 (Thu, 14 Jul 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/tgap/tg_bin.c

Added loop detection in bin_incr_nseq/nref/nanno code. This has
triggered from time to time, but not sure why and cannot yet repeat.

------------------------------------------------------------------------
r2611 | jkbonfield | 2011-07-14 11:44:56 +0100 (Thu, 14 Jul 2011) | 6 lines
Changed paths:
   M /staden/trunk/src/tgap/tg_cache.c
   M /staden/trunk/src/tgap/tg_gio.h

Improved the CACHE_REF_DEBUG ref counting debugging code.
If we cache_incr(), cache_rw() and then cache_decr() we failed to
remove the debugging indicating the first cache_incr as cache_rw has
changed our ref count. This was showing up as falsely reporting
reference leaks that didn't actually happen.

------------------------------------------------------------------------
r2610 | jkbonfield | 2011-07-13 15:06:06 +0100 (Wed, 13 Jul 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/gap4_compat.c

Fixed complement_contig crashes by using cache_incr() and cache_decr()
on the contig. Previously these could cause the contig to be purged
out of memory and result in crashes.

------------------------------------------------------------------------
r2609 | jkbonfield | 2011-07-13 12:36:48 +0100 (Wed, 13 Jul 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/tgap/tg_contig.c

Fixed a bug when removing a column of pads causes the last item in a
bin to be removed. It wasn't setting start_used/end_used to zero.

------------------------------------------------------------------------
r2608 | jkbonfield | 2011-07-13 11:43:17 +0100 (Wed, 13 Jul 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/consensus.c

Ugly hack - protection against failing to load a cached consensus in
case of corrupted databases or other I/O failures.

------------------------------------------------------------------------
r2607 | jkbonfield | 2011-07-13 11:42:18 +0100 (Wed, 13 Jul 2011) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_join.c
   M /staden/trunk/src/gap5/editor_view.c
   M /staden/trunk/src/gap5/newgap5_cmds.c
   M /staden/trunk/src/gap5/newgap_structs.h

Juggled the code a little bit to allow the join contigs implementation
to be executed outside of an edview struct. Exposed this as a
join_contigs command callable from Tcl. (This allows the gap5
dummy-user thrashing code to try joining.)

------------------------------------------------------------------------
r2606 | jkbonfield | 2011-07-13 11:40:31 +0100 (Wed, 13 Jul 2011) | 5 lines
Changed paths:
   M /staden/trunk/src/tgap/tg_check.c

Improved the fixing of cases where seq len doesn't match range
end-start+1. We try to adjust start now for complemented sequences
instead of always fixing end. This hopefully keeps things in the same
position as is visually displayed.

------------------------------------------------------------------------
r2605 | jkbonfield | 2011-07-13 11:39:17 +0100 (Wed, 13 Jul 2011) | 7 lines
Changed paths:
   M /staden/trunk/src/tgap/tg_contig.c

Fixes to inserting data when at the extreme end of a complemented
contig, in the cutoff data.

The fix was to give up attempting to track the exact behaviour of bin
start_used and end_used and simply recompute it verbatim. Not as fast,
but robust.

------------------------------------------------------------------------
r2604 | jkbonfield | 2011-07-13 11:36:14 +0100 (Wed, 13 Jul 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/tgap/tg_iface_g.c

Added code to protect against attempting to write a bin range with a
record but no data. This can happen when we end up removing all items
within a bin.

------------------------------------------------------------------------
r2603 | jkbonfield | 2011-07-13 11:33:48 +0100 (Wed, 13 Jul 2011) | 9 lines
Changed paths:
   M /staden/trunk/src/gap5/break_contig.c

Fixes to break contig.

1) We check if breaking here will produce a contig with no data, which
   causes inconsistencies. Quit early if so.

2) Fixed an error in remove_empty_bins where the first non-empty bin
   recursing down from the root is complemented. It was setting the
   bin offset incorrectly.

------------------------------------------------------------------------
r2602 | jkbonfield | 2011-07-11 11:33:27 +0100 (Mon, 11 Jul 2011) | 5 lines
Changed paths:
   M /staden/trunk/src/gap5/shuffle_pads.c

Worked around issues with the malign code in seq_utils. This assumes
contigs start at base 1 and go to base N, so we now shift data to
ensure this is so before running the algorithm,  and shift it back at
the end.

------------------------------------------------------------------------
r2601 | jkbonfield | 2011-07-08 16:54:34 +0100 (Fri, 08 Jul 2011) | 1 line
Changed paths:
   M /staden/trunk/src/NEWS


------------------------------------------------------------------------
r2600 | jkbonfield | 2011-07-08 16:42:15 +0100 (Fri, 08 Jul 2011) | 1 line
Changed paths:
   A /staden/trunk/src/gap5/gap5_check.tcl

CLI interface to check database
------------------------------------------------------------------------
r2599 | jkbonfield | 2011-07-08 16:24:08 +0100 (Fri, 08 Jul 2011) | 1 line
Changed paths:
   M /staden/trunk/src/tgap/tg_check.c

Fixed check_seq for consensus seqs - blank base-calls is expected
------------------------------------------------------------------------
r2598 | jkbonfield | 2011-07-08 16:23:32 +0100 (Fri, 08 Jul 2011) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/tkEditor.c

Adding debugging method 'ref_count' for reporting contig ref counts
------------------------------------------------------------------------
r2597 | jkbonfield | 2011-07-08 16:23:08 +0100 (Fri, 08 Jul 2011) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl

Fixed ref count leak in editor_undo_info
------------------------------------------------------------------------
r2596 | jkbonfield | 2011-07-08 14:21:02 +0100 (Fri, 08 Jul 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/sam_index.c

Protect against tags in SAM being beyond the extent of a sequence. We
now warn about this and clip the tag appropriately.

------------------------------------------------------------------------
r2595 | jkbonfield | 2011-07-08 12:08:16 +0100 (Fri, 08 Jul 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/tgap/tg_contig.c

When deleting sequences or tags in contig_delete_base2() we now
correctly update the nseq and nanno bin fields.

------------------------------------------------------------------------
r2594 | jkbonfield | 2011-07-08 11:43:05 +0100 (Fri, 08 Jul 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/tgap/tg_tcl.c

Fixed Tcl $contig move_anno method. It was incorrectly setting obj_rec
to obj_type (silly error), and also wasn't correct compensating for
sequence positions. Ie I previously tested it on consensus tags only...

------------------------------------------------------------------------
r2593 | jkbonfield | 2011-07-07 17:32:08 +0100 (Thu, 07 Jul 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/tgap/tg_bin.c

Added missing cache_rw() to bin_remove_item_from_bin, causing some
data to be not written back to disk sometimes (or for the editor to
modify base io instead of its child io).

------------------------------------------------------------------------
r2592 | jkbonfield | 2011-07-07 17:16:02 +0100 (Thu, 07 Jul 2011) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl

Added keyboard short-cut for checking consistency of the contig being edited, using the editor's child-io struct
------------------------------------------------------------------------
r2591 | jkbonfield | 2011-07-07 17:15:30 +0100 (Thu, 07 Jul 2011) | 1 line
Changed paths:
   M /staden/trunk/src/tgap/tg_sequence.c

Improved (ie bug fixed) range updating in sequence_range_length function
------------------------------------------------------------------------
r2590 | jkbonfield | 2011-07-07 17:14:50 +0100 (Thu, 07 Jul 2011) | 1 line
Changed paths:
   M /staden/trunk/src/Misc/shell.c

Removal of warning msg
------------------------------------------------------------------------
r2589 | jkbonfield | 2011-07-07 16:22:41 +0100 (Thu, 07 Jul 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_view.c
   M /staden/trunk/src/tgap/hache_table.c
   M /staden/trunk/src/tgap/hache_table.h

Added code to reverse the linked lists in hash tables. Use this in the
contig editor, which fixes issues of overlapping tags not displaying
correctly.

------------------------------------------------------------------------
r2588 | jkbonfield | 2011-07-07 16:21:41 +0100 (Thu, 07 Jul 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/tgap/tg_cache.c

Improved debugging with CACHE_REF_DEBUG.

------------------------------------------------------------------------
r2587 | jkbonfield | 2011-07-07 14:11:33 +0100 (Thu, 07 Jul 2011) | 14 lines
Changed paths:
   M /staden/trunk/src/gap5/break_contig.c
   M /staden/trunk/src/tgap/tg_bin.c
   M /staden/trunk/src/tgap/tg_iface_g.c

Fixed a major corruption involving reuse of old GRange slots. The
free-list, if containing at least one item, was failing to terminate
with record -1, instead pointing at record 0.

This has been fixed in the unpack_rng_array() function to prevent
possible data corruption, but at a cost of sometimes leaking bin slots
(freeing them up and never reusing them). The correct solution will
involve a minor change to the packed range format which I'll work on
later.

Also added extra code for ensuring bin flags get updated to request data
changed is written back to disk (this is almost certainly done
already, but it's clearer to do at source rather than later on).

------------------------------------------------------------------------
r2586 | jkbonfield | 2011-07-07 14:07:58 +0100 (Thu, 07 Jul 2011) | 1 line
Changed paths:
   M /staden/trunk/src/tgap/tg_check.c

Further checks and fixes: bin->free_rec list
------------------------------------------------------------------------
r2585 | jkbonfield | 2011-07-06 17:08:36 +0100 (Wed, 06 Jul 2011) | 9 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/tgap/tg_tcl.c

Lots of overhauls to editor Undo, which also involved adding a new
move_seq method to the tg-tcl interface.

These fix undo of removal of pad columns for the first or last base in
a contig and the first or last base in a sequence. They also fix undo
of tag deletion - we now recreate the tag using the old record number
instead of a new one (which broke subsequent undo ops on that same
tag).

------------------------------------------------------------------------
r2584 | jkbonfield | 2011-07-06 17:06:50 +0100 (Wed, 06 Jul 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/tgap/tg_contig.c

Correct errors introduced in insert/delete by the patch to allow these
functions to shift data instead of insert data. They were causing the
bin start/end used portion to be updated incorrectly in some special cases.

------------------------------------------------------------------------
r2583 | jkbonfield | 2011-07-06 17:05:09 +0100 (Wed, 06 Jul 2011) | 7 lines
Changed paths:
   M /staden/trunk/src/tgap/tg_sequence.c

Replaced an assert with a warning message instead, now that we have a
dedicated checker.

Corrected error in sequence_delete_base() when removing the very last
base. Also added much more code to sequence_range_length() to update
bin used ranges and contig sizes as appropriate.

------------------------------------------------------------------------
r2582 | jkbonfield | 2011-07-06 17:02:31 +0100 (Wed, 06 Jul 2011) | 1 line
Changed paths:
   M /staden/trunk/src/tgap/tg_check.c

Changes to allow check_contig to run on child IOs
------------------------------------------------------------------------
r2581 | jkbonfield | 2011-07-06 17:01:52 +0100 (Wed, 06 Jul 2011) | 1 line
Changed paths:
   M /staden/trunk/src/tgap/tg_cache.c

Comments
------------------------------------------------------------------------
r2580 | jkbonfield | 2011-07-05 12:18:11 +0100 (Tue, 05 Jul 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/consensus.c

Added a reference count (lock) to the contig in calculate_consensus_simple2.
This fixes a crash that sometimes happened due in gap5_consensus.

------------------------------------------------------------------------
r2579 | jkbonfield | 2011-07-04 17:42:04 +0100 (Mon, 04 Jul 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_view.c

Fixed edReadEnd() to set the cursor to 1 past the contig end when
cutoffs are not shown. It's now in agreement with the with-cutoffs
implementation.

------------------------------------------------------------------------
r2578 | jkbonfield | 2011-07-04 15:17:35 +0100 (Mon, 04 Jul 2011) | 9 lines
Changed paths:
   M /staden/trunk/src/tgap/tg_iface_g.c

Removed memory corruption when we have stored a range containing zero
array elements. This leads to calling ArrayCreate with dim 0 which
secretly gets converted to dim 1, but we reset the array pointer to
one of size 0 causing later corruptions when we try to extend.

Also reverted the order of checks in the seq block decoding to check
in[i].bin before parent_rec. While perhaps a bit slower on our
benchmarks, it avoids spurious valgrind complaints.

------------------------------------------------------------------------
r2577 | jkbonfield | 2011-07-04 15:15:18 +0100 (Mon, 04 Jul 2011) | 2 lines
Changed paths:
   M /staden/trunk/src/tgap/tg_bin.c

Added assertion to next_range(). Not triggered (yet).

------------------------------------------------------------------------
r2576 | jkbonfield | 2011-07-01 17:17:28 +0100 (Fri, 01 Jul 2011) | 1 line
Changed paths:
   M /staden/trunk/src/ChangeLog
   M /staden/trunk/src/NEWS
   M /staden/trunk/src/gap5/docs/TODO


------------------------------------------------------------------------
r2575 | jkbonfield | 2011-07-01 17:06:10 +0100 (Fri, 01 Jul 2011) | 9 lines
Changed paths:
   M /staden/trunk/src/gap5/editor_join.c

Changed the amount of data we tack on to the end of consensus
sequences when computing overlaps. Previously it was a fixed 30%, but
since we modified the band size for the alignment algorithm this was
pushing the alignment beyond the band causing broken alignments in the
join editor.

Now we use the same calculation to keep this in sync with the
alignment algorithm, incase we change the parameters again.

------------------------------------------------------------------------
r2574 | jkbonfield | 2011-07-01 16:42:53 +0100 (Fri, 01 Jul 2011) | 6 lines
Changed paths:
   M /staden/trunk/src/gap5/break_contig.c

Further fix to start/end ranges after breaking.

This fix is for the left-hand contigs start coordinate, which can
change if the right hand contig happened to contain the furthest-left
sequence (in cutoff).

------------------------------------------------------------------------
r2573 | jkbonfield | 2011-07-01 12:38:36 +0100 (Fri, 01 Jul 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_id.tcl
   M /staden/trunk/src/gap5/gap4_compat.tcl

Fixed a crash caused by typing #<num> into a contig identifier
dialogue where <num> was neither a GT_Contig or GT_Seq record id.

------------------------------------------------------------------------
r2572 | jkbonfield | 2011-07-01 12:37:34 +0100 (Fri, 01 Jul 2011) | 12 lines
Changed paths:
   M /staden/trunk/src/gap5/contig_editor.tcl
   M /staden/trunk/src/tgap/tg_anno.c
   M /staden/trunk/src/tgap/tg_check.c
   M /staden/trunk/src/tgap/tg_contig.c
   M /staden/trunk/src/tgap/tg_tcl.c

Fixed the usage of obj_rec in anno_ele_t. Obj_type/obj_rec (and
pair_rec in range_t) point to the record that is being annotated. This
works well for sequences, but is problematic for contigs. Eg consider
breaking a contig in two; all consensus annotations in the right hand
half will need their obj_rec (and pair_rec) fields changing.

Mostly this worked as we simply didn't bother and instead took
consensus annotations to be on the contig they are within, regardless
of the contents of obj_rec or pair_rec, but not in all cases. Now we
force obj_rec to be zero when obj_type is GT_Contig and fixed the
exceptions where we failed to ignore the field.

------------------------------------------------------------------------
r2571 | jkbonfield | 2011-06-30 17:27:13 +0100 (Thu, 30 Jun 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/tgap/tg_contig.c

Changed assert ABS(r->end - r->start) + 1 != ABS(s->len) to be less
aggressive. It's now a verror message and we gloss over it, as the
assert served its purpose - to find and fix the bug.

------------------------------------------------------------------------
r2570 | jkbonfield | 2011-06-30 17:11:23 +0100 (Thu, 30 Jun 2011) | 1 line
Changed paths:
   M /staden/trunk/src/gap5/list_contigs.tcl

Corrected handling of REG_QUIT events
------------------------------------------------------------------------
r2569 | jkbonfield | 2011-06-30 17:11:01 +0100 (Thu, 30 Jun 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/gap5/consensus.c

Speed increase wheni n read-only mode and asking for sequence only. It
no longer attempts to get quality data as well to store in the cache,
as it cannot (and will not) do this due to r/o mode.

------------------------------------------------------------------------
r2568 | jkbonfield | 2011-06-30 17:10:05 +0100 (Thu, 30 Jun 2011) | 1 line
Changed paths:
   M /staden/trunk/src/tgap/tg_check.c

Allow 'n' as well as 'N' in seqs
------------------------------------------------------------------------
r2567 | jkbonfield | 2011-06-30 17:09:48 +0100 (Thu, 30 Jun 2011) | 4 lines
Changed paths:
   M /staden/trunk/src/tgap/tg_iface_g.c

Sped up io_seq_block_read when there are a large number of libraries.
Sometimes it can be 3x faster, but for the usual case there is little
difference.

------------------------------------------------------------------------
r2566 | jkbonfield | 2011-06-30 12:04:27 +0100 (Thu, 30 Jun 2011) | 3 lines
Changed paths:
   M /staden/trunk/src/gap5/consen.tcl

Bug fix when saving fastq. We always computed the quality for the
entire contig rather than just the region we specified.

-----------------------------------------------------------------------------
Older ChangeLog format below.

2011-06-30  jkbonfield

	* tgap/tg_check.c: Extra check for where a child bin has a
	  non-zero record but cannot be read. Also fixable.

	* gap5/break_contig.c, tgap/tg_bin.c, tgap/tg_bin.h,
	  tgap/tg_tracks.c: Fixed bin_get_position() to deal with
	  complemented bins correctly, and also return relative
	  orientation of the query bin to the contig now.
	  
	  This and changes in Break Contig together have fixed a bug where
	  breaking a contig could sometimes cause the bin position to be
	  incorrect and at odds with contig->start/end.

	* gap5/consen.tcl: Fixed a reference count leak in the Save
	  Consensus code.

2011-06-29  jkbonfield

	* gap5/contig_editor.tcl, gap5/tk-io-reg.c,
	  tgap/tg_register.c: Fixed quit_displays and REG_QUIT
	  notifications so that the contig editor correctly cets a
	  chance to veto any attempts at shutting down gap5 if there
	  are unsaved changes.

	* gap5/gap4_compat.c: contig_name_to_number() now accepts
	  reading numbers too, used after the contig index lookup
	  fails.
	  
	  This means using fofn or lists for contigs containing
	  reading names works again, as per Gap4 style.

2011-06-28  jkbonfield

	* tgap/tg_check.c: Removal of false positives (empty bins).
	  
	  Added fix-up for contig order size.

	* tgap/tg_contig.c: Removed a reference count leak in the
	  contig iterator (leaking bins at times).
	  
	  Made contig_destroy() decrement the size of the contig_order
	  array.  This wasn't strictly a problem as we always use
	  io->db.Ncontigs to work out how many contigs there are, but
	  it's inefficient (writing out more data than we need to) and
	  the new check_database code just happened to notice it due
	  to extra-anal checking.

2011-06-28  awhitwham

	* gap5/fasta.c: Fixed double free.

2011-06-27  jkbonfield

	* gap5/check_database.tcl, gap5/gap5.tcl, gap5/gap5rc,
	  gap5/gap5rc_menu_full, gap5/tclIndex, tgap/tg_check.c,
	  tgap/tg_check.h, tgap/tg_tcl.c: Further work on Check Database.
	  
	  * It now has a user interface.
	  * The fix mode can now correct for more things.
	  * Uses vmessage() instead of fprintf().
	  * Added annotation and refpos checks.
	  * Added checks for libraries and contig order.

	* tgap/tg_iface_g.c: Fixed lock/view leak in io_rec_exists().

	* gap5/list_contigs.tcl, gap5/list_proc.tcl: Removal of reference
	  count leak ($io get_contig).

	* tgap/tg_gio.c, tgap/xerror.c, tgap/xerror.h: Removed unused error
	  handling code.
	  
	  Improved error messages reported when failing to create a new
	  database.

	* tgap/tg_bin.c: Removal of debugging info

2011-06-24  jkbonfield

	* gap5/sam_index.c: Fix for consensus tags. The anno_ele_t
	  struct was previously claiming it annotations the sequence
	  the Zc:A:* aux record was found on, rather than the
	  contig. However the range_t for that anno was correct which
	  is why the affect was invisible.
	  
	  The bug fix is purely a consistency fix.

	* gap5/consensus.c: Fixed memory corruption in the consensus
	  algorithm.
	  
	  Recomputing an existing cached consensus due to changes to
	  the contig, when the contig also grew, was sometimes
	  overflowing a buffer.

	* gap5/ace.c: Two fixes to ACE importing.
	  
	  1) The mapping quality has now changed to 255 (the SAM
	  synonym for unknown), both consistently in range_t and seq_t
	  structs.  Previously it was 0 and 50 which caused
	  check_contig() to complain.
	  
	  2) Fixed a stack corruption when copying over the sequence
	  data.  I've no idea why this ever worked, but it used to.

2011-06-23  jkbonfield

	* tgap/Makefile, tgap/tg_check.c, tgap/tg_check.h, tgap/tg_tcl.c:
	  Added a check_contig() function for internal consistency
	  checking.
	  
	  It's a work in progress: functional now and already
	  identifying some issues, but without a UI.

	* NEWS: Collation of change logs

	* gap5/consensus.c, gap5/consensus.h, tgap/tg_bin.c: Bug fixes
	  to removal of data from a contig (utilised when moving
	  data). This wasn't updating the bin start_used and end_used
	  fields where the sequence being removed was the cause of the
	  bin extents being that large.
	  
	  When this happens, it also now triggers a check on the
	  contig extents, as the contig start/end may also need
	  updating.

2011-06-21  jkbonfield

	* gap5/tg_index_common.c, gap5/tg_index_common.h: Accidentally
	  commited half a test-change in tg_index_common.c. So
	  commented it out and the associated code in tg_index_common.h.
	  
	  (The change was to track mapping quality and only build
	  insert size distributions from good quality
	  alignments. Potentially useful, hence commented out instead
	  of removed completely.)

	* tk_utils/init.tcl: We now check whether the editor "Sheet"
	  font is fixed width. Some Tk version and font package
	  combinations (eg Tk8.5 when specifying font name "Fixed")
	  didn't work too well and chose alternatives, not always
	  sensible ones.
	  
	  In these cases we fall back to a default Courier which
	  should work everywhere.

	* gap5/contig_selector.tcl: Removed List Notes from the context
	  menu.

	* gap5/consensus.c: I'm not sure it matters greatly, but
	  explicitly allow for extending the search range in iterators
	  within consensus_valid_range. (In theory the CITER_CSTART
	  and CITER_CEND already indicate this, but to be honest I
	  forget whether this change was the one that fixed the clip
	  point code so I'm keeping it!)

	* gap4/shuffle_pads.c: Improved alignment positioning. Instead
	  of +/-3 for the length we allow half a band-width. This
	  improves alignments in many cases.

	* NEWS, gap5/Makefile, gap5/gap5rc_menu_full,
	  gap5/newgap5_cmds.c, gap5/shuffle_pads.c,
	  gap5/shuffle_pads.h, gap5/shuffle_pads.tcl,
	  seq_utils/align_lib.c, seq_utils/align_lib.h: Added the
	  first version of Shuffle Pads to gap5. This is based on the
	  Gap4 version, which in turn is based on Gene Myers'
	  ReAligner program.  It's not desparately fast, but
	  functional.

2011-06-17  jkbonfield

	* tgap/tg_contig.c, tgap/tg_contig.h: Fixed two bugs with the
	  contig iterators, introduced in the recent change to try and
	  speed them up.
	  
	  Firstly, CITER_SMALL_BS had a value which clashed with CITER_IEND
	  causing data to always be sorted on right hand end even when
	  explicitly asked to sort of left end. This means iterators could
	  skip
	  data.
	  
	  Secondly, we jumped CITER_BS into the contig for each range
	  search, even when the first one only fetched CITER_SMALL_BS
	  worth of data.
	  
	  The affects were ride ranging, but mostly hard to
	  detect. The most obvious impact is control-a and control-e
	  to jump to the start and end of the contig in the contig
	  editor would sometimes not take us all the way there when
	  faced with widely varying sequence lengths (eg capillary
	  assemblies).

2011-06-16  jkbonfield

	* tgap/tg_bin.c: Identified a bug in bin_add_range and
	  bin_for_range.
	  
	  When creating new bins as the smallest bin is larger than
	  io->min_bin_size and we're in a complemented orientation
	  (our parent or one of its parents has been complemented),
	  then we were setting offset incorrect. This meant that
	  sequences were put in the incorrect location. This bug was
	  in bin_for_range().
	  
	  Also in bin_add_range() we updated the start_used and
	  end_used bin fields incorrectly for complemented bins.

2011-06-14  jkbonfield

	* system.mk.in: More SVN_VERSION fixes

	* system.mk.in: Patch to fix latest SVN_VERSION string.

	* gap5/bam.c: Removed harmless icc compiler warning

	* Misc/misc.h, configure.in, gap4/gap.tcl, gap5/gap5.tcl,
	  gap5/tg_index.c, gap5/tg_index_common.c, gap5/tg_view.c,
	  pregap4/gui.tcl, staden_config.h.in, system.mk.in,
	  tk_utils/init.c, trev/trev.tcl: Added the svn head revision
	  number to C define and Tcl global variables. We use these
	  when reporting program version numbers, so even minor
	  revision updates become obvious for users running the
	  programs.

2011-06-13  jkbonfield

	* gap4/init.c: Remove signal handlers for Gap4 too. This is
	  because abort() within a signal handler very often ends up
	  in a core file which gdb cannot produce stack traces from
	  (on linux). I'd rather have no messages on a crash then a
	  broken core file.

	* tgap/actf.c: Fixed uninitialised memory access. Could
	  occasionally result in failure to open databases.

	* gap5/editor_view.c, gap5/editor_view.h, gap5/find_oligo.c:
	  Added an editor method to find existing editors for a
	  specific contig. Used this within the Sequence Search
	  function so that the Next button won't keep bringing up new
	  editors each time.
	  
	  This allowed resolving a user request, as we can (and do) now
	  underline the appropriate section of the editor too.

	* gap5/gap-error.c, gap5/init.c, gap5/stack_dump.c: Added
	  stack dump printing for the linux signal handlers, but I now
	  decided the signal handler itself is a bad idea given how it
	  prevents gdb from working. I'd rather have no stack trace
	  and a working gdb than a stack trace and a core file I
	  cannot debug.

2011-06-10  jkbonfield

	* tgap/tg_struct.h: (Forgot with previous commit)
	  Added in-memory-only fields to library_t for caching.

	* gap5/editor_view.c, gap5/gap5rc, gap5/gap5rc_menu_full,
	  gap5/libraries.tcl, gap5/tkEditor.c, tgap/tg_iface_g.c,
	  tgap/tg_library.c, tgap/tg_sequence.c, tgap/tg_sequence.h: Added
	  some template status colours to the contig editor:
	  
	  white = ok pair
	  blue = single ended
	  orange = pair, spanning contigs
	  red = inconsistent orientation
	  grey = consistent orientation, but distance too large or too
	  small.
	  
	  In the process of this I also added some in-memory only
	  fields to the library_t struct for tracking whether the
	  library stats are up to date. Also improved the library mean
	  and s.d. calculations to be iterative, attempting to home in
	  on a suitable peak and remove outliers. This doesn't change
	  the mean significantly, but dramatically reduces the
	  variance to a sensible figure by excluding likely invalid
	  templates.
	  
	  In the editor names display, this also caused a few tweaks
	  to mapping quality display. Now in packed mode the names are
	  always coloured, either by template status or by mapping
	  quality. (Ie the Quality button no longer controls the
	  colouring of the names.) The unpacked dir+readname name
	  display has room for showing both template and mapping
	  quality data, so both are always shown.

	* tk_utils/init.tcl, tk_utils/sheet.c, tk_utils/sheet.h,
	  tk_utils/tkSheet_common.c, tk_utils/tkSheet_common.h,
	  tk_utils/tkSheet_config.h, tk_utils/tk_utilsrc: Finally
	  implemented the sh_bold highlight mode, some 10+ years after
	  it was first added to the bit-field.

	* gap5/consensus.c, gap5/consensus.h, gap5/contig_editor.tcl,
	  gap5/editor_search.c, gap5/editor_search.tcl,
	  gap5/newgap5_cmds.c, gap5/newgap_structs.h: Added unpadded
	  position display/search to the contig editor.
	  
	  Right now this is a noddy approach operating by simply
	  computing the consensus and counting '*'s, although it's
	  rescued to some extent by the consensus cache. (I had to
	  enable this again for child IO's, but hopefully it now works
	  fully.)
	  
	  The editor "goto" box in the bottom left still works on
	  padded or reference coordinates as listed by the P or R
	  button, but manually adding the letter 'u' after a number
	  will request unpadded coord.  The P/R button hasn't been
	  made P/R/U yet as the display of coordinates will be too
	  slow still.
	  
	  There are more explicit padded vs unpadded options in the
	  search dialogue, or hitting Return in the editor consensus
	  will also show that coordinate.

2011-06-07  jkbonfield

	* gap5/newgap5_cmds.c, gap5/newgap_structs.h, gap5/readpair.c,
	  gap5/readpair.h, gap5/readpair.tcl: The Find Read Pairs plot
	  now has the option to filter the reported hits by the
	  library. By default it uses all. Note filtering slows down
	  the code substantially.

	* gap5/consensus.c, tgap/tg_contig.c, tgap/tg_contig.h: Speed
	  increase to the contig iterator when supplied with whence &
	  CITER_SMALL_BS. Then it only uses 100 bp window instead of a
	  10Kb window for the initial range query. This is optimal
	  when being called from consensus_valid_range as the chances
	  are 100bp from the end is sufficient to find the real contig
	  clip point, while still not affecting efficiency for range
	  queries beyond the ends.

2011-06-06  jkbonfield

	* gap5/gap_range.c: Bug fix to the template pairing.
	  
	  The recent change to add the quality plot changed how the
	  detection of "done this pair" code worked, from zeroing
	  record number to setting a flag (as we needed the record
	  left intact). Unfortunately it was bugged. The impact was
	  that using filters would lose many pairs and they'd stay
	  lost until we had to query a new range.

	* gap5/contig_editor.tcl, tk_utils/sheet.c, tk_utils/sheet.h,
	  tk_utils/tkSheet_config.h: The sheet widget now has an
	  option to control whether a cursor is solid or a hollow
	  box. This isn't automatically tied to focus, but is
	  controlled explicitly from the join editor to indicate which
	  of the pair is the "curr_editor".

	* gap5/contig_editor.tcl, gap5/editor_search.tcl: Improved
	  editor search UI. Hovering over the Search button in the
	  dialogue window will now highlight which editor of an join
	  editor pair will be searched in. (As before, left-clicking
	  in an editor will change this, only now it's obvious this
	  happens.)
	  
	  Also fixed control-S/control-R so they don't bring up a separate
	  dialogue window.

	* gap5/contig_editor.tcl: Clicking on a base within the tag
	  now displays the summary data of the base underneath it
	  instead of repeating the mouse-over text. This is the same
	  interface as gap4 now.

2011-06-03  jkbonfield

	* Misc/dstring.c, gap4/newgap_cmds.c, gap4/tkEditor.c,
	  gap4/tman_interface.c, gap5/consensus.c, gap5/editor_search.c,
	  gap5/hash_lib.c, gap5/hash_lib.h, gap5/readpair.c,
	  gap5/sam_index.c, gap5/tg_index.c, spin/seq_results.c,
	  spin/seqed_search.c, tgap/tg_gio.c, tgap/tg_iface_g.c,
	  tgap/tg_library.c, tk_utils/tcl_io_lib.c: Another rag-tag batch
	  of compiler warning removals.
	  
	  90% of these are unused variables, but there's a few missing
	  prototypes and the occasional printf arguments issue (in error
	  handling code).

	* spin2/Makefile, spin2/seq_reg_cmds.c, spin2/spin.tcl: Spin2 is
	  still unused program, but minor tweaks to get it to compile
	  should we ever need to release it again.

	* gap5/Makefile, gap5/depth.tcl, gap5/depth_track.c,
	  gap5/gap5rc, gap5/gap_range.c, gap5/gap_range.h,
	  gap5/newgap5_cmds.c, gap5/quality_plot.c,
	  gap5/quality_plot.h, gap5/template_display.c: Added various
	  consensus quality plots to the template display. By default
	  they are turned off as they incur a heavy CPU cost: unlike
	  the main template display, computing the consensus needs to
	  fetch all the seq_t objects rather than just the bin/range
	  arrays.
	  
	  The quality plots occupy one single track but are
	  configuration to show consensus quality, discrepancies or
	  heterozygosity (the highest log-odds score for any het
	  mixture).

	* gap5/consensus.c, gap5/consensus.h: Speed optimisations to
	  calculate_consensus_bit_het. Also exposed it outside the
	  scope of this file so it can be called directly when a
	  rangec_t array is already know. This also allows direct
	  control of what to compute, to skip some things. Eg don't
	  bother filling out the 7-way log-odds scores if all we're
	  going to be using is the phred score.

	* tgap/tg_iface_g.c: Minor speed optimisation to unpack_rng_array()

2011-06-01  awhitwham

	* tgap/actf.c, tgap/g-files.c, tgap/g-files.h: Fixed bug where gap5
	  couldn't open a db in another directory from the File menu.

2011-05-31  jkbonfield

	* gap4/fij.c: Fixed free ordering, which was causing glibc
	  malloc checking to fail.  Only happened when
	  make_consensus() failed (eg due to too small a max-consensus
	  size).

2011-05-26  jkbonfield

	* gap5/contig_editor.tcl, tgap/tg_contig.c, tgap/tg_tcl.c:
	  Added editor Undo support for the contig-shift
	  operations. This was a bit complex, so needed a $contig
	  move_anno method adding in the tcl interface too.

2011-05-25  jkbonfield

	* tgap/tg_contig.c: Fixed moving of annotation tags when using
	  the new contig shift left/right functions.
	  
	  Sped up the shift functions by tweaking hache table
	  configuration.

2011-05-24  jkbonfield

	* gap5/contig_editor.tcl, tgap/tg_contig.c, tgap/tg_contig.h,
	  tgap/tg_tcl.c: Added commands to shift data in a
	  contig. These move all data to the right of the editing
	  cursor to the right or left by one base (bound to
	  control-left and control-right arrow keys in th editor with
	  the cursor on the consensus).
	  
	  This is implemented using the existing code to insert or remove
	  columns of pads, but without the actual sequence-editing step.

	* tgap/tg_sequence.c, tgap/tg_sequence.h, tgap/tg_tcl.c: Fixed a
	  bug where the tcl interface to sequence_insert_bases and
	  sequence_delete_bases didn't update the range_t structure.
	  Consequentially the sequence length and the start..end length in
	  the
	  range struct could differ.
	  
	  This was detected via the assertions added in svn update
	  #2493, so we now know what was altering the data that
	  triggered the bug fixed there.
	  
	  From C the only other use of the sequence ins/del functions
	  are from the code in tg_contig.c to insert/delete entire
	  columns of pads, and these already updated the range arrays
	  correctly. Resolved the issue by creating a new
	  sequence_range_length() function to update the range data
	  any time we feel it's been invalidated due to changing
	  sequence length.

2011-05-20  jkbonfield

	* gap5/contig_editor.tcl, gap5/gap5rc_menu_full: Fixed the Commands
	  menu to work properly in a join editor. Now Create
	  Tag on the top window adds tags to that window and not the bottom
	  one.

2011-05-19  awhitwham

	* gap5/afg.h: Added missing header file.

2011-05-19  jkbonfield

	* gap5/consensus.c, gap5/consensus.h, gap5/editor_search.c,
	  gap5/editor_search.tcl, gap5/gap5rc: Added a discrepancy
	  calculation to the consensus algorithm too. This attempts to
	  score discrpeancies based on the number of mismatching bases
	  vs the expected number given depth and confidence values.
	  It then expresses this in a (half-baked?) way that takes
	  into account significance through sample-size.
	  
	  Exposed both this and the previous het score[6] value to the
	  contig editor search window.

	* tgap/tg_anno.c: Unused code at present - for future work on tag
	  orientation

2011-05-18  awhitwham

	* gap5/Makefile, gap5/afg.c, gap5/tg_index.c: Experimental Velvet
	  afg file indexing added.

2011-05-18  jkbonfield

	* gap5/contig_editor.tcl: Added a Join To function for read-pairs
	  that span contigs.

	* gap5/contig_editor.tcl, gap5/editor_view.c,
	  gap5/editor_view.h, gap5/fij.c, gap5/tkEditor.c: Added
	  next_difference and prev_difference methods to the editor
	  widget. These search through the join editor consensus
	  sequences looking for differences. The join editor
	  "differences" line now has < and > buttons to call these.
	  
	  Also bug fixed the FIJ "Invoke Join Editor" menu item so
	  that it positions the editor cursor on the correct consensus
	  base instead of the first read in the contig (often being
	  beyond the end of it leading to an invisible cursor).

	* gap5/consensus.c: Remove the code in
	  calculate_consensus_simple() to convert a call to N if the
	  scores[call] < Q_CUTOFF. This often happens now due to it
	  preferring say A/C over A, but we'd rather the consensus is
	  still kept as A for ease of algorithms elsewhere.

2011-05-17  awhitwham

	* gap5/caf.c: Replaced zf file functions with normal ones. CAF does
	  not work with compressed files.

2011-05-17  jkbonfield

	* gap5/consensus.c, gap5/consensus.h, gap5/editor_view.c,
	  gap5/gap5rc: Implemented a new consensus algorithm to compute
	  probabilities for
	  both pure single-base columns of data and mixed heterozygous
	  columns.
	  
	  This means it can call the consensus as likely consisting
	  of, say, an AT mix instead of pure A or pure T. We still
	  also call the most likely homozygous consensus, but if it is
	  more likely to be a heterozygous mix then the probability
	  assigned to a homozygous call is therefore far lower than
	  before.
	  
	  My belief is that this will prevent major conflicts still
	  being given very high homozygous consensus values simply
	  because one base type outweighs another. This work also
	  forms the basis of SNP calling or misassembly detection.

2011-05-13  jkbonfield

	* gap5/consensus.c: Removed the fixed confidence of pads, now
	  using the score listed on that base. Also permit confidence
	  100 on pads to force consensus.

	* gap5/gap5: Don't override $GTAGDB if already set.

	* tgap/tg_tcl.c: Fix to inserting sequences in certain
	  combinations of complemented bins. This becomes visible when
	  using control-left/control-right in the editor to move
	  sequences around, which sometimes had the impact of reverse
	  complementing data too.

2011-05-06  jkbonfield

	* gap5/docs/TODO, tgap/tg_bin.c, tgap/tg_bin.h: Fixed issues with
	  moving sequences using control-left/right arrow
	  keys.
	  
	  In some situations it would reverse complement data due to
	  incorrectly checking BIN_COMPLEMENT flag rather than XORing
	  it with the full path back to the root bin.
	  
	  It also incorrectly returned the complement flag when using
	  CACHE_LAST_BIN optimisations.

	* gap5/editor_view.c: Fixed cut and paste of complemented
	  sequences when in a bin that has been complemented.

	* tgap/tg_sequence.c: typo

	* tgap/tg_contig.c, tgap/tg_sequence.c: In attempts to track
	  down crashes when inserting columns of pads to contigs that
	  have been highly broken, complemented and joined I temporary
	  implemented a new version of contig_insert_base(). For now
	  this is #ifdef-ed out though as it turns out the cause is a
	  disparity between s->len and r->end - r->start + 1: cause
	  unknown!
	  
	  So, added some asserts to check for this. This doesn't fix
	  the bug and data corruption! It just means it'll hopefully
	  it'll be pointed out far sooner after it occurs, giving a
	  more obvious link between cause and effect.
	  
	  Also improved robustness of sequence insertion to check for
	  attempting to insert off the end of a sequence.

	* gap5/contig_editor.tcl: The Goto... feature now attempts to
	  list gap size between template pairs.
	  
	  Fixed a display error where the contig record was not
	  re-cached when inserting or deleting columns of pads.

	* gap5/libraries.tcl: Added a key and scrollbars to the plot
	  interface.

	* gap5/ace.c, gap5/baf.c, gap5/caf.c, gap5/fasta.c,
	  gap5/maq.c, gap5/sam_index.c, gap5/tg_index_common.c,
	  tgap/tg_iface_g.c, tgap/tg_struct.h: Modified contig_t,
	  seq_t, anno_ele_t and library_t data structures to use "char
	  data[1]" as the terminating entry rather than "char
	  *data". This is both more in line with what I intended
	  (actually "char data[]" would be better, but may not be
	  supported everywhere yet) and also works around a bug(?) in
	  GCC 4.4.4 onwards giving false-hits in the buffer overrun
	  detection code of _FORTIFY_SOURCE.

	* gap5/docs/TODO:

2011-05-04  jkbonfield

	* tgap/tg_cache.c, tgap/tg_cache_item.h: Fixed undefined
	  behaviour in construct_key() and the use of structure
	  assignments. It had an accidental assumption on structure
	  copying preserving the contents of structure padding
	  bytes. This exhibited itself as problems when compiling on
	  gcc 4.4.
	  
	  Also reworked the cached_item struct to remove excessive use
	  of bit-fields and instead moved them into the recently
	  creating structure padding caused by changing tg_rec to
	  64-bit.

	* tgap/tg_iface_g.c: Debugging support (disabled atm)

2011-04-21  jkbonfield

	* gap5/readpair.c: Removal of debugging output.

	* gap5/gap_hash.c: Enable word size 14 in find repeats on large
	  data-sets; > 100Mb of consensus

	* gap5/contig_editor.tcl, gap5/editor_view.c, gap5/readpair.c:
	  Fixed Find Read Pairs. It now should work better with
	  reversed matches and it now also invokes the join editor at
	  the correct locations.

	* gap5/consensus.c: Fix an issue with the new consensus valid
	  range code. When faced with inconsistent data where all
	  reads are outside the claimed start..end range, or simply
	  contigs with no data, we no longer return INT_MIN/INT_MAX as
	  values. Instead we return 0.

	* gap5/fasta.c, tgap/tg_bin.c, tgap/tg_cache.c: Some tweaks to
	  improve handling *really* large single sequences (>
	  1Gb). It's still not robust in that situation and not to be
	  recommended.

2011-04-20  jkbonfield

	* gap5/editor_search.c: Allow #record_number to be used for reading
	  name search

	* gap5/contig_editor.tcl: Fixed bug when right clicking on reading
	  names

	* Misc/Makefile, Misc/misc.h, Misc/strtol64.c: Added
	  strtol32/strtol64 and atoi equiv implementations.
	  
	  These avoid having to check everywhere whether strtol or
	  strtoll is the appropriate function to return an int64_t
	  data type.

2011-04-19  jkbonfield

	* gap5/gap5.tcl, gap5/tg_index.c: Bump version to 1.2.12 for local
	  test release.

	* gap5/hash_lib.c: fast_mode is now off by default. It was
	  always set/unset explicitly by FIJ, but the "align" button
	  in the join editor just uses the default.

	* gap5/gap_hash.c, gap5/hash_lib.c, gap5/hash_lib.h: Further speed
	  up of Find Repeats, along with a memory reduction.
	  
	  We now have versions of init_hashn, store_hashn and reps
	  that don't use the h->counts[] array.

	* gap5/consensus.c: Rewrite of consensus_valid_range() to use
	  contig iterators. The new version is generally substantially
	  faster.

	* tgap/tg_iface_g.c: Check the master database version and
	  don't attempt to write structures in formats newer than the
	  master version indicates.
	  
	  This has currently only been implemented for version 1 vs 2,
	  which covers the addition of reference positions in bin
	  Ranges and nannotations in bin structs.

	* Misc/Makefile, gap4/Makefile, get_scf_field/Makefile,
	  haplo/Makefile, polyA_clip/Makefile, qclip/Makefile,
	  spin/Makefile, text_utils/Makefile, tk_utils/Makefile:
	  Auto-updates from "make depend"

	* gap5/Makefile, gap5/actf.c, gap5/actf.h, gap5/fij.c,
	  gap5/find_repeats.c, gap5/fort.h, gap5/gap_globals.c,
	  gap5/gap_hash.c, tgap/Makefile, tgap/actf.c, tgap/actf.h: Moved
	  actf.c from gap5 to tgap as it's used by libtgap. This fixes
	  MacOS X build issues.
	  
	  Also removed the redundant fort.h

2011-04-18  jkbonfield

	* gap5/contig_editor.tcl: Fixed the editor Join command. It
	  saved the two contigs but then gave the option to bail out
	  after saving if the mismatch was two high.  Now the order of
	  this logic has been reversed.

	* gap5/contig_editor.tcl, gap5/editor_join.c,
	  tgap/tg_sequence.c, tgap/tg_tcl.c: Quality values inserted
	  (manually or automatically by the join editor Align button)
	  to the consensus and/or sequences now default to quality
	  -1. This is interpreted as MIN(left_qual,right_qual).

2011-04-15  jkbonfield

	* gap5/do_fij.c: Reverse the order of comparisons when doing single
	  vs all in FIJ.
	  
	  The outer loop is now the single contig with the inner loop
	  being each contig in turn to compare against it. This sounds
	  like it should be slower than hashing all at once and
	  comparing a single contig against it, but benchmarking says
	  otherwise.

	* gap5/assemble_single.tcl, gap5/gap5rc, gap5/map_reads.tcl,
	  gap5/tclIndex, tk_utils/Makefile, tk_utils/init.c,
	  tk_utils/tcl_io_lib.c, tk_utils/tcl_io_lib.h: Extended the
	  Map Reads functions of gap5 to be able to use a file of
	  filenames, using io_lib to read from experiment files and
	  trace files (either as local files or remote via URLs).

	* gap5/consen.tcl: Removal of debugging output

	* gap4/cs-object.c: Speed increase to DeleteRepeats (as per gap5
	  change).

	* gap5/cs-object.c, gap5/cs-object.h: Huge speed increase in
	  destroying the contig selector "canvas item ID to C pointer"
	  hash table. With ~1 million find repeat hits it's now 1500
	  times faster to shut down the display.

2011-04-14  jkbonfield

	* tgap/g-files.c: Minor update to finding files by old vs new
	  filename. Previously it sometimes modified the database
	  filename during the first pass, causing it to fail 2nd as
	  well.

	* gap4/tagEditor.c: Fix accessing of free memory by minor moving of
	  TagEdDestroy call

	* gap5/do_fij.c, gap5/docs/TODO, gap5/editor_join.c, gap5/fij.c,
	  gap5/fij.h, gap5/fij.tcl, gap5/gap5rc, gap5/gap_hash.c,
	  gap5/hash_lib.c, gap5/hash_lib.h, gap5/newgap5_cmds.c,
	  gap5/newgap_structs.h, seq_utils/align_lib.h,
	  seq_utils/dna_utils.c, seq_utils/dna_utils.h: Major speed
	  improvements to Find Internal Joins and Find Repeats.
	  
	  FIJ is around 10x faster in quick mode, and I also added a
	  fastest mode that takes a few more liberties in order to
	  speed things up further (another 2-3x over quick
	  mode). Speed gains will vary by size of project and number
	  of contigs. The above was on a project with ~1500 contigs
	  and ~20Mb of consensus.
	  
	  Some related speed ups may be possible in the sensitive
	  mode, but for now I've left that code largely as-is.
	  
	  One of the speeds to FIJ involved the hashing code, which is
	  the core of Find Repeats. Consequentially Find Repeats is
	  somewhere around 100x faster! Again, depending on the
	  project.

	* seq_utils/align_lib.c: Minor improvements to debug calls

	* tk_utils/tkTrace.c: Removed use of png_set_compression_level, to
	  avoid issues with Z_BEST_COMPRESSION not being found on some
	  Macs. Why?

	* tk_utils/text_output.c: Allow for \r at start of a vmessage()
	  call to request overwriting the current output line

	* tk_utils/scalebox.tcl: Added a -variable option to scalebox

	* gap5/contig_selector.c: Faster repeat/FIJ plotting

	* gap5/consensus.c: Fixed a bug involving consensus being spaces at
	  the ends of contig.
	  
	  Removed debugging printfs.

2011-03-24  jkbonfield

	* gap5/contig_editor.tcl: Modified Page Up and Page Down to
	  scroll 1 screen full at a time instead of 1 Kb. The modified
	  Page Up/Down (shift, control shift+control) have been
	  updated to do the old 1k and beyond scroll incremements.
	  
	  Also added Home and End keybindings to mimic control-a and
	  control-e.

	* gap5/gap5rc_menu_full, gap5/search.tcl: Added a prefix
	  search for sequence names, using the new iterator prefix
	  mechanism.

	* tgap/b+tree2.c, tgap/b+tree2.h, tgap/tg_gio.h,
	  tgap/tg_iface.h, tgap/tg_iface_g.c, tgap/tg_sequence.c,
	  tgap/tg_sequence.h, tgap/tg_tcl.c: Added an iterator to the
	  B+Tree implementation (currently only "next" and no
	  "previous"). Exposed this to the Tcl interface.

2011-03-23  jkbonfield

	* gap5/tkEditor.c: Added bounds checking to the X scrollbar

	* gap5/depth.tcl, gap5/template_display.c: Removed excessive
	  debugging output.

	* gap5/consensus.c, gap5/editor_view.c: The consensus off the
	  ends of contigs is now " " (space) rather than "N".
	  
	  Also put bounds checking in for user-selections in the
	  consensus line, preventing users from attempting to create
	  tags off the ends of contigs.

	* gap5/contig_editor.tcl: Added more incr/decr contig calls as tag
	  creation/deletion can modify the contig struct. This had the
	  effect of causing data to temporarily vanish due to out of date
	  caches.

	* tgap/tg_contig.c: Fixed typo in postscript generation

2011-03-22  jkbonfield

	* gap5/sam_index.c, gap5/sam_pileup.c, gap5/sam_pileup.h: Added
	  handling for cigar N (reference skip) alignments.
	  
	  For now we just create a separate sequence, but we need a
	  more general purpose mechanism of dealing with templates
	  with more than 2 sequences.
	  
	  TODO: Check the TC field in sam aux as an indicator of
	  whether it's acceptable to remove the hashed template name
	  when we see the second record. Also set this mode when
	  finding a cigar N op.

	* gap5/bam.c: Improved error messages when parsing BAM headers
	  - with line numbers and report of erroneous text.
	  
	  We no longer simply exit on bad formatted data, but attempt to
	  gracefully continue albeit with messages to stderr.

	* tk_utils/text_output.c: Changed default value of "noisy" to 0.
	  This also has the effect of reducing the need for our_interp
	  to be initialised before calling verror.

2011-03-21  jkbonfield

	* gap5/gap_range.c: Minor bug fix to handle cases when depth is
	  zero.

	* ChangeLog, NEWS:

	* gap5/depth.tcl, gap5/gap_range.c, gap5/gap_range.h: Improvements
	  to the template display:
	  
	  1) It now deals better with contigs that do not start as base 1.
	  
	  2) The depth plot should no longer change Y values so
	  drastically when zooming in and out. This still exists in part
	  due to aliasing, but it's far better than it was.

2011-03-18  jkbonfield

	* gap5/actf.c: Fix to actf_lock(); don't complain of missing
	  database files when we're attempting to create a new one.

	* gap5/actf.c, gap5/actf.h, tgap/g-files.c, tgap/g-files.h,
	  tgap/tg_gio.c: Added BUSY file locking for Gap5, as per Gap4.

	* gap5/tag_editor.tcl: Temporarily removed the tag editor Move and
	  Copy buttons as they haven't yet been implemented.

	* gap5/bam.c: Removed buffer overrun in sam_next_seq() when
	  processing SAM files with no @SQ lines. It wasn't null
	  terminating the reference string.

2011-03-17  jkbonfield

	* gap5/fasta.c, gap5/fasta.h, gap5/newgap5_cmds.c: Fixed fasta
	  import:
	  
	  It now correctly terminates the last reading. Previously it
	  would produce a blank contig for the last sequence.
	  
	  It also now calls bin_add_range at the end to flush any cached
	  nseq values, so contigs no longer claim to have zero sequences
	  in them.

	* gap5/contig_selector.c: Fixed a bug with reordering contigs. It
	  could cause a contig to be duplicated and another to be
	  overwritten when the user moved contigs around.

2011-03-16  jkbonfield

	* gap5/break_contig.c, gap5/consensus.c, gap5/contig_editor.tcl,
	  gap5/contig_selector.tcl, gap5/editor_join.c,
	  gap5/editor_search.c, gap5/editor_search.tcl,
	  gap5/editor_view.c, gap5/gap5.tcl, gap5/gap5rc,
	  gap5/gap5rc_menu_full, gap5/list_contigs.tcl,
	  gap5/newgap5_cmds.c, gap5/sam_index.c, gap5/tg_index.c,
	  gap5/tg_index.h, gap5/tkEditor.c, gap5/tkEditor.h,
	  tgap/g-files.c, tgap/tg_anno.c, tgap/tg_bin.c, tgap/tg_bin.h,
	  tgap/tg_contig.c, tgap/tg_contig.h, tgap/tg_iface_g.c,
	  tgap/tg_struct.h, tgap/tg_tcl.c:

	  Reference base coordinates are now tracked when the input is a
	  SAM/BAM file. This required adjustments to the on-disc file
	  formats for bins, although the code will still read the old
	  format data too.
	  
	  In the editor window the position box in the bottom left now has
	  a P or R label next to it. Clicking this toggles padded vs
	  reference coordinates. It can be adjusted from the settings menu
	  too. When in Reference mode the contig coordinate line also
	  updates too.
	  
	  An editor search mode of "reference indel" has been added, to
	  skip ahead to the next consensus insertion or deletion to the
	  reference. Do not confuse these with pads - it's specifically
	  where the data has been removed. Even when all the sequences
	  have a D operator, if they have all had a * added then the
	  consensus is the correct length and still has a 1:1 mapping to
	  the reference, meaning there are no missing bases to find. A
	  future useful addition though would be to add markers for
	  consensus pads that align against a reference base
	  (deletion of zero length maybe?) so we can search for these.
	  
	  We also need to decide how to fit unpadded coordinates into this
	  system still.
	  
	  Implementation wise, a bin range now has an additional type
	  REFPOS. A refpos object has no actual record, but instead uses
	  these range fields to hold a mapping to the absolute reference
	  ID and coordinate.
	  
	  Added nrefpos and nanno to the bin struct in addition to the
	  existing nseqs field. Much like nseqs these count the number of
	  objects in this bin and child bins in a recursive manner.
	  
	  Updated the contig iterators to use nseqs, nrefpos and nanno
	  fields to short-cut the searches for next/previous
	  item. Basically this is my "needle in a haystack" algorithm
	  allowing us to rapidly skip forward to e.g. the next annotation
	  simply by noting which bins have nanno == 0, and not requiring a
	  linear read of every bin range.
	  
	  
	  
	  Other passenger updates that appeared in this large update: -
	  Editor "stripe mode" or "fanfold mode" has reappeared. This is
	  just a visual tweak to make visualising columns easier in deep
	  repetitive data.
	  
	  - Fixed contig annotations in SAM to no longer claim to be on
	  sequences.
	  
	  - Relaxed the SAM data out of order check as it's currently
	  triggered by alignments starting with a deletion in the cigar
	  string. We need a better check for this.
	  
	  - SAM/BAM reading code now automatically removes duplicates
	  unless tg_index -D flag is specified.
	  
	  - Fixed a break contig bug where tags to the right of the break
	  point are on readings that start to the left of the break point
	  were not always moved to the left hand contig (when the tags
	  happened to also fall into a new bin further to the right).

	* gap5/dis_readings.c, gap5/readpair.c: Minor printf formatting
	  tweaks - ensure we use PRIrec instead of %d.

	* gap5/list_contigs.tcl: Minor change to report =number instead of
	  #number for contig records.

	* gap5/gap4_compat.c: Improved robustness when given incorrect
	  inputs - eg contigs that don't exist, or a contig number to
	  rnumtocnum().

	* gap5/docs/IMPLEMENTATION, gap5/docs/TODO:

	* gap5/dis_readings.c: Fixed algorithm for detecting empty bins.
	  Previously a bin with no sequences but having annotations was
	  labelled as empty and removed.

	* gap5/bam.c: Fixed parsing of SAM files that have "*" as the
	  quality string.

2011-03-15  jkbonfield

	* gap5/configure.tcl, gap5/tag_checklist.tcl,
	  gap5/trace_display.tcl: Fix for SF bug 3213620:
	  
	  Saving settings now writes to ~/.gap5rc instead of .gaprc.

2011-03-08  jkbonfield

	* tk_utils/sheet.c, tk_utils/sheet.h, tk_utils/tkSheet_common.c,
	  tk_utils/tkSheet_config.h, tk_utils/tkSheet_struct.h: Added more
	  'sh_' highlight options: caret for deletion markers between
	  characters; sh_indel for an alternative colouring scheme to
	  highlight specific bases.
	  
	  The sh_underline highlight is now an extra pixel lower provided
	  the font has sufficient descender room.

2011-03-03  jkbonfield

	* tgap/tg_contig.c: Correction to last fix - extra check in case of
	  overlapping bins

	* tgap/tg_contig.c: Fixed a major bug with contig_delete_base: it
	  was no longer correctly moving the data in the right hand bin
	  leftwards due to an earlier bug fix.

2011-03-02  jkbonfield

	* tgap/tg_cache.c: Fix to previous fix!
	  
	  Reverted back some of the incr/decr ref counting code. This
	  still cures the original bug with join contigs (I believe), but
	  doesn't now crash with assertion failures elsewhere.
	  
	  It *does* still have a reference count leak somewhere though
	  which I was attempting to fix and clearly failed. Anyway -
	  working with leak is clearly a big improvement over not working
	  at all. More to come.

	* gap5/bam.c, gap5/sam_pileup.c, gap5/sam_pileup.h: Improved
	  handling of SAM files. We now properly deal with unpadded
	  data correctly when it has no reference at all.
	  
	  We also cope with SAM files with missing @SQ records or even
	  header lines at all. (Instead we just figure them out as we go.)

	* gap5/consensus.c: Fixed use of consensus cache when contig start
	  exactly matches the bin start. Previously it failed to copy out
	  of the cached bin, leaving blanks in the consensus.

2011-03-01  jkbonfield

	* tgap/tg_cache.c: Fixed reference counting bug in cache_dup. It
	  wasn't incrementing the ref count of the base object,
	  potentially allowing it to go out of scope. This in turn meant
	  that subsequent writes of that object from the child io could
	  attempt to flush data back to the wrong record
	  (if the view had been reused). This was fortunately caught via
	  an assert, but is likely the cause of some early corruptions we
	  saw.
	  
	  The reference counting in copy-on-write scenarios still isn't
	  ideal and I think there's a reference count leak here, albeit
	  small.  This is still preferable though than data corruption so
	  I'm submitting the partial fix already.

	* gap5/contig_editor.tcl, gap5/contig_id.tcl, gap5/gap_utils.tcl:
	  Removed various minor reference count leaks.

	* tgap/tg_bin.c: Fixed bin used size updating when being given
	  length 1 sequences.

2011-02-25  jkbonfield

	* gap5/caf.c: Applied patch from Rob Davies to fix get_line(). The
	  new version honours the \ continuation lines in CAF, making
	  multi-line tags now work OK.

	* gap5/tg_index_common.c: Bug fix to unescape_line when finding \
	  on the end of lines.

2011-02-24  jkbonfield

	* gap5/bam.c, gap5/bam.h: Fixed binary mode on windows (need to
	  check - unable at present).
	  
	  Added cigar_len field to the bam struct as a 32-bit int. This
	  means we can now support sam files with cigar length > 64k,
	  although bam by design still has this limitation.

2011-02-23  jkbonfield

	* gap5/tg_index.c: Fixed minor bug in memory allocation for
	  argument parsing.

2011-02-22  jkbonfield

	* gap5/bam.c: Fixed issue in bam_more_output() (the decompression
	  output, but on "input" side) when faced with truncated reads. We
	  now keep going until either real eof or read enough.

2011-02-21  jkbonfield

	* gap4/tman_interface.c: Protection against a infinitely recursive
	  loop. We observed this happening, apparently due to a sequence
	  not being loaded into memory yet while scrolling off the end of
	  it. (I cannot see how it is possible to bring up a trace for a
	  sequence you haven't yet observed, but apparently some clever
	  user discovered a way.)

2011-02-18  jkbonfield

	* incrTcl-3.3cvs: Header files are no longer needed given we do not
	  depend on itcl any more.

2011-02-15  jkbonfield

	* ac_stubs/tcl.m4, staden.profile, system.mk.in: Improvements to
	  help find libraries in <root>/lib/staden. The tcl.m4 already had
	  code for --enable-rpath (default) and --disable-rpath, so we now
	  expose these to the Makefile properly.

2011-02-10  jkbonfield

	* README.build: More MacOS X build hints

	* Misc/os.h: ppc64 detection too

2011-02-09  jkbonfield

	* windows/wix/splash.bmp: Correct version number this time
	  (2.0.0b8)

	* windows/wix/splash.bmp: Version number change

2011-02-08  jkbonfield

	* README.build, gap5/gap5.tcl, gap5/tg_index.c, gap5/tg_view.c:
	  Updates to gap5 versions (1.2.11). 1.2.9 was last beta release,
	  but 1.2.10 has been used as several internal interim releases.

2011-02-07  jkbonfield

	* tgap/tg_iface_g.c: Better handling of error case in
	  io_seq_index_query_all()

2011-02-04  jkbonfield

	* tgap/tg_iface_g.c: Added extra paranoia after observing a
	  corrupted database, where another record type got written to aux
	  slot 0 (should be a GDatabase record), despite an apparent check
	  for this with an assert.
	  
	  The cached_item struct holds both a record and a View; a handle
	  to that record. The View in turn has a cache of the aux data for
	  this record, which in turn holds the record number again. Double
	  check that these two are identical so at least we die rather
	  than corrupt
	  (and hopefully help to point out what went wrong if so).

	* README.macosx:

	* gap5/template_display.c: Fixed error in XPutImage macro for
	  windows.

	* tk_utils/tkAquaX.c: Not used, but there incase we wish to restart
	  the aqua port some day.

	* gap5/ng_fb_cmds.tcl: Fixed DB_Load to work with the new file
	  suffixes.

2011-02-03  jkbonfield

	* configure.in: Added check for the Aqua framework version of
	  tcl/tk. These aren't supported currently as we need the X11
	  build of Tk.
	  
	  Rather than accept this at configure time and barf mysteriously
	  mid compile, we now spot the issue and fail early.

	* gap5/template_display.c: Replaced TkPutImage calls with
	  XPutImage and a check for _WIN32 to #define back to TkPutImage.
	  
	  The reason for this is that Windows is the exception here, not
	  vice versa. Plus TkPutImage requires use of the internal
	  tkInt.h, which causes compilation problems on many platforms.

2011-02-02  jkbonfield

	* gap5/editor_search.c: Fixed crash when searching (name, tag
	  type, tag contents) with the editor cursor at the end of the
	  contig. This caused the iterator to
	  (validly) be NULL. I now check.

	* gap5/contig_selector.tcl: Fixed ContigParams to work when
	  CurContig is a contig that has just been removed (eg by joining
	  it to another) and CurContig is specified using the =cnum
	  notation.
	  
	  To trigger the bug before, try:
	  
	  tg_index -z 65536 NT_113898.bam; # produces 1 contig
	  gap5 NT_113898.0 &
	  
	  Break Contig dialogue, pos 1000000, OK
	  [ CurContig is now eg =5]
	  Complement Contig via contig selector popup menu
	  Find Internal Joins
	  "Next" button -> Join editor -> "Join" button
	  [ We now have joined eg contig =5 to contig =581]
	  Complement Contig via contig selector poup menu
	  [ Calls ContigParams with CurContig =5, which crashed. ]

	* tgap/tg_struct.h: Removal of duplicate #define

	* tgap/g-alloc.c: Improvements to the debug program built when
	  using -DHEAP_CHECK. (No affect on gap5.) We now output the
	  object type and compression method used.

	* ChangeLog, NEWS: Updates from svn log

2011-02-01  jkbonfield

	* staden/trunk/doc/manual/dependencies,
	  staden/trunk/doc/manual/gap5-t.texi,
	  staden/trunk/doc/manual/gap5_list_libraries.png,
	  staden/trunk/doc/manual/list_libraries-t.texi,
	  gap5/depth.tcl, gap5/gap5rc_menu_full, gap5/libraries.tcl,
	  tgap/tg_library.c, tgap/tg_tcl.c: Improved List Libraries
	  interface in gap5 and also added it to the
	  documentatiopn. Other minor gap5 doc changes too.

	* tgap/tg_cache.c: Fixed bug where attempting to call
	  cache_rw() in read-only mode would grant access, but then
	  cause a crash later on. It now properly returns NULL.

2011-01-31  jkbonfield

	* staden/trunk/doc/manual/Makefile,
	  staden/trunk/doc/manual/calc_consensus-t.texi,
	  staden/trunk/doc/manual/comparator-t.texi,
	  staden/trunk/doc/manual/contig_selector-t.texi,
	  staden/trunk/doc/manual/find_oligo-t.texi,
	  staden/trunk/doc/manual/gap4-t.texi,
	  staden/trunk/doc/manual/gap4.texi,
	  staden/trunk/doc/manual/gap5-t.texi,
	  staden/trunk/doc/manual/gap5.texi,
	  staden/trunk/doc/manual/gap5_assembly-t.texi,
	  staden/trunk/doc/manual/gap5_break_contig.png,
	  staden/trunk/doc/manual/gap5_contig_editor-t.texi,
	  staden/trunk/doc/manual/gap5_disassembly-t.texi,
	  staden/trunk/doc/manual/gap5_disassembly.png,
	  staden/trunk/doc/manual/gap5_export-t.texi,
	  staden/trunk/doc/manual/gap5_export_sequences.png,
	  staden/trunk/doc/manual/gap5_export_tags.png,
	  staden/trunk/doc/manual/gap5_fij-t.texi,
	  staden/trunk/doc/manual/gap5_find_read_pairs.png,
	  staden/trunk/doc/manual/gap5_read_pairs-t.texi,
	  staden/trunk/doc/manual/gap5_repeats-t.texi,
	  staden/trunk/doc/manual/gap5_rp_comparator.png,
	  staden/trunk/doc/manual/header.m4,
	  staden/trunk/doc/manual/lists-t.texi,
	  staden/trunk/doc/manual/results-t.texi, gap5/break_contig.tcl,
	  gap5/configure.tcl, gap5/contig_editor.tcl, gap5/depth.tcl,
	  gap5/dis_readings.tcl, gap5/editor_search.tcl,
	  gap5/find_oligo.tcl, gap5/find_repeats.tcl,
	  gap5/gap5rc_menu_full, gap5/list_contigs.tcl, gap5/list_proc.tcl,
	  gap5/map_reads.tcl, gap5/ng_fb_cmds.tcl, gap5/qual.tcl,
	  gap5/readpair.tcl, gap5/result_manager.tcl, gap5/search.tcl,
	  gap5/tag_checklist.tcl, gap5/tag_editor.tcl,
	  gap5/template_display.tcl, gap5/trace_display.tcl,
	  tk_utils/help_netscape.tcl: Fixes to gap5 documentation.
	  (Unsure what happened to last commit...)

	* gap5/export_contigs.tcl: Removed BAF output as it's unimplemented
	  atm.

	* gap5/qualIO.c: Implemented get_base_confidences() function at
	  last.

2011-01-28  jkbonfield

	* gap5/contig_editor.tcl: Fixed default colours for contig editor
	  window.

	* gap5/ng_fb_cmds.tcl, gap5/tg_index.c, tgap/g-defs.h,
	  tgap/g-files.c, tgap/tg_iface_g.c: Renamed Gap5 database
	  suffixes. We now have .g5d/.g5x instead of ""/.aux.
	  
	  Also adjusted tg_index to generate a sensible default
	  database name instead of g_db, named after the input
	  filename.

	* gap5/gap.tcl, gap5/gap5, gap5/gap5.tcl: Renamed gap.tcl to
	  gap5.tcl to make sprun.exe work on Windows.

	* gap4/tagdb.c, gap5/tagdb.c: Changed the default tagdb file
	  to GTAGDB. Previously with GTAGDB environ unset it looked in
	  $STADTABL/TAGDB which didn't exist, causing gap4 to die.

	* windows/wix/generate_wxs.pl: Added manual to the startup menu.

2011-01-27  jkbonfield

	* Misc/win_funcs.h, gap5/bam.c, tgap/zfio.c,
	  tk_utils/text_output.c: Minor updates to remove warnings under
	  Windows.

	* Misc/os.h, Misc/win_funcs.h: Enabled large file support when
	  building under mingw. Tested on a 32-bit vista
	  system, but we need to verify these defines are needed when
	  building on a
	  native 64bit system.

	* windows/wix/generate_wxs.pl: Improved handling of file
	  associations.

	* gap5/tk-io-reg.c: Removed bizarre memset of regs in the
	  tk_contig_deregister function. It was overflowing the struct
	  and corrupting memory.

2011-01-26  jkbonfield

	* windows/run/main.cpp, windows/wix/README, windows/wix/banner.bmp,
	  windows/wix/generate_wxs.pl, windows/wix/splash.bmp,
	  windows/wix/staden.wxs, windows/wix/ui.wxi: More windows tweaks,
	  this time for the installer.
	  
	  Upgraded the wix generation code to work with the latest WiX
	  release (3.5).

2011-01-25  jkbonfield

	* tgap/tg_iface_g.c: Reversed earlier change to i32 data type
	  (int to uint). It's meant to be signed due to the older
	  range format. This was an error in the past (and has already
	  been fixed for newer format databases), but we can't just
	  fix the datatype to remove compiler warnings without doing
	  more work as we introduce decoding bugs.

	* gap5/template_draw.h, staden_config.h.in: Report back to unix.
	  Required inttypes.h added after the previous
	  change from u_int32_t to uint32_t.

	* Misc/Makefile, Misc/getfile.c, Misc/os.h, Misc/win_funcs.c,
	  Misc/win_funcs.h, ac_stubs/ax_lib_curses.m4,
	  ac_stubs/ax_lib_lzma.m4, ac_stubs/ax_lib_png.m4,
	  ac_stubs/ax_lib_zlib.m4, configure.in, copy_reads/copy_reads,
	  gap4/IO.c, gap4/gap4, gap5/contig_editor.tcl, gap5/depth_track.c,
	  gap5/gap5, gap5/gap5_consensus, gap5/gap5_export,
	  gap5/template_display.c, gap5/template_draw.c,
	  gap5/template_draw.h, gap5/tg_index, gap5/tg_view,
	  gap5/tg_view.c, prefinish/prefinish, pregap4/pregap4, spin/spin,
	  spin_emboss/create_emboss_files, staden_config.h.in,
	  system.mk.in, tgap/zfio.c, tk_utils/Makefile, trev/trev: Windows
	  port - misc and minor edits mainly.

	* gap5/tg_view.c: Removed incorrect cache_decr calls.

2011-01-19  jkbonfield

	* Misc/dstring.c, Misc/dstring.h, Misc/error.c, Misc/error.h,
	  Misc/misc.h, Misc/vlen.c, Misc/vlen.h, gap4/gap-error.c,
	  gap4/gap-error.h, gap4/gap_hash.c, gap4/tkEditor.c,
	  gap5/cs-object.h, gap5/dis_readings.c, gap5/do_fij.c, gap5/fij.c,
	  gap5/find_oligo.c, gap5/find_repeats.c, gap5/gap-error.c,
	  gap5/gap-error.h, gap5/gap_hash.c, gap5/newgap5_cmds.c,
	  gap5/qual.c, gap5/qualIO.c, gap5/readpair.c, gap5/tk-io-reg.c,
	  gap5/tkEditor.c, polyA_clip/seqInfo.c, polyA_clip/seqInfo.h,
	  qclip/seqInfo.c, qclip/seqInfo.h, text_utils/text_output.h,
	  text_utils/text_output_stubs.c, tk_utils/tcl_utils.c,
	  tk_utils/tcl_utils.h, tk_utils/text_output.c,
	  tk_utils/text_output.h: Added gcc printf format checking via
	  __attribute__ (if using gcc).
	  This spotted a myriad of minor bugs (mostly in error handling
	  code), even including some 10+ years old. Now fixed.

2011-01-18  jkbonfield

	* gap5/bam.c, gap5/bam.h, gap5/sam_index.c, gap5/sam_pileup.c,
	  tgap/tg_iface_g.c: Minor signed vs unsigned changes to prevent
	  compiler warnings.

	* ac_stubs/ax_lib_staden_io_lib.m4: Extra checks for header files,
	  incase we have io_lib-config but no headers installed

	* gap5/bam.c: Bug fixed endianness reversal code after testing on a
	  PowerPC iMac.

	* tgap/g-files.c: Rearranged code to remove (incorrect?) gcc
	  warning on gcc 3.3

2011-01-17  jkbonfield

	* gap5/dis_readings.c: Bug fix to disassemble readings with
	  the "remove reads from database" option. The order of this
	  is critical to not produce errors and abort early, which it
	  was doing. Also since the addition of a proper bin removal
	  system the r->rec == s->rec assert could be hit; we now only
	  perform this section if the bin index hasn't already been
	  updated to be BIN_RANGE_UNUSED.

	* gap5/assemble_single.tcl, gap5/gap5rc,
	  gap5/gap5rc_menu_full, gap5/newgap5_cmds.c, gap5/tclIndex:
	  Added a basic GUI to support import of fasta/fastq files
	  (equiv to tg_index -a foo.fasta).

	* gap5/fasta.c: Bug fix to fasta parsing

	* gap5/fasta.c: Bug fix to fasta parsing

2011-01-14  jkbonfield

	* seq_utils/sequence_formats.h: Fixed potential single byte
	  buffer overflow in parse_feat(). On all mainstream platforms
	  the single byte coincides with structure padding so it had
	  nil effect anyway.

	* gap5/Makefile, gap5/fasta.c, gap5/tg_index.c,
	  gap5/tg_index_common.c, tgap/zfio.c, tgap/zfio.h: Added
	  fasta and fastq reading code to tg_index. It just creates
	  single read contigs, but this can be useful for pulling in
	  consensus sequences or a few finishing reads with the aim to
	  then searches for matches within gap5.

	* Misc/misc.h, convert/gapDB.c, convert/list.h,
	  copy_reads/copy_reads.c, eba/qual.c, gap4/assemble_direct.c,
	  gap4/clones.c, gap4/oligo.c, gap4/shuffle_pads.c,
	  gap4/tman_cons.c, gap4/tman_diff.c, gap4/tman_interface.c,
	  gap5/ace.c, gap5/bam.c, gap5/editor_join.c, gap5/editor_search.c,
	  gap5/find_oligo.c, gap5/import_gff.c, gap5/readpair.c,
	  gap5/sam_index.c, gap5/tg_index.c, gap5/tg_index_common.c,
	  gap5/tman_interface.c, get_scf_field/get_scf_field.c,
	  haplo/haplo_snps.c, hetins/hetins.c, make_weights/make_weights.c,
	  prefinish/finish_pcr.c, primer3/src/dpal.c,
	  primer3/src/primer3_lib.c, screen_seq/screen_seq.c,
	  seq_utils/align_lib.c, seq_utils/filter_words.c,
	  seq_utils/renz_utils.c, spin/nip_splice_search.c,
	  spin/seq_plot_funcs.c, spin/seq_raster.c, spin/seqed_write.c,
	  spin/sim.c, spin/sip_find_identity.c, spin/splice_search.c,
	  spin/tkSeqed.c, spin/trna_search.c, stops/stops.c,
	  tgap/g-alloc.c, tgap/tg_anno.c, tgap/tg_bin.c, tgap/tg_cache.c,
	  tgap/tg_contig.c, tgap/tg_sequence.c, vector_clip/vector_clip.c:
	  Many updates to fix gcc warnings.
	  
	  - Removal of type punned casts to resolve strict aliasing
	  problems.
	  
	  - Initialising more variables to avoid "may be used
	  uninitialised" warnings. Note most of these are invalid gcc
	  warnings, but a few cases are real when faced with invalid
	  data or abnormal errors.

	* gap5/export_contigs.c: Bug fix to export SAM format. When
	  outputting aux fields (if stored in gap5) we were missing a
	  tab before the first aux record.

	* convert/main.c: Bug fix to rev 2344: replacing gets by fgets
	  isn't the whole story. I now also remove the \n which is
	  left in by fgets but removed by gets.

2011-01-13  jkbonfield

	* gap4/confidence_graph.c, gap4/gap-error.c, gap5/gap-error.c,
	  prefinish/finish_hash.c, tgap/tg_cache.c: More minor warning
	  removal - mostly around string literals.

	* convert/main.c: Replaced use of gets by fgets. Not that it
	  matters much in such old
	  code, but I'm on a roll with warning removal.

	* Misc/parse_db.c, seq_utils/align_lib.c: Added initialisations to
	  variables to remove compiler warnings about
	  "may be used uninitialised". The compiler is wrong, but this
	  keeps
	  things happy.

	* Misc/misc.h, Misc/vlen.c, Misc/vlen.h, mutlib/sp_align_lib.cpp,
	  text_utils/text_output.h, tgap/misc.h, tk_utils/misc.c,
	  tk_utils/text_output.c, tk_utils/text_output.h: Added const to
	  various functions. By no means is this all, but it's
	  the ones we're passing string constants into, eg
	  vmessage("foobar"),
	  which with gcc 4.5 now emits warnings about removing const from
	  string
	  literal.

	* Misc/Makefile, copy_reads/Makefile, gap4/Makefile, gap5/Makefile,
	  polyA_clip/Makefile, prefinish/Makefile, spin/Makefile,
	  tgap/Makefile, tk_utils/Makefile: Updates from 'make depend'

2011-01-12  jkbonfield

	* seq_utils/filter_words.c: Fixed potential (but rare) buffer
	  overflow

	* mutlib/tracealign_helper.cpp: Fixed transposed memset arguments
	  (thank you gcc!)

2011-01-07  jkbonfield

	* tk_utils/user_defaults.tcl: Fix to make this work on MacOS
	  X. I'm not sure on the cause of bdir not ending in a /, but
	  by ensuring it is so we now find the libraries correctly.

	* configure.in: Bug fix to previous itcl* changes

	* README.build, configure.in: Made itcl/itk/iwidgets optional

	* tk_utils/xcombobox.tcl: Added -command option for ttk::combobox
	  version

	* spin/comborange.tcl: Bugfix with xcombobox -text vs -label

	* spin/nip_translation.tcl: Removal of debugging info

	* spin_emboss/acd2tcl.tcl,
	  spin_emboss/acdtcl/aaindexextract.acd,
	  spin_emboss/acdtcl/abiview.acd,
	  spin_emboss/acdtcl/ajbad.acd,
	  spin_emboss/acdtcl/ajfeatest.acd,
	  spin_emboss/acdtcl/ajtest.acd,
	  spin_emboss/acdtcl/antigenic.acd,
	  spin_emboss/acdtcl/backtranseq.acd,
	  spin_emboss/acdtcl/banana.acd,
	  spin_emboss/acdtcl/biosed.acd,
	  spin_emboss/acdtcl/btwisted.acd, spin_emboss/acdtcl/cai.acd,
	  spin_emboss/acdtcl/chaos.acd, spin_emboss/acdtcl/charge.acd,
	  spin_emboss/acdtcl/checktrans.acd,
	  spin_emboss/acdtcl/chips.acd, spin_emboss/acdtcl/cirdna.acd,
	  spin_emboss/acdtcl/codcmp.acd,
	  spin_emboss/acdtcl/coderet.acd,
	  spin_emboss/acdtcl/complex.acd,
	  spin_emboss/acdtcl/compseq.acd, spin_emboss/acdtcl/cons.acd,
	  spin_emboss/acdtcl/contacts.acd,
	  spin_emboss/acdtcl/corbatest.acd,
	  spin_emboss/acdtcl/cpgplot.acd,
	  spin_emboss/acdtcl/cpgreport.acd,
	  spin_emboss/acdtcl/cusp.acd,
	  spin_emboss/acdtcl/cutgextract.acd,
	  spin_emboss/acdtcl/cutseq.acd, spin_emboss/acdtcl/dan.acd,
	  spin_emboss/acdtcl/dbiblast.acd,
	  spin_emboss/acdtcl/dbifasta.acd,
	  spin_emboss/acdtcl/dbiflat.acd,
	  spin_emboss/acdtcl/dbigcg.acd,
	  spin_emboss/acdtcl/degapseq.acd,
	  spin_emboss/acdtcl/demoalign.acd,
	  spin_emboss/acdtcl/demofeatures.acd,
	  spin_emboss/acdtcl/demolist.acd,
	  spin_emboss/acdtcl/demoreport.acd,
	  spin_emboss/acdtcl/demosequence.acd,
	  spin_emboss/acdtcl/demostring.acd,
	  spin_emboss/acdtcl/demotable.acd,
	  spin_emboss/acdtcl/descseq.acd,
	  spin_emboss/acdtcl/diffseq.acd,
	  spin_emboss/acdtcl/digest.acd,
	  spin_emboss/acdtcl/distmat.acd,
	  spin_emboss/acdtcl/domainer.acd,
	  spin_emboss/acdtcl/dotmatcher.acd,
	  spin_emboss/acdtcl/dotpath.acd,
	  spin_emboss/acdtcl/dottup.acd, spin_emboss/acdtcl/dreg.acd,
	  spin_emboss/acdtcl/einverted.acd,
	  spin_emboss/acdtcl/embossdata.acd,
	  spin_emboss/acdtcl/embossversion.acd,
	  spin_emboss/acdtcl/emma.acd, spin_emboss/acdtcl/emowse.acd,
	  spin_emboss/acdtcl/entrails.acd,
	  spin_emboss/acdtcl/entret.acd,
	  spin_emboss/acdtcl/epestfind.acd,
	  spin_emboss/acdtcl/eprimer3.acd,
	  spin_emboss/acdtcl/equicktandem.acd,
	  spin_emboss/acdtcl/est2genome.acd,
	  spin_emboss/acdtcl/etandem.acd,
	  spin_emboss/acdtcl/extractfeat.acd,
	  spin_emboss/acdtcl/extractseq.acd,
	  spin_emboss/acdtcl/findkm.acd,
	  spin_emboss/acdtcl/fraggle.acd,
	  spin_emboss/acdtcl/freak.acd, spin_emboss/acdtcl/funky.acd,
	  spin_emboss/acdtcl/fuzznuc.acd,
	  spin_emboss/acdtcl/fuzzpro.acd,
	  spin_emboss/acdtcl/fuzztran.acd,
	  spin_emboss/acdtcl/garnier.acd,
	  spin_emboss/acdtcl/geecee.acd,
	  spin_emboss/acdtcl/getorf.acd,
	  spin_emboss/acdtcl/helixturnhelix.acd,
	  spin_emboss/acdtcl/hetparse.acd,
	  spin_emboss/acdtcl/histogramtest.acd,
	  spin_emboss/acdtcl/hmmgen.acd,
	  spin_emboss/acdtcl/hmoment.acd, spin_emboss/acdtcl/iep.acd,
	  spin_emboss/acdtcl/infoalign.acd,
	  spin_emboss/acdtcl/infoseq.acd,
	  spin_emboss/acdtcl/interface.acd,
	  spin_emboss/acdtcl/isochore.acd,
	  spin_emboss/acdtcl/lindna.acd,
	  spin_emboss/acdtcl/listor.acd,
	  spin_emboss/acdtcl/marscan.acd,
	  spin_emboss/acdtcl/maskfeat.acd,
	  spin_emboss/acdtcl/maskseq.acd,
	  spin_emboss/acdtcl/matcher.acd,
	  spin_emboss/acdtcl/megamerger.acd,
	  spin_emboss/acdtcl/merger.acd, spin_emboss/acdtcl/msbar.acd,
	  spin_emboss/acdtcl/mwcontam.acd,
	  spin_emboss/acdtcl/mwfilter.acd,
	  spin_emboss/acdtcl/needle.acd,
	  spin_emboss/acdtcl/newcoils.acd,
	  spin_emboss/acdtcl/newcpgreport.acd,
	  spin_emboss/acdtcl/newcpgseek.acd,
	  spin_emboss/acdtcl/newseq.acd,
	  spin_emboss/acdtcl/noreturn.acd,
	  spin_emboss/acdtcl/notseq.acd,
	  spin_emboss/acdtcl/nthseq.acd,
	  spin_emboss/acdtcl/octanol.acd,
	  spin_emboss/acdtcl/oddcomp.acd,
	  spin_emboss/acdtcl/palindrome.acd,
	  spin_emboss/acdtcl/pasteseq.acd,
	  spin_emboss/acdtcl/patmatdb.acd,
	  spin_emboss/acdtcl/patmatmotifs.acd,
	  spin_emboss/acdtcl/patmattest.acd,
	  spin_emboss/acdtcl/pdbparse.acd,
	  spin_emboss/acdtcl/pdbtosp.acd,
	  spin_emboss/acdtcl/pepcoil.acd,
	  spin_emboss/acdtcl/pepinfo.acd,
	  spin_emboss/acdtcl/pepnet.acd,
	  spin_emboss/acdtcl/pepstats.acd,
	  spin_emboss/acdtcl/pepwheel.acd,
	  spin_emboss/acdtcl/pepwindow.acd,
	  spin_emboss/acdtcl/pepwindowall.acd,
	  spin_emboss/acdtcl/plotcon.acd,
	  spin_emboss/acdtcl/plotorf.acd,
	  spin_emboss/acdtcl/polydot.acd, spin_emboss/acdtcl/preg.acd,
	  spin_emboss/acdtcl/prettyplot.acd,
	  spin_emboss/acdtcl/prettyseq.acd,
	  spin_emboss/acdtcl/prima.acd,
	  spin_emboss/acdtcl/primers.acd,
	  spin_emboss/acdtcl/primersearch.acd,
	  spin_emboss/acdtcl/printsextract.acd,
	  spin_emboss/acdtcl/profgen.acd,
	  spin_emboss/acdtcl/profit.acd,
	  spin_emboss/acdtcl/prophecy.acd,
	  spin_emboss/acdtcl/prophet.acd,
	  spin_emboss/acdtcl/prosextract.acd,
	  spin_emboss/acdtcl/pscan.acd, spin_emboss/acdtcl/qatest.acd,
	  spin_emboss/acdtcl/qatestcalcfeat.acd,
	  spin_emboss/acdtcl/qatestcalcregexp.acd,
	  spin_emboss/acdtcl/qatestcalcseq.acd,
	  spin_emboss/acdtcl/qatestcalcseqall.acd,
	  spin_emboss/acdtcl/qatestcalcseqset.acd,
	  spin_emboss/acdtcl/qatestcalcstring.acd,
	  spin_emboss/acdtcl/rebaseextract.acd,
	  spin_emboss/acdtcl/recoder.acd,
	  spin_emboss/acdtcl/redata.acd, spin_emboss/acdtcl/remap.acd,
	  spin_emboss/acdtcl/restover.acd,
	  spin_emboss/acdtcl/restrict.acd,
	  spin_emboss/acdtcl/revseq.acd,
	  spin_emboss/acdtcl/scopalign.acd,
	  spin_emboss/acdtcl/scopnr.acd,
	  spin_emboss/acdtcl/scopparse.acd,
	  spin_emboss/acdtcl/scoprep.acd,
	  spin_emboss/acdtcl/scopreso.acd,
	  spin_emboss/acdtcl/scopseqs.acd,
	  spin_emboss/acdtcl/seealso.acd,
	  spin_emboss/acdtcl/seqalign.acd,
	  spin_emboss/acdtcl/seqinfo.acd,
	  spin_emboss/acdtcl/seqmatchall.acd,
	  spin_emboss/acdtcl/seqnr.acd, spin_emboss/acdtcl/seqret.acd,
	  spin_emboss/acdtcl/seqretall.acd,
	  spin_emboss/acdtcl/seqretallfeat.acd,
	  spin_emboss/acdtcl/seqretset.acd,
	  spin_emboss/acdtcl/seqretsingle.acd,
	  spin_emboss/acdtcl/seqretsplit.acd,
	  spin_emboss/acdtcl/seqrettype.acd,
	  spin_emboss/acdtcl/seqsearch.acd,
	  spin_emboss/acdtcl/seqsort.acd,
	  spin_emboss/acdtcl/seqwords.acd,
	  spin_emboss/acdtcl/showalign.acd,
	  spin_emboss/acdtcl/showdb.acd,
	  spin_emboss/acdtcl/showfeat.acd,
	  spin_emboss/acdtcl/showorf.acd,
	  spin_emboss/acdtcl/showseq.acd,
	  spin_emboss/acdtcl/shuffleseq.acd,
	  spin_emboss/acdtcl/sigcleave.acd,
	  spin_emboss/acdtcl/siggen.acd,
	  spin_emboss/acdtcl/sigplot.acd,
	  spin_emboss/acdtcl/sigscan.acd,
	  spin_emboss/acdtcl/silent.acd, spin_emboss/acdtcl/sirna.acd,
	  spin_emboss/acdtcl/sixpack.acd,
	  spin_emboss/acdtcl/skipseq.acd,
	  spin_emboss/acdtcl/splitter.acd,
	  spin_emboss/acdtcl/stretcher.acd,
	  spin_emboss/acdtcl/stssearch.acd,
	  spin_emboss/acdtcl/supermatcher.acd,
	  spin_emboss/acdtcl/syco.acd, spin_emboss/acdtcl/tclIndex,
	  spin_emboss/acdtcl/tcode.acd,
	  spin_emboss/acdtcl/testplot.acd,
	  spin_emboss/acdtcl/textsearch.acd,
	  spin_emboss/acdtcl/tfextract.acd,
	  spin_emboss/acdtcl/tfm.acd, spin_emboss/acdtcl/tfscan.acd,
	  spin_emboss/acdtcl/tmap.acd,
	  spin_emboss/acdtcl/tranalign.acd,
	  spin_emboss/acdtcl/transeq.acd,
	  spin_emboss/acdtcl/treetypedisplay.acd,
	  spin_emboss/acdtcl/trimest.acd,
	  spin_emboss/acdtcl/trimseq.acd,
	  spin_emboss/acdtcl/twofeat.acd,
	  spin_emboss/acdtcl/union.acd,
	  spin_emboss/acdtcl/vectorstrip.acd,
	  spin_emboss/acdtcl/water.acd,
	  spin_emboss/acdtcl/whichdb.acd,
	  spin_emboss/acdtcl/wobble.acd,
	  spin_emboss/acdtcl/wordcount.acd,
	  spin_emboss/acdtcl/wordmatch.acd,
	  spin_emboss/acdtcl/wossname.acd,
	  spin_emboss/acdtcl/yank.acd,
	  spin_emboss/create_emboss_files.tcl, spin_emboss/tclIndex:
	  Removed the Tcl generated from .acd files and instead made
	  the tclIndex auto-generate them as needed. The
	  create_emboss_files program may still be used to create and
	  save them though if desired.

2011-01-07  awhitwham

	* gap5/sam_index.c: Removed line causing double free.

2011-01-06  jkbonfield

	* gap4/gap_prefinish.tcl: Added a error window to cope with
	  Iwidgets package possibly being
	  absent.
	  
	  When it is absent, we simply warn the user that the
	  prefinish GUI is unavailable. This is a reasonable
	  alternative to completely rewriting it to avoid itcl (which
	  is non-trivial).

	* gap4/tag_editor.tcl: Removal of debugging output

	* gap4/acd2tag.tcl, gap5/contig_editor.tcl,
	  spin/comborange.tcl, spin_emboss/acd2tcl.tcl,
	  spin_emboss/emboss_utils.tcl, tk_utils/tclIndex,
	  tk_utils/xcombo.tcl, tk_utils/xcombobox.tcl: Replaced a
	  hacky xcombo with a proper mega-widget implementation of
	  xcombobox, which uses either native tk 8.4 or the
	  ttk::combobox from tk8.5.
	  
	  Rewrote the acd2tcl (and derived acd2tag) code to remove all
	  iwidgets uses.

2011-01-05  jkbonfield

	* pregap4/gui.tcl, pregap4/pregap4.tcl, spin/Makefile,
	  spin/comborange.itk, spin/comborange.tcl, spin/dataentry.itk,
	  spin/dataentry.tcl, spin/nip_translation.tcl,
	  spin/nip_trna_search.c, spin/orientedradiobox.itk,
	  spin/radioboxn.itk, spin/seq_id.tcl, spin/seqentry.tcl,
	  spin/sequence_manager.tcl, spin/sip_similar_spans.tcl,
	  spin/spin.tcl, spin/spinrange.itk, spin/spinrc, spin/tclIndex,
	  spin/twinnedrange.itk: Removal of itcl/itk/iwidgets dependencies
	  for pregap4 and spin.
	  
	  Tested on Tcl8.4, but if 8.5 is present we'll use some of those
	  ttk widgets in preference (specifically ttk:notebook for now).

	* tk_utils/init.tcl, tk_utils/tabnotebook.tcl, tk_utils/tclIndex,
	  tk_utils/xcombo.tcl, tk_utils/xentry.tcl,
	  tk_utils/xfilebrowser.tcl, tk_utils/xget_fname.tcl,
	  tk_utils/xradiobox.tcl, tk_utils/xscrolledlistbox.tcl,
	  tk_utils/xscrolledtext.tcl, tk_utils/xspinbox.tcl,
	  tk_utils/xtwinspin.tcl: Added various new mega-widgets and
	  tweaked existing ones.
	  
	  This is part of a larger goal to totally remove any dependency on
	  incrtcl, incrtk and incrwidgets.

	* tk_utils/tk_utilsrc: Minor font changes for MacOS X

	* gap5/depth.tcl: Use canvas "-dash -.." instead of the
	  numeric equivalent "-dash {6 4 2 4 2 4}". I've no idea why
	  this matters, but it fixes a crash in the MacOS Tk
	  implementation (or X libraries?).

	* tgap/tg_iface_g.c: Improved handling of HAVE_LIBLZMA macro for
	  when lzma isn't found by autoconf

	* copy_reads/copy_reads.c, gap4/init.c, gap5/init.c,
	  haplo/haplo_tcl.c, prefinish/finish.c, spin/seq_reg_cmds.c,
	  tgap/tg_tcl.c, tk_utils/init.c: Added Unload and SafeUnload
	  tcl init functions. These aren't used by our code, but Tcl
	  looks for them on load and the MacOS X symbol table querying
	  library seems to spit out unsightly error messages.

2010-12-16  jkbonfield

	* gap5/cs-object.h: Bug fixed FIJ.
	  
	  After adding find read pairs I chanegd the size of some
	  structures, but forgot to make obj_fij the same size. I
	  should be using a union instead, but it's nastily coded with
	  casting (supposedly) compatible data structs.

2010-12-15  awhitwham

	* find_renz/Makefile, gap4/Makefile: Added explicit io_lib links
	  for Centos compilation.

	* make_weights/Makefile: Added an explicit link to io_lib.
	  Centos-5.5 seems to prefer it this way.

	* gap5/caf.c: Cosmetic file changes.

2010-12-13  awhitwham

	* gap5/tg_index_common.c, gap5/tg_index_common.h: Replaced the
	  useful, but non-standard, getline with one of my own making.

2010-12-09  awhitwham

	* Misc/string_alloc.c: Removed the size limitations to make it more
	  flexible.

2010-12-08  awhitwham

	* gap5/ace.c, gap5/baf.c, gap5/caf.c, gap5/maq.c, gap5/sam_index.c,
	  gap5/tg_index.c, gap5/tg_index.h, gap5/tg_index_common.c,
	  gap5/tg_index_common.h: Added a -q option to tg_index to limit
	  the amount of unpaired reads held in memory. This should
	  significantly reduce the memory usage of tg_index at the cost of
	  longer running times.

	* tgap/hache_table.c, tgap/hache_table.h: Added a table empty
	  function to remove all data but keep the data structures in
	  place.

2010-12-02  jkbonfield

	* gap4/gap-tcl.c: Added io_read_array and io_write_array Tcl
	  commands. These also copy to the internal cached copies of
	  arrays if the record number matches.
	  
	  The purpose is to ease implementation of code to reorder
	  contigs at the scripting level.

2010-12-01  jkbonfield

	* tgap/tg_bin.c, tgap/tg_cache.c, tgap/tg_gio.h: Removed a
	  reference count leak (which looks like a memory leak, but
	  isn't traceable by valgrind) in the bin_for_range() function.
	  
	  Also added extra cache leak detection code. This can be enabled
	  by adding -DCACHE_REF_DEBUG to the CFLAGS in system.mk and
	  recompiling
	  everything.

	* gap5/sam_index.c, gap5/sam_pileup.c, gap5/tg_index_common.c:
	  Various minor memory leaks fixed

2010-11-30  jkbonfield

	* gap5/tg_index.c: Added a cache_flush call while indexing
	  read names. This resolves excessive memory using during
	  tg_index -t on large data sets.

2010-11-29  jkbonfield

	* gap5/cs-object.h, gap5/gap5rc, gap5/newgap5_cmds.c,
	  gap5/newgap_structs.h, gap5/readpair.c, gap5/readpair.h,
	  gap5/readpair.tcl: Added a minimum mapping quality filter to the
	  Find Read Pairs plot.

2010-11-29  awhitwham

	* gap4/newgap_cmds.c: Removed header include.

2010-11-29  jkbonfield

	* gap5/bam.c, gap5/bam.h: Forgot to add these with previous commit.
	  
	  Reimplementation of portions of samtools library for use in new
	  pileup code.s

2010-11-26  jkbonfield

	* gap5/editor_view.c: When displaying tags we now draw a box
	  around bases that have multiple tags on them, so it's visually
	  obvious there is more information available than the top-most
	  one being displayed.

	* gap5/caf.c, gap5/export_contigs.c, tgap/tg_library.c,
	  tgap/tg_library.h: Improvements to the CAF import and export.
	  
	  - We now use the CAF Ligation_no line (or Insert_size if not
	  present) to generate a library for each sequence record. These
	  records get output again too when using export sequences.
	  
	  - The library handling code has been improved to automatically
	  compute mean and standard deviations.
	  
	  - On export, "-" now gets converted to "N" correctly instead of
	  being interpreted as a pad.
	  
	  - Now exports consensus tags too.

2010-11-25  jkbonfield

	* gap5/contig_editor.tcl: 3 minor changes to the contig editor.
	  - We now create primer tags with the oligo name earlier in the
	  tag and the sequence later. This helps the editor status line
	  contain more useful information.
	  
	  - The editor status line now replaces multiple spaces and tabs
	  with a single space, in order to reduce horizontal space. It
	  also no longer lists newlines as "\n" but "//" instead, hoping
	  that this is more indicative of a break in data that an escaped
	  newline symbol.
	  
	  - Names are cut (for pasting) with the left mouse button now as
	  well as the middle.

	* gap5/tg_index.c: Made name indexing the default now; use -T to
	  disable.

	* tgap/tg_bin.c: Fixed a bug in the adding items to bins. The
	  delayed increment of the number of sequences in a bin could
	  corrupt memory and/or crash if the cached last_bin value pointed
	  to a bin object which has been purged from the cache.
	  
	  Rather than increment the reference count to block this, we now
	  just cache the record number and look up the bin as and when
	  needed.

	* tgap/tg_tcl.c: Fixed library insert size data - previously we
	  were dividing by 100, but this was a misunderstanding between
	  in-memory and on-disk formats.

	* gap4/dbcheck.c: Grammar fix in error message

2010-11-24  jkbonfield

	* gap4/newgap_cmds.c, gap5/Makefile, gap5/gap5rc,
	  gap5/gap5rc_menu_full, gap5/newgap5_cmds.c,
	  gap5/newgap_structs.h, gap5/readpair.c, gap5/readpair.h,
	  gap5/readpair.tcl: Added "Find Read Pairs" first draft.
	  
	  This supports plotting read-pairs using all vs all, all vs end
	  and end vs end search modes.

	* gap5/contig_editor.tcl: Fixed a bug with highlighting reading
	  names when we start making the selection from outside a reading
	  name.

	* gap5/consensus.c: Removed small memory leak

2010-11-19  jkbonfield

	* gap5/sam_pileup.c: Append new sequences to the end of the pileup
	  list instead of the start, effectively reversing the order of
	  data within columns.
	  
	  This now means we add data in the same order as the old tg_index
	  and the same order as viewed within samtools tview.

	* gap4/GTAGDB, gap5/import_gff.c: Bug fix to gap5 import_gff
	  function.
	  
	  Added generic GFF tags for lines with "colour=<0-17>" to match
	  up with those used in Artemis.

2010-11-18  jkbonfield

	* configure.in, gap5/Makefile, gap5/docs/TODO,
	  gap5/newgap5_cmds.c, gap5/sam_index.c, gap5/sam_index.h,
	  gap5/sam_index2.c, gap5/sam_pileup.c, gap5/sam_pileup.h,
	  gap5/tg_index.c, staden_config.h.in, system.mk.in: Major update
	  of bam/sam reading code. We no longer have any dependency on the
	  samtools package, instead rewriting the bam/sam reading code and
	  the pileup code ourselves. This has several consequences.
	  
	  - BAM/SAM reading should be slightly faster in most cases, and
	  considerably faster in highly padded regions.
	  
	  - Cases of deletions immediately following insertions in CIGAR
	  strings will now produce the correct alignments.
	  
	  - No need for --with-samtools in configure scripts and the need
	  to recompile samtools with -fPIC.
	  
	  - Support for gzipped SAM files.

	* gap5/depad_seq_tree.c: Bug fix in get_padded_coord(). When
	  asking for a coordinate beyond the last pad we were just
	  returning the unpadded value rather than the using the unpadded
	  distance since the last known pad.

2010-11-16  jkbonfield

	* gap5/sam_pileup.c: Minor reformatting of append_int()

2010-10-29  jkbonfield

	* tgap/tg_iface_g.c: Improved error checking to handle cases of
	  running out of disk space.  We make sure we never flush any
	  changes like this now, instead either reporting an error or just
	  plain aborting. (Not ideal, but 100% better than corrupting the
	  database.)

2010-10-28  jkbonfield

	* gap5/sam_index2.c, gap5/sam_pileup.c, gap5/sam_pileup.h: A work
	  in progress and currently not linked in.  These implement an
	  alternative pileup interface to using samtool's own pileup
	  code. It's both faster and less buggy (it handles neighbouring
	  insertions and deletions), but also less complete at current in
	  that it doesn't deal with tg_index -g.

	* gap4/auto_break.c, gap4/find_oligo.c, gap4/join.c,
	  gap5/break_contig.c, gap5/caf.c, gap5/consensus.c,
	  gap5/contig_selector.c, gap5/dis_readings.c, gap5/editor_join.c,
	  gap5/export_contigs.c, gap5/find_oligo.c, gap5/import_gff.c,
	  gap5/qual.c, gap5/template_draw.c, gap5/tg_index_common.c,
	  gap5/tman_interface.c, primer3/src/oligotm.c,
	  spin/seq_plot_funcs.c, tgap/g-request.c, tgap/tg_contig.c,
	  tgap/tg_register.c, tgap/tg_tcl.c, tk_utils/tkTraceDisp.c: More
	  code tidy ups: appropriately dealt with unused variables and
	  functions.

	* configure.in, gap5/docs/TODO, gap5/gap.tcl, gap5/tg_index.c,
	  gap5/tg_view.c: Various updates preparing for new release -
	  version number changes and
	  the like.

	* gap4/edUtils2.c, gap5/editor_join.c, gap5/editor_search.c,
	  gap5/tkEditor.c, gap5/tman_display.c, gap5/tman_interface.c,
	  polyA_clip/seqInfo.c, seq_utils/align_sv.c,
	  seq_utils/dna_utils.c, seq_utils/genetic_code.c, spin/init.c,
	  spin/seqed.c, spin/seqed_restriction_enzymes.c,
	  spin/seqed_search.c, spin/seqed_translate.c, spin/seqed_write.c,
	  spin/tkSeqed.c, spin/tkSeqedNames.c, spin/tkSeqedUtils.c,
	  tgap/tg_iface.h, tgap/tg_library.c, tgap/tg_tcl.c,
	  tk_utils/sheet.c, tk_utils/tkSheet.c: Remove various (harmless)
	  compiler warnings.

2010-10-27  jkbonfield

	* ChangeLog, NEWS: Preparation for 2.0.0b8 (internal test version)

	* gap5/baf.c, gap5/caf.c, gap5/consensus.c, gap5/dis_readings.c,
	  gap5/import_gff.c, gap5/sam_index.c, gap5/tg_index.c,
	  gap5/tg_index_common.c, tgap/tg_anno.c, tgap/tg_bin.c,
	  tgap/tg_bin.h, tgap/tg_sequence.c, tgap/tg_tcl.c:
	  bin_add_range() now has the option of grouping up calls to
	  bin_incr_nseq to increment once for all items in the bin rather
	  than once for every item.
	  
	  This dramatically reduces the number of calls to bin_incr_nseq,
	  sometimes speeding up import by 10% or so.

2010-10-25  jkbonfield

	* gap5/tg_index.c, tgap/tg_iface_g.c: Added -1 to -9 parameters to
	  tg_index to allow manual control over the
	  compression levels used.

	* tgap/hache_table.h: Remove external prototypes for Hache*
	  functions.

	* tgap/hache_table.c: Optimisation of the hashing code for keys of
	  length 16. These are the dominant keys in Gap5 due to
	  cache_serch and cache_key_t. Also made the hash functions static
	  to permit better inlining.

	* tgap/g-request.c: Consider record 0 to be non-free as well as
	  G_NO_REC. Fixes data corruption where free_record could become 0
	  and then cause overwrite of the GDatabase record.

	* gap5/editor_view.c: Protect against regions of zero depth in
	  edview_row_for_item(). This function previously crashed.

2010-10-19  jkbonfield

	* tgap/tg_iface_g.c: Added assertions to block attempts to write
	  to record 0 (which should only ever be a GDatabase record).

	* gap5/fast2sam:

	* gap5/docs/UNPADDED, gap5/docs/wishlist.txt: Added missing docs

	* README.fedora8, README.macosx, staden.login: Added
	  inconsequential missing files. (Not for distrib, just svn
	  purposes.)

	* tgap/tg_iface_g.c: 32-bit vs 64-bit fix for bin ranges.

2010-10-07  awhitwham

	* gap4/notedb.h, gap4/tagdb.h, gap5/notedb.h, gap5/tagdb.h,
	  seqed/feature_colour.h, seqed/tagdb.h, spin2/feature_selector.h,
	  tk_utils/intrinsic_type.h, tk_utils/sheet.h: Removed dependency
	  on Xintrinsic.h. Use local definitions now.

2010-10-07  jkbonfield

	* gap5/gap.tcl: Correct "gap5 -h" output.

2010-10-05  awhitwham

	* convert/Makefile, gap5/Makefile, prefinish/Makefile: Added io_lib
	  to required libraries to correct Centos5.5 compilation problems.

2010-09-30  jkbonfield

	* system.mk.in: Move placement of ${DESTDIR} so that manual
	  override of e.g. --mandir after specifying --prefix still works.

2010-09-21  awhitwham

	* tgap/tg_struct.h: Removed old struct.

2010-09-15  awhitwham

	* gap5/depth.tcl: Added invoke editor from depth track.

	* gap5/caf.c: Changed to improve speed and memory use on large
	  files.

	* Misc/Makefile, Misc/string_alloc.c, Misc/string_alloc.h: Added
	  pooled string allocation.

2010-09-14  jkbonfield

	* tgap/tg_iface_g.c: Bug fix when reading old data. (Technically
	  working around an old bug.)
	  
	  The range record deltas were previously stored as uint32_t,
	  meaning some were written out as, say, 4294967291 instead of
	  -5. We should have been using int2s7/s72int instead of
	  int2u7/u72int. However it didn't matter (except for size of
	  storage) as the unsigned value was written into the address of a
	  signed 32-bit int and it worked anyway.
	  
	  Now we load as 64-bit we obtain the full glory of a large
	  integer. Fixed by changing the temporary data type I load into.

2010-09-13  jkbonfield

	* gap5/contig_editor.tcl, gap5/list_proc.tcl, gap5/tk-io-reg.c:
	  Allow HIGHLIGHT_READ to be a contig_notify option from Tcl. We
	  use this now as a generic notification, to contig 0, that
	  something somewhere has changed highlight. The targetted
	  approach still works via reg_highlight_read, but we're using the
	  new call instead to avoid spamming potentially thousands of
	  events when we load a new readings list or hit the Clear button.

	* gap5/docs/DONE, gap5/docs/TODO, gap5/editor_view.c: Fixed a bug
	  in the highlight and selection of reads in the EdName panel. The
	  coordinate handling differed slightly between querying the read
	  under the cursor and the drawing code, meaning we sometimes
	  couldn't select what we thought was visible.

	* gap5/contig_editor.tcl: Removal of debugging output.

	* gap5/docs/DONE, tgap/tg_cache.c: Fixed, I hope, a reference
	  counting problem.
	  
	  When running cache_rw on a child io cache for an item which is
	  blocked (ie seq or anno), the first time through we create a new
	  (eg) SeqBlock record. Subsuquent cache_rw on other sequences
	  within the same block were not updating the reference count on
	  the cache_master object, but cache_decr did still want to
	  decrememnt them.
	  
	  This shows up as an assertion failure if you try to edit two
	  neighbouring sequences (I tried adjusting clip points, but I
	  expect it happens with other edits too).

	* gap5/contig_editor.tcl, gap5/docs/TODO, gap5/editor_view.c,
	  gap5/list_proc.tcl, gap5/tkEditor.c, gap5/tkEditor.h,
	  tgap/tg_iface_g.c: First stab at implementing the "readings"
	  list. The contig editor can
	  (de)select members on this list as well as view them. It's not
	  perfect yet though as the list holds reading numbers instead of
	  names.
	  
	  Also moved the <<select-drag>> editor-names binding for copying
	  sequence names to middle click <2> instead.

	* tgap/tg_cache.c, tgap/tg_gio.h, tgap/tg_iface.h, tgap/tg_tcl.c:
	  Added both C and Tcl interfaces to check whether a record exists
	  with the given type. This allows the higher level layers of Gap5
	  to check validity of user input without triggering the low level
	  asserts in tg_iface_g.c.
	  
	  See cache_exists() in C and $io rec_exists in Tcl.

	* tk_utils/sheet.c, tk_utils/sheet.h: Added a new sh_box mode (and
	  sh_box_alt). As expected, these draw a box around a group of
	  characters. The sh_box_alt exists to allow two boxes
	  concatenated together; the display modes are identical, but the
	  toggle from sh_box to sh_box_alt forces the end of one style and
	  the start of a new one.

	* gap5/list_proc.c, gap5/list_proc.h: Removal of dead code -
	  FORTRAN interfaces!

2010-09-10  jkbonfield

	* tgap/tg_iface_g.c: Protect against tg_rec being large when
	  encoding bin ranges. The previous worst-case malloc of 5 bytes
	  per record id has been upped to 10 to permit full 64-bit data
	  (ceil(64/7)).

2010-09-09  jkbonfield

	* tgap/tg_iface_g.c: Fixed a bug with the 64-bit tg_rec code. When
	  reading a database in the older formats with 32-bit records, we
	  were only filling out the bottom 32-bits of the record ID
	  leaving the top 32-bits undefined.

	* gap5/editor_search.c, tgap/b+tree2.c, tgap/b+tree2.h,
	  tgap/tg_contig.c, tgap/tg_contig.h, tgap/tg_iface.h,
	  tgap/tg_iface_g.c, tgap/tg_sequence.c, tgap/tg_sequence.h: Editor
	  searching by sequence name now accepts a prefix match. This
	  required an extra parameter to the b+tree search code.
	  
	  Also the mechanism of searching is now different as we search
	  both through a list of names pulled out of the btree (finding
	  the closest one in the direction we search) and also using a
	  positional iterator on the contig. This resolves issues where we
	  may have 10,000 sequences matching a prefix string, but only 5
	  sequences away is the first occurence of this so a linear scan
	  would have found the match faster.
	  
	  (Potentially we could modify this to allow searching by names
	  even if no name index exists, albeit at a time cost.)

2010-09-08  jkbonfield

	* abi/Makefile, eba/Makefile, gap5/Makefile, gap5/ace.c,
	  gap5/baf.c, gap5/break_contig.c, gap5/break_contig.h, gap5/caf.c,
	  gap5/consen.c, gap5/consen.h, gap5/consensus.c, gap5/consensus.h,
	  gap5/contig_selector.c, gap5/contig_selector.h, gap5/cs-object.c,
	  gap5/cs-object.h, gap5/depad_seq_tree.c, gap5/depad_seq_tree.h,
	  gap5/dis_readings.c, gap5/dis_readings.h, gap5/do_fij.c,
	  gap5/docs/TODO, gap5/editor_join.c, gap5/editor_oligo.c,
	  gap5/editor_search.c, gap5/editor_view.c, gap5/editor_view.h,
	  gap5/export_contigs.c, gap5/fij.c, gap5/find_oligo.c,
	  gap5/find_repeats.c, gap5/gap4_compat.c, gap5/gap4_compat.h,
	  gap5/gap_cli_arg.h, gap5/gap_range.c, gap5/gap_range.h,
	  gap5/import_gff.c, gap5/io-reg.h, gap5/io_utils.h,
	  gap5/list_proc.c, gap5/list_proc.h, gap5/maq.c,
	  gap5/newgap5_cmds.c, gap5/newgap_structs.h, gap5/primlib.c,
	  gap5/qual.c, gap5/qual.h, gap5/qualIO.c, gap5/qualIO.h,
	  gap5/read_depth.c, gap5/read_depth.h, gap5/sam_index.c,
	  gap5/template_draw.h, gap5/tg_index.c, gap5/tg_index.h,
	  gap5/tg_index_common.c, gap5/tg_index_common.h, gap5/tg_view.c,
	  gap5/tk-io-reg.c, gap5/tkEdNames.c, gap5/tkEditor.c,
	  gap5/tman_interface.c, gap5/tman_interface.h,
	  get_scf_field/Makefile, init_exp/Makefile, polyA_clip/Makefile,
	  qclip/Makefile, spin/Makefile, stops/Makefile, tgap/Makefile,
	  tgap/b+tree2.c, tgap/b+tree2.h, tgap/g-request.c,
	  tgap/gap_cli_arg.c, tgap/gap_cli_arg.h, tgap/tg_anno.c,
	  tgap/tg_anno.h, tgap/tg_bin.c, tgap/tg_bin.h, tgap/tg_cache.c,
	  tgap/tg_cache_item.h, tgap/tg_contig.c, tgap/tg_contig.h,
	  tgap/tg_gio.c, tgap/tg_gio.h, tgap/tg_iface.h, tgap/tg_iface_g.c,
	  tgap/tg_iface_g.h, tgap/tg_library.c, tgap/tg_library.h,
	  tgap/tg_register.c, tgap/tg_register.h, tgap/tg_sequence.c,
	  tgap/tg_sequence.h, tgap/tg_struct.h, tgap/tg_tcl.c,
	  tgap/tg_tracks.c, tgap/tg_utils.c, tgap/tg_utils.h,
	  tk_utils/Makefile, tracediff/Makefile: MAJOR overhaul of record
	  numbers.
	  
	  We now must use tg_rec throughout all the code as the data type
	  for record numbers instead of int or GRec. GRec still exists,
	  but it should only be within the tgap/g-* code and
	  tgap/tg_iface_g.c interface. Basically GRec is the data type for
	  the underlying "g" library, which is still 32-bit, while tg_rec
	  is used throughout gap5 proper for records.
	  
	  The purpose of this is:
	  A) Allow for more sequence record numbers. The given bottom
	  10-bits of
	  a sequence (or anno) record are an index into a SeqBlock and the
	  upper
	  bits the SeqBlock record. This previously meant just 21 bits of
	  record
	  space for SeqBlock or about 2 million records.
	  
	  B) Allow for future changes of record number to be an ID into
	  other
	  storage media. Right now they're an index into the g-layer aux
	  file,
	  but we plan on using them as an index into a bam file if we
	  permit
	  copy-on-write (or even an index into Arcturus). For bam the
	  obvious
	  way is to use the record number as a file offset, which therefore
	  needs more than 2Gb worth of address space.
	  
	  
	  Change summary:
	  
	  1) All use of types for records are now tg_rec.
	  For Tcl interfaces, we use Tcl_WideInt instead of int and
	  functions
	  like Tcl_GetWideInt instead of Tcl_GetInt. (These are defined to
	  be
	  at least 64-bit.)
	  Use atorec() instead of atoi() when converting from string to
	  tg_rec.
	  
	  2) All uses of %d in printing record IDs are now %"PRIrec"
	  instead.
	  (Similarly PRIbtr for BTRec types in b+tree2.c)
	  
	  3) Removed the option to reserve sequence record numbers from
	  tg_index
	  and allocate() function.
	  
	  4) Changed the format of some data structures. This means the new
	  gap5
	  databases are INCOMPATIBLE with the old ones. This gap5 will
	  still
	  read old data, but not vice versa. This was required to handle
	  64-bit values.
	  
	  5) Split GDatabase into GDatabase (g-layer) and database_t (gap5
	  layer) types. In theory the G data structures are interface
	  specific ("g" layer in this case) and shouldn't ever be used by
	  the
	  gap5 code. Not important right now, but a necessary split to
	  enforce if we ever switch to, say, sqlite as a storage engine.
	  
	  6) The parse_args functions for tcl interfaces now have a new
	  data
	  type ARG_REC, to replace the usual ARG_INT used before.
	  
	  7) Added index_del interfaces for sequence and contig names. Not
	  strictly part of the tg_rec code, but discovered their omission
	  during these changes.
	  
	  8) Bug fix to btree_search for when looking at an item at the
	  current
	  root.
	  
	  9) Removed bin_id field from bin_index_t. It was never filled out
	  properly and was essentially the same as rec.
	  
	  10) Removed rec arrays from SeqBlock and AnnoEleBlock internal
	  structures. The arrays were pointless as they were all sequential
	  anyway given we have no reallocation system (and they're were not
	  written to disc).
	  
	  11) Bug fix to bin_get_position when recursing over complemented
	  data (not part of tg_rec fixes).

2010-09-01  jkbonfield

	* gap5/docs/DONE, gap5/docs/TODO:

2010-08-31  jkbonfield

	* tgap/g-request.c: g_unlock_views() now sorts the views by record
	  number so that writing out to the aux file is in file offset
	  order.
	  
	  I'm not sure if this makes a big difference or not, but it seems
	  wise to not do things in random (or as was actually regularly
	  happen, reverse) file offset.
	  
	  Also fixed update_record to check against 0 as well as
	  G_NO_IMAGE. This prevents (ignored) errors from heap_free(),
	  although I'm unsure why we get image of zero anyway.

	* tgap/tg_iface.h, tgap/tg_iface_g.c: More mid-level deallocation
	  code.

	* gap5/dis_readings.c: Added lots of code for deallocating data
	  Also lots of extra checking code: check_contig_bins().  Now also
	  trims contig left/right ends if we disassemble data at the end.

	* gap5/break_contig.c: Implemented remove_empty_bins() function to
	  recurse through a contig tidying up dead and useless bins after
	  a break. It's easier to do this here than during the break
	  itself.
	  
	  Fixed memory leak in contig_visible_start/end - now deallocate
	  the contig iterator.

	* tgap/tg_cache.c, tgap/tg_cache_item.h, tgap/tg_contig.c,
	  tgap/tg_gio.h: Mid-level item deallocation:
	  
	  Cache items now have a forgetme bit-flag. When set it indicates
	  the record should be removed. The cache_rec_deallocate function
	  does this.  This is turn then calls the 'iface' destroy methods.
	  
	  Added asserts to cache_decr. We should never get to negative ref
	  counts. Equally so we should never hit a zero ref count on a
	  modified item. (This was the cause of a corruption recently.)

	* tgap/tg_bin.c: Protect against invalid records in
	  bin_get_item_position - no longer crash, but return -1 instead.
	  
	  bin_invalidate_consensus() no longer forces bin to be rewritten
	  if it already had no valid cached consensus present.

	* tgap/g-filedefs.h, tgap/g-io.c, tgap/g-os.h, tgap/g-request.c,
	  tgap/g-request.h, tgap/g-struct.h: Store free record numbers in
	  a linked list (starting with AuxHeader.free_record). Add
	  G_VIEW_DELETED as a view type, which triggers the adding to this
	  free list upon unlocking.  The new g_free_rec_() interface
	  removes the most recent record item from the list and returns
	  it. (Or G_NO_REC if none available.)

	* tgap/g-alloc.c: Tweaks to output when DEBUG is
	  defined. Otherwise no impact.  Also added a debug function,
	  heap_largest_check(), to aid in looking for allocation
	  problems. (It found none, but will leave the debug code in
	  place.)

2010-08-25  awhitwham

	* gap5/Makefile, gap5/caf.c, gap5/caf.h, gap5/tg_index.c,
	  gap5/tg_index_common.c: Added CAF format to tg_index.

2010-08-20  jkbonfield

	* gap5/dis_readings.c: Various tweaks and improvements to the hole
	  detection and contig-end trimming algorithms.
	  
	  Previously we could either end up with contigs containing no
	  data or contigs with holes in.

	* gap5/ace.c, gap5/baf.c, gap5/break_contig.c,
	  gap5/dis_readings.tcl, gap5/editor_view.c, gap5/export_contigs.c,
	  gap5/gap_range.c, gap5/maq.c, gap5/sam_index.c, tgap/tg_bin.c,
	  tgap/tg_cache.c, tgap/tg_contig.c, tgap/tg_gio.c,
	  tgap/tg_sequence.c: Mass tidy up of cache_incr and cache_decr
	  calls. This fixes several bugs which often revealed themselves
	  as "cache_unload: Assertion `io->base || ci->updated == 0'
	  failed." 
	  
	  This happens when we cache_decr too much, making the ref count
	  go to zero and removing the item from the hachetable in_use
	  list. The in_use list is scanned through looking for
	  ci->updated==1 when flushing changes, so a record which has been
	  modified and then decrememented doesn't get written on a
	  flush. Instead it's identified in the above insert upon closing
	  the io handle.

	* gap5/dis_readings.c, gap5/newgap5_cmds.c: Bug fixes to
	  disassemble readings:
	  
	  1) Don't crash when called with zero reads to disassemble.
	  2) Handle unknown read names, instead of trying to disassemble
	  rec -1.
	  3) The iter_next and iter_prev code in remove_contig_holes now
	  has auto-extend on the range. The reason is that the start/end we
	  have is the range for a region that we've just removed a read
	  from and may not be guaranteed to have overlapping data on (eg
	  if the contig already had a hole).

	* tgap/hache_table.c: We now issue a warning when attempting to
	  decrement a reference count of an item with zero reference count
	  already.  This is nearly always a symptom of buggy reference
	  count updates in the calling code.
	  
	  Also fixed a bug in the ref-info code for haches with cache_size
	  of zero.

	* tgap/g-files.c, tgap/g-files.h, tgap/g-request.c: Aded
	  g_remember_index as an analog to the g_forget_index. This is
	  called when explicitly locking a record. Also we no longer call
	  g_forget_index when flushing, only when explicitly unlocking.
	  
	  Combined these should ensure that the reference counting of
	  idx_hash works correctly.

2010-08-19  jkbonfield

	* gap5/Makefile, gap5/dis_readings.c, gap5/dis_readings.h,
	  gap5/dis_readings.tcl, gap5/docs/TODO, gap5/gap5rc,
	  gap5/gap5rc_menu_full, gap5/newgap5_cmds.c,
	  gap5/newgap_structs.h: First draft of disassemble readings.

	* tgap/tg_bin.c, tgap/tg_bin.h, tgap/tg_sequence.c: Generalised
	  the sequence_invalidate_consensus as bin_invalidate_consensus
	  which now takes arbitrary ranges, rather than just the range a
	  sequence covers.
	  
	  (We need this for disassemble readings.)

	* tgap/tg_bin.c: Invalidate the consensus cache in more
	  places. The best catch-all of this is bin_incr_nseq() as any
	  time we add or remove from a bin we have to call this, which
	  automatically invalidates any consensus in all bins from here on
	  up.
	  
	  What about if the consensus is in a bin below? We still need to
	  check for this, but a belt-and-braces approach means this change
	  is still viable.

	* gap5/break_contig.c: Fixed contig_visible_start - it was
	  returning 1 mostly rather than the actual start.

	* gap5/consensus.c: Removed assert as it still seems to be
	  triggered.
	  
	  I know this sounds bad, but given the comment above it I
	  concluded it was overly aggressive. I'm not *100%* sure on that
	  though...

	* gap5/gap.tcl, gap5/sam_index.c, gap5/tg_index.c, tgap/b+tree2.c,
	  tgap/tg_gio.c, tgap/tg_iface_g.c: Improved handling of errors
	  when indexing broken files or opening corrupted databases.
	  
	  We shouldn't crash (either via deliberate assert/abort or due to
	  not checking returns) and should also now exit with an error
	  code.

2010-08-17  jkbonfield

	* gap5/consensus.c: Fixed the "perfect base" handling code.
	  
	  We no longer explicitly check * and N (which was wrong as "-" is
	  an ambiguous base). We now check the primary quality for the
	  called base using lookup[base].

	* gap5/gap5rc: Added missing CONTIG_EDITOR.SHOW_CUTOFFS definition.

	* gap5/gap5rc_menu_full: Removal of unimplemented items from menus
	  (Check Database, Extract Readings, Reading coverage).
	  
	  Moved Import GFF from Edit to File menu.

	* gap5/editor_view.c: Further fixes to the Y-caching code to
	  prevent crashes: this time in tk_redisplayCursor.

	* gap5/trace_display.tcl: Remove the "compact" button/mode.
	  
	  Removed the Diff button/option as it's not in gap5 yet.
	  
	  Fixed complement so it no longer causes a tk error.

2010-08-13  jkbonfield

	* gap5/consensus.c: Fixed 'perfect' base check (manually edited at
	  Q100) to only apply to real bases and not N or *. These
	  previously had all-zero for scores of acgt which was interpreted
	  as perfect too.

2010-08-12  jkbonfield

	* gap5/contig_editor.tcl, gap5/gap5rc, gap5/gap5rc_menu_full: Added
	  a contig editor "Save Settings" command.

	* gap4/contig_editor.tcl: Removal of debugging output

	* gap5/consensus.c, tgap/tg_sequence.c: Integer quality values of
	  100 (phred or logodds) for the called base are now treated as
	  probability 1.0 for correctness, regardless of contrary evidence
	  (unless it's another Q100). This means that manually edited
	  bases now always take precedence in the consensus.

	* gap5/contig_editor.tcl: The Undo button now updates the
	  information line with a summary of the change it will make when
	  pressed.
	  
	  Added C-s and C-r keybindings for searching forwards and
	  backwards.

2010-08-12  awhitwham

	* gap5/depth.tcl: Now redraws contig edit cursor on scroll.

2010-08-12  jkbonfield

	* gap5/tag_editor.tcl: Fixed tag_macro_copy

	* gap5/contig_editor.tcl, gap5/gap5rc_menu_full,
	  gap5/tag_editor.tcl: Added the Save Tag Macros command to the
	  editor Settings menu (and also load them up at editor
	  start). This stores them in $HOME/.gap5rc

	* gap5/contig_editor.tcl, gap5/tag_editor.tcl: Added "tag macros" -
	  as per Gap4.
	  
	  Also added the tag_editor.tcl file which was forgotten before.
	  (It's in the tarballs, but oddly not svn.)

	* gap5/editor_view.c: Protect against xx->rec_hash being
	  NULL. This was added to lots of functions, but I suspect most
	  already check by dint of checking xx->nr too.
	  
	  The one we fixed a crash in is edview_row_for_item. It died when
	  attempting to launch an editor at a region with zero data.

	* gap5/gap5_consensus.tcl: Added a tk_messageBox equivalent so
	  that errors reported from consen.tcl generate a decent message
	  instead of a tcl error about tk_messageBox not existing.

	* gap5/contig_editor.tcl, gap5/docs/TODO, gap5/editor_view.c,
	  gap5/editor_view.h, gap5/tkEditor.c: Added two new editor widget
	  methods: getxy and show_cursor.
	  
	  F11/F12 for fast tag editing or removal now only operate on the
	  item under the editing cursor, rather than under the mouse
	  pointer.  This brings it back inline with Gap4.
	  
	  Deletion of data has been made safer. We only permit deletion of
	  pads now unless Control+Delete is used, which will revert to the
	  old behaviour of removing anything (even entire columns).

2010-08-11  jkbonfield

	* gap5/contig_editor.tcl: More key bindings:
	  
	  Page up/down already scrolled in X by 1Kb, but with Shift,
	  Control or Shift+Control this now moves by 10, 100 and 1000Kb.
	  
	  We can now adjust the base confidence values using [, ]
	  Shift+Up/Down arrows and Control+Up/Down arrows - much as we did
	  in gap4.

2010-08-06  jkbonfield

	* gap5/docs/TODO:

	* gap5/tkEditor.c: Protect against attempts of -ve Y scroll
	  positions

	* tgap/tg_contig.c: Fixed sort order when sorting by technology
	  and some samples have seq_tech while others do not.
	  
	  Bug fix to the update_range_y calls in contig_items_in_range().
	  We update these as we go along, rather than at end, meaning
	  multiple technologies should compensate correctly for the shift
	  in start.

2010-08-05  awhitwham

	* gap5/template_display.c: Added scrolling offset to xhair return
	  values.

2010-08-03  jkbonfield

	* gap5/editor_view.c: Fixed bugs in the new Y-layout code.
	  
	  - Protect against scrolling off end of contig and having no
	  visible rows to try and match.
	  
	  - We can now get entirely blank lines due to preserving Y, so
	  make sure we draw them to avoid ghosting.

2010-08-03  awhitwham

	* gap5/depth.tcl, gap5/depth_track.c, gap5/gap_range.c,
	  gap5/gap_range.h, gap5/template_display.c: Tweaks to the track
	  view filters.

2010-08-03  jkbonfield

	* system.mk.in: Honour DESTDIR variable (which by default is blank
	  and has no impact). See
	  http://www.gnu.org/software/hello/manual/automake/DESTDIR.html
	  for more information.

2010-08-03  awhitwham

	* gap5/depth.tcl, gap5/depth_track.c, gap5/depth_track.h,
	  gap5/gap5rc_menu_full, gap5/newgap5_cmds.c,
	  gap5/template_display.c, gap5/template_display.h,
	  gap5/template_draw.c: Changed template display to use custom
	  canvas item types rather than tkRaster for track display.

2010-08-02  jkbonfield

	* primer3/src/Makefile: Added $(L)/.dir dependency to the
	  $(L)/$(SHLIB_PREFIX)... targets.  This means that when
	  outputting -o lib/libfoo.so we ensure that lib/ is created
	  first.
	  
	  This should resolve some parallel make problems.

	* copy_reads/Makefile, g/Makefile, gap4/Makefile, gap5/Makefile,
	  haplo/Makefile, mutlib/Makefile, prefinish/Makefile,
	  seq_utils/Makefile, spin/Makefile, text_utils/Makefile,
	  tgap/Makefile, tk_utils/Makefile: Added $(L)/.dir dependency to
	  the $(L)/$(SHLIB_PREFIX)... targets.
	  This means that when outputting -o lib/libfoo.so we ensure that
	  lib/ is created first.
	  
	  This should resolve some parallel make problems.

	* ac_stubs/ax_lib_samtools.m4: Added -lbam to SAMTOOLS_LDFLAGS when
	  not using --with-samtools, but detecting a working bam.a/h.

	* ac_stubs/ax_lib_samtools.m4: Fixed typo in comment

	* Makefile.in: Added primer3/src as dependency to gap5, given the
	  recent addition to using this library. Hopefully this fixed some
	  parallel make failures.

	* ac_stubs/ax_lib_samtools.m4: Fixed elseif/elif issue in
	  --with-samtools option.

2010-07-16  jkbonfield

	* gap5/editor_view.c, gap5/editor_view.h: Sped up the contig editor
	  when dealing with excessively deep alignments.
	  
	  Specifically we now have a hash to go from record numbers to
	  index into xx->r[i], allowing rapid identification of object
	  location. Conversely we also now binary search xx->r[] when
	  looking for items at specific Y coords.

	* gap5/contig_editor.tcl, gap5/editor_view.c: Avoid calling
	  consensus_valid_range() for as long as possible, as it
	  can be slow to compute. Instead we first check if a consensus
	  position is valid when moving the editor cursor simply by
	  checking if the consensus is non-N.

2010-07-15  jkbonfield

	* tgap/tg_contig.c: Now only call update_range_y when COMPUTE_YPOS
	  job is set. Also removed a debugging printf.

2010-07-14  jkbonfield

	* Tagged VERSION 2.0.0b7

	* ChangeLog, NEWS, configure.in, gap5/docs/DONE, gap5/docs/TODO:
	  1.2.9 (aka 2.0.0b7) release

2010-07-14  jkbonfield

        * gap5/template_display.c, tgap/tg_cache.c, tgap/tg_contig.c,
          tgap/tg_contig.h, tgap/tg_gio.h, tgap/tg_iface_g.c,
          tgap/tg_struct.h: Updated the compute_ypos function in
          tg_contig.c (note, not the one in template_display.c) to
          keep track of previous Y coordinates.

          We achieve this by modifying the low-level cached bin-range
          structures to also include a Y (in memory and not written to
          disk). If our next query already has Y coordinates used then
          we prefer these over allocating new ones.

          This prevents the "rotating" effect of short-read data when
          scrolling right in the contig editor, although at the moment
          this still happens when scrolling left.

2010-07-09  jkbonfield

        * gap5/docs/TODO:

        * ChangeLog, NEWS, gap5/docs/TODO:

        * tgap/tg_bin.c, tgap/tg_contig.c: Fixed our check for
          bin->{start_used,start_end} being valid from comparing
          whether they are equal to checking whether bin->rng is
          blank.

          The former method meant that a bin consisting solely of a 1
          base tag (eg start_used=1000, end_used=1000) was considered
          empty. The next time we add another tag to the bin,
          start/end weren't extended but instead moved as-if
          initialising an empty bin. This caused tags to be invisible
          in some corner cases.

2010-07-08  jkbonfield

        * gap5/Makefile, gap5/gap5rc_menu_full, gap5/import_gff.c,
          gap5/import_gff.h, gap5/import_gff.tcl, gap5/newgap5_cmds.c,
          gap5/tclIndex: Added an Import GFF function to act as the
          reverse of the tag export code in export_contigs.c.

          It handles both padded and unpadded coordinates, although
          unpadded import is far slower.

          Also right now the GFF type field is ignored, instead using
          a type= attribute at the end.

        * gap5/export_contigs.c: Fixed writing unpadded coordinates
          for GFF tags when not-mapping from sequence to consensus
          positions.

2010-07-07  jkbonfield

        * gap5/export_contigs.c: Now use
          active_list_contigs_extended()
          when exporting tags in GFF
          format.

          Fixed separator in GFF attrib section, from "," to ";".

        * gap5/gap4_compat.c, gap5/io_utils.h, gap5/list_proc.c,
          gap5/list_proc.h: When expanding a list of contig names to
          contig recs, start and end coordinates we now have the
          option of using the full unclipped contig length instead of
          the previous clipped length.

          This is through using the new active_list_contigs_extended()
          function instead of active_list_contigs().

          Functions will need to use what is appropriate. Outputting
          consensus makes sense to only have the clipped portion as
          the extensions are just poly-N. Outputting all sequence and
          tags may make sense to use extended mode.

        * gap5/baf.c: Bug fix to parsing of consensus tags in BAF

2010-07-02  jkbonfield

        * gap5/editor_view.c: Disabled the debugging output:
          accidentally left on from earlier commit.

        * gap5/sam_index.c: Prevented crash when dealing with CIGAR
          strings using "N" (skipped bases). These can come from
          TopHat's spliced alignments. The samtools pileup interface
          treats a single input sequence as having multiple start and
          end coordinates (unfortunately without a flag indicating
          whether it's a true or spliced end).

          We need a better method of handling this, especially with
          regards to templates and more than 2 reads on it. (We
          actually know how many we expect due to previous scanning of
          CIGAR.)

2010-07-02  awhitwham

        * gap5/depth.tcl: Fixed the resizing issues on the template
          tracks.

2010-07-01  jkbonfield

        * gap5/break_contig.c: Added two new utility functions which
          we may later wish to move to a more general purpose
          location: contig_visible_start and
          contig_visible_end. Visible here including cutoff data but
          excluding the invisible cached consensus data.

        * gap5/editor_view.c, gap5/export_contigs.c: Updated the way
	  we interpret consensus tags.

          Previously the range (flags & GRANGE_FLAG_TAG_SEQ) bit was
	  used to distinguish sequence tags vs consensus tags, but
	  also the range pair_rec held the record number the tag was
	  bound to. This makes sense for sequences, but we also stored
	  the consensus record for consensus tags.

          The problem comes when breaking a contig. We reparent an
	  entire section of bin tree, attaching it to a new contig
	  record. We do not wish to go through the entire bin tree
	  changing r->pair_rec to be the new contig ID. Fortunately
	  checking the GRANGE_FLAG_TAG_SEQ bit is sufficient to know
	  if the tag is for the consensus instead.

          So... changed cases where we checked r->pair_rec ==
          contig_rec to instead use !(r->flags & GRANGE_FLAG_TAG_SEQ).

          Also updated the GFF export code in export_contigs.c so it
	  does hex escaping instead of C-string escaped (as mandated
	  in GFF3 spec at http://www.sequenceontology.org/gff3.shtml).

        * gap5/docs/TODO:

        * tgap/tg_contig.c, tgap/tg_contig.h: Overloaded the "whence"
	  type to the iterator to also control whether we sort by
	  start (default and old mode) or end of read. This is
	  particularly useful when using whence of CITER_LAST and
	  using contig_iter_prev to walk through the list backwards,
	  allowing us to iterate along the order in which sequences
	  become visible while going backwards.

        * tk_utils/sheet.c, tk_utils/sheet.h: Removed the maximum
          number of rows/columns. It wasn't functioning correctly
          anyway, being only checked in some cases and consequentially
          causing memory corruptions. (Albeit hard to hit unless using
          nil2 font.)

        * gap5/editor_view.c: Protect against potentiallty
	  uninitialised values returned from edview_item_at_pos when
	  nothing is visible. (This makes it easier for error checking
	  in the calling function.)

          Fixed buffer overflow when an editor sheet is at the maximum
          display width.

2010-06-30  jkbonfield

        * gap5/baf.c: Fixed a bug with consensus tags. We were
	  incorrectly setting the flag to indicate they were sequence
	  tags. (This was causing crashes in break contig too.)

2010-06-28  jkbonfield

	* gap5/editor_view.c: Attempted to improve the positioning of
	  the Y scrollbar when scrolling around in X. This is somewhat
	  tricky to get right, especially when multiple sequences are
	  packed in a line as the Y coordinates of them jump around a
	  lot anyway. However our method is as follows.
	  
	  - Attempt to keep the top sequence still in the top position
	  after scrolling, adjusting Y scrollbar as necessary.
	  
	  - If top sequence is no longer overlapping, repeat for bottom
	  sequence.
	  
	  - If the editing cursor was on screen before, and is still
	  within X-bounds of the new scrolled position, it should be still
	  be visible after.
	  
	  Also fixed horizontal cursor movement keys (eg left/right
	  arrows) so that they also checked to make sure the cursor is
	  visible.  Previously it didn't snap back to visibility if the X
	  cursor position was still on screen but it had been manually
	  scrolled off the top of bottom.

	* tgap/tg_contig.c: Fixed bug in Y-allocation by sequence
	  technology type - we now exclude tags during this. Previously we
	  chose Y ranges too large.

	* gap5/contig_editor.tcl, gap5/editor_view.c, gap5/gap5rc,
	  gap5/tkEditor.c, tgap/tg_contig.c, tgap/tg_contig.h,
	  tgap/tg_struct.h: Added a CSIR_SORT_BY_SEQ_TECH flag for the
	  contig_items_in_range function. This required adding seq_tech to
	  the rangec_t struct (in-memory, not on-disk version) too. Should
	  this be added to on-disk struct at some stage for efficiency?
	  
	  For now the editor always passes this flag in so capillary
	  sequences are always on top. I need to make this adjustable.
	  
	  The editor also no longer calls contig_items_in_range
	  continually (even on mouse overs) as it now correctly tracks
	  edits and so caches this data.
	  
	  Finally the seq_tech field can now be (and is) displayed in the
	  brief status line of the editor.

	* gap5/sam_index.c: Fill out sequencing technology field from
	  read-group PL string. Also attempt to guess this from sequence
	  names when no read-group is available, although this is highly
	  error prone.

	* gap5/libraries.tcl: Changed solexa for illumina in output

	* gap5/contig_editor.tcl: Moved the calls to store_undo when
	  adjusting read clip points or read positions to after the edit
	  takes place.
	  
	  This fixes a redisplay bug in other copies of the editor window
	  as it is the store_undo code that sends the event message around
	  to redisplay.

2010-06-23  jkbonfield

	* gap5/export_contigs.c: Fixed SAM quality strings to cap at
	  quality 94 (ASCII ~ after adding 33). This prevents Picard from
	  throwing an error.

	* gap5/contig_editor.tcl, gap5/depth.tcl, tgap/tg_register.c: Added
	  a context sensitive menu to the sequence name panel in the
	  editor.
	  
	  This sports a "Goto ..." function to jump to other reads on this
	  same template, even when they're in another contig (it'll bring
	  up a new editor).

2010-06-21  jkbonfield

	* gap5/export_contigs.c: SAM output is now sorted by clipped
	  position instead of unclipped position, removing the need to
	  convert from sam to bam and then run samtools sort.

	* gap5/baf.c, gap5/export_contigs.c, gap5/sam_index.c,
	  gap5/tg_index_common.c, gap5/tg_index_common.h: Added
	  experimental tag support to the SAM format, both for export and
	  import.
	  
	  This uses Zc (consensus) and Zs (sequence) SAM auxillary tag
	  records.

	* Misc/dstring.c, Misc/dstring.h: Added more functions to append
	  single characters, an integer (in ascii form) or to zero (empty)
	  a string for reuse again.

2010-06-17  awhitwham

	* gap5/depth.tcl, gap5/depth_track.c, gap5/gap_range.c: Fixed some
	  of the template display's scrolling bugs.

2010-06-17  jkbonfield

	* gap5/Makefile: Added back PROGS definition as it prevented any
	  targets from being built. Oops.

2010-06-16  jkbonfield

	* gap5/Makefile, gap5/gap5_consensus, gap5/gap5_consensus.tcl,
	  gap5/gap5_export, gap5/gap5_export.tcl, gap5/tg_index,
	  gap5/tg_view: Added wrapper scripts for tg_index and tg_view so
	  they set the correct LD_LIBRARY_PATH environment without
	  explicitly requiring the user to source staden.profile.
	  
	  Also added (with wrappers) gap5_consensus and gap5_export
	  command line toos to dump out data from a gap5 database
	  non-interactively.

	* gap5/gap.tcl, gap5/tg_index.c, gap5/tg_view.c: Bumped gap5
	  version to 1.2.9 for local test release

	* gap5/gap_range.c: Removed some extra depth code that appeared to
	  add template depth on to sequence depth. I'm not sure of the
	  intent for this original code, but I'm sure we'll find out
	  sooner or later. (Right now it's less bugged than before
	  though.)
	  
	  Changed the colouring of reads to use the true forward/reverse
	  sequence attributes instead of uncomplemented / complemented
	  status.

	* gap5/template_draw.c: Fixed a colour allocation bug causing
	  colour number 18 to end up as blue instead of grey.

2010-06-11  jkbonfield

	* gap5/contig_editor.tcl, gap5/editor_oligo.c: Improvements to the
	  primer selection interface. It can now create tags.
	  
	  Also applied a minor fix to the Join button reenabling it and
	  removing the debug message.

	* tk_utils/tclIndex, tk_utils/xcombo.tcl: Added a basic combobox
	  as an alternative to the one in tk8.5 (as it's not as common as
	  8.4 yet) or iwidgets (which I'd prefer to not have a dependency
	  on given lack of improvements to it).

2010-06-09  jkbonfield

	* gap5/export_contigs.c, gap5/sam_index.c: Sped up SAM export. The
	  [sb]am_aux_stringify functions now generate the string form
	  directly rather than using dozens of sprintf calls. Also
	  implemented a trial version of a faster fprintf implementation,
	  although right now it is unused.
	  
	  Finally, the sam export function now permits saving to final "-"
	  to signify stdout. This is of no use in the GUI, but will be
	  useful when scripting gap5.

	* gap5/gap4_compat.c: Sanitised lget_contig_num - given broken
	  input with start or end positions off the end of the contig, we
	  now clip correctly.

	* gap5/contig_editor.tcl, gap5/editor_join.c, gap5/tkEditor.c:
	  Updated the "Join" button in the editor to display the overlap
	  length and percentage mismatch. We now also get a question
	  confirmed whether we wish to make the join.
	  
	  Also bug fixed the "align" button. It had an error in computing
	  the coordinates of the overlap when one or both contigs did not
	  start at base position 1.

	* gap5/newgap5_cmds.c: Added a Tcl interface to
	  consensus_valid_range: this returns the used
	  (akas "clipped") portion of a contig.

	* gap5/depth.tcl: Minor tweak to prevent an infinite loop when the
	  template display is initially brought up on a region with no
	  visible data.

	* tgap/tg_utils.c, tgap/tg_utils.h: Updated the [us]72int and
	  int2[us]7 functions so that they're faster
	  (maybe 30% or so, depending on compiler and options). Also
	  implemented macro equivalents which are faster still, although
	  as yet these aren't used.

	* seq_utils/dna_utils.c, tgap/tg_sequence.c: Replaced complementing
	  functions with a marginally faster version.

2010-06-03  jkbonfield

	* gap5/contig_editor.tcl, gap5/gap5rc, gap5/primlib.c,
	  gap5/primlib.h, primer3/src/boulder_input.c,
	  primer3/src/oligotm.c, primer3/src/oligotm.h,
	  primer3/src/primer3.h, primer3/src/primer3_lib.c: Updated the
	  primer3 melting temperature calculation to take into account the
	  more recent formulae described in SantaLucia et al 1998, and
	  Ahsen et al 1999 (see source for full refs).  These are enabled
	  via a #define and by default are turned on.
	  
	  For Gap5 (not gap4 currently), the extra parameters required are
	  now configurable too, along with a few more of the existing
	  parameters.

2010-05-20  jkbonfield

	* gap5/export_contigs.c, gap5/sam_index.c, gap5/tg_index_common.c:
	  Improvements to SAM support, both input and output.
	  
	  - We now correctly populate the COMP2 (other pair complemented)
	  range flag. Improved on PAIRED flag too.
	  
	  - PEND_REV flags (other end reverse) are now also set during
	  tg_index of sam.
	  
	  - When exporting, we now attempt to set the strand fields
	  better.  (This fixes a bug where export to sam and reimport lost
	  some of the strand information.)

2010-05-14  awhitwham

	* gap5/docs/TODO: Added a couple of template display bugs.

	* gap5/depth.tcl, gap5/template_display.c: Improved y scrolling on
	  the template track.

2010-05-12  jkbonfield

	* gap4/join.c, gap4/searchUtils.c, gap4/tagU2.c, gap4/tkEditor.c,
	  gap5/ace.c, gap5/baf.c, gap5/break_contig.c, gap5/consensus.c,
	  gap5/contig_selector.c, gap5/cs-object.c, gap5/depad_seq_tree.c,
	  gap5/depad_seq_tree.h, gap5/do_fij.c, gap5/docs/TODO,
	  gap5/editor_join.c, gap5/editor_oligo.c, gap5/editor_oligo.h,
	  gap5/editor_search.c, gap5/editor_view.c, gap5/export_contigs.c,
	  gap5/fij.c, gap5/find_oligo.c, gap5/find_repeats.c,
	  gap5/gap4_compat.h, gap5/gap_globals.c, gap5/gap_hash.c,
	  gap5/hash_lib.c, gap5/maq.c, gap5/maq.h, gap5/newgap5_cmds.c,
	  gap5/qual.c, gap5/sam_index.c, gap5/tg_index.c,
	  gap5/tg_index_common.c, gap5/tg_view.c, gap5/tkEditor.c,
	  gap5/tman_interface.c, primer3/src/boulder_input.c,
	  primer3/src/primer3_lib.c, seq_utils/align_lib.c,
	  seq_utils/dna_utils.c, seq_utils/renz_utils.c,
	  seq_utils/sequence_formats.c, spin/seq_reg.c, tgap/b+tree2.c,
	  tgap/g-alloc.c, tgap/g-io.c, tgap/g-request.c,
	  tgap/hache_table.c, tgap/tg_bin.c, tgap/tg_bin.h,
	  tgap/tg_cache.c, tgap/tg_contig.c, tgap/tg_gio.h,
	  tgap/tg_iface_g.c, tgap/tg_sequence.c, tgap/tg_sequence.h,
	  tgap/tg_tcl.c, tk_utils/element_canvas.c,
	  tk_utils/restriction_enzyme_map.c, tk_utils/tkTrace.c,
	  tk_utils/trace_print.c: Mass tidy up of minor compilation warning
	  issues.
	  
	  These cover unused variables, variable names shadowing "parent"
	  ones, missing prototypes, enum lists ending with comma, etc.

2010-05-12  awhitwham

	* gap5/depth_track.c, gap5/gap_range.c, gap5/template_display.c:
	  Code tidy to get rid of some warnings.

2010-05-12  jkbonfield

	* mutscan/Makefile, mutscan/staden.h, tracediff/Makefile,
	  tracediff/staden.h: A few more tweaks when building with icc with
	  regards to os.h

2010-05-11  jkbonfield

	* Misc/os.h, abi/Makefile, abi/abiIO.h, eba/Makefile, eba/conf.c,
	  eba/qual.c, gap4/seqInfo.c, get_scf_field/get_scf_field.c,
	  hetins/Makefile, hetins/hetins.c, init_exp/init_exp.c,
	  polyA_clip/polyA_clip.c, polyA_clip/seqInfo.c, qclip/consen.c,
	  qclip/seqInfo.c, qclip/seqInfo.h, stops/Makefile, stops/stops.c,
	  tk_utils/misc.c, tk_utils/tkTrace.c, tk_utils/tkTraceComp.c,
	  tk_utils/tkTraceDisp.c, tk_utils/tkTraceIO.c,
	  tk_utils/trace_print.c: Forced use of the Staden Package <os.h>
	  instead of relying on picking up one from an io_lib
	  installation.
	  
	  The key difference is that the local one will honour
	  HAVE_CONFIG_H and pick up little vs big endian definitions from
	  our autoconf derived values, while including a remote io_lib one
	  will not. (This should still work, but it requires the
	  auto-detection macros based on processor type instead.)

	* gap5/docs/TODO:

	* gap5/docs/TODO:

	* gap5/map_reads.tcl, gap5/newgap5_cmds.c, gap5/sam_index.c,
	  tgap/tg_iface.h, tgap/tg_iface_g.c: Improved Mapped Assembly.
	  When we ask to index sequence names, if a name index doesn't
	  already exist we create it.
	  
	  In the process of this we extended the database interface to add
	  an index creation method; fixed memory dup/free issues with the
	  btree code (harmless change); fixed uninitialised variables
	  (store unmapped data / aux records) for sam input via this
	  route; and moved some of the puts statements to use vmessage so
	  they appear in the editor window instead of stdout.

2010-05-11  awhitwham

	* tgap/tg_contig.c, tk_utils/tkRaster.c, tk_utils/tkRaster.h: More
	  changes to improve the template display.

	* gap5/Makefile, gap5/depth.tcl, gap5/depth_track.c,
	  gap5/depth_track.h, gap5/gap5rc_menu_full, gap5/gap_range.c,
	  gap5/gap_range.h, gap5/newgap5_cmds.c, gap5/template_display.c,
	  gap5/template_display.h: Improvements to the template display.

2010-05-10  jkbonfield

	* gap5/gap.tcl: Fixed error with starting gap5 -ro and not
	  specifying a database name.

2010-05-07  jkbonfield

	* gap5/contig_editor.tcl, gap5/editor_view.c, gap5/editor_view.h,
	  gap5/gap5rc, gap5/gap5rc_menu_full, gap5/tkEditor.c: Added draft
	  of primer picking within the contig editor. This still needs
	  more work and currently just lists primers rather than picking
	  templates for them and adding tags.

2010-05-06  jkbonfield

	* gap5/editor_oligo.c, gap5/editor_oligo.h: First draft of oligo
	  selection code within the editor.

	* gap5/primlib.c, gap5/primlib.h: Added primer3 wrapper layer code.

2010-05-05  jkbonfield

	* tgap/tg_library.h: Added missing prototype

	* tgap/tg_tcl.c: Protection against NULL tc->contig when destroying
	  the command.

	* convert/Makefile, global.mk, mutlib/Makefile, mutscan/Makefile,
	  prefinish/Makefile, seq_utils/Makefile, seqed/Makefile,
	  spin/Makefile, spin2/Makefile, tgap/Makefile, tk_utils/Makefile,
	  tracediff/Makefile, trev/Makefile: We're now more explicit about
	  our library dependencies. This should aid compilation on MacOS X
	  and Windows (untested).
	  
	  Also made sure that for TCL only we add $(TCL_LIB) and for
	  Tcl/Tk both we use only $(TK_LIB) and not both. This is because
	  adding @TCL_LIBS@ and @TK_LIBS@ to the system.mk.in has lead to
	  some dependent libraries being specified twice if we explicitly
	  ask to use both $(TCL_LIB) and $(TK_LIB). For libieee.a this
	  causes problems due to a global version symbol, causing a link
	  error.

	* ac_stubs/ax_lib_curses.m4, configure.in, gap5/Makefile,
	  gap5/docs/DONE, gap5/docs/TODO, gap5/tg_view.c,
	  staden_config.h.in, system.mk.in, tgap/tg_library.c: Added
	  curses/ncurses to autoconf. It now detects which is installed on
	  the system automatically and allows an alternative path to be
	  specified too.

	* ac_stubs/ax_lib_lzma.m4: Misc cut and paste errors of samtools &
	  libz instead of lzma.

2010-04-29  jkbonfield

	* gap4/list_contigs.tcl, gap5/contig_selector.tcl, gap5/gap.tcl,
	  gap5/gap5rc_menu_full, gap5/list_contigs.tcl,
	  gap5/ng_fb_cmds.tcl: Improvements to read-only mode.
	  
	  We no longer allow Save Contig Order from the List Contig
	  windows to be tried when we opened a database in read-only
	  mode. (It didn't work as it was caught later on, but
	  ungracefully.)

2010-04-28  jkbonfield

	* gap5/break_contig.c: Commented out the remove_redundant_bins()
	  call in break contig for now as this does not correctly shift
	  the start coordinate when removing the parent bin and leaving
	  only a right-child bin.
	  
	  (This still needs fixing, but without the optimisation in place
	  we at least get correct results once again.)

	* gap5/docs/DONE, gap5/docs/TODO:

	* Misc/Makefile, abi/Makefile, convert/Makefile,
	  copy_reads/Makefile, eba/Makefile, find_renz/Makefile,
	  g/Makefile, gap4/Makefile, gap5/Makefile, global.mk,
	  haplo/Makefile, make_weights/Makefile, mutlib/Makefile,
	  polyA_clip/Makefile, prefinish/Makefile, qclip/Makefile,
	  screen_seq/Makefile, seq_utils/Makefile, spin/Makefile,
	  stops/Makefile, tgap/Makefile, tk_utils/Makefile,
	  tracediff/Makefile, vector_clip/Makefile: Fixed the "make
	  depend" code so that it works when run from a sub-directory
	  rather than only just in the top-level checkout.
	  
	  This commit also includes the results of running this - ie
	  makefiles with updated dependencies.

	* Misc/getfile.c, Misc/misc.h, Misc/os.h, Misc/parse_db.c,
	  abi/abiIO.c, abi/getABIfield.c, alf/alfsplit.c, convert/bapIO.c,
	  convert/dapIO.c, convert/flat_sd.c, find_renz/find_renz.c,
	  g/freetree.c, g/g-db.c, g/g-request.c, gap4/actf.c,
	  gap4/consen.c, gap4/edCommands.c, gap4/extract.c,
	  gap4/gap-create.c, gap4/newgap_cmds.c, gap4/tagU2.c,
	  gap5/actf.c, gap5/export_contigs.c, gap5/newgap5_cmds.c,
	  gap5/tg_index_common.c, make_weights/make_weights.c,
	  mutlib/align.cpp, mutlib/read_matrix.cpp, mutscan/main.cpp,
	  polyA_clip/polyA_clip.c, prefinish/finish.c,
	  prefinish/finish_walk.c, qclip/qclip.c, screen_seq/screen_seq.c,
	  seq_utils/genetic_code.c, seq_utils/read_matrix.c,
	  seq_utils/renz_utils.c, seq_utils/sequence_formats.c,
	  spin/codon_content.c, spin/emboss_input_funcs.c,
	  spin/nip_cmds.c, spin/readpam.c, spin/seq_reg_cmds.c,
	  spin/splice_search.c, spin/tkSeqedUtils.c, stops/stops.c,
	  tgap/b+tree2.c, tgap/g-alloc.c, tgap/g-files.c, tgap/g-io.c,
	  tgap/g-request.c, tgap/tg_contig.c, tgap/zfio.c,
	  tk_utils/capture.c, tk_utils/postscript.c,
	  tk_utils/text_output.c, tracediff/main.cpp,
	  vector_clip/vector_clip.c: Fixed various large file support
	  issues for linux.
	  
	  These include additional includes of <staden_config.h> and use of
	  fseeko in place of fseek.

	* g/g-files.c: When opening in read-only mode we no longer attempt
	  to register items with the freetree structure. This is only a
	  minor speedup, but more importantly it allows us to use copy_db
	  to attempt to recover some corrupted databases.

2010-04-20  jkbonfield

	* gap5/gap4_compat.c: Fixed contig_name_to_number to recognise
	  "=<recno>" syntax.

2010-04-19  jkbonfield

	* gap5/contig_editor.tcl: Added auto-scrolling when selecting a
	  region (underlining it). Also enabled shift+click to extend a
	  selection.

	* gap5/gap.tcl: Fixed Database Information output.

	* gap5/libraries.tcl, gap5/tclIndex: Updated the List Libraries
	  window to use Plotchart. It now has axis and things, but needs
	  more work still.

2010-04-14  jkbonfield

	* gap5/contig_selector.c, gap5/contig_selector.h,
	  gap5/newgap5_cmds.c, gap5/tk-io-reg.h: Added back
	  tk_matchresult_configure function, now in contig_selector.c.
	  This fixes an error when trying to configure a contig comparator
	  plot, such as changing colour or line width.

	* gap5/contig_selector.c, gap5/contig_selector.h,
	  gap5/contig_selector.tcl, gap5/cs-object.c, gap5/fij.c,
	  gap5/find_oligo.c, gap5/find_repeats.c, gap5/gap5rc_menu_full,
	  gap5/newgap5_cmds.c, gap5/result_manager.tcl, gap5/tk-io-reg.h:
	  The contig order can now be saved, from both the contig selector
	  and contig list windows. Furthermore we can now move contigs
	  around in the contig selector.
	  
	  The "show diagonal" and "Clear all" commands work in the contig
	  selector.
	  
	  The results manager and the results menu in the contig selector
	  now update properly.

	* tgap/tg_register.c: Remove old debugging output

	* gap5/do_fij.c: Remove duplicates from the contig_list[] as we go
	  through it. These occured when doing single vs all as the single
	  contig is in the list twice (as first and then later on in the
	  "all" bit).

	* gap5/depad_seq_tree.c, gap5/map_reads.tcl, gap5/newgap5_cmds.c:
	  The Map Reads dialogues now have an option whether to index the
	  sequence names (and this was renamed from -no_tree to
	  -index_names at the API level).
	  
	  Also fixed a bug with the tg_index -g mode, where the input bam
	  file is assumed to have been aligned against an ungapped copy of
	  the contig already in the gap5 DB. We failed to take into
	  account that contigs may not start at base 1.

	* gap5/editor_search.c, gap5/editor_search.tcl, gap5/gap5rc: Added
	  by-annotation and by-tag-type search methods to the contig
	  editor. Also fixed searching by name so it no longer tried to
	  jump to sequence names that are found in another contig.
	  
	* tgap/tg_iface_g.c: Fixed a bug when writing out SeqBlocks
	  containing a mixture of data with libraries and without
	  libraries. (This can happen when writing the cached consensus to
	  a db generated from a bam file.)
	  
	  We incorrectly handled the no-library cases, causing corrupt
	  data to be written to the DB when the first read in a block was
	  missing.

	* gap4/gap-tcl.c: Fixed a memory corruption when using tcl in
	  debugging mode (where Tcl_Free is not the same as free).

2010-04-01  jkbonfield

	* convert/Makefile, copy_reads/copy_reads, gap4/gap4, gap5/gap.tcl,
	  gap5/gap5, gap5/gap5rc, prefinish/finish_sanger, pregap4/pregap4,
	  spin/spin, spin_emboss/create_emboss_files, system.mk.in,
	  tgap/Makefile, tgap/tg_tcl.c, tk_utils/Makefile, tk_utils/init.c,
	  trev/trev: Various fixes for building on MacOS X.
	  
	  - The sh wrapper scripts seem to need a trailing / on $STADLIB
	  otherwise tcl "load" doesn't add one. I'm not sure why yet.
	  
	  - Removed tkCanvGraph.c and tclCanvGraph.c from tk_utils build.
	  These caused all sorts of problems with needing internal tcl/tk
	  header files, but they're only used by spin2 which we no longer
	  support nor build. We can cross that bridge if we ever go back
	  to it.
	  
	  - Similarly removed tclInt.h from tg_tcl.c. In theory this was
	  added to get a prototype for Tcl_GetCommandFromObj, but it
	  doesn't always seem to be there anyway. Perhaps a Tcl version
	  issue.
	  
	  - Added various more extra libs to explicitly link against in the
	  Makefiles as MacOS X doesn't like the implicit chains.
	  
	  - Removed load of iwidgets from gap5rc. Not sure if we need
	  this, but it seems to have been commented out some time ago for
	  gap4 so it seems unlikely.
	  
	  - Use @TK_LIBS@ and @TCL_LIBS@ again in system.mk.in. I do not
	  know why I commented those out (which is worrying), but they're
	  definitely required for MacOS.
	  
	  - Similarly disabled -rpath-link for now as it doesn't exist on
	  MacOS X. I'm hoping the explicit library linking will remove the
	  need for using this anyway... to test on other platforms.

	* Misc/os.h: Updated os.h to handle endianness is a better
	  fashion.  This is taken from io_lib's copy of it and hopefully
	  works better now on intel based MacOS X systems or Mac systems
	  building "fat binaries".

2010-03-26  jkbonfield
	* rel-2-0-0-b6
	  gap5-1-2-8

	* NEWS, configure.in: 2.0.0b6 updates.

	* gap5/gap.tcl, gap5/tg_index.c, gap5/tg_view.c: Bumped g5 versions
	  to 1.2.8

	* tk_utils/tk_utilsrc: Use a smaller font for the contig editor on
	  unix

	* tgap/tg_iface_g.c: Fixed memory allocation error (causing
	  crashes) when dealing with
	  multiple read-groups and read-names with substantially different
	  lengths.

2010-03-24  James Bonfield

	* Tagged rel-2-0-0-b5
	* Tagged gap5-1-2-7

2010-03-24  jkbonfield

	* gap5/docs/ChangeLog:

        * gap4/join.c: We now temporarily set the two editor panels in
          the join editor to be "StateDown" during the dojoin()
          call. This prevents them from receiving the REG_LENGTH event
          and therefore from reloading the entire contig into memory
          (unless another display exists for the same contig in
          another window).

          This substantially reduces the amount of I/O when performing
          a join.

        * gap5/break_contig.c: Fixed a bug where seq->bin_index wasn't
          updated when moving sequences from one bin to another during
          break contig.

2010-03-22  jkbonfield

	* gap5/docs/TODO:

	* gap5/gap_utils.tcl, gap5/tclIndex: Updated c_length proc to use
	  the contig get_length method. This avoids the old io_read_contig
	  emulation, which spends a lot of time and I/O needlessly
	  figuring out the first and last reading in the contig.

	* gap5/export_contigs.c: Improvements to CAF export.
	  - We use - instead of * now for pads.
	  - We generate new names using the record ID. This avoids the
	    problem of duplicate read names in gap5.

	* gap5/map_reads.tcl: We now enable B+Tree indexing of finishing
	  read sequence names.

	* gap5/tg_view.c: Minor change to tg_view -l to deal with *DEEP*
	  data

	* tgap/tg_contig.c: Minor speed improvement to the y-layout
	  algorithm.
	  
	  compute_ypos_tags() now checks whether any tags are visible and
	  short-cuts the hash table building step if it's not
	  needed. Still not optimal, but a step in the right direction.

2010-03-12  jkbonfield

	* gap5/sam_index.c: Fixed a crash that occured when adding
	  unaligned data and the unaligned read was the first read to be
	  added to a contig.

	* gap4/tag_checklist.tcl, gap5/tag_checklist.tcl: Used "extended"
	  mode of the listbox instead of our old local hack of
	  extended2. This difference is in how it handles toggling and
	  whether we can select multiples without using control, but at
	  least it's now functional again when using a native Tk instead
	  of a locally hacked one.

	* gap4/acd2tag.tcl: Fixed some issues with incorrectly resizing
	  notebooks.
	  
	  Also fixed using variables with acd dependencies.

2010-03-08  jkbonfield

	* ChangeLog:

	* NEWS, tk_utils/Makefile:

	* ac_stubs/ax_lib_lzma.m4, gap5/contig_id.tcl,
	  gap5/gap4_compat.tcl: Remove debugging chatter

	* gap5/tclIndex: Added io_read_contig

        * gap5/export_contigs.c, gap5/export_contigs.tcl: Added CAF format
          to the export contigs dialogue. Not a recommended
          format, but users are requesting it still.

        * tgap/tg_cache.c: Bug fixed an earlier fix to cache_rw(). If we
	  lock, flush and attempt to relock a record the change to the
	  function meant we failed to set the updated flag. (An example of
	  it causing a problem is crashing when computing the consensus
	  after exiting the database and reopening it.)

          This perhaps needs a fix elsewhere too. Should roll back the
	  lock to RO after a flush?

2010-03-05  jkbonfield

        * gap5/maqmap.c, gap5/sam_index.c, tgap/tg_anno.c,
          tgap/tg_register.c, tgap/tg_sequence.c, tk_utils/sheet.c: Fixed
          various compilation warnings

        * ChangeLog, NEWS, README.build, configure.in: Updates to prepare
          for 2.0.0b5

	* gap5/contig_editor.tcl, gap5/docs/DONE, gap5/docs/TODO,
	  tgap/tg_anno.c, tgap/tg_anno.h, tgap/tg_bin.c, tgap/tg_bin.h,
	  tgap/tg_sequence.c, tgap/tg_tcl.c: Added anno_get_position and
	  anno_get_position2 functions, analogous to
	  the sequence_get_position* funcs. The two share common code so
	  internally they now call the same function,
	  bin_get_item_position(),
	  that takes a type field.
	  
	  Added a move_annos method of the tcl seq object. This calls the
	  C sequence_move_annos() function. It's used within the contig
	  editor to ensure that annotations are moved with a
	  sequence. Still to do: allow partial moves, in the case of
	  inserting or deleting with a sequence.
	  
	  Fixed a bug with the bin_for_range function where the database
	  had smaller bins than the current default minimum bin
	  size. Sometimes we were putting things in larger bins than we
	  need to.
	  
	  The Contig Editor Undo command now undoes changes to tag type
	  and tag comment.

	* gap5/tkEditor.c: The "select get" editor method now returns the
	  base under the editing cursor when no selection has been
	  made. This prevents a crash when attempting to create a tag
	  without marking a region.

	* tgap/tg_cache.c: Prevented excessive item duplications when we
	  attempt to cache_rw the same object multiple times within the
	  editor.

	* tgap/tg_contig.c: Extended contig_dump_ps to output sequence
	  lines too

	* gap4/gap.tcl: Moved the -menu_file code to after the
	  load_package section (to fix a problem with Sanger's
	  exoseq_make_gapdb).

2010-03-04  jkbonfield

	* ac_stubs/ax_lib_png.m4: Fixed bug where PNG_LDFLAGS defaults to
	  -lz when no --with-png is used.
	  
	  Also fixed an issue where --with-png was assumed to be used even
	  when not explicitly specified, by virtue of picking up the
	  previous $withval used within the --with-lzma section.

	* ac_stubs/ax_lib_lzma.m4: Fixed AC_CHECK_LIB test

2010-03-03  jkbonfield

	* prefinish/finish_cDNA, prefinish/finish_cDNA_ends_only,
	  prefinish/finish_sanger.tcl: Fixed the scripts so that when run
	  as an executable rather than from tclsh the auto-restarting code
	  computes STADENROOT based on the assumption of $0 being in the
	  share/staden/scripts/$0 location.

	* tk_utils/stash: Fixed argc

2010-03-02  jkbonfield

	* tk_utils/Makefile, tk_utils/stash: Added a new stash script to
	  the installed bin directory. This pretends to be the old stash
	  executable, by virtue of running the system tclsh and running a
	  little bit of startup code.
	  
	  It's not a recommended route, but will be kept for backwards
	  compatibility for old scripts.

	* gap4/gap.tcl, gap5/gap.tcl, gap5/tg_index.c: Bumped some version
	  numbers:
	  
	  gap4 2.11.2
	  gap5 1.2.7
	  tg_index 1.2.7

	* gap5/contig_selector.tcl: Removed excessing debugging output

	* gap5/docs/DONE, gap5/docs/TODO, global.mk, system.mk.in: Fixed
	  compilation when no libpng is found.

2010-03-01  jkbonfield

	* gap5/docs/DONE:

	* gap5/contig_editor.tcl, gap5/gap4_compat.c, gap5/tkEditor.c:
	  Further event handling.
	  
	  Complement contig now requests contig_lock_write() access. This
	  in turn is now handled by the editor, bringing up a dialogue box
	  as appropriate.
	  
	  The editor also handles JOIN_TO requests better now. For this to
	  happen it may need to change the contig we're associated with,
	  which in turn means updating the $ed io and contig_rec
	  values. These methods are now set/get rather than pure get,
	  allowing them to be updated after "$ed init".

	* gap5/tk-io-reg.c, tgap/tg_register.c: Moved busy_dialog() from
	  tk-io-reg.c to tg_register.c and also make
	  use of it in the locking code.

	* gap5/tk-io-reg.c: Improved calling of tcl-registered contig_reg
	  items. To protect against memory corruptions when a function is
	  contig_deregister()ed while processing an event, we now do some
	  basic reference counting in the cr_type object.
	  
	  Also added code for handling the return value for REG_GET_LOCK
	  queries.

	* gap5/gap5rc_menu_full, gap5/tclIndex: Reenabled the Results
	  Manager window - it's no longer hidden behind the expert mode
	  flag.

	* gap5/editor_join.c: Fixed the REG_JOIN_TO event we send out to
	  include the correct contig number (was right, now left).

	* tgap/hache_table.c, tgap/hache_table.h, tgap/tg_register.c: -
	  Added a HacheTableRehash function. This allows an item to be
	  assigned to a new key without needing to remove and reinsert it.
	  
	  - Fixed contig_register_join to use HashTableRehash instead of
	  remove/insert. This means that the hacheItem doesn't change and
	  hence we fixed a bug with incorrect tracking this. Also added
	  asserts to better protect against similar bugs.

	* tgap/tg_cache.c: When unloading items from the cache we no
	  longer also unlock the record if this is a child i/o and the
	  record is still in the base i/o.
	  
	  Previously by doing this we could end up attempting to write to
	  already-freed views, leading to cryptic "Error: -1" from save
	  contig.

2010-02-25  jkbonfield

	* seq_utils/align_lib.h: Added comments so I can remember what the
	  cryptic edge_mode values mean in the future.

	* gap5/cs-object.c, gap5/fij.c: Fixed issues with complementing
	  match objects. These used to just use "contig_length - pos", but
	  the contig length includes cutoff data now. Calling
	  consensus_valid_range cures this, although we may want to cache
	  that data to speed up the process.

	* tgap/hache_table.c: Minor improvements to the hache dump debug
	  code.

	* gap5/contig_editor.tcl, gap5/contig_selector.c, gap5/docs/DONE,
	  gap5/docs/TODO, gap5/editor_join.c, gap5/find_oligo.c,
	  gap5/find_repeats.c, gap5/gap4_compat.c, gap5/tkEditor.c,
	  tgap/tg_contig.c, tgap/tg_register.c, tgap/tg_register.h: Fixed
	  missing contig notifications on events like complementing a
	  contig, joining contigs or simply just saving from the editor.
	  Now we handle these the clearing of the FIJ plot has been
	  removed as it updates correctly.
	  
	  Plots that used to register with all contigs in a verbatim
	  manner now register with contig 0. (And indeed in many case they
	  were incorrect anyway as they registered with contig 1..Ncontigs
	  rather than the actual contig record numbers.)
	  
	  To facilitate this the send_event function has been improved so
	  that sending to contig -N will send the message to all plots
	  registered against contig zero, but claiming to been an event
	  sent to contig N rather than 0 so that the receiver knows the
	  request. This change is internal to how tg_register works and
	  not something that is visible outside of that file.

	* gap4/hash_lib.c, gap5/hash_lib.c: Fixed a bug introduced in svn
	  rev 919 (Dec 9 2005) when I changed
	  (amongst other things) the edge_mode parameter from fixed
	  constants to symbolic names.
	  
	  The edge_mode parameter was incorrectly set for the first block,
	  meaning that left-end pads were penalised for. We now explicitly
	  mask off the bit requesting this and consequentially our
	  alignments now improve. Impressive it lasted this long without
	  anyone complaining about broken alignments when using FIJ in
	  fast-mode.

2010-02-19  jkbonfield

	* tgap/tg_contig.c: Fixed bug in contig_set_name(). It reset *c
	  too early, but now sets it after cache_item_resize call.

2010-02-18  jkbonfield

	* gap5/consensus.c, gap5/contig_editor.tcl, gap5/editor_search.c,
	  gap5/editor_view.c, gap5/editor_view.h, gap5/tkEditor.c,
	  gap5/tman_interface.c, tgap/tg_sequence.c, tgap/tg_sequence.h,
	  tgap/tg_tcl.c: 1) More work on undo, especially when undoing a
	  base deletion that is the first/last base in hidden data, at the
	  junction of clipped vs used.  Normally when we manually insert
	  here we want the base to be in the used visible portion, but if
	  we're inserting as a result of undoing a deletion then it's
	  probably cutoff data we're adding back instead.
	  
	  This involved changing sequence_get_base to return whether a
	  base is in used or cutoff data, along with everything that calls
	  it.
	  
	  Lots of cursor work involving cutoff data. When we turn off
	  cutoffs and our cursor is in the cutoff region of a sequence the
	  cursor now gets moved to the consensus. Moving around with arrow
	  keys will also skip cutoff data when cutoffs are not shown,
	  similarly for making selections. Finally when undoing changes
	  that occured in the cutoff data we now automatically make the
	  cutoffs visible again if they were not already.
	  
	  This also involved modifying the parameters to edSetCursorPos.

2010-02-17  jkbonfield

	* gap5/docs/DONE, gap5/docs/TODO:

	* gap5/contig_editor.tcl, gap5/ng_fb_cmds.tcl, tgap/tg_gio.c:
	  Better handling of read-only databases. We now open them instead
	  of just aborting requiring the user to re-run using -ro. We also
	  check the read-only status in the contig editor to block
	  attempted edits and saves.

	* gap5/gap5rc_menu_full: Fixed the File->New removal (previously
	  accidentally removed the "note" menu part, which isn't visible
	  anyway).

	* gap5/contig_editor.tcl, tgap/tg_sequence.c, tgap/tg_tcl.c: Added
	  methods to adjust the sequence left/right clip points in the
	  contig editor. These are bound to the < and > keys, as in gap4.

	* gap5/baf.c, gap5/export_contigs.c, tgap/BAF: Added consensus tags
	  to input/output via BAF.

2010-02-16  jkbonfield

	* gap5/export_contigs.tcl: Change the output file name based on
	  file format, and automatically pick something appropriate based
	  on the DB name too.

	* gap5/gap.tcl, gap5/newgap5_cmds.c, tgap/tg_gio.c, tgap/tg_gio.h,
	  tgap/tg_iface_g.c, tgap/tg_struct.h, tgap/tg_tcl.c: The main
	  database record now has a version number (starting with 1 for
	  v1.2.6). This relates to the global version of the database
	  format.
	  
	  Also added $io methods to query the version, the database name
	  and read-only status. These are now used to update the main
	  title bar.

	* gap5/editor_view.c, tgap/tg_sequence.c, tgap/tg_sequence.h:
	  Control-a and control-e now look at the cutoffs editor parameter
	  to determine whether they should jump to the visible start/end
	  of the sequence/contig or the hidden start/end.
	  
	  In a similar vein, the left/right arrow keys no longer scroll
	  past the visible end either unless cutoffs are shown even when
	  complemented
	  (previously this was bugged).
	  
	  To simplify the implementation of this, I added a new function
	  sequence_get_orient() which returns the relative orientation of
	  this sequence vs the contig. This is more than just "s->len < 0"
	  now considering the complemented status of bins en-route to the
	  root node and so fixes a bug the bug in scrolling along
	  sequences in a complemented contig.

	* tgap/tg_cache.c: Fixed a memory corruption involved with
	  cache_item_resize(). We now always update the data_size pointer,
	  rather than only when realloc moves the memory.

2010-02-15  jkbonfield

	* gap5/consensus.c, gap5/docs/DONE, gap5/docs/TODO, tgap/tg_bin.c,
	  tgap/tg_tcl.c: Fixed issues with consensus caching in
	  complemented contigs.
	  
	  Related to this is the issue of moving sequences in complemented
	  contigs too, which may cause creation of a new root bin which
	  itself will not be complemented. (Also fixed)

2010-02-12  jkbonfield

	* gap5/contig_editor.tcl, gap5/editor_view.c, tgap/tg_anno.c,
	  tgap/tg_anno.h, tgap/tg_tcl.c: Further editor undo fixes - this
	  time annotations.
	  
	  This involved adding an extra option to anno_get_range to allow
	  returning the relative location instead of absolute, and adding a
	  method to the tcl $tag object to query this.

	* convert/Makefile: Added an explicit -lg to the convert link
	  line.  Some systems didn't automatically follow the dependency
	  from -lgap.

	* gap5/tg_index_common.c: We now complement data correctly when
	  using tg_index -a to append to an existing contig and that
	  contig has been complemented.

	* gap5/export_contigs.c: Further fixes to ace, baf and sam output
	  when exporting a complemented contig.

	* tgap/tg_bin.c: Allow for adding to a complement contig.

	* gap5/gap4_compat.c: complement_contig() now maintains the same
	  clipped start/end position, so a contig with used (uncutoff)
	  portion of data from A to B and total coverage including hidden
	  data from A' to B' will now flip around the midpoint of A to B,
	  such that the complemented contig covers the same range of
	  visible data.
	  
	  This is now equivalent to Gap4 for contigs starting at base 1.

	* gap5/sam_index.c: Compile bam_aux_stringify even when
	  HAVE_SAMTOOLS isn't set so we can export to sam format still.

2010-02-11  jkbonfield

	* gap5/export_contigs.c: Fixed export contigs when running on
	  complemented contigs.

2010-02-09  jkbonfield

	* gap5/gap5rc_menu_full: Remove the unimplemented File->New menu
	  option

	* gap5/sam_index.c: Major speed up when dealing with very deep
	  data.
	  
	  We replaced the array of recnos with a linked list, for faster
	  adding/removal. Removed the memmove call from bio_del_seq and
	  instead do an in-situ copy while iterating over the items. This
	  essentially means one array copy per column instead of one per
	  sequencing ending per column.
	  
	  Estimations are about 27x speed up on a contig of ~50000 depth.

2010-02-08  jkbonfield

	* gap5/contig_editor.tcl, gap5/tkEditor.c: Fixed display and undo
	  issues relating to moving sequences, especially moving them left
	  from the start of the contig into negative coorindates.
	  
	  We're now more careful about caching of data which may change,
	  such as the contig struct and the root bin it points to. In Tcl
	  we resolve this largely by not caching the object, but only the
	  record number. In C we resolved it by implementing a manual way
	  to repopulate cached contig struct on demand (the decr_contig
	  and incr_contig editor methods), although it may be preferable
	  to replace these by record number caching instead at some stage.

	* tgap/tg_contig.c, tgap/tg_sequence.c: sequence_insert_base() now
	  updates *s with the new seq_t struct. Previously this didn't
	  happen so if it moved via cache_item_resize the caller kept a
	  broken pointer.
	  
	  Also moved the location of these updates in various other
	  related functions, to better handle the error cases.

	* tgap/tg_bin.c: Fixed the last_bin caching in bin_for_range(). It
	  now caches the bin record number and not the pointer. While
	  perhaps not quite as efficient, this works even when the pointer
	  changes due to a realloc or cache_rw change (eg moving from
	  base-io to child-io in the case of contig editor handling).
	  
	  This fixes a bug with undo in the editor.

	* gap5/sam_index.c: Fixed an efficiency bug when not storing
	  unmapped data. We allocated a record number for these reads and
	  didn't use it, nor remove from the pending record number
	  list. The DB was correct, but we gradually got slower and
	  slower.

2010-02-05  jkbonfield

	* tgap/tg_bin.c: Comment for later

	* tgap/tg_tcl.c: The remove_sequence and add_sequence seq methods
	  now return and accept range pair-record and range flags, so a
	  sequence can be moved while retaining all data about it.
	  
	  Also fixed a bug where reinserting a sequence did not correct
	  update the seq->bin_index field.

	* tgap/tg_gio.c: Set min_bin_size for child io so bin based edits
	  on the contig editor work properly. (Ideally the min_bin_size
	  should be remembered from tg_index, stored in the database
	  record.)

	* README.build: Added note about -fPIC and Samtools

2010-02-04  awhitwham

	* gap5/depth.tcl, gap5/template_display.c, gap5/template_display.h,
	  gap5/template_draw.c: Intermediate Template Display changes.

2010-02-03  jkbonfield

	* staden.profile: Resurrected (and majorly rewrote, hence no real
	  history) the old staden.profile script.
	  
	  It's not required to source this, but some programs tightly
	  linking with the staden package or people wishing to run the
	  smaller tools rather than the main GUI apps will need to get
	  their environment set up properly: LD_LIBRARY_PATH, MANPATH,
	  etc.
	  
	  This script does that and so should be sourced from a
	  bourne-shell syntax login script as desired.

	* gap5/ace.c, tgap/g-files.c: Further memory leak fixes

	* gap5/docs/TODO:

	* tgap/tg_cache.c: Allow for child io to have the cache destroyed.
	  In this case, such as quitting an editor and not saving changes,
	  we relax the assert to allow for updated records to be thrown
	  away without saving first.

	* tgap/g-files.c: When preloading neighbouring index records from
	  the aux file we now do so for the block the requested record
	  resides in, rather than for the record we request and the next
	  256. This means we generally load the data in fewer requests and
	  also don't attempt to load the same records multiple times
	  (which lead to a memory leak).

	* gap5/contig_editor.tcl, tgap/tg_gio.c: Removed a memory leak -
	  the editor now deallocates the child io and any cached data held
	  within it upon exit.

	* gap5/contig_editor.tcl, tgap/tg_tcl.c: Substantial improvements
	  to undo:
	  
	  Removed the Redo functionality for now. I may add this back when
	  undo itself is finished.
	  
	  Deleting an entire column of data in the consensus now remembers
	  the old data so undo works (previously it just added pads). To
	  implement this a new contig obj method was added, pileup, to
	  return a column of data.

	* gap5/contig_selector.c: Removed a minor memory leak

	* gap5/newgap5_cmds.c: Extra debugging and a leak_check command if
	  VALGRIND is defined

	* tgap/tg_sequence.c: Removed a memory leak in
	  sequence_invalidate_consensus().
	  
	  Fixed sequence_delete_base() - it sometimes used the old
	  pre-cache_rw copy of the seq_t struct leading to undefined
	  behaviour.

2010-02-01  jkbonfield

	* gap5/contig_editor.tcl: Fixed a bug whereby the child IO of a
	  top editor in a join editor was not detached properly.
	  
	  This meant that exiting editing (eg pressing "align") and then
	  cancelling the join and closing the window would still have the
	  edits cached. Subsequent invocations of an editor for that
	  contig would see these edits still.

	* tgap/tg_cache.c, tgap/tg_iface_g.c: Removed a recently added
	  memory leak in reading sequence blocks. Also worked around a
	  malloc(0) size issue which while technically not incorrect,
	  caused valgrind to whinge a bit.

	* tgap/tg_iface_g.c: Fixed a bug with the new code to reorder read
	  names by their read group. Happened when a seq block contained
	  blank entries.

	* gap5/export_contigs.c: Removal of debugging output

2010-01-28  jkbonfield

	* gap5/ace.c, gap5/baf.c, gap5/export_contigs.c,
	  gap5/export_contigs.tcl, gap5/maq.c, gap5/sam_index.c,
	  gap5/sam_index.h, gap5/tg_index.c, gap5/tg_index.h,
	  tgap/tg_cache.c, tgap/tg_contig.c, tgap/tg_iface_g.c,
	  tgap/tg_sequence.c, tgap/tg_sequence.h, tgap/tg_struct.h:
	  Multiple improvements in input/output of SAM/BAM format.
	  
	  - We now support storing SAM auxillary records (other than the
	  old RG: tag). This is disabled by default, but enabled using
	  tg_index -x.
	  
	  - We can now also store unmapped data, although at present it is
	  still visible in the contig editor. This is enabled with
	  tg_index -u.
	  
	  - Fixed the ordering of adding reads to the database. Previously
	  reads were added as their right hand end went past the sam
	  'pileup' position hence we sorted by right end. Now we create
	  records in the same order they appear in the input file, meaning
	  export contigs should output in the correct order too.  To do
	  this cache_item_create has been split into creation and
	  initialisation stages, allowing for record numbers to be
	  allocated and then filled out later.
	  
	  - When querying and sorting sequences by X, we now disambiguate
	  matches by secondary sorting on record number. This also allows
	  for the editor or output functions to match the input sam order.
	  
	  - Export contig now allows for "fixmates" sam output, similar to
	  the samtools sub-command. Warning: this is substantially
	  slower. Also improved flags with respect to unmapped data.

	* gap5/editor_join.c: Fixed joining of contigs where the start
	  position is not 1.

	* ac_stubs/tcl.m4, staden_config.h.in: Removed the tcl
	  LARGEFILE_SOURCE64 and LARGEFILE64_SOURCE defines.
	  These confused autoconf on Ubuntu 9 and aren't needed by the
	  Staden
	  Package.

	* gap5/docs/TODO:

2010-01-25  jkbonfield

	* configure.in: Fixed io_lib version we require (to >= 1.12.2).

2010-01-22  jkbonfield

	* gap5/contig_editor.tcl: Prevent attempts to join a contig to
	  itself.

	* tk_utils/canvas_box.tcl: Better handling in error conditions,
	  when highling/unhighlighting matches

	* gap4/consen.c, gap4/consen.tcl, gap4/gaprc: Added fastq output
	  for consensus.

	* gap5/consensus.c: Fixed bug in consensus generation. Very long
	  sequences (>64Kb), meaning no small leaf nodes in the bin tree,
	  could omit filling out the final portion of the consensus in the
	  calculate_consensus_simple function.
	  
	  This manifested itself as FIJ failing when given sequences that
	  were consensus seqs from another DB.

2010-01-21  jkbonfield

	* global.mk, system.mk.in: Removed the LD_LIBRARY_PATH definitions
	  in global.mk (they wouldn't work on MacOS X anyway) and added
	  -Wl,-rpath-link,$(L) to the linker flags instead.
	  
	  Similarly added -rpath-link for io_lib's install directory. This
	  is because typically it may be built along side the staden
	  package with neither yet installed or without the user yet
	  setting LD_LIBRARY_PATH up.
	  
	  This also has provision to switching to -rpath later if desired,
	  although rpath is - of course - evil.

2010-01-19  jkbonfield

	* tk_utils/sheet.c: Fixed a crash when resizing a sheet widget to
	  zero width and back again. The problem was that zero width
	  widgets are classified as unmapped by Tk_IsMapped, causing
	  reallocation failures.

2010-01-18  jkbonfield

	* primer3/src/Makefile: Fix to permit parallel makes

	* Makefile.in: Added dependencies between directories so parallel
	  makes work.

2010-01-16  James Bonfield  <jkb@sanger.ac.uk>

	* Tagged rel-2-0-0-b4
	* Tagged gap5-1-2-6

2010-01-15  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/tg_index.c: Made the repad option public (was -x, not -g).
	  
	  Tidied up the usage message.

	* gap5/depad_seq_tree.c, gap5/depad_seq_tree.h, gap5/sam_index.c:
	  Fix memory leak - we can now deallocate the pad tree.

	* ac_stubs/ax_lib_lzma.m4: Fixed link bug: -llzma and not -lzma

	* gap5/newgap5_cmds.c: Also initialise a.pair_reads in
	  tcl_import_reads interface.

	* README.build, configure.in, staden_config.h.in, system.mk.in,
	  tgap/Makefile: Added --with-lzma to specify the liblzma (xz
	  utils) install root.
	  Modified the makefiles and to support this.

	* gap5/maq.c, gap5/maqmap.c: Improved short/long maq format
	  autodetection

2010-01-14  James Bonfield  <jkb@sanger.ac.uk>

	* ac_stubs/ax_lib_itcl.m4, ac_stubs/ax_lib_itk.m4,
	  ac_stubs/ax_lib_iwidgets.m4, ac_stubs/ax_lib_lzma.m4,
	  ac_stubs/ax_lib_png.m4, ac_stubs/ax_lib_samtools.m4,
	  ac_stubs/ax_lib_tklib.m4, ac_stubs/ax_lib_zlib.m4: Added a
	  AX_LIB_LZMA configure option.
	  
	  Fixed many of the expr regexp matches for version checking. These
	  used . instead of \., sometimes causing 4.12 to be interpreted as
	  4,12,2 major,minor,patch levels.
	  
	  Also fixed the [0-9]* patterns which in a few cases was typo as
	  [0-9*].

2010-01-13  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/export_contigs.c: Fixed the offset so that output to sam
	  does not shift the data by 1.
	  
	  Also (#ifdefed out) added some experimental code to shrink cigar
	  strings, assuming the consensus to be the reference.

	* gap5/gap5rc, gap5/gap5rc_menu_full, gap5/map_reads.tcl,
	  gap5/search.tcl, gap5/tclIndex: Added an Assembly -> Map Reads
	  menu. This allows running bwa
	  externally to align data to our consensus sequences, and then
	  importing them into Gap5.
	  
	  Experimental at the moment.

	* gap5/newgap5_cmds.c: Added tcl_import_reads interface. This is
	  effectively an interface to the guts of the tg_index command.

	* tgap/tg_cache.c: Allow for 250k per seqblock instead of 150k.

	* gap5/depad_seq_tree.c, gap5/depad_seq_tree.h: Newer depadding
	  functions that represent the unpadded to padded coordinate
	  mapping in a sorted red-black tree instead of the usual array
	  method. It is hoped that this will be smaller than a full array,
	  assuming the pad density is not too high.

	* gap5/maq.c, gap5/maq.h: Moved tg_index and tg_view from tgap to
	  gap5. This allows tg_index to start using gap5 functionality, eg
	  calculating the consensus.  This is used in an experimental
	  repad option where the alignment of incoming data is padded to
	  match an existing consensus.

	* gap5/Makefile, gap5/ace.c, gap5/ace.h, gap5/baf.c, gap5/baf.h,
	  gap5/maqmap.c, gap5/maqmap.h, gap5/sam_index.c,
	  gap5/sam_index.h, gap5/tg_index.c, gap5/tg_index.h,
	  gap5/tg_index_common.c, gap5/tg_index_common.h, gap5/tg_view.c,
	  tgap/Makefile, tgap/ace.c, tgap/ace.h, tgap/baf.c, tgap/baf.h,
	  tgap/maq.c, tgap/maq.h, tgap/maqmap.c, tgap/maqmap.h,
	  tgap/sam_index.c, tgap/sam_index.h, tgap/tg_index.c,
	  tgap/tg_index.h, tgap/tg_index_common.c, tgap/tg_index_common.h,
	  tgap/tg_view.c: Moved tg_index and tg_view from tgap to
	  gap5. This allows tg_index to start using gap5 functionality, eg
	  calculating the consensus.  This is used in an experimental
	  repad option where the alignment of incoming data is padded to
	  match an existing consensus.

	* gap4/trace_display.tcl, gap5/trace_display.tcl: Fix a bug with
	  poorly sized trace windows when initially brought up.
	  
	  This only happens sometimes, and only on some window managers.

2010-01-12  awhitwham

	* gap5/Makefile, gap5/template_display.c, gap5/template_display.h,
	  gap5/template_draw.c, gap5/template_draw.h, tgap/hache_table.c,
	  tgap/hache_table.h, tgap/tg_contig.c, tgap/tg_contig.h,
	  tgap/tg_struct.h, tk_utils/tkRaster.c, tk_utils/tkRaster.h:
	  Changes to speed up the template display showing large numbers of
	  reads.

2010-01-04  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/tg_iface_g.c: Fixed bug in reorder_by_read_group mode while
	  decoding.

	* gap4/list_contigs.tcl: Honour the contig order

2009-12-08  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/consensus.c: Fixed a memory corruption / cache counting
	  problem when working on complemented contigs.

	* gap5/consen.tcl: Honour the Strip Pads dialogue option.

	* gap5/docs/TODO:

	* gap5/hash_lib.c: Random musings in comments

	* tgap/zfio.c: Added <unistd.h> so that R_OK is defined.

2009-12-04  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/tg_gio.c, tgap/tg_gio.h, tgap/tg_iface.h,
	  tgap/tg_iface_g.c, tgap/tg_index.c, tgap/tg_index.h: Added a -c
	  <compression_method> to tg_index. This in turn gets passed all
	  the way down into tg_iface_g.c which now properly supports
	  switching from zlib to either no compression or liblzma. The top
	  bits of the format bytes now encode the compression method.
	  
	  This will still be disabled though unless -DHAVE_LIBLZMA is
	  specified in CFLAGS of the Makefile, which currently there is no
	  autoconf setting for.
	  
	  Also adjusted the format for GT_SeqBlocks to reorder quality and
	  names by the read-group (parent_rec field). This improves
	  compression of mixed assemblies.

2009-11-30  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/Makefile, gap5/contig_editor.tcl, gap5/editor_search.c,
	  gap5/editor_search.tcl, gap5/editor_view.h, gap5/tkEditor.c:
	  Added some basic editor searching. It's not as complete as Gap4,
	  but supports consensus sequences, read names and consensus
	  quality scores.

	* tgap/tg_gio.c: Bug fix to child IO: we now inherit the read-only
	  flag too. This prevents the editor from crashing due to
	  consensus caching when cutting and pasting out of the editor
	  consensus line.

2009-11-27  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/tg_iface_g.c: Added experimental code to support liblzma
	  instead of zlib for compression of data. The results vary based
	  on input data, but appear to be around 15% smaller at a cost of
	  2-4x CPU usage.
	  
	  Also added code to reorder quality values and names when writing
	  a seq block so that sequences from the same library are adjacent
	  to one another. This further improves compression ratio,
	  depending on whether mixed libraries are in use: about 7%
	  smaller on a 1000genomes mixed sample.
	  
	  Both of these changes are hidden behind #ifdefs and are currently
	  disabled.

2009-11-23  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/tg_struct.h: Increased size_hist[] dimensions. The values
	  can be 0 to 1792 inclusive, so it now reads [LIB_BINS+1]. This
	  fixes a corruption when dealing with values over 1Mb in size.

	* gap5/break_contig.c: Fixed a bug with break contig due to
	  over-ambitious optimisation.

2009-11-18  James Bonfield  <jkb@sanger.ac.uk>

	* gap4/legacy_f2c.c: Fixed ancient bug involving elipses and
	  function prototypes. I'm not sure why it's only surfaced now,
	  but perhaps it's a compiler version thing.
	  
	  On AMD64 gcc generates different code when calling a function
	  with ... args than when calling a function with specific types
	  args, even when the types are the default C promotion
	  rules. Fixed the various extern int declarations of swrt*_
	  functions to use ... instead of the auto-generated full argument
	  list. These now match those in f2c.c and so fixes an illegal
	  instruction and crash.

2009-11-17  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/tg_cache.c: More minor stats on exit.

	* gap4/edCommands.c: Fixed an issue with turning off undo in
	  remove pad columns. It still turns it off in some cases, but it
	  now clears the existing undo history and it reactivates it once
	  all the pad insertions have happened.

	* gap4/gap4: Allowed for GTAGDB to be set outside the wrapper
	  script.

	* tgap/sam_index.c: Fixed several sam parsing bugs.
	  
	  1) We now reset the number of insertions to zero for each new
	  contig. This was causing data to be shifted in susbequent
	  contigs.
	  
	  2) Pads can no longer get inserted at the end of a read.
	  
	  3) The lowercase letters immediately prior to a deletion are now
	  uppercase again.

2009-11-16  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/tg_bin.c: Fixed a bug in bin_for_range(). When recursing
	  down bins it could only create one extra layer of bin on the
	  right hand child of a bin.  This was because it didn't reset the
	  f_a and f_b variables used by NORM/NMIN/NMAX macros. (Bug added
	  when we fixed this code to handle inserting to complemented
	  bins.)

	* gap5/editor_join.c: Fixed a bug in join_invalidate(). It was
	  invalidating all of the right hand contig rather than just the
	  overlapping region.

2009-11-12  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/export_contigs.c: Added @RG header lines and RG:Z:*
	  auxillary sequence records, using the new name field from
	  libraries.

	* gap5/libraries.tcl, tgap/maq.c, tgap/sam_index.c,
	  tgap/tg_iface_g.c, tgap/tg_index_common.c, tgap/tg_library.c,
	  tgap/tg_library.h, tgap/tg_struct.h, tgap/tg_tcl.c: Added a name
	  field to libraries, so we can track their original names
	  in SAM.

2009-11-09  James Bonfield  <jkb@sanger.ac.uk>

	* configure.in, gap5/gap.tcl, tgap/tg_index.c, tgap/tg_view.c:
	  Version updates - for a local 2.0.0b3 test release internal to
	  Sanger (or those that wish to fish out the source from SVN).
	  Primary changes are bug fixes.

	* gap5/consen.tcl, gap5/gap4_compat.c: Fixed the lget_contig_num
	  to always clip off cutoff data when interpreting the contig
	  start/end values.
	  
	  This allows for consensus saving to always behave better now too.

	* gap5/editor_join.c: Fixed bugs with the "align" join editor
	  button.

	* gap5/consensus.c: Fixed bug in consensus_valid_range where a
	  right hand cutoff of > 1Kb was reported as 1Kb only.
	  
	  Fixed a bug with using cached consensus data from bins that
	  don't quite butt up to one another. Why this happens I am unsure
	  still (likely a bug in contig joining), but the defensive
	  approach is to detect it and fall back to filling in the
	  consensus gaps using the old technique.
	  
	  Also fixed a consensus algorithm bug where we could overflow the
	  cache and break things. We use cache_incr/decr now to protect
	  against this.

	* tgap/tg_cache.c: Fix the internal seq_t pointers if we've had to
	  realloc it during a resize request.

2009-11-05  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/g-files.c, tgap/g-io.c: The read_aux_index_* functions now
	  return the number of entries read, rather than just 0 or
	  -1. This allows for us to ask to read 256 and only get back 200
	  without being in error.
	  
	  This is now utilised in g_read_index() which reads blocks of
	  index records rather than 1 at a time, vastly reducing the
	  number of seek/read system calls needed.

2009-10-30  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/sam_index.c: Added a "-d data_type_list" option to
	  tg_index.  By default we store everything, but now we have the
	  option of skipping the read names or qualities, or just storing
	  nothing at all (except layout data).

	* tgap/baf.c, tgap/maq.c, tgap/tg_index.c, tgap/tg_index.h,
	  tgap/tg_index_common.c: Added a "-d data_type_list" option to
	  tg_index. By default we store everything, but now we have the
	  option of skipping the read names or qualities, or just storing
	  nothing at all (except layout data).
	  
	  Also fixed the library size histograms generated in
	  tg_index_common.c.

	* gap5/export_contigs.c: Improved BAF output. It now contains
	  tags, listed in the correct location with respect to their
	  sequences. (This proved harder than expected.)

2009-10-28  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/docs/TODO:

	* gap5/newgap5_cmds.c: Added export_tags C-to-Tcl binding

2009-10-26  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/export_contigs.c, gap5/export_contigs.h,
	  gap5/export_contigs.tcl, gap5/gap5rc_menu_full, gap5/tclIndex:
	  Added an Export Tags function. Currently it only outputs in GFF
	  format and it requires testing yet to see whether it is fully GFF
	  conformant.

2009-10-22  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/result_manager.tcl: Added missing file - forgot to check
	  this in!

	* tgap/tg_contig.c, tgap/tg_contig.h, tgap/tg_struct.h: The contig
	  iterators can now be given a type too to iterate sequences
	  only (the previous mechanism), annotations only, or anything.

	* tgap/tg_iface_g.c: Fixed a bug in AnnoEleBlock encoding where
	  the obj_rec was invalid. (Typically this has no effect due to it
	  being in the range array too.)

2009-10-19  James Bonfield  <jkb@sanger.ac.uk>

	* ac_stubs/ax_lib_iwidgets.m4: Added default install path as used
	  by Debian.

2009-10-16  James Bonfield  <jkb@sanger.ac.uk>

	* Tagged VERSION 2.0.0b2

2009-10-16  James Bonfield  <jkb@sanger.ac.uk>

        * tgap/tg_gio.h, tgap/tg_iface_g.c, tgap/tg_index.c,
	tgap/tg_index.h: Added a "-r nseqs" option to tg_index to reserve
	space in the aux file. This is an interim solution for the
	internal record number
        (ie not the actual index into the aux) not being a 64-bit number.

	Problems currently arise due to packing 1024 sequences into a
	SeqBlock record. We simulate individual sequence records by taking
	the record number of the SeqBlock and multiplying by 1024, then
	adding in the element number. However this means we have 2^21
	instead of 2^31 records avaalable in total, meaning 2 million bins
	is enough to make it impossible to allocate any sequences unless
	we ensure that we reserve the lower record numbers for the
	sequence/anno blocked structures.

        The correct solution, to be implemented later, would be to use a
	64-bit record type.

2009-10-16  Andrew Whitwham

        * tgap/tg_index_common.c, tgap/tg_index_common.h: Faster pair
          indexing.

        * tgap/ace.c, tgap/baf.c, tgap/maq.c, tgap/sam_index.c: Faster two
	  directional pairing.

2009-10-15  James Bonfield  <jkb@sanger.ac.uk>

        * tgap/g-alloc.c: turned off VALGRIND mode

        * tgap/sam_index.c: Added a comment

        * gap5/docs/TODO:

        * tgap/baf.c: Allow for extra blank lines in the baf file.  Report
	  time %age more often, also listing the number of contigs created
	  since last checkpoint as this has a significant impact on speed.

2009-10-14  James Bonfield  <jkb@sanger.ac.uk>

        * tgap/tg_anno.c: Fixed return value from anno_ele_set_type(),
	  This sometimes caused saving a tag in the contig editor to fail
	  with an error dialogue.

        * configure.in: version change to 2.0.0b2

        * gap5/docs/TODO:

        * tgap/baf.c: Fix bug when processing annotations with no text
          comment.

        * tgap/ace.c, tgap/tg_tcl.c, tgap/zfio.c: Bug fix for zlib.h and
	  LARGE_FILE support; move or add staden_config.h include

        * copy_reads/copy_reads, gap4/gap4, gap5/gap5,
	  prefinish/prefinish, pregap4/pregap4, spin/spin,
	  spin_emboss/create_emboss_files, trev/trev: Bug fix for when
	  LD_LIBRARY_PATH hasn't already been exported in user's
	  environment

        * Makefile.in: Small update to distsrc

        * Misc/array_arith.h, Misc/find.c, Misc/usleep.c,
          gap4/tman_cons.c,
          pregap4/Makefile, scripts/Makefile,
          seq_utils/sequence_formats.c,
          spin/nip_cmds.h, spin/nip_structs.h,
          spin/nip_translation.tcl,
          spin/resource.h, spin/seq_id.tcl, spin/seq_results.h,
          tk_utils/biolimsbox.tcl: Fixed rogue executable property

2009-10-13  James Bonfield  <jkb@sanger.ac.uk>

 	* Gap5 VERSION 1.2.4 *

2009-10-13  James Bonfield  <jkb@sanger.ac.uk>
	* ac_stubs/ax_lib_itcl.m4, ac_stubs/ax_lib_itk.m4: Now detects the
	default itcl/itk install on 32-bit fedora 11 systems.

	* tgap/g-files.c: Removed the large integer constant from assert.
	It just causes warnings as there's no real portable way to define
	it as long long (eg 0x7fffLL).
	
        * gap5/gap5: Set execute property
        
	* gap5/ChangeLog, gap5/NEWS:

	* gap5/gap.tcl: Bumped version to 1.2.4

	* gap5/gap4_compat.tcl: removal of debugging info

	* gap5/editor_view.c, tgap/tg_contig.c, tgap/tg_contig.h:
	#ifdef-ed out the code to allow cached consensus sequences to be
	visible in the editor and/or template displays. See tg_contig.h
	for the #define to reenable this if further debugging is required.
	
2009-10-12  James Bonfield  <jkb@sanger.ac.uk>

        * tgap/zfio.c, tgap/zfio.h: Added the zfopen/zfgets/zfclose
	 interface. This is required by the gzip support added a couple
	 checkins ago, but was omitted through error.

	 * copy_reads/copy_reads, copy_reads/copy_reads_main.tcl,
	 gap4/gap4, gap5/gap5, pregap4/pregap4, spin/spin,
	 spin_emboss/acd2tcl.tcl, spin_emboss/create_emboss_files,
	 spin_emboss/create_emboss_files.tcl, tk_utils/Makefile,
	 tk_utils/init.c, tk_utils/init.tcl, trev/trev: Replaced use of
	 stash by tclsh. This means that the setting of TCL_LIBRARY is
	 pushed over to the system install of Tcl rather than us having to
	 work it out for stash instead.

	 To facilitate this, the tkinit function is no more and the few
	 bits it did have been moved into Tk_Utils_Init instead. Replaced
	 the odd required use of tkinit with "package require Tk".

	 Also fixed create_emboss_files to run in the correct
	 directory.

	* gap5/export_contigs.c: We now output @SQ header lines to SAM
	  format, meaning it can be used to load in again via tg_index or
	  converted to bam directly without using a .fai file.
	  
	  Also ensure that all contig coordinates are positive, shifting
	  data if required, as SAM requires positions >= 1.

	* tgap/tg_index.c: Removed the old "aln" format from tg_index.
	  
	  Tg_index now attempts to automatically work out the file type
	  for the data files (eg sam vs ace etc).

	* configure.in, staden_config.h.in, tgap/Makefile, tgap/ace.c,
	  tgap/baf.c, tgap/baf.h, tgap/sam.c, tgap/sam.h, tgap/sam_index.c,
	  tgap/sam_index.h: Renamed sam.[ch] to sam_index.[ch] to avoid
	  header file clash with
	  samtools.
	  
	  Added gzipped file support for ACE/BAF.
	  
	  Removed the old "aln" format from tg_index.
	  
	  Tg_index now attempts to automatically work out the file type
	  for the data files (eg sam vs ace etc).

2009-10-09  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/contig_editor.tcl, gap5/editor_view.c: The editor now
	  starts up at the reading specified rather than base 1 of the
	  contig.

	* tgap/tg_tcl.c: Bug fixed the sequence object. Fetching the
	  record from the sequence appears to have broken when we moved to
	  SeqBlock structs.

	* tgap/sam.c: Added code to generate SAMX type tags from the SAM
	  auxillary tags.  For now this is #ifdefed out via
	  SAM_AUX_AS_TAG, as it adds unnecessarily to file size.

	* gap5/export_contigs.c: Improved SAM file generation, specifically
	  the flags.
	  
	  Also added code to generate the insert size and position
	  columns.  This majorly slows down the code so for now it's
	  disabled, but I plan on making it an option at some stage.

	* tgap/ace.c: Minor reformatting

	* tgap/tg_index.c, tgap/tg_index.h, tgap/tg_index_common.c,
	  tgap/tg_index_common.h: When using tg_index -t to index sequence
	  names, the B+Tree index is now built at the end rather than
	  while adding sequences. To do this is writes to a temporary
	  file, sorts the result, and then adds the items in an already
	  sorted fashion. This *dramatically* reduces the number of cache
	  misses in btree nodes.
	  
	  Testing on a project with 24million sequences the wall-clock
	  time dropped from ~126000 seconds to 750 seconds. Without name
	  indexing it took 549 seconds, implying only a small overhead to
	  index names now.

	* tgap/b+tree2.c, tgap/b+tree2.h, tgap/tg_iface_g.c: Improved the
	  encoding of B+Tree nodes. These are packed in a better
	  manner now and compressed too. Gap5 can still read the old format
	  data, but newer gap5 databases will not be readable by old gap5
	  versions if name indexing is used.

2009-10-07  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/docs/TODO:

	* gap5/export_contigs.c: For ACE format output, added back the DS
	  lines as they appear to be mandatory for consed, even if often
	  pointless. Also adjusted the BS line generation to work better
	  when contigs have holes.

	* gap5/Makefile: Added find_oligo.o to objs list

	* gap5/consensus.c: In calculate_consensus_simple we no longer
	  skip bins with no range data as this prevented us from caching
	  the consensus in a blank bin.

2009-10-02  Andrew Whitwham

	* tgap/Makefile, tgap/ace.c, tgap/baf.c, tgap/g-alloc.c,
	  tgap/maq.c, tgap/sam.c, tgap/tg_index_common.c: Moved common
	  functions to tg_index_common.

	* tgap/tg_index_common.c, tgap/tg_index_common.h: Initial version.

2009-10-02  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/newgap5_cmds.c: Added the Tcl interface to find_oligos
	  (sequence search). Accidentally missed in earlier checkin.

	* tgap/tg_bin.c: Now invalidate consensus cache when adding new
	  sequences in bin_add_range()

2009-10-01  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/find_oligo.c, gap5/find_oligo.h, gap5/find_oligo.tcl,
	  gap5/gap5rc, gap5/gap5rc_menu_full: Added the Sequence Search
	  option.
	  
	  Missing (compared to gap4) right now is the ability to search
	  the sequence covered by a specific tag type to then find all
	  other occurences of that sequence elsewhere. It's a bit specific
	  and likely not of top most priority, so it's disabled for now.

2009-09-30  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/tg_contig.c: Fixed bug where inserting/deleting a base to
	  the consensus crashed if
	  we have an annotation at that position.

	* gap5/break_contig.c, gap5/consensus.c, gap5/editor_join.c,
	  gap5/editor_view.c, tgap/tg_contig.c, tgap/tg_contig.h,
	  tgap/tg_iface_g.c, tgap/tg_sequence.c, tgap/tg_sequence.h,
	  tgap/tg_struct.h: Added a new experimental consensus caching
	  system. The consensus is stored as a fragmented sequence along
	  with other sequences, breaking it into (approximately) 64k
	  blocks to be stored in bins at the appropriate level.
	  
	  To achieve this, the range flags have been extended from seq vs
	  "isanno" to a mask and a set of values, allowing for ISCONS and
	  (unimplemented) ISREF too. Consequently a lot of code needed to
	  be modified; more still does too including the contig editor,
	  where cached consensus is currently visible purely for debugging
	  purposes.
	  
	  Editing, breaking and joining contigs invalidates cached
	  consensus.
	  
	  A new contig_bins_in_range function has been created to look for
	  the candidate bins that may contain cached consensus data.
	  
	  Also fixed sequence_copy so that it didn't zero rec, block and
	  idx subfields.

	* gap5/newgap5_cmds.c: Fixed memory leak in tcl_reformat_sequence

	* tgap/ace.c, tgap/baf.c, tgap/maq.c, tgap/sam.c, tgap/tg_anno.c,
	  tgap/tg_bin.c, tgap/tg_bin.h, tgap/tg_index.c, tgap/tg_tcl.c:
	  bin_add_range and bin_for_range functions now take an extra
	  argument to return whether the bin in complemented relative to
	  the contig.

	* tgap/tg_gio.c, tgap/tg_gio.h: Added a read_only flag to GapIO so
	  we can easily query if we can modify the database.

2009-09-24  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/tg_cache.c: Newly created sequences now get their seq->rec
	  field set correctly.

	* Makefile.in, gap4/Makefile, global.mk, mutlib/Makefile: More
	  small tweaks regarding make depend.

	* seqed/Makefile, spin2/Makefile, tracediff/Makefile: Futher
	  dependency tweaks

	* copy_reads/copy_reads, gap4/gap4, gap5/gap5, prefinish/prefinish,
	  pregap4/pregap4, spin/spin, spin_emboss/create_emboss_files,
	  trev/trev: Improvements to setting LD_LIBRARY_PATH.

	* Misc/Makefile, Misc/dependencies, abi/Makefile,
	  abi/dependencies, alf/Makefile, alf/dependencies,
	  convert/Makefile, convert/dependencies, copy_reads/Makefile,
	  copy_reads/dependencies, eba/Makefile, eba/dependencies,
	  find_renz/Makefile, find_renz/dependencies, g/Makefile,
	  g/dependencies, gap4/Makefile, gap4/dependencies, gap5/Makefile,
	  get_scf_field/Makefile, get_scf_field/dependencies, global.mk,
	  haplo/Makefile, haplo/dependencies, hetins/Makefile,
	  hetins/dependencies, init_exp/Makefile, init_exp/dependencies,
	  make_weights/Makefile, make_weights/dependencies,
	  mutlib/Makefile, mutlib/dependencies, mutscan/Makefile,
	  mutscan/dependencies, polyA_clip/Makefile,
	  polyA_clip/dependencies, prefinish/Makefile,
	  prefinish/dependencies, primer3/src/Makefile,
	  primer3/src/dependencies, qclip/Makefile, qclip/dependencies,
	  screen_seq/Makefile, screen_seq/dependencies,
	  seq_utils/Makefile, seq_utils/dependencies, seqed/Makefile,
	  seqed/dependencies, spin/Makefile, spin/dependencies,
	  spin2/Makefile, spin2/dependencies, stops/Makefile,
	  stops/dependencies, text_utils/Makefile,
	  text_utils/dependencies, tgap/Makefile, tk_utils/Makefile,
	  tk_utils/dependencies, tracediff/Makefile,
	  tracediff/dependencies, trev/Makefile, vector_clip/Makefile,
	  vector_clip/dependencies: Major overhaul of the "make depend"
	  system. We no longer use the make include directive to load in a
	  prebuilt dependencies file.  Instead this is appended to the
	  Makefile itself. Furthermore the users can just do a direct make
	  without having the auto-dependency code to run, removing the
	  requirement on imake (for makedepend) to build.
	  
	  Developers will still want to use make depend from time to time.

2009-09-18  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/tkEdNames.c: Fixed buffer overflow in the get_number
	  method. (Previously fixed for the tkEditor widget.)

2009-09-15  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/sam.c, tgap/tg_iface_g.c, tgap/tg_index.c,
	  tk_utils/tkTrace.c: Added more #include <staden_config.h>
	  statements, or in some cases moved them so they appear before
	  sys/types.h gets included. This fixes some compilation issues on
	  32-bit fedora.

	* global.mk: Switched from using LD_RUN_PATH to LD_LIBRARY_PATH
	  during linking.
	  
	  We need one of these so (for example) libmisc.so, referenced by
	  libtk_utils.so, is found when we use only -ltk_utils (and no
	  explicit -lmisc is used).
	  
	  LD_RUN_PATH however had the undesireable effect of forcing the
	  build directory to be searched even after a make install.

	* ac_stubs/ax_lib_itcl.m4, ac_stubs/ax_lib_itk.m4,
	  ac_stubs/ax_lib_iwidgets.m4, ac_stubs/ax_lib_tklib.m4,
	  shlib.conf.in: Improvements for handling itcl/itk on Centos (and
	  presmuably other OSes).

2009-09-10  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/contig_editor.tcl: Improvements to undo for tag editing.

	* gap5/consensus.c: Added code (currently "#if 0"ed out) to
	  attempt to cache the consensus in tracks per bin. Specifically
	  the plan was to store the A,C,G,T,* accumulated log(probability)
	  values for data held within that bin as a track. It means we can
	  compute the consensus without having to load all the invdividual
	  sequences.
	  
	  In practice, it does speed up the consensus generation when
	  cached (usually only barely, but occasionally by > 10x), but the
	  downsides are considerable. It needs read-write access, and
	  worst of all the space it takes up is very substantial - often
	  far more than the rest of the database. The existing
	  implementation also is only approximate as we store the floating
	  point values in very low precision.
	  
	  Given the size problems I'm planning on reimplementing this via
	  another means, but the code is checked in here (disabled) so I
	  can revert or refer back to it at some stage if required.
	  
	  Also see the code changes to tg_iface_g.c.

	* gap5/newgap5_cmds.c: Use ckfree instead of free to fix memory
	  corruption, in tcl_calc_consensus()

	* README.build: Fixed typo

	* tgap/tg_bin.c, tgap/tg_bin.h, tgap/tg_cache.c,
	  tgap/tg_iface_g.c, tgap/tg_struct.h: Added a bin_track_t struct
	  to house the in-memory track data, instead of using the
	  GBinTrack struct which should only be known by the "g" interface
	  code.
	  
	  This has also allowed the addition of a track pointer to be
	  cached within the bin_track_t struct, meaning we can add fake /
	  temporary tracks to a bin structure (they're not written back to
	  disk) and still query them back again without having to load
	  from a record number.

2009-09-07  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/tg_iface_g.c: Removed debugging information.

2009-09-04  James Bonfield  <jkb@sanger.ac.uk>

	* convert/bapDB.h, gap4/gap-error.c, gap4/legacy_f2c.c,
	  gap4/shuffle_pads.c, gap5/editor_view.c, gap5/gap-error.c,
	  gap5/gap4_compat.c, gap5/newgap5_cmds.c, gap5/qualIO.c,
	  polyA_clip/Makefile, polyA_clip/polyA_clip.c, qclip/Makefile,
	  qclip/qclip.c, tgap/b+tree2.c, tgap/baf.c, tgap/g-request.c,
	  tgap/tg_anno.h, tgap/tg_iface_g.c, tgap/tg_register.h,
	  tgap/tg_view.c, tk_utils/capture.c, tk_utils/tkTraceIO.c:
	  General warning tidyup to remove complaints from the SunStudio C
	  compiler.

	* configure.in, staden_config.h.in, system.mk.in: Use
	  TEA_CONFIG_CFLAGS to override the predefined vars loaded by
	  TEA_LOAD_TCLCONFIG. This means we can work out how to build
	  shared libraries if we pick a different compiler than the one
	  used to build the system tcl. Eg ./configure ... CC=foocc

2009-09-03  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/docs/TODO:

	* gap5/contig_editor.tcl, gap5/gap5rc_menu_full, gap5/tkEditor.c:
	  The contig editor now has add/remove tags functionality.

	* tgap/tg_cache.c: Fixed cache_item_create_anno_ele to initialise
	  anno_ele_t->rec field.

	* tgap/tg_anno.c, tgap/tg_anno.h, tgap/tg_tcl.c: Created a
	  anno_ele_add and anno_ele_destroy function to make adding
	  and removing tags easier. These can be called from the Tcl object
	  interface too. The tcl obj interface also has other additional
	  functions: new_contig/sequence/anno_ele (from $io),

	* gap5/break_contig.c, tgap/tg_bin.c, tgap/tg_contig.c,
	  tgap/tg_iface_g.c, tgap/tg_sequence.c, tgap/tg_struct.h: Allow
	  for range items to be marked as unused (free). They form a
	  linked list, with a new rng_free member of the bin_index_t
	  structure pointing to the head of the list. (If this isn't
	  present due to an older format database it'll automatically get
	  created when it's next written to, although this will migrate
	  the DB to be unusable by the old gap5.)

2009-09-01  James Bonfield  <jkb@sanger.ac.uk>

	* ac_stubs/ax_lib_iwidgets.m4: Allow the --with-iwidgets=DIR
	  parameter to include the iwidgets package directory itself too,
	  rather than just the prefix

	* ac_stubs/ax_lib_itcl.m4, ac_stubs/ax_lib_itk.m4: Adding
	  /usr/lib64 to the search path, helping it to work out of the box
	  on 64-bit fedora

	* ac_stubs/ax_lib_tklib.m4: Fix cut and paste error - no means yes
	  in some diagnostic output...

	* ac_stubs/tcl.m4: Removed error output when /usr/include/tcl*
	  doesn't match anything

	* gap5/editor_view.c, gap5/editor_view.h, gap5/tkEdNames.c,
	  gap5/tkEditor.c: Modified edview_item_at_pos to control whether
	  we want only sequences returned or also tags. This allows
	  selecting a region to work over a tag, which previously caused
	  gap5 to crash.

	* tgap/tg_anno.c, tgap/tg_anno.h, tgap/tg_tcl.c: Added various set
	  methods to the anno_ele struct, both from C and also
	  via the tcl interface.

	* tgap/baf.c: Tags now interpret "\n" as a newline, enabling
	  multi-line annotations.

2009-08-25  James Bonfield  <jkb@sanger.ac.uk>

	* ac_stubs/ax_lib_itcl.m4, ac_stubs/ax_lib_itk.m4, ac_stubs/tcl.m4:
	  Added /usr/lib64 to search paths.

2009-08-12  Andrew Whitwham

	* tgap/tg_struct.h: Added define to make build work.

2009-08-07  James Bonfield  <jkb@sanger.ac.uk>

 	* Gap5 VERSION 1.2.3 *

2009-08-07  James Bonfield  <jkb@sanger.ac.uk>

	* staden/trunk/doc/Makefile, configure.in, gap5/NEWS: Minor tweaks
	  to set version to 2.0.0b1

	* tgap/ace.c, tgap/ace.h, tgap/baf.c, tgap/baf.h, tgap/maq.c,
	  tgap/maq.h, tgap/sam.c, tgap/sam.h, tgap/tg_index.c,
	  tgap/tg_index.h: Added a -f (fast mode) parameter to tg_index.
	  When linking read-pairs this links A' to A but not A back to
	  A'. This reverse link is desireable, but currently causes major
	  I/O bottlenecks on very large data sets. I'll address this later
	  in a better fix, so -f will probably be only a temporary option.

	* gap5/contig_editor.tcl, gap5/editor_view.c, gap5/tkEdNames.c:
	  Fixesd bugs with mouse-over events in the editor names panel. We
	  now always display a name, rather than accidentally picking a
	  tag. In one-per-line non-stacking mode we now also correctly
	  display the name.

	* gap5/docs/TODO:

2009-08-06  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/break_contig.c, gap5/editor_join.c: Both breaking and
	  joining contigs now track the number of sequences
	  per bin correctly.
	  
	  For break contig only:
	  - Fixed a common crash.
	  - Annotations now get moved correctly too.

	* gap5/editor_view.c: Minor debugging changes.

	* tgap/tg_contig.c: Minor change to contig_dump_ps().

	* gap5/docs/PLANS, gap5/docs/TODO:

	* gap5/docs, gap5/docs/DESIGN, gap5/docs/IMPLEMENTATION,
	  gap5/docs/TRACKS, gap5/docs/Tree_format: Added some gap5
	  code/design documentation. A lot of it is out of date now or is
	  information on how I thought things would go rather than how
	  they ultimately got implemented, but hopefully it's of use to
	  curious browsers still.

2009-08-05  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/tg_iface_g.c: Fixed bug in io_anno_ele_block_read. The sub
	  cached_item records were all set to be type GT_Seq rather than
	  type GT_AnnoEle meaning cache_rw would crash later.

	* gap5/gap4_compat.c: Protect against contigs with zero sequences
	  in io_clnbr and io_crnbr.

2009-08-03  James Bonfield  <jkb@sanger.ac.uk>

	* configure.in: typo fix

2009-07-31  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/tkEditor.c: Fixed a buffer overrun in the editor get_number
	  method.

2009-07-30  James Bonfield  <jkb@sanger.ac.uk>

	* tk_utils/help_choose.tcl, tk_utils/help_config: Fixed paths for
	  displaying help

2009-07-28  James Bonfield  <jkb@sanger.ac.uk>

	* Makefile.in, configure.in, io_lib: Removed io_lib stub directory
	  and also removed the option of compiling
	  using a local io_lib directory in the staden package Makefiles.

	* io_lib/branches, io_lib/tags, io_lib/trunk, io_lib/trunk/CHANGES,
	  io_lib/trunk/COPYRIGHT, io_lib/trunk/ChangeLog,
	  io_lib/trunk/Makefile, io_lib/trunk/Makefile.am,
	  io_lib/trunk/README, io_lib/trunk/acinclude.m4,
	  io_lib/trunk/bootstrap, io_lib/trunk/configure.in,
	  io_lib/trunk/dependencies, io_lib/trunk/docs,
	  io_lib/trunk/include, io_lib/trunk/io_lib,
	  io_lib/trunk/io_lib-config.in, io_lib/trunk/io_lib.m4,
	  io_lib/trunk/man, io_lib/trunk/options.mk, io_lib/trunk/progs,
	  io_lib/trunk/tests, io_lib/CHANGES, io_lib/COPYRIGHT,
	  io_lib/ChangeLog, io_lib/Makefile, io_lib/Makefile.am,
	  io_lib/README, io_lib/acinclude.m4, io_lib/bootstrap,
	  io_lib/configure.in, io_lib/dependencies, io_lib/docs,
	  io_lib/include, io_lib/io_lib, io_lib/io_lib-config.in,
	  io_lib/io_lib.m4, io_lib/man, io_lib/options.mk, io_lib/progs,
	  io_lib/tests: Moved io_lib from staden source tree into it's own
	  top-level
	  subversion directory, complete with tags, branches, and trunk.
	  
	  For now the old tagged copies of io_lib are still in the
	  staden/tags/ directory with tag names io_lib-<version>, but that
	  is perhaps right and proper (as it's where the code actually
	  resided at that release number).

	* io_lib/abi, io_lib/alf, io_lib/ctf, io_lib/exp_file,
	  io_lib/plain, io_lib/read, io_lib/scf, io_lib/sff, io_lib/srf,
	  io_lib/utils, io_lib/ztr: Remove old stub directories; these come
	  from the earlier CVS tree when
	  we had the library split into per-format directories.

	* io_lib/progs/Makefile.am, io_lib/progs/solexa2srf.c,
	  io_lib/progs/srf2solexa.c: Removed Illumina/Solexa specific
	  programs. These are now out of date with respect to Illumina's
	  own fork, plus I don't think they belong in the largely platform
	  agnostic library.

	* io_lib/CHANGES, io_lib/ChangeLog, io_lib/README,
	  io_lib/configure.in, io_lib/io_lib/Makefile.am: Preparations for
	  1.12.0 release.
	  
	  There is now proper versioning support for the library too. The
	  soname used here is libstaden-read.so.1, to distinguish from any
	  earlier dynamic libraries. (The ABI definitely has changed over
	  the years in incompatible manners.)

	* io_lib/tests/data/slx_out/both.info,
	  io_lib/tests/data/slx_out/raw.info: Updated for new format
	  srf_info output

	* io_lib/tests/data/slx_out/proc.info: Updated with new format
	  output.

2009-07-27  James Bonfield  <jkb@sanger.ac.uk>

	* io_lib/io_lib/vlen.c: Include os.h so we can pick up NEED_VA_COPY
	  definition.

	* io_lib/progs/srf_filter.c: Reorganisation to allow chunks to be
	  added as well as removed. At present this only supports adding
	  REGN chunks.
	  
	  (Patch supplied by Steven Leonard.)

	* io_lib/progs/index_tar.c: Handle GNU tar extensions: LongLink
	  notation.
	  (Patch supplied by Steven Leonard).

	* io_lib/progs/srf2fasta.c, io_lib/progs/srf2fastq.c,
	  io_lib/progs/srf_extract_hash.c: Changed the maximum read length
	  from 1024 to 10000. This allows for capillary traces to be
	  stored in SRF.
	  (Patch supplied by Steven Leonard)

	* io_lib/progs/srf_info.c: Use int64_t instead of long for base
	  counts and chunk sizes.
	  (Supplied by Steven Leonard.)

	* io_lib/man/man1/srf_info.1, io_lib/progs/srf_info.c: Added
	  compressed chunk size to the per-chunk type output. This allows
	  us to see what takes up the most storage in an SRF.

	* io_lib/io_lib/ztr.c: removed C9Xism

	* io_lib/configure.in, io_lib/io_lib/Makefile.am,
	  io_lib/progs/Makefile.am: Re-enabled libtool, with a workaround
	  to remove the infuriating rpath nonsense. (It's now 2x slower to
	  configure, 3x slower to compile and 10x more anguish to debug,
	  but at least I can sleep at night knowing rpath hasn't had it's
	  wicked way with the code.)

	* data/Makefile:

	* ac_stubs/ax_lib_itcl.m4, ac_stubs/ax_lib_itk.m4,
	  ac_stubs/ax_lib_iwidgets.m4, ac_stubs/ax_lib_png.m4,
	  configure.in, shlib.conf.in, staden_config.h.in, system.mk.in,
	  tk_utils/tkTrace.c: More autoconf checks; for itcl, itk, and
	  png.  In the case of png it's an optional --with and if not
	  found we simply disable the one piece of code that relies on it.

2009-07-24  James Bonfield  <jkb@sanger.ac.uk>

	* ac_stubs/ax_func_va_copy.m4, ac_stubs/ax_lib_iwidgets.m4,
	  ac_stubs/ax_lib_tklib.m4, shlib.conf.in: More autoconf checks.

	* configure.in, global.mk: Removed the dependency on Fortran for
	  building. For now we'll use the
	  f2c converted code. It may not be quite as efficient (not tested
	  that), but it's trivial to build everywhere and we're not
	  modifying
	  the code at all.

	* Makefile.in, io_lib/io_lib/Makefile: Added a Makefile for
	  io_lib/io_lib; so the library itself. This isn't expected to be
	  used normally, but it allows me to test local copies of io_lib
	  (under a different library name) in conjunction with the staden
	  source tree before releasing either.

	* tgap/tg_iface_g.c: Changed allocate() to take a data type
	  argument too.  The plan for this (#ifed out at the moment) is to
	  reserve different record-spaces for blocked data vs nonblocked
	  data.
	  
	  Without this we hit problems when the number of records goes
	  above 2 million, meaning the 10-bits of sub-record used for
	  sequence indexing takes us over 31-bits record size. (Maybe
	  long-term we should just use 64-bit record IDs; this is a
	  temporary hack and commented out in the main source tree.)

	* tgap/sam.c, tgap/tg_index.c: Fixed HAVE_SAMTOOLS macro name.

2009-07-23  James Bonfield  <jkb@sanger.ac.uk>

	* vector_clip/vector_clip.c: Removed rotate_seq() and use the
	  identical copy in seq_utils.

2009-07-22  James Bonfield  <jkb@sanger.ac.uk>

	* prefinish/prefinish_lib.tcl, prefinish/prefinishrc,
	  pregap4/modules/interactive_clip.p4m,
	  pregap4/modules/screen_seq.p4m,
	  pregap4/modules/sequence_vector_clip.p4m, pregap4/pregap4.tcl,
	  pregap4/templates.tcl, spin_emboss/emboss_utils.tcl,
	  tk_utils/help.tcl, tk_utils/help_macosx.tcl: Various pathname
	  tweaks to use STADLIB and/or STADTCL variables
	  correctly.

	* gap4/acd2tag.tcl, gap4/gap_prefinish.tcl, gap5/gap5rc,
	  prefinish/prefinish.tcl, spin_emboss/acd2tcl.tcl: Use package
	  require instead of load_package for iwidgets.

	* README.build: Minor update listing system specifics

	* ac_stubs/ax_lib_staden_io_lib.m4,
	  ac_stubs/libcurl_check_config.m4, configure.in: Improved output
	  messages while running autoconf. Samtools is also now
	  permitted to not exist, rather than aborting.

	* ac_stubs/tcl.m4: Fixed --with-tcl/tk and --with-tkinclude to
	  also search the default install locations used by Debian.

	* tk_utils/xmclistbox.tcl: Fix tab stops so the code works with
	  tk8.5

	* tk_utils/sheet.c, tk_utils/sheet.h: Updated to work with Tk 8.5
	  font methods.

	* mutlib/staden.h: Work around problem in io_lib/compress.h on
	  newer linux. The pipe2()
	  function has been added and clashes.

	* tgap/sam.c, tgap/tg_index.c: Check for HAVE_SAMTOOLS_H, so we can
	  compile without samtools being
	  installed.

2009-07-20  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/tg_tcl.c: Include staden_config.h so HAVE_UNISTD_H is
	  defined prior to tcl includes. This prevents a conflict between
	  Tcl's compat/unistd.h when building against Tcl 8.5.

	* seq_utils/Makefile, spin/Makefile, spin_emboss/Makefile,
	  trev/Makefile: Further tweaks to distsrc Makefile target

	* spin/seq_reg_cmds.c: Removed remnant of licence checking

	* pregap4/pregap4.tcl, spin/spinrc: Replaced our local load_package
	  interface witht he standard package require => Iwidgets now found

	* pregap4/pregap4rc: Fixed search path for pregap4 modules

	* README.build, configure.in, system.mk.in: Added FORTRAN checks
	  into autoconf.

	* tk_utils/tkRaster.c: Removed debugging output

	* Makefile.in, Misc/Makefile, README.build, abi/Makefile,
	  alf/Makefile, configure.in, convert/Makefile,
	  copy_reads/Makefile, eba/Makefile, find_renz/Makefile,
	  g/Makefile, gap4/Makefile, gap4/fak2rc, gap4/gap4, gap5/Makefile,
	  gap5/gap5, get_scf_field/Makefile, global.mk, haplo/Makefile,
	  hetins/Makefile, init_exp/Makefile, make_weights/Makefile,
	  mutlib/Makefile, mutscan/Makefile, polyA_clip/Makefile,
	  prefinish/Makefile, pregap4/Makefile, primer3/Makefile,
	  primer3/src/Makefile, qclip/Makefile, screen_seq/Makefile,
	  scripts/Makefile, seq_utils/Makefile, shlib.conf.in,
	  spin/Makefile, spin_emboss/Makefile, stops/Makefile,
	  system.mk.in, text_utils/Makefile, tgap/Makefile,
	  tk_utils/Makefile, tracediff/Makefile, trev/Makefile,
	  vector_clip/Makefile: "make distsrc" should now work. It creates
	  a subdirectory containing
	  the files necessary for distribution. Note for now this isn't the
	  entire tree as some programs are unfinished and unsupported
	  (spin2,
	  seqed).

2009-07-17  James Bonfield  <jkb@sanger.ac.uk>

	* gap4/newgap_cmds.c, gap4/tkEditor.c, gap5/newgap5_cmds.c,
	  gap5/tkEditor.c, tk_utils/capture.c: Further changes to do with
	  TCL_DYNAMIC and not using ckalloc. We now
	  use TCL_VOLATILE where appropriate (or ckalloc).

	* Makefile.in, Misc/Makefile, Misc/vlen.c, abi/Makefile,
	  ac_stubs/ax_lib_samtools.m4, alf/Makefile, configure.in,
	  convert/Makefile, copy_reads/Makefile, copy_reads/copy_reads,
	  copy_reads/copy_reads_main.tcl, copy_reads/copy_readsrc, data,
	  data/RENZYM.4, data/RENZYM.6, data/RENZYM.ALL, data/alus,
	  data/blast_data, data/gcodes, data/m13mp18_primers, data/pam250,
	  data/renzyme_bairoch, data/vector_primer, data/vectors,
	  eba/Makefile, find_renz/Makefile, g/Makefile, gap4/GTAGDB,
	  gap4/Makefile, gap4/NOTEDB, gap4/cap2rc, gap4/cap3rc,
	  gap4/checked.gif, gap4/fak2rc, gap4/follow.bitmap,
	  gap4/gap-tcl.c, gap4/gap.tcl, gap4/gap4, gap4/gap4_defs.mk,
	  gap4/gap_prefinish.tcl, gap4/gaprc, gap4/gaprc_menu_demo,
	  gap4/gaprc_menu_full, gap4/gaprc_menu_mito,
	  gap4/gaprc_menu_viewer, gap4/list_contigs.tcl, gap4/phraprc,
	  gap4/unchecked.gif, gap5/Makefile, gap5/depth.tcl, gap5/gap.tcl,
	  gap5/gap5, gap5/gap5rc, gap5/gap5rc_menu_full,
	  get_scf_field/Makefile, haplo/Makefile, haplo/haplorc,
	  hetins/Makefile, init_exp/Makefile, make_weights/Makefile,
	  mutlib/Makefile, mutscan/Makefile, polyA_clip/Makefile,
	  prefinish/Makefile, prefinish/args.template,
	  prefinish/config.prefinish, prefinish/finish_sanger,
	  prefinish/prefinish, prefinish/prefinish.tcl,
	  prefinish/prefinishrc, pregap4/Makefile, pregap4/pregap4,
	  pregap4/pregap4.tcl, pregap4/pregap4rc, primer3/src/Makefile,
	  qclip/Makefile, screen_seq/Makefile, scripts/Makefile,
	  seq_utils/Makefile, seq_utils/align_lib_nuc_matrix,
	  seq_utils/nuc_matrix, seqed/seqedrc, spin/Makefile, spin/eia.wts,
	  spin/ied.wts, spin/niprc, spin/perceptron.wts,
	  spin/prokprom_10.wts, spin/prokprom_35.wts, spin/siprc,
	  spin/spin, spin/spin.tcl, spin/spinrc, spin2/FEATCOLDB,
	  spin2/FEATQUALDB, spin2/FEATUREDB, spin2/spin2rc,
	  spin2_emboss/spin2_embossrc, spin_emboss/Makefile,
	  spin_emboss/create_emboss_files, spin_emboss/emboss_menu,
	  spin_emboss/spin_embossrc, staden_config.h.in, stops/Makefile,
	  system.mk.in, text_utils/Makefile, tgap/Makefile,
	  tk_utils/2bars_h.bmp, tk_utils/2bars_v.bmp, tk_utils/Makefile,
	  tk_utils/help_config, tk_utils/init.c, tk_utils/shlib.conf,
	  tk_utils/stash.c, tk_utils/tk_utilsrc,
	  tk_utils/user_defaults.tcl, tracediff/Makefile, trev/Makefile,
	  trev/trev, trev/trev.tcl, trev/trevrc, vector_clip/Makefile:
	  Further upheaval of build system:
	  - Make install now works.
	  
	  - Removal of excessive $(O) (was $(machine)-binaries) and
	  similarly unnecessary fluff in the makefiles.
	  
	  - Moved files from tables/* to appropriate src/*. There are a
	  few exeptions (small blast databases, alu sequences, etc)
	  which have been added to a src/data directory. Not technically
	  source I guess, but it means the src tree contains everything
	  necessary to obtain a run-time environment (minus
	  documentation and test/training data).
	  
	  - Overhauled the directory layout to be more friendly to using a
	  prefix of /usr, rather than something dedicated to the staden
	  package.
	  
	  - Extra autoconf code to check for and utilise va_copy().
	  
	  - Fix to samtools autoconf.
	  
	  Other fixes:
	  - Removed use of $(MACHINE)-binaries as it's no longer needed.
	  
	  - Fixed gap-tcl.c's io_read_text function to work with thread
	  enabled Tcl. This is almost certainly the tip of the iceberg.
	  When using threads Tcl must be given memory allocated using
	  ckalloc rather than malloc. One trivial solution (used here)
	  is simply to pass data over as TCL_VOLATILE instead of
	  TCL_DYNAMIC which forces it to allocate it's own copy in
	  whatever method it deems appropriate. Obviously we then have
	  to free up our own copy.
	  
	  - Gap4's List Contigs feature has been updated to use reading
	  numbers instead of reading names internally. This avoids
	  issues when (corrupted) databases exist with duplicate read
	  names. Not elegant, but defensive.

2009-07-16  James Bonfield  <jkb@sanger.ac.uk>

	* staden/trunk/README.build, abi/abiIO.h, abi/getABIfield.c,
	  bootstrap, global.mk, tk_utils/tclAppInit.c, tracediff/Makefile:
	  Fixes to new autoconf build. Now actually builds on Debian etch.

	* Makefile, Makefile.in, Makefile.thirdparty, Misc/Makefile,
	  Misc/os.h, abi/Makefile, ac_stubs, ac_stubs/ax_lib_samtools.m4,
	  ac_stubs/ax_lib_staden_io_lib.m4, ac_stubs/ax_lib_zlib.m4,
	  ac_stubs/libcurl_check_config.m4, ac_stubs/tcl.m4, alf/Makefile,
	  configure.in, convert/Makefile, copy_reads/Makefile,
	  copy_reads/copy_reads.c, eba/Makefile, eba/conf.c, eba/conf.h,
	  eba/qual.c, find_renz/Makefile, g/Makefile, gap4/IO.c,
	  gap4/IO2.c, gap4/Makefile, gap4/assemble_direct.c, gap4/consen.c,
	  gap4/copy_db_main.c, gap4/extract.c, gap4/extract.h,
	  gap4/gap4_defs.mk, gap4/newgap_cmds.c, gap4/preass.c,
	  gap4/seqInfo.c, gap4/seqInfo.h, gap4/tagU2.c, gap4/tkEditor.c,
	  gap4/tman_cons.c, gap4/tman_diff.c, gap4/tman_display.h,
	  gap4/tman_interface.c, gap5/Makefile, gap5/consen.c,
	  gap5/extract.h, gap5/tkEditor.c, gap5/tman_display.h,
	  gap5/tman_interface.c, get_scf_field/Makefile,
	  get_scf_field/get_scf_field.c, global.mk, haplo/Makefile,
	  hetins/Makefile, hetins/hetins.c, init_exp/Makefile,
	  init_exp/init_exp.c, licence, make_weights/Makefile,
	  make_weights/make_weights.c, mk, mutlib/Makefile,
	  mutscan/Makefile, mutscan/main.cpp, mutscan/staden.h,
	  polyA_clip/Makefile, polyA_clip/polyA_clip.c,
	  polyA_clip/seqInfo.c, polyA_clip/seqInfo.h, prefinish/Makefile,
	  pregap4/Makefile, primer3/Makefile, primer3/src/Makefile,
	  qclip/Makefile, qclip/consen.c, qclip/qclip.c, qclip/seqInfo.c,
	  qclip/seqInfo.h, screen_seq/Makefile, screen_seq/screen_seq.c,
	  scripts/Makefile, seq_utils/Makefile, spin/Makefile,
	  spin/nip_cmds.c, spin/seq_reg_cmds.c, spin/sip_cmds.c,
	  spin_emboss/Makefile, staden_config.h.in, stops/Makefile,
	  stops/stops.c, system.mk.in, tcl8.4.0, text_utils/Makefile,
	  tgap/Makefile, tk8.4.0, tk_utils/Makefile, tk_utils/init.c,
	  tk_utils/misc.c, tk_utils/postscript.h, tk_utils/tkCanvGraph.c,
	  tk_utils/tkTrace.c, tk_utils/tkTrace.h, tk_utils/tkTraceComp.c,
	  tk_utils/tkTraceDisp.c, tk_utils/tkTraceIO.c,
	  tk_utils/trace_print.c, tracediff/Makefile, tracediff/main.cpp,
	  tracediff/staden.h, trev/Makefile, vector_clip/Makefile,
	  vector_clip/vector_clip.c: Major tidyup of build system:
	  
	  * We now use autoconf to generate a system.mk tailored for this
	  machine. This replaces the old mk/$(MACHINE).mk stubs.
	  
	  * We no longer have Makefile.thirdparty and the local copies of
	  tcl, tk, itcl, itk, etc.
	  
	  * Removed the defunct licencing code.
	  
	  It is recommended when using this that you make a subdirectory
	  and use ../configure. This keeps binaries and source code neatly
	  separated.

2009-06-26  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/tg_cache.c: fix for copy-on-write of GT_SeqBlock and
	  GT_AnnoEleBlock
	  structs. This was causing save after edits in the contig editor
	  to crash.

	* gap5/editor_view.c: Fixed annotation viewing. Clicking on an
	  annotation caused crashes and also display glitches due to not
	  expected xx->cursor_type to be GT_AnnoEle.

2009-06-25  James Bonfield  <jkb@sanger.ac.uk>

	* tk_utils/tclIndex, tk_utils/xscrolledlistbox.tcl,
	  tk_utils/xscrolledtext.tcl: Added xscrolledtext and
	  xscrolledlistbox widgets - to replace iwidget equivalents. (Not
	  100%, but sufficient for our purposes.)

2009-06-22  James Bonfield  <jkb@sanger.ac.uk>

 	* VERSION 1.2.2 *

2009-06-22  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/contig_selector.c,
	* gap5/contig_selector.h,
	* gap5/contig_selector.tcl,
	* gap5/gap4_compat.c,
	* gap5/gap4_compat.h:
	(11:31:05) Updated various functions to use int64_t instead of int
	for contig coordinates.  Specifically anything using the total
	contig length or coordinates in the contig selector.
	
	This means that the contig selector now displays data when the
	total contig length is > 2Gb. 

	* gap5/IO.h,
	* gap5/Makefile,
	* gap5/editor_join.c,
	* gap5/editor_view.h,
	* gap5/qual.c,
	* gap5/template_display.c:
	(11:33:18) Removal of minor compilation warnings.
	
	Fixed the main build to no longer link against fortran or C++
	libraries as these aren't used in Gap5 and they hamper portability. 

2009-06-19  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/ace.c:
	(14:16:03) Initialise more elements in range_t. They were left
	uninitialised so all sorts of things could happen! 

	* gap5/template_display.c,
	* gap5/template_display.h:
	(14:17:44) Added a template size blocking factor for use in the
	Stacking Y-mode. This groups like-sized templates together, causing
	extra-long templates to appear beneath the smaller ones and so
	rearrangements become easier to spot. 

	* gap5/depth.tcl:
	(16:11:56) Added an interface to changing the "stacking y size"
	(only used in stacking mode).
	
	The entire GUI for this needs an overhaul, but that's for later. 

	* gap5/template_display.c:
	(16:16:35) Removal of some debugging info. 

	* tgap/maq.c:
	(16:18:02) Added timing stats. 

	* tgap/maq.c,
	* tgap/sam.c,
	* tgap/tg_cache.c,
	* tgap/tg_gio.h,
	* tgap/tg_iface_g.c,
	* tgap/tg_index.c,
	* tgap/tg_register.c,
	* tgap/tg_sequence.c,
	* tgap/tg_sequence.h:
	(16:35:07) General code tidyup. Removal of unused variables;
	deleted old #if 0 code (will get it back if we need afterall);
	tidied up some const vs non-const warnings, etc. 

	* tgap/tg_contig.h:
	(16:40:57) Export more functions 

2009-06-18  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/editor_view.c:
	(11:25:17) Improved the editor information line to show contig
	names when a read-pair has the position in another contig rather
	than this one. 

2009-06-17  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/tg_anno.c,
	* tgap/tg_anno.h:
	(11:27:17) Added an anno_get_range() function to return the range_t
	struct associated with an annotation. This allows us to query
	positional data, flags, etc. 

	* tgap/tg_contig.c:
	(11:27:51) Annotations now have their Y coordinates allocated too
	(if requested) so that they reside on top of the correct sequence Y
	location. 

	* gap5/contig_editor.tcl,
	* gap5/editor_view.c,
	* gap5/editor_view.h,
	* gap5/tkEditor.c:
	(11:29:51) The get_seq_status editor method (calling
	edview_item_at_pos in C) can return AnnoEle records as well as the
	usual sequence/contig records. Thefore we can now show tag summary
	data in the editor information bar too. 

	* tgap/ace.c:
	(14:03:28) Now set seq.bin_index too. Without this it was causing
	assertion failures in sequence_get_pair() during viewing in gap5. 

2009-06-16  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/Attic/tg_depth.c:
	(09:14:59) removed 

	* tgap/Makefile,
	* gap5/Makefile:
	(11:11:50) Minor makefile changes - CXX vs CXXLD etc 

	* gap5/contig_editor.tcl:
	(11:13:14) Extra options on panedwindow to show sash. This was made
	invisible with later Tk releases. (A bad case of form over
	function.) 

	* gap5/libraries.tcl:
	(11:14:12) Fix issues with apparent diagonal lines at the start of
	the library plot. These come from having no values between 0 and
	the first observed insert size. 

	* gap5/contig_selector.c,
	* gap5/cs-object.c,
	* gap5/editor_view.c,
	* gap5/list_contigs.tcl,
	* gap5/tk-io-reg.c,
	* gap5/tman_display.c:
	(11:18:14) Removal of interp->result to use the appropriate Tcl
	functions. Mainly Tcl_SetResult (plus our Tcl_vSetResult for printf
	style args) and Tcl_GetStringResult().
	
	It's not done in the best manner, but a way that works. Eg we
	regularly do things like changing atoi(interp->result) into
	atoi(Tcl_GetStringReslt(interp)). This would be better done using
	Tcl_GetInt instead, but the changes were formulaic and simply
	implemented. If I was to tailor each one carefully then optimally
	we should be using Tcl_Obj based methods anyway.
	
	The requirement for this change comes from Tcl8.6 where the result
	element from Tcl_Interp has finally been removed (rather than
	simply labelled as deprecated, which it has been for many years).
	
	Also tweaked a few other bits here and there regarding removal of
	deprecated features (especially in tkRaster.c). 

	* tgap/sam.c:
	(11:20:06) Changed search of LB tag to RG tag. It appears this is
	normally how libraries are implemented in SAM.
	
	In theory I should then read the RG header lines and redirect those
	to the LB header lines too, but by region is perhaps more useful
	for now as even though it's not a genuine library it allows for
	splitting data by lane or by run. 

	* gap5/editor_view.c:
	(11:40:32) Removed memory corruption when displaying long sequence
	tags. 

	* gap5/contig_editor.tcl,
	* gap5/editor_view.c,
	* gap5/tkEditor.c,
	* gap5/tkEditor.h:
	(15:31:14) Added a Hide Annotations setting in the contig editor,
	also bound to control-Q. This allows us to see the quality values
	underneath a tag. 

2009-06-15  James Bonfield  <jkb@sanger.ac.uk>

	* VERSION 1.2.1 *
	
2009-06-15  James Bonfield  <jkb@sanger.ac.uk>

        * tgap/tg_index.c,
        * tgap/tg_view.c,
        * gap5/gap.tcl:
        (10:43:54) Bumped version to 1.2.1

2009-06-12  James Bonfield  <jkb@sanger.ac.uk>

        * tgap/tg_iface_g.c:
        (14:17:29) Fixed memory corruption when writing out seq blocks if
        trace_name disagrees with sequence name. (We didn't allocate enough
        storage.)

        Also insure seq_block and anno_ele_block est_size field is always
        initialised to zero.

        * tgap/caf2baf.pl:
        (15:13:08) *** empty log message ***

        * tgap/maq.c,
        * tgap/tg_iface_g.c:
        (16:24:28) Fixed use of assert. Nasties like assert(*cp++ ==
        GT_Seq) are invalid as compiled used NDEBUG to disable assert also
        no longer increments cp.

2009-06-10  James Bonfield  <jkb@sanger.ac.uk>

	* VERSION 1.2.0 *
	
2009-06-10  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/tg_register.c:
	(13:19:21) Protect against io_cursor_reg(io) being NULL in
	io_cursor_get(). This can happen when shutting down all displays. 

	* tgap/g-request.c:
	(13:19:58) Added use of pwrite instead of lseek and write (similar
	to the already in-use pread calls). 

	* tgap/tg_cache.c:
	(13:20:27) Set cache size to 1024 (from 8192). More applicable now
	we have compound "blocked" data structs. 

	* tgap/tg_iface_g.c,
	* tgap/tg_struct.h:
	(13:22:25) *INCOMPATIBILITY* Major overhaul on encoded data
	formats.
	
	Every record written to disk now starts with a byte for the data
	type and a byte for the encoding format (starting at zero for now).
	Every time we read a record we assert that the type and format are
	correct.
	
	This should help spot potential data corruptions before they take
	place. The error handling could be improved, but assert/abort is
	sufficient for now and (in theory) these should never happen
	anyway. 

	* gap5/contig_editor.tcl:
	(13:27:44) Added pageup/pagedown bindings (+/- 1k at a time). 

	* tgap/tg_index.c,
	* tgap/tg_view.c,
	* gap5/gap.tcl:
	(13:28:38) Bumped version to 1.2.0 

2009-06-09  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/tg_contig.c,
	* tgap/tg_contig.h:
	(09:23:34) Added a flag to distinguish between the first range and
	subsequent ranges in the contig iterators.
	
	The first range needs to allow objects that overlap the range to be
	included while subsequent objects need to only allow objects that
	start entirely within the new range (in order to remove
	duplicates).
	
	This fixes a bug where the first few sequences in a contig were
	rejected when exporting to varying file formats. 

	* tgap/Makefile:
	(12:38:18) Link libtgap.so against ptmalloc3 library.
	
	This replaces the system malloc as we've seen some *dire*
	performance issues. In one case tg_index sped up 24 fold after
	linking with the new library. 

	* tgap/baf.c:
	(12:39:17) Count all object types rather than just sequences when
	deciding to flush.
	
	Improved outputs, giving timings per block of data. 

	* tgap/tg_bin.c:
	(12:40:12) Fix buf where bin->nseqs changes weren't always written
	back to disk. 

	* tgap/tg_cache.c:
	(12:40:45) Bug fix: remove empty case statement (illegal C?).
	
	Minor debug output changes. 

	* tgap/tg_iface_g.c:
	(12:41:05) Minor change to improve portability. 

	* tgap/tg_index.c:
	(12:42:44) The default value of merge_contigs is now dependant on
	whether or not we are appending. This removes the need to search
	through contig existing names when we're not appending.
	
	ASSUMPTION: per input file, all data for a single contig is
	collated together rather than intermingled. 

	* tgap/sam.c:
	(14:00:31) Fixed bug with handling 'Z' aux sam type. 

2009-06-04  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/export_contigs.c:
	(13:32:07) #ifdefed out code; for evaluating size of fastq files
	when complementing sequences to keep in assembly orientation. 

	* gap5/editor_view.c,
	* gap5/tkEditor.c:
	(13:32:43) Added support for displaying annotation colours. 

	* tgap/ace.c,
	* tgap/g-struct.c,
	* tgap/hache_table.c,
	* tgap/hache_table.h,
	* tgap/maq.c,
	* tgap/sam.c,
	* tgap/tg_contig.c,
	* tgap/tg_index.c,
	* tgap/tg_register.c:
	(13:49:25) Strictly for debugging purposes, hache tables now have a
	name field. If set this outputs the name string in debugging output
	instead of using %p and the hache table pointer. 

	* tgap/tg_cache.c,
	* tgap/tg_iface.h,
	* tgap/tg_iface_g.c,
	* tgap/tg_struct.h:
	(13:50:04) GT_AnnoEle items are now blocked like sequences in a
	GT_AnnoEleBlock items instead. This massively reduces the file size
	for tag-rich databases.
	
	Also improved I/O stats output. 

	* tgap/tg_sequence.c:
	(13:50:13) Added sequence_reset_ptr and sequence_copy functions to
	remove code duplication. 

	* tgap/baf.c,
	* tgap/tg_bin.c:
	(13:50:27) Fixed reference count leaks 

	* tgap/tg_anno.c,
	* tgap/tg_anno.h:
	(13:50:53) Added tag types to anno_ele so we can get away with not
	using anno structs at all for the simple case of a tag marking just
	one region. Tag types are now stored in the range_t struct too,
	using the mqual field (TODO: use a union instead). Old old_type was
	stored here, but now fits in a flag instead. 

2009-06-01  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/editor_view.c:
	(10:36:47) Bug fix cases where the item in xx->r[] is an annotation
	instead of a sequence (eg in edCursorUp, edCursorDown and
	edview_item_at_pos). 

2009-05-29  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/BAF,
	* tgap/baf.c,
	* tgap/baf.h:
	(10:57:28) Added annotation support. 

	* tgap/sam2fai.pl:
	(10:58:00) Now preserves the order in the input sam file when
	producing the output list. (Not needed, but useful for debugging
	purposes sometimes.) 

	* tgap/tg_bin.c:
	(10:58:23) Fixed the nseqs counter so it isn't incremented by
	annotations. 

	* tgap/tg_contig.c:
	(10:59:05) compute_ypos() when operating in non-stacking mode no
	longer counts tags in computing Y coordinates. 

	* tgap/tg_iface_g.c:
	(16:32:29) Fixed bug in decoding of SeqBlocks and seq->bin_index. 

	* tgap/tg_sequence.c:
	(16:32:54) Assert in sequence_get_pair() - spotted bin_index
	decoding issues. 

2009-05-28  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/libraries.tcl:
	(14:23:34) Improved the auto-scaling and added a simple key. 

2009-05-27  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/tg_contig.c:
	(15:31:35) Upped the size of the range queries used in the
	contig_iter system from 1k to 10k. 

	* gap5/NEWS:
	(15:40:35) *** empty log message *** 

	* gap5/export_contigs.c:
	(15:41:27) Improved cigar string generation for SAM format.
	
	Added ACE format output. 

	* gap5/export_contigs.tcl:
	(15:41:41) Added ACE format output. 

	* gap5/libraries.tcl,
	* gap5/tclIndex:
	(15:42:18) Added a rudimentary libraries Tk interface. 

2009-05-26  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/ace.c:
	(14:21:41) Fixed ACE file reading of complemented data. 

	* tgap/Makefile,
	* tgap/maq.c,
	* tgap/sam.c,
	* tgap/tg_cache.c,
	* tgap/tg_gio.c,
	* tgap/tg_gio.h,
	* tgap/tg_iface.h,
	* tgap/tg_iface_g.c,
	* tgap/tg_library.c,
	* tgap/tg_library.h,
	* tgap/tg_struct.h,
	* tgap/tg_tcl.c:
	(14:24:21) Added libraries as a data type.
	
	These replace the (unimplemented) DNASrc data type. For now only
	MAQ and SAM input formats populate these fields, but more will
	follow shortly. 

	* tgap/tg_contig.c:
	(14:27:50) Fixed contig_iter_next and contig_iter_prev. When faced
	with sequences of varying length these sometimes caused duplicates
	during iteration. 

2009-05-15  James Bonfield  <jkb@sanger.ac.uk>

	* VERSION 1.1.3.1 *

2009-05-15  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/baf.c:
	(09:05:14) Only flush changes every 65536 sequences now, as this
	improves data locality and reduces database fragmentation.
	
	Fixed issues with incorrect quality values for soft-clipped data in
	SAM. 

	* tgap/maq.c,
	* tgap/sam.c:
	(09:05:15) Only flush changes every 65536 sequences now, as this
	improves data locality and reduces database fragmentation.
	
	Fixed issues with incorrect quality values for soft-clipped data in
	SAM. 

	* tgap/tg_cache.c:
	(09:16:16) Tweaked the maximum data size of an uncompressed
	sequence block from 200k to 150k as this appears to be marginally
	more optimal in disk usage. 

2009-05-13  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/sam2fai.pl:
	(15:56:47) Added a simple tool to index sam files, building a .fai
	file suitable for use with "samtools import". 

	* gap5/export_contigs.c,
	* gap5/export_contigs.h,
	* gap5/export_contigs.tcl,
	* gap5/newgap5_cmds.c,
	* gap5/tclIndex:
	(16:01:05) Added a "File->Export Sequences" command.
	
	This outputs data in SAM, Fasta, Fastq or BAF format and can be
	used for migrating between gap5 releases or from gap5 back to
	samtools.
	
	Note that right now it's not robust with regards to CIGAR
	alignments though - it writes out padded data currently. 

	* gap5/Makefile:
	(16:02:13) Added export_contigs.c 

	* tgap/sam.c:
	(16:03:25) Fixed contig names - we now use the references listed in
	the sam file.
	
	Fixed sequence position - they were out by 1.
	
	Removed the old sam reading code (previously #if-ed out). 

2009-05-12  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/tg_bin.c,
	* tgap/tg_bin.h,
	* tgap/tg_contig.c,
	* tgap/tg_gio.c,
	* tgap/tg_gio.h,
	* tgap/tg_index.c:
	(16:40:21) Made the minimum bin size a parameter of tg_index. This
	allows for a great improvement of speed and compression size when
	dealing with very low coverage data sets (eg many 1000G runs). 

	* tgap/tg_iface_g.c:
	(16:41:07) We now store GT_Bin structs in a more optimal fashion.
	
	This doesn't have a big impact mostly unless using lots of small
	bins with shallow depth data. 

	* tgap/tg_bin.c,
	* tgap/tg_iface_g.c:
	(16:58:16) The io->iface->bin.create method no longer creates a bin
	from a template, instead preferring simply to just allocate the
	record.
	
	This along with bin_new() changes means we don't write the bin
	struct to disk multiple times. It has a minor change on deep
	projects, but a substantial speed improvement on very shallow ones
	(with admittedly too many bins for the depth). 

2009-05-11  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/editor_view.c:
	(09:07:02) Handle sequences longer than MAX_SEQ_LEN. The #define
	should only be for static memory allocation for speed, and not a
	hard limit. 

	* gap5/editor_view.c:
	(16:27:38) Fixed memory leak: free memory for anno_hash. 

	* gap5/consensus.c,
	* gap5/editor_view.c:
	(16:28:20) Don't decrement the seq_t cache. This is unnecessary as
	it's not auto-incremented and it now produces issues for
	referencing counting of block data. 

	* tgap/tg_contig.c:
	(16:29:24) Fixed memory leak in compute_ypos(). 

	* tgap/tg_utils.c,
	* tgap/tg_utils.h:
	(16:30:16) Added signed versions of the 7-bit int encoding; int2s7
	and s72int. 

	* tgap/tg_cache.c,
	* tgap/tg_iface.h,
	* tgap/tg_iface_g.c,
	* tgap/tg_sequence.c,
	* tgap/tg_struct.h:
	(16:35:38) *MAJOR AND INCOMPATIBLE CHANGE*
	
	First draft of a new data type: SeqBlock. This implements a block
	of sequences, rather than a single sequence object.  The purpose is
	to improve compression by allowing for multiple sequences (up to
	1024) to be compressed as a single block of data at the g-layer.
	
	This requires a LOT of smoke and mirrors in the caching layer to
	get right, and a few tweaks to allocation of new sequence objects
	too (in tg_sequence.c).
	
	Currently it's a mess of code, but the implementation appears to
	now be working. The compression achieve is quite amazing; typically
	beating bzip2 of the old gap5 database size while still being
	faster. The actual compression ratios vary, but 5:1 isn't
	unexpected.
	
	Note that it works far better with deep assemblies and less well
	with very shallow (eg 1000 genomes) data sets. This is partly due
	to the inherent compression from having lots of similar (ie
	overlapping) strings and partly due to a better ratio of sequences
	to bins. (Lots of almost empty bins is inefficient). 

2009-05-08  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/tg_bin.c:
	(13:23:22) When extending contigs and adding a new root bin we now
	inherit the count of sequences from the old root.
	
	Previously it restarted the count at zero, giving incorrect
	sequence counts. 

2009-04-24  James Bonfield  <jkb@sanger.ac.uk>

	* VERSION 1.1.3 *

2009-04-24  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/ChangeLog,
	* gap5/NEWS:
	(13:26:43) *** empty log message *** 

	* gap5/depth.tcl:
	(14:01:24) Added an "update idletasks" when moving the cursor
	window. This prevents oscillation as we scroll by generating motion
	events that are applied to the location of the old window,
	pre-move. 

	* gap5/depth.tcl:
	(16:10:08) Fixed an issue with resize events occurring all the
	time. This was due to changes in resize1.5 and subtracting the
	scrollbar size from ${w}(width). Now using a separate variable for
	this.
	
	Also fixed an issue where bringing up a contig editor first,
	followed by the template display. Then double left clicking to move
	the editor was giving errors. 

2009-04-23  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/baf.c,
	* tgap/baf.h:
	(14:23:26) Added PR (primer type) parsing. 

	* gap5/contig_editor.tcl:
	(14:24:27) Handle incoming CURSOR_NOTIFY events requesting the
	cursor to be moved. 

	* gap5/depth.tcl:
	(14:25:25) This plot now registers itself with the contig
	registration system. As such it now appears in the Results Manager
	and can display/control the contig editor editing cursors. 

	* gap5/editor_view.c,
	* gap5/editor_view.h,
	* gap5/tkEditor.c:
	(14:27:11) The contig editor edview struct now contains a cursor_t
	element, holding the private cursor to use used in CURSOR_MOVE
	messages. This allows integration with other windows. 

	* gap5/depth.tcl:
	(16:30:41) Fixed an issue with the template display and ruler track
	not being on the same scale - the width of the Y scrollbar impacted
	the scaling.
	
	Also dramatically simplified the calculation of the world
	coordinates. What was I thinking of? 

2009-04-21  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/hache_table.c:
	(14:03:46) HacheItemDestroy now also unlinks the in_use links.
	
	This caused crashes previously. 

	* tgap/tg_register.c,
	* tgap/tg_register.h:
	(14:07:51) Overhauled the contig deregistration system.
	Specifically in how we handle removal from the hache table.
	
	Also changed the meaning of contig 0. This is not a way to
	broadcast to all contigs (although we still have a broadcast_event
	function for this purpose) but rather a registration list for
	windows that wish to receive events that take place on any contig.
	(Such as the contig selector or Results Manager.) 

	* gap5/contig_selector.c:
	(14:09:30) Switched from registering with all contigs to just
	contig 0. 

	* gap5/contig_editor.tcl,
	* gap5/tk-io-reg.c:
	(14:19:18) Added REG_CHILD_EDIT callback instead of sending
	REG_LENGTH so that windows like the contig selector do not
	automatically redraw on every contig editor update. 

	* gap5/editor_view.c:
	(15:36:45) Fixed a bug with sequences sometimes being drawn as tags
	too due to assumptions on precedence rules. 

2009-04-17  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/template_display.c:
	(10:46:44) Now using X position + record number in the Y spread
	function instead of X position + array index. This means that
	scrolling in X will give the same Y-spread variation for a sequence
	so it doesn't jump up and down now. 

	* tgap/maqmap.c:
	(14:52:52) Added <ctype.h> include to remove warnings. 

	* tgap/tg_sequence.c:
	(14:55:26) Protect against trace_name and alignment being NULL in
	sequence_new_from(). 

	* tgap/Makefile,
	* tgap/tg_anno.c,
	* tgap/tg_anno.h,
	* tgap/tg_bin.c,
	* tgap/tg_cache.c,
	* tgap/tg_contig.c,
	* tgap/tg_contig.h,
	* tgap/tg_gio.h,
	* tgap/tg_iface.h,
	* tgap/tg_iface_g.c,
	* tgap/tg_struct.h,
	* tgap/tg_tcl.c:
	(15:03:06) Added starting code for annotations. These consist of
	anno elements and annotations (possibly I'll later rename these to
	annotations and annotation_link respectively).
	
	This involves two new files (tg_anno.c and tg_anno.h), plus support
	for the anno_t and anno_ele_t data structure in tg_iface* and
	tg_cache.c.
	
	So far anno_t is largely unimplemented, but anno_ele_t is the guts
	of it and where the link to sequences or contigs occur. Right now
	this means we support single tags in a similar style to Gap4,
	without the link concept.
	
	Annotations are indexed in the same bin range arrays as sequences,
	utilising a flag to distinguish between seq_t and anno_ele_t
	references. This code needs more work as range_t should become a
	union (partly done, but commented out in tg_struct.h). This is
	being checked in now as to do this properly requires a file format
	change.
	
	The contig_seqs_in_range function had been extended to be part of a
	family, now including contig_anno_in_range and
	contig_items_in_range. The latter of these can return both
	sequences and annotations in one query. 

	* tgap/tg_bin.h:
	(15:03:51) Added prototype for bin_remove_item().
	
	Changed the minimum bin size from 1K to 4K. 

	* gap5/break_contig.c:
	(15:04:32) Removal of debugging calls to contig_dump_ps(). 

	* gap5/editor_view.c,
	* gap5/editor_view.h:
	(15:06:40) Fixed a bug with the stacked-reads view of the editor
	where the dots in the names panel would overflow the names array.
	
	Added test support for viewing tags. This is unfinished and for now
	they're simply highlighted in inverse, but it's a proof of concept
	to help test the storage of tags (aka annotations). 

	* gap5/break_contig.tcl,
	* gap5/complement.tcl,
	* gap5/configure.tcl,
	* gap5/do_fij.c:
	(15:09:47) Added files. Not new - but apparently I forgot to commit
	these! Sorry. 

	* gap5/Attic/complement.h:
	(15:10:19) Redundant and removed. 

2009-04-16  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/ace.c,
	* tgap/tg_index.c:
	(16:34:37) Fixed the ACE format code to work with the newer
	pair_rec mechanism (in bin rather than seq object).
	
	Added minimal support for RT, CT and WA. For now it just skips over
	them as opposed to dying, so it doesn't yet add the tags for real. 

2009-04-15  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/gap.tcl,
	* gap5/newgap5_cmds.c,
	* gap5/ng_fb_cmds.tcl:
	(11:14:16) Fixed db_info num_contigs to return the correct value.
	
	Opening the database now checks for num_contigs <= 1000 before
	deciding whether to display the contig selector, unless -csel has
	been explicitly requested on the command line. 

2009-04-14  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/contig_editor.tcl:
	(15:31:11) Improved undo/redo when using the join editor. I think
	there still maybe bugs, but it interoperates with other editors in
	a far saner fashion now with regards to which buttons are greyed
	out.
	
	Made the undo/redo buttons highlight the editor they will apply to.
	This is changed by clicking in an editor window to change focus.
	(Only makes sense for the join editor.) 

	* gap5/contig_editor.tcl,
	* gap5/editor_view.c,
	* gap5/editor_view.h,
	* gap5/tkEdNames.c,
	* gap5/tkEditor.c:
	(16:16:03) The edview_item_at_pos functions now takes an extra
	"exact" argument to indicate if the query should find closest or
	exact only.
	
	This is now used in the editor <<select>> binding so that clicking
	will position the editor cursor on the nearest sequence in X (and
	more importantly allows setting the editor cursor one past the end
	of a sequence). 

2009-04-09  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/tg_register.c,
	* tgap/tg_register.h:
	(13:18:49) Fixed send_event when asking for a events to be sent to
	an entire contig. Maybe! 

	* gap5/tk-io-reg.c:
	(13:20:10) Fixed handling of REG_GENERIC events when acting via the
	tcl interface. 

	* gap5/tkEditor.c:
	(13:20:47) Added a contig_rec subcommand. 

	* gap5/contig_editor.tcl:
	(13:22:01) Overhaul of the undo/redo mechanism. There are still
	issues to tackle here when dealing with the join editor, but the
	basic editor(s) work.
	
	Improved handling of multiple editors on the same contig. The
	contig editor now registers and responds to basic events via the
	contig registration system, meaning it's moved closer to the
	original view,model,controller design. 

2009-04-08  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/tg_contig.c:
	(15:46:43) Improved the compute_ypos function to always find the
	minimum Y rather than sometimes just the minimum recently used Y. 

	* gap5/contig_editor.tcl:
	(15:48:20) Updated the way the settings work in the join editor.
	I've removed the notion of the "current contig" (which was never
	updated anyway) and now options like cutoffs, quality and highlight
	disagreements automatically apply to both editors in the join
	editor. 

	* gap5/editor_view.c,
	* gap5/editor_view.h,
	* gap5/tkEdNames.c,
	* gap5/tkEditor.c:
	(15:52:48) The "pack sequences" display mode now behaves better. -
	The editing cursor, copy selection, scrollbars, etc now operate  
	correctly rather than counting in Y as if we had one line per  
	sequence. - The names panel switches to a small scaled
	representation of the	data visible in the editor panel. This
	still allows viewing of   mapping quality and the possibility of a
	right-click menu. Obviously   the names panel is optional too still
	in as far as it can be	 minimised.
	
	Minor (unfinished) support for the editor edit_annotation method.
	Currently this does nothing. 

2009-04-06  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/template_display.c,
	* tgap/tg_contig.c,
	* tgap/tg_contig.h:
	(14:05:17) Updated the tg_contig compute_ypos function to us the
	same tree based algorithm as used in the template display.
	
	There's still quite a bit of code duplication here, but where
	possible the data structures are shared. The duplication comes
	about because the data structures being sorted (range_t vs tline)
	differ. 

2009-04-03  James Bonfield  <jkb@sanger.ac.uk>

	* VERSION 1.1.2 *

2009-04-03  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/template_display.c:
	(11:26:38) Added a filter dialogue to allow the template display to
	be filtered by spanning, pair/single or mapping quality.
	
	Adjusted the Y-spread function to also take into account an index
	rather than purely X location. This means lines at the same X,Y
	coordinate can now be spread too, making duplicated templates
	easier to see.
	
	Fixed Y x-hair so that the reported position in the information bar
	is now the correct Y position. 

	* gap5/depth.tcl,
	* gap5/template_display.h:
	(11:26:39) Added a filter dialogue to allow the template display to
	be filtered by spanning, pair/single or mapping quality.
	
	Adjusted the Y-spread function to also take into account an index
	rather than purely X location. This means lines at the same X,Y
	coordinate can now be spread too, making duplicated templates
	easier to see.
	
	Fixed Y x-hair so that the reported position in the information bar
	is now the correct Y position. 

	* gap5/gap.tcl:
	(11:33:01) Bumped version to 1.1.2 

	* gap5/template_display.c:
	(13:53:44) Fixed the Y crosshair value when using
	separate-by-strands mode. 

	* gap5/template_display.c:
	(14:05:24) Minor tweaks of out by one errors in Y xhair value. 

2009-04-02  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/consen.tcl,
	* gap5/newgap5_cmds.c:
	(14:59:34) Sped up the consensus saving code substantially when
	many contigs are output due to an over-zelous addition to the map
	passed into string map; this ultimately made the code O(N^2) in
	speed.
	
	Added a new tcl_reformat_sequence command in C to convert binary
	quality to fastq and to perform line-wrapping. This works around
	locale issues and is faster to boot.
	
	Fixed a bug in calc_quality that wrote out one more base than
	desired. 

	* gap5/consensus.c:
	(15:09:09) Fixed the consensus generation functions when passed a
	sequence exactly 1 more than a multiple of 1024 long. Due to a < vs
	<= the last base was uninitialised. 

	* gap5/contig_editor.tcl:
	(15:11:10) Added clipboard copy for reading names, although at
	present without any highlighting. 

	* gap5/tkEdNames.c:
	(15:11:11) Added clipboard copy for reading names, although at
	present without any highlighting. 

	* gap5/editor_view.c:
	(15:12:35) Bug fixed copy(clipboard) of the consensus; it was out
	by one sometimes. 

	* gap5/list_proc.tcl:
	(15:12:52) Removal of debugging output. 

2009-03-31  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/maq.c:
	(16:28:19) minor grammar change 

	* gap5/contig_editor.tcl,
	* gap5/editor_view.c,
	* gap5/editor_view.h,
	* gap5/tkEditor.c:
	(16:29:54) Added selection (copy) handling for sequences and
	consensus. 

2009-03-27  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/hache_table.c:
	(12:46:05) Added a HacheTableLeakCheck() function for debugging.
	
	/*  * For debugging purposes only. This function severs all links
	to items  * with a reference count > 0. Obviously this breaks the
	HacheTable in  * various ways, but the purpose is that it should be
	immediately followed  * up by an exit() call and an analysis of
	memory leaks.  *  * In theory all items with a reference count > 0
	will have pointers to them  * in other pieces of code. If they do
	not then we know we leaked memory  * somewhere by virtue of
	incrementing the reference count and not  * decrementing it again
	before losing our pointer to the object.  */ 

	* tgap/maq.c:
	(12:47:12) Fixed a bug with the recent code to skip over unmapped
	sequences. This caused a memory. Also it was erroneously skipping
	over SW matches sequences too rather than only non-matched data,
	causing other memory wastage in the pair hash. 

	* tgap/tg_sequence.c:
	(12:47:40) Fixed an uninitialised memory access in
	sequence_index_update(). 

	* gap5/editor_view.c:
	(14:11:02) Fixed a bug with the display in the editor vanishing
	whenever the names panel is scrolled. 

2009-03-26  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/contig_selector.tcl:
	(11:16:16) Fixed searching of contig names via reading names. 

	* gap5/contig_id.tcl,
	* gap5/gap4_compat.tcl:
	(11:16:19) Fixed searching of contig names via reading names. 

	* tgap/tg_iface_g.c:
	(12:23:05) Reenabled the INDEX_NAMES code for using B+Trees on
	sequence names. Fixed a bug with the btree_del_cache code too. 

	* tgap/tg_index.c:
	(12:24:16) Changed the defaults for pair-linking (now on) and btree
	indexing (now off). Added -P and -t options too (already have -p
	and -T). The -p/-P is on/off for pairing and -t/-T is on/off for
	btree indexing.
	
	Program version now 0.14. 

	* tgap/g-struct.c,
	* tgap/tg_cache.c,
	* tgap/tg_iface_g.c,
	* tgap/tg_index.c:
	(17:12:21) Increased the size of the HacheTables by 4. This allows
	us to efficiently flush less often, which has a considerable impact
	on the performance of tg_index when using -t mode for building the
	name b+tree. 

	* tgap/maq.c,
	* tgap/maq.h:
	(17:17:51) Check the maq flags for NOMATCH and SW bits. When both
	set this implies that this sequence is not aligned, so we reject
	it.
	
	When NOMATCH only is set it implies only one end matched, which
	means we do not need to add this sequence name to the pair hash
	table.
	
	Also decreased the frequency of flushes. 

2009-03-25  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/contig_selector.tcl,
	* gap5/list_contigs.tcl:
	(10:25:23) Now list the number of sequences in a contig. 

	* tgap/tg_bin.c,
	* tgap/tg_iface_g.c,
	* tgap/tg_struct.h,
	* tgap/tg_tcl.c:
	(10:27:18) Added nseqs field to the bin structure and added an
	nseqs method to contig objects to return the number of sequences in
	the root bin. This is automatically kept up to date in
	bin_add_range() and bin_remove_item(), but I am unsure currently on
	the performance hit of this. 

	* tgap/tg_index.c:
	(12:40:52) Fixed the frequency of flushing (for .aln format) to be
	less frequent. I think I had accidentally pushed out a debugging
	version. 

	* tgap/hache_table.c,
	* tgap/hache_table.h,
	* tgap/tg_cache.c:
	(12:42:48) The hache table now maintains a linked list of objects
	with at least one reference count. This is useful when iterating
	through all referenced objects, such as in cache_flush().
	
	If we use a very large hache table (eg 3276800 instead of the
	current 32768) then the benchmarks showed that about 40% of cpu
	time was spent simply iterating through the hache table finding
	which items we need to flush. The impact is far less significant
	with smaller hache tables though. 

2009-03-23  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/editor_view.c:
	(16:05:46) Temporarily disabled the range caching code in
	edview_visible_items as it cannot detect when data is changed (eg
	inserting a base to the consensus => identical query range, but
	sequences maybe shifted within that range). 

	* gap5/depth.tcl:
	(16:09:19) The window title bar is now named after the contig being
	displayed. 

2009-03-20  James Bonfield  <jkb@sanger.ac.uk>

	* VERSION 1.1.1 *

2009-03-20  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/sam.c:
	(16:30:42) Removal of memory leaks. 

	* tgap/tg_index.c:
	(16:31:12) Update version to 0.13 

	* gap5/depth.tcl:
	(16:32:35) Small tweaks to make the depth plot work again (as I've
	been mainly focusing on the template display).
	
	Adjusted the default parameters for template display (scales,
	separate strands now off). 

	* gap5/gap_canvas_box.tcl:
	(16:33:35) Copied from gap4 and tweaked. Needed to support zooming
	in the contig selector. 

	* gap5/tclIndex:
	(16:33:57) *** empty log message *** 

	* gap5/template_display.c:
	(16:36:26) Total rewrite of the compute_ypos packing algorithm.
	This needs migrating back into tg_contig.c sometime. The new one
	uses a pair of splay trees and is massively faster than before.
	
	Adjusted the line width of reads when zoomed >= 150 in Y.
	
	Restructured the plotting function to be more distinct between
	querying, allocating Y and plotting. This is a precursor to caching
	of data (so we can scroll in Y faster) and better scrolling. 

	* gap5/template_display.h:
	(16:36:56) New "colours" (actually just GC line width change) for
	fwd/rev. 

2009-03-16  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/Makefile,
	* tgap/sam.c,
	* tgap/tg_index.c:
	(16:35:40) Added support for indexing bam format files (see
	samtools). 

2009-03-11  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/tg_contig.c:
	(11:10:37) Experimented with different compute_ypos() functions.
	The new one I tried I ended up rejecting, but I doubled the speed
	of the existing implementation with a bit more optimisation. 

	* gap5/depth.tcl,
	* gap5/template_display.c,
	* gap5/template_display.h:
	(17:06:33) Added cross-hairs 

	* gap5/gap.tcl:
	(17:35:30) Version number update.
	
	Instead of Gap v5.x.x the program is now called gap5 and has
	version 1.x.x. Although a bit of a departure, it's more sane in
	that we regain control of the major version number again. 

	* gap5/ng_fb_cmds.tcl:
	(17:46:10) Removed the assumption of having a version code in
	database names. 

2009-03-10  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/depth.tcl,
	* gap5/template_display.c,
	* gap5/template_display.h:
	(12:35:18) Added a sequence depth and template depth line
	(optional). These need moving to their own raster or canvas, but
	for now they're functional rather than elegant.
	
	Fixed a bug with the xview coordinates. The raster plot was offset
	by the contig start coordinate, so if it didn't start at zero
	(clipped) it was shifted in X. 

2009-03-09  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/depth.tcl,
	* gap5/template_display.c,
	* gap5/template_display.h:
	(17:34:01) Ripped out the old canvas based template display code.
	
	Added an init method of plots (implemented for template display)
	and adjusted the layout slightly.
	
	Improved (but still not completely fixed) X and Y zooming of plots.
	
	Fixed template_display object "range" method call. It's now the
	same coordinates worked out during plotting.
	
	Added a (currently unused) xzoom mode to the template display
	window to mirror the (currently used) yzoom control. 

2009-03-05  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/tg_contig.c:
	(16:59:09) Rewrote compute_ypos() to be faster. It's still not
	ideal though. I think it needs the combination of a linked list for
	fast resorting and an array for y scanning. 

	* gap5/depth.tcl,
	* gap5/template_display.c,
	* gap5/template_display.h:
	(17:01:21) Improvements to the template display:
	
	- background is now black so the reads are more vibrant and show up
	easier with low depth data.
	
	- Can separate out by template strand.
	
	- Additional yoffset control used as an offset to the computed Y.
	This allows bringing the two halves (when separated) closer or
	further apart. 

	* gap5/depth.tcl,
	* gap5/template_display.c,
	* gap5/template_display.h:
	(17:45:41) Added a control to filter out single ended data. 

2009-02-27  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/maq.c:
	(14:01:49) Added code to read the newer maq-long format. This can
	be forced using tg_index -M, or is automatically attempted if maq
	-m fails. 

	* tgap/maq.h,
	* tgap/maqmap.c,
	* tgap/maqmap.h,
	* tgap/tg_index.c:
	(14:01:51) Added code to read the newer maq-long format. This can
	be forced using tg_index -M, or is automatically attempted if maq
	-m fails. 

2009-02-26  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/template_display.c,
	* gap5/template_display.h:
	(12:13:29) Added a red colour for templates that have read-pairs in
	inconsistent orientations. 

2009-02-25  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/tg_iface_g.c:
	(12:41:17) Check for errors in opening DB 

	* tgap/tg_bin.c,
	* tgap/tg_register.c,
	* tgap/tg_sequence.c,
	* tgap/tg_sequence.h,
	* tgap/tg_tcl.c,
	* tgap/tg_view.c:
	(12:43:05) Added an end return value to sequence_get_position(), in
	addition to the start. This means we can query the extents of a
	read rather than just one end. Most calls to this just have an
	extra NULL inserted to adhere to the new API. 

	* tgap/tg_contig.c,
	* tgap/tg_struct.h:
	(12:44:11) The rangec_t struct now has a pair_ind element. This is
	normally -1, but is set to the index in the array index of the data
	returned by contig_seqs_in_range() if the pair is also in this
	array.
	
	This can be used to avoid iterating through templates twice. 

	* gap5/Makefile:
	(13:59:35) Added template_display.o 

	* gap5/editor_view.c:
	(14:00:46) Changes to sequence_get_position API. 

	* gap5/gap.tcl:
	(14:01:09) Better error checking when given invalid DB to open. 

	* gap5/gap4_compat.c:
	(14:01:29) Changes due to sequence_get_position API change. 

	* gap5/newgap5_cmds.c:
	(14:02:27) Added call to TDisp_Init to register template display
	additions. 

	* gap5/qualIO.c:
	(14:02:46) Changes due to sequence_get_position API change. 

	* gap5/tman_interface.c:
	(14:03:10) Changes due to sequence_get_position API change. 

	* gap5/contig_editor.tcl:
	(14:04:01) Missing bracket? How did it work before. 

	* gap5/depth.tcl:
	(14:04:53) Major overhaul to use raster widget instead and the new
	template_display.c C code. The old canvas widget code is still
	there intact, albeit not reachable right now.
	
	This still needs a big tidyup. 

	* gap5/depth.tcl:
	(15:30:13) Allow for the old canvas based template display to still
	be viewed, so we can do mouse-overs etc. This is a temporary hack
	to get a usable interface, but ultimately I'll probably end up
	rewriting the raster method to be a canvas object so it can be
	combined with canvas overlays and fits in with the rest of the
	window. 

2009-02-19  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/depth.tcl:
	(14:57:13) Improved ways to colour and allocate Y positions to
	sequences 

2009-02-16  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/editor_view.c:
	(16:59:13) The contig editor information line now shows data on
	read-pairs if the read is paired. 

	* gap5/depth.tcl:
	(16:59:56) Added an option to colour the template by mapping
	quality. In this mode it doesn't draw the reads for paired data so
	the template is more visible. 

	* tgap/baf.c,
	* tgap/maq.c,
	* tgap/tg_contig.c,
	* tgap/tg_index.c,
	* tgap/tg_struct.h,
	* tgap/tg_tcl.c:
	(17:01:24) Added mapping quality and paired mapping quality values
	to the bin GRange structure.
	
	These are still in the seq_t struct too, but they've been
	duplicated here in order to allow graphical plots fast access to
	the summary data for viewing by quality. 

	* tgap/tg_index.c,
	* tgap/tg_view.c:
	(17:02:44) Bumped versions to 0.12 

	* gap5/gap.tcl:
	(17:02:51) Bumped version to 5.0.2 

2009-02-13  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/tg_bin.c:
	(16:21:07) Initialise bin.anno to NULL on bin creation 

	* tgap/tg_contig.c:
	(16:24:23) Fixed bug in contig_insert_base (introduced when the
	break statement was commented out). It now shifts all bins
	appropriately again.
	
	Added a job command to contig_seqs_in_range. This allows for
	allocation of Y position (1 per line or several per line) and
	sorting by X or X&Y. 

	* tgap/tg_contig.h:
	(16:24:29) Added a job command to contig_seqs_in_range. This allows
	for allocation of Y position (1 per line or several per line) and
	sorting by X or X&Y. 

	* tgap/tg_struct.h:
	(16:24:56) Added y value to rangec_t, to facilitate Y ordering. 

	* tgap/tg_tcl.c:
	(16:25:22) Added a get_mapping_qual subcommand for sequence
	objects. 

	* tgap/tg_tracks.c,
	* tgap/tg_view.c:
	(16:26:16) Modified to support new option to
	contig_seqs_in_range(). 

	* gap5/consensus.c:
	(16:31:47) Updated calls to contig_seqs_in_range due to argument
	changes. 

	* gap5/read_depth.c,
	* gap5/tkEdNames.c:
	(16:31:48) Updated calls to contig_seqs_in_range due to argument
	changes. 

	* gap5/contig_editor.tcl:
	(16:32:59) Added GUI options for packing multiple sequences per
	line. 

	* gap5/depth.tcl:
	(16:34:08) Implemented a template Y allocation system similar to
	Magnus Manske's plots, where the Y position is based on the size of
	insert.
	
	Added some rudimentary GUI controls for this too. 

	* gap5/editor_view.c,
	* gap5/editor_view.h:
	(16:36:06) We now cache the last read rangec_t structs from
	contig_seqs_in_range rather than requerying every time the cursor
	moves.
	
	Implemented a rough draft of stacking multiple sequences per line.
	For now this only works for display and the cursor coordinates do
	not function correctly. It also needs the names display removing
	too to be sensible. 

	* gap5/tkEditor.c:
	(16:36:50) Added -stripe_mode and -stack_mode options. (For use in
	the experimental multiple sequences per line mode.) 

	* gap5/tkEditor.h:
	(16:36:51) Added -stripe_mode and -stack_mode options. (For use in
	the experimental multiple sequences per line mode.) 

2009-02-12  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/tg_iface_g.c:
	(12:14:56) Fixed memory corruption in io_contig_read 

2009-02-10  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/maq.c:
	(15:19:51) Minor speed ups 

	* tgap/tg_sequence.c:
	(15:20:47) Sped up sequence_index_update() 

	* tgap/tg_iface_g.c,
	* tgap/tg_struct.h:
	(15:21:46) Minor tweaks for adding annotations - not yet
	implemented though. 

2009-02-09  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/Makefile:
	(14:16:16) Removed -DVALGRIND, which massively slows down
	heap_allocate 

	* tgap/g-alloc.c,
	* tgap/g-alloc.h:
	(16:26:03) Added tracking of the maximum size of object in a pool
	and also when all pools between X and Y are empty we jump straight
	to pool Y if we previously tried to allocate from X and ended up in
	Y. This caching is governed by next_free_pool, next_free_time and
	timer, with the latter two jointly implementing a means to
	invalidate the cache. 

	* tgap/g-alloc.c:
	(16:35:43) I had accidentally left heap_alloc in debug mode where
	it scanned from the first pool instead of the predicted pool in
	order to verify predictions. 

2009-02-06  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/depth.tcl:
	(16:05:25) Improved display of inconsistent templates, so reads and
	templates show up differently (may need to fix colours!).
	
	Fixed a bug with ordering of elements in lines sometimes giving tcl
	errors. 

	* tgap/maq.c:
	(16:06:03) Fixed parsing of read names when they have /1 and /2. We
	now also treat these as read pairs, and furthermore we set the
	actual end. 

	* tgap/tg_contig.c,
	* tgap/tg_tcl.c:
	(16:07:23) Added extra flags to handle knowing the template end. 

	* tgap/tg_cache.c,
	* tgap/tg_iface_g.c,
	* tgap/tg_sequence.c,
	* tgap/tg_struct.h:
	(16:08:28) Added room for sequence annotations. The structs exist,
	but no I/O to create, read or write is present yet. However this
	means the sequence format shouldn't need to change when they do get
	added. 

2009-02-05  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/tg_view.c:
	(10:03:35) Minor prototype fixes 

	* tgap/g-request.c:
	(10:04:42) removed unused variable 

	* tgap/hache_table.c,
	* tgap/hache_table.h:
	(10:06:22) Added protection against HacheItems being passed into
	the wrong HacheTable (as this happened in practice due to a bug).
	
	Added a new debug function: HacheTableRefInfo. This lists the
	number of cached items separated by reference count. 

	* tgap/maqmap.c:
	(10:07:14) Support for maq files with no reference sequence; minor
	allocation change 

	* tgap/tg_bin.c,
	* tgap/tg_bin.h:
	(10:08:44) Enabled the bin-prediction code in bin_for_range. Also
	some small tidy-ups regarding reference counts.
	
	Moved RD_ELEMENTS macro to tg_bin.h so it can be used elsewhere. 

	* tgap/tg_cache.c:
	(10:10:13) Fixed a bug when working with derived GapIOs. We were
	often returning a HacheItem from the base GapIO, but then
	incrementing the reference count in the derived GapIO. We always
	use the same one now (plus HacheTable checks for consistency of
	such things too to spot similar bugs). 

	* tgap/tg_contig.c,
	* tgap/tg_iface_g.c,
	* tgap/tg_sequence.c,
	* tgap/tg_sequence.h,
	* tgap/tg_struct.h:
	(10:17:21) Changed the format of the on-disc GT_Seq, GT_Bin and
	GT_Range structures. NB: *INCOMPATIBLE* file format with previous
	release.
	
	Sequences no longer hold their paired sequence record directly in
	the sequence struct. Instead it's in the bin range array. To
	facilitate fast lookup the sequence holds the index in the bin
	range array referring back to that sequence.
	
	This allowed a change to how the pairing is computed too. In
	contigs_seqs_in_range we hash on record number and so link each
	sequence directly to its pair. This means that we don't need to
	load any sequence structs at all when plotting graphical displays
	like the template display, except for the rair cases at the edge of
	the window being plotted. (The I/O improvement in number of seeks
	and reads is somtimes a 10 fold drop.)
	
	New function sequence_get_pair() hides away the logic to compute
	the other end of a sequence pair. 

	* tgap/tg_tcl.c:
	(10:18:49) Updates for the contig interface: new dump_ps command;
	the sequences in range command now returns more data, related to
	the pairing. 

	* tgap/Makefile,
	* tgap/baf.c,
	* tgap/maq.c,
	* tgap/tg_index.c:
	(10:19:38) Updated maq, baf and plain .aln format parsers to cope
	with the new sequence and bin/range structures.
	
	NOTE: for now the ace format code has been disabled until it is
	rewritten to support the new structs. 

	* gap5/depth.tcl:
	(10:21:44) Changes to the template display following the sequence
	and bin/range structure changes.
	
	We now have an accurate and approximate mode. Both need MUCH less
	I/O than before, but approximate mode saves further I/O by not
	bothering to work out whether the other end of a template, which is
	not observed on screen, is in this contig and if so whether it is
	to the right or left of the sequence we did observe. 

	* gap5/editor_view.c:
	(10:22:13) Changed edGetTemplateReads to use the new
	sequence_get_pair function. 

	* gap5/break_contig.c,
	* gap5/break_contig.h,
	* gap5/editor_join.c:
	(10:29:57) Split break_contig into its own, more appropriately
	named, file. 

	* gap5/Makefile:
	(10:30:32) Added break_contig.o 

	* gap5/newgap5_cmds.c,
	* gap5/read_depth.h:
	(10:31:03) Minor warning fixes for undefined vars, prototypes, etc. 

	* tgap/tg_contig.c:
	(17:21:27) Removal of excessive debugging output 

	* gap5/break_contig.c,
	* tgap/tg_bin.c,
	* tgap/tg_bin.h,
	* tgap/tg_iface_g.c,
	* tgap/tg_struct.h:
	(17:22:38) Added a bin_invalidate_track() function.
	
	In the course of this discovered and fixed a bug where the track
	valid flag was not being set or checked for correctly. 

2009-01-28  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/contig_id.tcl,
	* gap5/contig_selector.tcl,
	* gap5/gap4_compat.tcl:
	(11:19:08) Improvements to contig_id handling. We now accept contig
	name, #seq_num and =contig_num. TODO: support reading name too for
	when contig name fails. 

	* tgap/tg_gio.c:
	(11:28:49) Protect against no contig_order array in
	gio_read_contig. 

	* tgap/tg_bin.c:
	(12:41:44) Added (currently commented out) bin-estimation code in
	bin_for_range. It's disabled as I'm not 100% sure it's infalible
	and it didn't gain as much speed as I hoped. Possibly room for
	future work though. 

	* gap5/gap.tcl:
	(12:42:12) Bumped version to 5.0.2 

2009-01-27  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/editor_join.c:
	(17:12:22) An incomplete update to join contigs (#if-ed out for
	now) to determine the optimal bin to reparent, rather than always
	duplicating the root node. This will reduce average depth when
	making small containment joins. 

2009-01-26  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/editor_join.c:
	(10:29:52) Improved break contig: It no longer creates new blank
	bins for the right hand contig when they are unnecessary. 

	* gap5/editor_join.c:
	(16:05:59) More break contig tweaks. We now remove redundant bins
	from both left and right contig after breaking. 

2009-01-23  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/tg_contig.c,
	* tgap/tg_contig.h,
	* tgap/tg_tcl.c:
	(12:04:29) Added a postscript contig output function. It doesn't
	auto-scale yet, but that's relatively straight forward to manually
	edit in the ps file afterwards. 

	* gap5/editor_join.c:
	(12:05:08) Bug fixes for break contig. 

2009-01-08  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/editor_join.c:
	(14:05:48) Bug fix in break_contig_reparent_seqs: we no longer die
	when finding a bin with no Range data. 

	* gap5/gap_hash.c:
	(14:06:29) Protect against a match in find repeats extending 1 past
	the end of the sequence. I'm not sure why this occurs, but at least
	we handle the problem gracefully now. 

	* gap5/tk-io-reg.c:
	(14:07:18) Removed a heinous programming crime of returning the
	address of a local variable.
	
	This fixed the crosshairs in the contig selector/comparator window. 

	* tgap/tg_register.c,
	* tgap/tg_register.h:
	(14:09:02) Added reference counts and an inactive flag to the
	contig registration scheme. This allows us to protect against
	sending a notification which may cause the list of registered items
	to change, making it complex to iterate through all items to
	notify.
	
	Also implemented broadcasting (sending to all contigs) correctly. 

	* gap5/contig_editor.tcl:
	(14:22:05) Added temporary fix to shut down the contig selector
	when making a join. It's not what I want to do, but it works around
	the bug (and crash) that I'm not yet sending the appropriate
	notifications to force the plots to update upon a join.
	
	Will revert this when that code is in place. 

	* gap5/contig_editor.tcl:
	(14:32:11) Fixed the window title to display the contig name(s). 

	* gap5/editor_join.c:
	(14:32:44) When splitting contigs we now name the newly produce
	right-hand side contig with a derived name (#1, #2, etc). 

	* gap5/contig_id.tcl,
	* gap5/contig_selector.tcl:
	(14:50:26) Improvements to the contig selector / id UI components.
	We still need more work here to support #read_num and =contig_num,
	but for that to work we need a way of validating them first. 

2009-01-07  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/Makefile:
	(11:25:32) Added an install target 

	* tgap/gap_cli_arg.c:
	(11:26:23) Better error handling and added code to cope for when
	Tcl conversion from string fails for some reason (unknown why). 

	* gap5/Makefile:
	(11:26:57) Huge tidyup - more Gap5 now than a hacked gap4 

	* gap5/consen.c,
	* gap5/consen.h,
	* gap5/fij.c,
	* gap5/find_repeats.c:
	(11:30:54) make_consensus() now allocates memory for the consensus
	itself, rather than relying on something passed in. This removes
	the need to use a max_consensus parameter. 

	* gap5/contig_editor.tcl:
	(11:31:23) Now shutdowns the editor windows after a join. 

	* gap5/contig_selector.tcl:
	(11:31:56) Bug fixes to zooming and scrolling. 

	* gap5/editor_join.c,
	* gap5/newgap5_cmds.c,
	* gap5/newgap_structs.h:
	(11:32:58) Added first draft of the Break Contig function. 

	* gap5/tk-io-reg.c:
	(11:33:42) Fixed parsing in the reg_init_args function. This fix is
	part of the contig selector zooming/scrolling bug fixes. 

	* gap5/list_contigs.tcl:
	(11:34:05) *** empty log message *** 

	* gap5/list_proc.tcl:
	(11:34:24) gap_defs vs gap5_defs changes 

	* gap5/tclIndex:
	(11:34:43) Added result_manager.tcl 

	* gap5/editor_view.c:
	(12:27:24) Make sure we always set xx->link->lockOffset in
	set_displayPos for a join editor, even if lock is turned off.
	
	This fixes a bug in the join editor where turning off lock,
	scrolling, not hitting "align" and then hitting "join" will result
	in the incorrect join as it uses the starting lock offset instead
	of the current visible one. 

	* gap5/editor_view.c:
	(15:15:31) Better error checking in the status line updates. 

	* gap5/editor_join.c:
	(15:16:19) Fixed break contig: when sequences were moved from one
	bin to another bin I forgot to edit the sequence itself to relink
	the bin pointer to the new parent. 

2008-12-09  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/contig_selector.tcl,
	* gap5/tclIndex:
	(12:48:23) Moved GetItemInfo from template_display.tcl (not used)
	to here. 

	* gap5/depth.tcl:
	(12:49:13) Split the GUI dialogue into separate template displays
	and reading depth plots. 

	* gap5/gap_utils.tcl:
	(12:49:42) New utility function "counter". Used for generating
	unique window names. 

2008-12-03  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/consensus.c,
	* gap5/contig_editor.tcl,
	* gap5/editor_view.c,
	* tgap/tg_contig.c,
	* tgap/tg_sequence.c,
	* tgap/tg_sequence.h,
	* tgap/tg_tcl.c:
	(12:08:05) Modified the sequence_*_base() functions to take an
	extra argument named contig_orient. This controls whether we wish
	to make this change in the orientation that the sequence resides
	within the contig (requiring a bin traversal) or whether we already
	know and have taken that into account (such as from a former
	contig_seqs_in_range query).
	
	This allowed for multiple bug fixes relating to insertion/deletion
	of bases in the contig editor both within sequences and the
	consensus. 

	* gap5/editor_view.c:
	(12:22:03) Fixed '%b' brief format (base call). 

2008-12-02  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/g-request.c:
	(10:27:41) Initialise new index records to G_INDEX_NEW instead of
	zero. I don't think this affects anything though.
	
	Removed dead code from g_unlock_views. The heap_free call is
	already performed in update_record and so never actually got called
	in unlock_views.
	
	Tidied up some of the reading and writing argument checking steps
	to permit len==0 now. The logic of this is that it's easier to
	allocate and write a zero length block (for say X*Ncontigs when
	initialising the contig order array) than to check for the special
	case of zero length. 

	* tgap/tg_bin.h:
	(10:29:04) Increased the minimum bin size to 1024. 

	* tgap/tg_iface_g.c:
	(10:33:25) Improved error handling. "g" functions typically return
	positive error codes, so we now check these and turn into -1 rather
	than passing through verbatim and being missed.
	
	Fixed minor memory leak in io_database_create_files().
	
	Added io_database_lock and io_database_unlock functions. We use
	these to queue up writes in the g-* code and hence reduce the
	amount of aux file updating.
	
	Support for decoding zero-byte blocks in seq_decode() - ie it
	doesn't crash any more and instead initialises a blank seq_t struct
	for us. 

	* tgap/tg_sequence.c:
	(12:23:44) sequence_new_from() now performs the initialise steps
	itself as these have been removed from the low-level
	iface->seq.create call. This is to avoid initialising and flushing
	data until the proper cache_flush time, and in doing so removes
	unnecessary disk seeks.
	
	sequence_get_position has been updated to support complemented
	bins. It also has an extra argument to return whether the bin is
	effectively reverse-complemented in the contig as a whole.
	
	sequence_get_base and sequence_get_base4 now return data in the
	orientation of the seq_t struct rather than complementing
	themselves.
	
	sequence_replace_base now works with sequences in complemented
	contigs. 

	* tgap/tg_sequence.h:
	(12:24:00) sequence_get_position has been updated to support
	complemented bins. It also has an extra argument to return whether
	the bin is effectively reverse-complemented in the contig as a
	whole. 

	* tgap/tg_struct.h:
	(12:24:16) Added 'rec' to seq_t struct. 

	* tgap/tg_tcl.c:
	(12:25:06) "io num_contigs" command now returns the correct number
	of contigs rather than the maximum previous size of the
	contig_order array. 

	* tgap/tg_view.c:
	(12:25:51) Due to changes in seq_t left/right (always having left
	<= right) we no longer need to complement positions. 

	* tgap/Attic/tg_edit.c:
	(12:26:22) Redundant - no longer being maintained and likely
	doesn't work now. 

	* tgap/tg_bin.c,
	* tgap/tg_register.c:
	(12:27:04) Updated for extra argument to sequence_get_position(). 

	* tgap/tg_cache.c:
	(12:28:09) Better error checking in cache_load().
	
	Flipped sort order of cached items as the DB lock/unlock method
	reverses the order within the g-* code. 

	* tgap/tg_contig.c:
	(12:30:00) Create new contigs with MIN_BIN_SIZE instead of
	hard-coded 16.
	
	contig_seqs_in_range2() now always returns range start and end in
	sorted position (start <= end) rather than flipped for complemented
	sequence. This removes complementing code elsewhere too.
	
	Added debugging tool contig_bin_dump() - to be called from gdb or
	similar for listing out a contig bin struct. 

	* tgap/tg_index.c:
	(12:30:23) Flush less often. 

	* gap5/consen.tcl:
	(12:32:30) Removal of debugging output.
	
	Added close of fd in get_consensus. 

	* gap5/consensus.c:
	(12:33:45) Removal of now unnecessary complementing code (see
	tg_contig.c changes).
	
	Bug fix to consensus_valid_range (param cons). 

	* gap5/contig_selector.c:
	(12:34:19) Added header files. 

	* gap5/Attic/dependencies:
	(12:34:33) *** empty log message *** 

	* gap5/editor_join.c:
	(12:35:33) Update 'offset' based on reach contig_offset value too.
	
	Now also destroys the contig properly. 

	* gap5/editor_view.c:
	(12:36:14) Changed arguments to sequence_get_position. Removed
	complementing code (see tg_contigs.c change). 

	* gap5/fij.c:
	(12:36:57) Now corrects for start positions of the editor; does not
	assume starts as bp 1. 

	* gap5/find_repeats.c:
	(12:37:12) Added include file. 

	* gap5/gap4_compat.c:
	(12:37:44) sequence_get_position() arg changes.
	
	Implemented complement_contig function. 

	* gap5/gap4_compat.h:
	(12:37:56) Implemented complement_contig function. 

	* gap5/newgap5_cmds.c:
	(12:38:16) Implemented complement_contig function. 

	* gap5/qualIO.c:
	(12:38:36) sequence_get_position arg changes. 

	* gap5/read_depth.h:
	(12:38:54) Added avg_sequence_depth prototype. 

	* gap5/tman_interface.c:
	(12:39:12) sequence_get_position arg changes. 

	* gap5/Attic/dependencies:
	(12:41:58) *** empty log message *** 

	* tgap/tg_contig.c:
	(17:29:05) Adjusted the positioning of contig offsets so that the
	offset is applied verbatim regardless of orientation of the root
	bin. The root bin's position element itself can be used to move
	contigs around (ie change the numbering start) instead of the
	contig start/end records. 

	* gap5/editor_join.c,
	* gap5/gap4_compat.c,
	* tgap/tg_sequence.c:
	(17:29:06) Adjusted the positioning of contig offsets so that the
	offset is applied verbatim regardless of orientation of the root
	bin. The root bin's position element itself can be used to move
	contigs around (ie change the numbering start) instead of the
	contig start/end records. 

2008-11-25  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/contig_editor.tcl:
	(10:01:36) Added a Join button.
	
	The save/cutoffs/quality buttons now apply to both editors when in
	join editor mode.
	
	The curr_editor variable is now updated when clicking on another
	editor (also in join editor mode).
	
	Fixed the mouse-over text display for the names window. 

	* gap5/editor_join.c,
	* gap5/editor_view.h,
	* gap5/tkEditor.c:
	(10:02:34) Implemented the edJoin() function and the tkEditor
	"join" sub command.  Tested and we successfully made our first
	join. Yay! Next up, complemented joins. 

2008-11-24  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/tg_cache.c:
	(10:08:14) Add missing break statment, which caused cache_dup to
	fail. 

	* tgap/tg_sequence.c:
	(10:08:29) Commented out the richard_munge_conf() call. 

	* gap5/consensus.c,
	* gap5/consensus.h:
	(10:09:58) New function: consensus_valid_range()
	
	This looks at the cutoff data to work out where the "used" extents
	of the contig are rather than the absolute sizes of the contig bins
	including cutoffs. 

	* gap5/fij.c,
	* gap5/find_repeats.c:
	(10:18:18) Fixed calls to edit_contig and join_contig. These now
	also specify the position in contig to display. 

	* gap5/gap4_compat.c:
	(10:19:35) lget_contig_num now returns the default contig range as
	the true start and end coordinates rather than 1 to 'length'. 

	* gap5/tclIndex:
	(10:19:46) Added join_contig 

	* gap5/tkEditor.c:
	(10:20:24) New sub-commands: link_to, lock and join_align. For the
	join editor. 

	* gap5/tkEditor.h:
	(10:20:39) *** empty log message *** 

	* gap5/Makefile,
	* gap5/editor_join.c:
	(10:24:05) New file: editor_join.c. This is derived from Gap4's
	join.c and consists of functions for the Join Editor to implement
	the align and join buttons. 

	* gap5/contig_editor.tcl,
	* gap5/editor_view.c,
	* gap5/editor_view.h:
	(10:24:47) Major works to support the Join Editor.
	
	Removed defunct and commented out calc_cons() call.
	
	Fixed bug in status line display of quality values.
	
	Fixed bug in X scrollbar position - if now compensates for contig
	start being negative (cutoff data) so user scrolled position and
	displayed position match.
	
	Allowed for editor to be started up with the cursor at a specified
	read and position. 

2008-11-17  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/baf.c,
	* tgap/baf.h:
	(11:09:55) Added minimal support for reading and storing the trace
	alignment string. 

	* tgap/maqmap.c,
	* tgap/maqmap.h:
	(11:11:30) Minor change to prototypes - added void instead of
	implicit "()" args. 

	* tgap/maq.c,
	* tgap/tg_cache.c,
	* tgap/tg_iface_g.c,
	* tgap/tg_index.c,
	* tgap/tg_sequence.c,
	* tgap/tg_struct.h:
	(11:13:07) Added trace name and alignment strings to the seq_t
	struct. Also improved the storage mechanism for CNF1 format data
	with some basic compression for sequence and quality values. This
	saves about 40% of storage on a mixed 454/Sanger assembly - less so
	for solexa/solid. 

	* gap5/tk-io-reg.c:
	(11:59:58) Fixed a bug in argument parsing within tcl_quit_displays 

	* gap5/fij.c:
	(16:40:29) *** empty log message *** 

	* gap5/depth.tcl:
	(16:40:48) Fixed Y scrolling (produced Tk error) 

	* gap5/consensus.c:
	(16:41:11) Fixed uninitialised data for zero-depth regions. 

	* tgap/tg_register.c:
	(16:42:32) Rewrote type_notify to accept the fact that calling the
	callback function may change the list of registered items (eg if
	the notification is a quit displays request). To address this if a
	callback function is called we then recompute the list of
	registered functions. 

	* tgap/maq.c:
	(16:43:01) Ensure we zero the alignment string. This was causing
	bugs whereby sequence and quality were corrupted. 

	* tgap/baf.c:
	(16:43:33) Added support for template names (TN lines) rather than
	assuming shared read-names indicate the template. 

2008-11-14  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/Attic/array.c,
	* tgap/Attic/array.h:
	(10:16:17) Duplicate copies removed - we use the version in the
	../Misc directory again now. 

2008-11-13  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/read_depth.c,
	* gap5/read_depth.h:
	(17:08:08) *** empty log message *** 

2008-11-11  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/BAF,
	* tgap/Makefile,
	* tgap/baf.c,
	* tgap/baf.h,
	* tgap/tg_index.c:
	(15:09:12) Added (some) support for BAF - the basic assembly
	format. This isn't intended to be a long-term file format but it
	will serve as a working format until a strong contender emerges.
	For now it's a replacement CAF to work around our current woes. 

	* tgap/hache_table.c,
	* tgap/hache_table.h:
	(15:09:30) Added iterators to the HacheTable code. 

	* tgap/tg_iface_g.c,
	* tgap/tg_sequence.c,
	* tgap/tg_sequence.h,
	* tgap/tg_struct.h:
	(15:11:12) Added trace_name to the sequence_t struct and a flag to
	indicate if the field is present on disk. This allows us to add
	explicit trace names only for cases where it differs to the
	sequence name. 

	* tgap/tg_view.c:
	(15:11:29) Fixed a bug with long read names where they could
	overlap the sequence. 

	* gap5/Makefile:
	(15:12:13) Fixed Makefile to not use ~jkb/work/tgap for the tgap
	source - it now correctly uses the Staden local copy. Oops 

	* gap5/trace_display.tcl:
	(15:12:55) Protect against trace titles containing dots, which
	previously broke the tk pathnames being generated. 

2008-10-24  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/consensus.c:
	(09:05:18) Added depth to the consensus struct per base.
	
	Improved support for utilising all 4 confidence values when
	available.
	
	Bug fixed some edge cases, such as zero depth regions. 

	* gap5/consensus.h:
	(09:05:31) Added depth to the consensus struct per base. 

	* gap5/contig_editor.tcl:
	(09:06:24) The status line updates quality information on keyboard
	cursor movements now as well as mouse over events. 

	* gap5/editor_view.c:
	(09:07:48) The editor "brief" status line format has been updated
	to support reporting all 4 confidence values for a sequence base
	call. 

	* gap5/gap4_compat.c:
	(09:08:23) contig_name_to_number now uses contig_index_query for
	btree scanning rather than a brute force search. 

	* gap5/newgap5_cmds.c:
	(09:10:06) New function: tcl_sequence_depth, doing pretty much what
	you expect.
	
	Start of tcl_find_internal_joins interface. Incomplete right now.
	
	tcl_calc_consensus_full now reports sequence depth too, incase
	you're already calculating the consensus anyway. 

2008-10-23  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/b+tree2.c:
	(14:09:23) Additional error checking in btree_find_recurse(). 

	* tgap/tg_contig.c,
	* tgap/tg_contig.h:
	(14:09:50) Added a contig_index_query function, analogous to
	sequence_index_query. 

	* tgap/tg_iface_g.c,
	* tgap/tg_index.c,
	* tgap/tg_sequence.c,
	* tgap/tg_sequence.h,
	* tgap/tg_tcl.c,
	* tgap/tg_view.c:
	(14:29:43) Fixed bug in btree_load_cache. If it had an error
	locking or reading data then it freed an uninitialised pointer.
	
	Fixed a view locking bug in btree_write().
	
	Added support for SEQ_FORMAT_CNF4 encoded sequences. These have 4
	log-odds confidence values instead of the 1 phred value. 

2008-10-03  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/Makefile,
	* tgap/ace.c,
	* tgap/ace.h,
	* tgap/maq.c,
	* tgap/tg_index.c:
	(16:12:13) Added support for loading (new format) ACE files in
	tg_index.
	
	For all formats we no longer flush the cache after every contig as
	this was a major speed hit when dealing with lots of small contigs.
	
	Added read-pairing support for the simple .aln format. If the name
	matches it's assumed to be part of a pair. 

	* tgap/hache_table.c:
	(16:13:07) Minor changes to the HacheTableStats function. The
	reporting number of cache hits/misses is now a delta from the last
	time the stats function was called. 

	* tgap/tg_tcl.c:
	(16:13:49) Added comments regarding usage. No code change. 

	* gap5/gap4_compat.c:
	(16:23:56) Fixes in get_contig_num. (Done so long ago I forget what
	the reasoning was - sorry!) 

	* gap5/fij.c,
	* gap5/fij.h,
	* gap5/fij.tcl,
	* gap5/newgap_structs.h:
	(16:25:46) Added Find Internal Joins function. 

	* gap5/depth.tcl,
	* gap5/tclIndex:
	(16:26:50) Added the first draft of a read-depth and template
	display. Also tidied up the menus to remove most of the unused
	functions somewhat. 

	* tgap/ace_reorder.pl:
	(17:00:02) This attempts to reorder an ACE file so that the reads
	within it are sorted in left to right order.
	
	The purpose for this is to improve efficiency when converting to a
	Gap5 database. While it'll work regardless of the read order
	(provided the reads are presented in the same order as listed int
	he AF lines), it is inefficient if the reads for a small region are
	spread throughout a large area of disk. 

	* gap5/depth.tcl:
	(17:56:15) Removed broken bits from the entry dialogue. The window
	doesn't yet support multiple contigs anyway. 

2008-08-29  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/tg_cache.c:
	(09:01:56) Bug fixed the new flush code. Using ARR instead of arr
	macro auto-extends the array for us. 

	* tgap/tg_contig.c:
	(09:03:15) Added cache_incr/decr calls around contig_seqs_in_range2
	so that the recursive nature of the function cannot push the bin
	out of the cache. 

	* tgap/tg_tcl.c:
	(13:46:28) Overhauled the tcl objects somewhat. Contigs and
	sequence (more to follow) sport an "io" and a "delete" method. This
	comes about from the realisation that my object system doesn't
	really fit in with Tcl.
	
	Consider:
	
	if {$condition} {    set r [$io get_sequence $seq_num]	  puts
	length=[$r get_length] }
	
	This this we query the tg_cache to get a sequence object, we create
	a Tcl_Obj associated with that too (stored in $r) and register a
	*global* function named after the string form of $r. This allows us
	to call it with "$r get_length" as technically objects are not
	classes and cannot have methods invoked on them in their own right.
	The names are globally unique though so there are no clashes.
	
	Hence when $r goes out of scope it destroys the reference to the
	object but does not remove the function. We now have to explicitly
	call "$r delete" to tidy up otherwise we end up with memory leaks
	and global namespace pollution. ie:
	
	if {$condition} {    set r [$io get_sequence $seq_num]	  puts
	length=[$r get_length]	  $r delete }
	
	It's not enough to track reference counts on $r either as the act
	of calling it as a function ($r get_length) changes the type from
	sequence to cmdName, decrementing the reference. We cannot remove
	the memory yet though, so it's not possible to keep track it seems.
	
		   - -	- -  - -  - -  - -  - -  - -  - -  - -	- -
	
	Perhaps with hindsight we should use a procedural model instead:
	
	if {$condition} {    set r [g5::io::get_sequence $io $seq_num]	 
	puts length=[g5::seq::get_length $r] }
	
	This way we do not create and remove procedures plus our data
	automatically goes out of scope and is tidied up for us. The above
	is essentially what happens in perl when io is blessed to be in
	class g5::io or $r is blessed to be in class g5::seq. I guess
	incrTcl has an equivalent mechanism. 

	* gap5/gap.tcl:
	(14:58:13) Removed requirement of database name being
	"dbname.version". 

2008-08-26  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/tg_cache.c,
	* tgap/tg_gio.h:
	(13:28:23) Fixed the cache_flush code to hand over cache_items from
	a "derived" io to the base io struct before running cache_flush on
	the base.
	
	This ensures that the base io obtains copies of data from (for
	example) the contig editor. 

	* gap5/contig_editor.tcl,
	* gap5/tkEditor.c:
	(13:30:43) Added an "edits_made" sub-command of the editor. This is
	used to implement a warning on editor exit to ask if changes should
	be saved.
	
	Also fixed an error with a callback when highlighting non-sequence
	objects in the names panel. 

2008-08-20  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/tg_iface_g.c:
	(15:48:12) Added more automatic commiting of writes. I'm still not
	sure if this is correct behaviour, but given our caching is now
	held in the tg_cache layer instead of G library it serves the
	purpose. 

	* tgap/tg_tcl.c:
	(15:49:01) Added a "child" subcommand of the io type. 

	* gap5/Makefile:
	(15:49:22) Tidyup to support tgap library being part of the staden
	build system now. 

	* gap5/contig_editor.tcl:
	(15:50:59) Made the contig editor using a child io for editing in.
	The save button now works.
	
	(Previously save/exit did the same thing as we edited the live io
	instead of child io.) 

	* gap5/gap.tcl:
	(15:51:49) Minor tweaks to replace gap4 with gap5 in strings,
	functions and version (gap v5.00 now) 

	* gap5/tkEditor.c:
	(15:52:29) Added Editor class save sub-command. 

2008-08-19  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/g-files.c:
	(15:10:36) Fix issues with .aux files being > 2Gb in size. 

2008-08-13  James Bonfield  <jkb@sanger.ac.uk>

	* tgap/Makefile,
	* tgap/Attic/array.c,
	* tgap/Attic/array.h,
	* tgap/b+tree2.c,
	* tgap/b+tree2.h,
	* tgap/g-alloc.c,
	* tgap/g-alloc.h,
	* tgap/g-connect.c,
	* tgap/g-connect.h,
	* tgap/g-db.c,
	* tgap/g-db.h,
	* tgap/g-defs.h,
	* tgap/g-error.c,
	* tgap/g-error.h,
	* tgap/g-filedefs.h,
	* tgap/g-files.c,
	* tgap/g-files.h,
	* tgap/g-io.c,
	* tgap/g-io.h,
	* tgap/g-misc.h,
	* tgap/g-os.h,
	* tgap/g-request.c,
	* tgap/g-request.h,
	* tgap/g-struct.c,
	* tgap/g-struct.h,
	* tgap/g.h,
	* tgap/gap_cli_arg.c,
	* tgap/gap_cli_arg.h,
	* tgap/hache_table.c,
	* tgap/hache_table.h,
	* tgap/libtgap.so,
	* tgap/maq.c,
	* tgap/maq.h,
	* tgap/maqmap.c,
	* tgap/maqmap.h,
	* tgap/misc.h,
	* tgap/mkdefs.c,
	* tgap/tg_bin.c,
	* tgap/tg_bin.h,
	* tgap/tg_cache.c,
	* tgap/tg_cache_item.h,
	* tgap/tg_contig.c,
	* tgap/tg_contig.h,
	* tgap/tg_depth,
	* tgap/tg_depth.c,
	* tgap/Attic/tg_edit.c,
	* tgap/tg_gio.c,
	* tgap/tg_gio.h,
	* tgap/tg_iface.h,
	* tgap/tg_iface_g.c:
	(14:18:07) Initial import of tgap. This is for use in Gap5 source
	(which uses libtgap.so), but development on the test programs
	tg_index and tg_view will now take place in this CVS tree instead
	of Sanger's private SubVersion repository. 

	* tgap/tg_iface_g.h,
	* tgap/tg_index.c,
	* tgap/tg_register.c,
	* tgap/tg_register.h,
	* tgap/tg_sequence.c,
	* tgap/tg_sequence.h,
	* tgap/tg_struct.h,
	* tgap/tg_tcl.c,
	* tgap/tg_tcl.h,
	* tgap/tg_track.c,
	* tgap/tg_track.h,
	* tgap/tg_tracks.c,
	* tgap/tg_tracks.h,
	* tgap/tg_utils.c,
	* tgap/tg_utils.h,
	* tgap/tg_view.c,
	* tgap/xalloc.h,
	* tgap/xerror.c,
	* tgap/xerror.h:
	(14:18:08) Initial import of tgap. This is for use in Gap5 source
	(which uses libtgap.so), but development on the test programs
	tg_index and tg_view will now take place in this CVS tree instead
	of Sanger's private SubVersion repository. 

2008-07-14  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/consensus.c:
	(15:38:06) Fixes to the consensus algorithm for solexa reads -
	specifically calling gaps. 

	* gap5/contig_editor.tcl:
	(15:39:22) Added more use of tg_tcl's interfaces - we can now move
	reads around and insert/delete bases within readings (not just the
	consensus). 

2008-06-27  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/consensus.c:
	(16:23:43) Improved the consensus algorithm to handle pads. For now
	all pads score a fixed amount and we compare them against bases
	(any type) also at a fixed score. Having done that we then compute
	the base-score from non-pad bases as before, factoring in the
	probability of the base even existing right at the end.
	
	These fixed costs of overcall/undercall are reasonable for solexa
	where such errors are due to PCR and not related to the data
	quality.
	
	For capillary data we need more work to pick appropriate costs. 

	* gap5/contig_editor.tcl:
	(16:29:06) Added keybinding to use the new contig insert and delete
	base method. (Used for inserting columns of pads.) 

2008-05-30  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/contig_editor.tcl,
	* gap5/editor_view.c,
	* gap5/editor_view.h,
	* gap5/tkEditor.c:
	(14:22:00) Added code to support read-pair data. For now this is
	just the right mouse click in the editor's read name as a proof of
	concept.
	
	Fixed the "is the cursor visible?" code too so set X first, fixing
	an error in working out the Y display point. 

2008-05-27  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/consen.tcl:
	(16:25:11) Added code for Gap4's main output consensus function.
	Right now it's in simple mode only with no marking or masking.
	Formats supported are fastq and fasta, with experiment file to
	follow maybe. 

	* gap5/contig_editor.tcl,
	* gap5/editor_view.c,
	* gap5/tkEditor.c,
	* gap5/tkEditor.h:
	(16:28:21) Added display of mapping quality to the read-name
	section. 

2008-05-22  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/consen.tcl,
	* gap5/consensus.c,
	* gap5/qual.tcl:
	(10:25:34) Implemented a new consensus algorithm using log-odds
	scores. 

	* gap5/consensus.h:
	(10:25:35) Implemented a new consensus algorithm using log-odds
	scores. 

	* gap5/Makefile:
	(10:26:40) *** empty log message *** 

	* gap5/contig_editor.tcl:
	(10:27:55) Changed the mouse highlight on bases to use
	BASE_BRIEF_FORMAT[12] instead of the READ_BRIEF_FORMAT format
	string. 

	* gap5/editor_view.c,
	* gap5/editor_view.h:
	(10:30:26) Make use of the new consensus algorithm, which gives
	quality values so we can now grey-scale the consensus too.
	
	Improved the "brief" status line support, adding a new
	edGetBriefCon for consensus status info too. 

	* gap5/qual.c,
	* gap5/tkEditor.c:
	(10:30:30) Make use of the new consensus algorithm, which gives
	quality values so we can now grey-scale the consensus too.
	
	Improved the "brief" status line support, adding a new
	edGetBriefCon for consensus status info too. 

	* gap5/newgap5_cmds.c:
	(10:32:08) Added in List Consensus Confidence and List Base
	Confidence functions (the latter still needs major bug fixes
	though). 

	* gap5/qualIO.c:
	(10:32:09) Added in List Consensus Confidence and List Base
	Confidence functions (the latter still needs major bug fixes
	though). 

	* gap5/gap.tcl:
	(10:32:44) Temporary hack to change maxseq until I update the code
	to automatically derive it. 

2008-05-12  James Bonfield  <jkb@sanger.ac.uk>

	* gap5/IO.h,
	* gap5/IO2.h,
	* gap5/Makefile,
	* gap5/actf.c,
	* gap5/actf.h,
	* gap5/active_tags.c,
	* gap5/active_tags.h,
	* gap5/Attic/complement.h,
	* gap5/consen.c,
	* gap5/consen.h,
	* gap5/contig_editor.tcl,
	* gap5/contig_id.tcl,
	* gap5/contig_selector.c,
	* gap5/contig_selector.h,
	* gap5/contig_selector.tcl,
	* gap5/cs-object.c,
	* gap5/cs-object.h,
	* gap5/Attic/dependencies,
	* gap5/editor_view.c,
	* gap5/editor_view.h,
	* gap5/extract.h,
	* gap5/find_repeats.c,
	* gap5/find_repeats.h,
	* gap5/find_repeats.tcl,
	* gap5/fort.h,
	* gap5/gap-dbstruct.h,
	* gap5/gap-error.c,
	* gap5/gap-error.h,
	* gap5/gap-if.h,
	* gap5/gap-tcl.h,
	* gap5/gap.tcl,
	* gap5/gap4_compat.c,
	* gap5/gap4_compat.h,
	* gap5/gap4_compat.tcl,
	* gap5/gap_cli_arg.h,
	* gap5/gap_globals.c,
	* gap5/gap_globals.h,
	* gap5/gap_hash.c,
	* gap5/gap_hash.h,
	* gap5/gap_utils.tcl,
	* gap5/hash_lib.c,
	* gap5/hash_lib.h,
	* gap5/init.c,
	* gap5/io-reg.h,
	* gap5/io_handle.h,
	* gap5/io_utils.h,
	* gap5/jog.tcl,
	* gap5/list.h,
	* gap5/list_contigs.tcl,
	* gap5/list_proc.c,
	* gap5/list_proc.h,
	* gap5/list_proc.tcl,
	* gap5/newgap5_cmds.c,
	* gap5/newgap_cmds.h,
	* gap5/newgap_structs.h,
	* gap5/ng_fb_cmds.tcl,
	* gap5/notedb.c,
	* gap5/notedb.h,
	* gap5/qual.c,
	* gap5/qual.h,
	* gap5/qualIO.c,
	* gap5/qualIO.h,
	* gap5/qualP.h,
	* gap5/search.tcl,
	* gap5/sendto.tcl,
	* gap5/stack_dump.c,
	* gap5/stack_dump.h,
	* gap5/tag_checklist.tcl,
	* gap5/tagdb.c,
	* gap5/tagdb.h,
	* gap5/tclIndex,
	* gap5/template_display.tcl,
	* gap5/tk-io-reg.c,
	* gap5/tk-io-reg.h,
	* gap5/tkAppInit.c:
	(11:26:37) Try v2. Initial checkin of gap5 source. Note this
	requires the tgap source too, which will be added soon. (It
	currently exists in Sanger's own SVN repository.) 

	* gap5/tkEdNames.c,
	* gap5/tkEdNames.h,
	* gap5/tkEditor.c,
	* gap5/tkEditor.h,
	* gap5/tman_display.c,
	* gap5/tman_display.h,
	* gap5/tman_interface.c,
	* gap5/tman_interface.h,
	* gap5/trace_display.tcl:
	(11:26:38) Try v2. Initial checkin of gap5 source. Note this
	requires the tgap source too, which will be added soon. (It
	currently exists in Sanger's own SVN repository.) 

	* gap5/contig_editor.tcl,
	* gap5/contig_id.tcl,
	* gap5/gap.tcl,
	* gap5/gap4_compat.tcl,
	* gap5/ng_fb_cmds.tcl,
	* gap5/select_contig.tcl:
	(16:11:41) Minor tweaks to tidy up gap5 distrib. 

	* gap5/tk-io-reg.c:
	(16:11:42) Minor tweaks to tidy up gap5 distrib.