File: fix_perl_interpreter_and_lib_path

package info (click to toggle)
sift 6.2.1-2
  • links: PTS, VCS
  • area: non-free
  • in suites: forky, sid
  • size: 4,784 kB
  • sloc: ansic: 18,272; perl: 219; csh: 164; makefile: 152
file content (1847 lines) | stat: -rw-r--r-- 60,165 bytes parent folder | download | duplicates (2)
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
* Fix perl interpreter paths.
* Support parallel build of binaries.
* Enhance verbosity in csh scripts for bug hunting.
* Add blast processors argument SIFT_for_submitting_fasta_seq.csh .
* Trailing whitespace removed from lines.
Index: sift/bin/perlscripts/get_BLINK_seq.pl
===================================================================
--- sift.orig/bin/perlscripts/get_BLINK_seq.pl
+++ sift/bin/perlscripts/get_BLINK_seq.pl
@@ -1,4 +1,4 @@
-#!/usr/local/bin/perl 
+#!/usr/bin/perl
 #use strict;
 use LWP::Simple;
 use LWP::UserAgent;
Index: sift/bin/seqs_chosen_via_median_info.csh
===================================================================
--- sift.orig/bin/seqs_chosen_via_median_info.csh
+++ sift/bin/seqs_chosen_via_median_info.csh
@@ -1,7 +1,8 @@
-#!/bin/csh
+#!/bin/csh -e
 # seqs_chosen_via_median_info.csh
 # Arg1 = protein sequence in fasta format
 # Arg2 = blastpgp database
+# Arg3 = blastpgp processors (-a)
 
 # This program is licensed to you under the Fred
 # Hutchinos Cancer Research Center (FHCRC)
Index: sift/bin/SIFT_for_submitting_NCBI_gi_id.csh
===================================================================
--- sift.orig/bin/SIFT_for_submitting_NCBI_gi_id.csh
+++ sift/bin/SIFT_for_submitting_NCBI_gi_id.csh
@@ -1,4 +1,4 @@
-#!/bin/csh
+#!/bin/csh -e
 #		SIFT.csh
 # This program is licensed to you under the Fred
 # Hutchinos Cancer Research Center (FHCRC)
Index: sift/src/Alignment.c
===================================================================
--- sift.orig/src/Alignment.c
+++ sift/src/Alignment.c
@@ -17,7 +17,7 @@ query sequence is moved to be the first
 #define _ALIGNMENT_C_
 #include "PN_convert.c"
 
-#define MAXSEQ 400
+#define MAXSEQ 20000
 
 #include "Alignment.h"
 
@@ -478,6 +478,7 @@ int flat_master_slave (FILE* fp, Sequenc
 		fprintf(errorfp, "ERROR! Why haven't %s and %s been freed?\n", prev_name,
 		prev_residues);
 		fprintf (errorfp, "Current %s %s\n", name, residues);
+		fprintf (stderr, "Current %s %s\n", name, residues);
 		exit (-1);
 	 }
 	} /* end of if (line[0] != ' ') */ 
@@ -752,7 +753,8 @@ read_psiblast_header_until_first (FILE*
         }
 	if (feof (fp)) {
 		fclose (fp);
-			fprintf (errorfp, "ERROR! PSI-BLAST found no hits. Program terminating.\n");
+		fprintf (errorfp, "ERROR! PSI-BLAST found no hits. Program terminating.\n");
+		fprintf (stderr, "%s:%d ERROR! PSI-BLAST found no hits. Program terminating.\n", __FILE__, __LINE__ );
                 exit (-1);
 	}
 
@@ -792,7 +794,8 @@ read_psiblast_header_until_first_no_erro
                 fclose (fp);
                 if (return_error) {
                         fprintf (errorfp, "ERROR! PSI-BLAST found no hits. Program terminating.\n");
-                exit (-1);
+                        fprintf (stderr, "%s:%d ERROR! PSI-BLAST found no hits. Program terminating.\n", __FILE__, __LINE__ );
+                	exit (-1);
                 } else {
                         return (-1);
                 }
@@ -827,6 +830,7 @@ printf ("finished reading psiblast file\
 	if (feof (fp)) {
 		fclose (fp);
 		fprintf (errorfp, "ERROR! PSI-BLAST found no hits. Program terminating.\n");
+		fprintf (stderr, "%s:%d ERROR! PSI-BLAST found no hits. Program terminating.\n", __FILE__, __LINE__ );
 		exit (-1);
 	}
 	sscanf (line, "Results from round %d", &iteration);
@@ -1213,6 +1217,7 @@ get_index_from_seqs (char name[], Sequen
 		}
 	}
 	fprintf (errorfp, "EXITING -- couldn't find %s in get_index_from_seqs\n", name);
+	fprintf (stderr, "EXITING -- couldn't find %s in get_index_from_seqs\n", name);
 	exit (-1);
 }
 
@@ -1352,8 +1357,9 @@ psiblast_pairwise (FILE* fp, Sequence *
 		sscanf (strptr, "Expect = %lf", &evalue);
 		} else { 
 			fprintf (errorfp, "Unable to read e-value, parsing incorrect");
-                exit (-1);
-        }
+			fprintf (stderr, "Unable to read e-value, parsing incorrect");
+                	exit (-1);
+        	}
 /* printf ("evalue is %lf\n", evalue); */ 
 /* end get evalue */
 			
@@ -1439,6 +1445,7 @@ nonoverlapping (Sequence* seq1, Sequence
 	assert (seq1->length == seq2->length);
 	if (strcmp (seq1->name, seq2->name ) != 0) {
 		fprintf (errorfp, "seeing whether %s and %s overlap, should be same name\n", seq1->name, seq2->name);
+		fprintf (stderr, "seeing whether %s and %s overlap, should be same name\n", seq1->name, seq2->name);
 		exit (-1);
 	}
 	for (i = 0; i < seq1->length; i++) {
@@ -1543,7 +1550,7 @@ read_4lines_of_pairwise (FILE* fp, Seque
 	}
 
 	if (strstr (line, "Query") == NULL) {
-		printf ("%s line should have Query:\n", line);
+		fprintf (stderr, "%s line should have Query:\n", line);
 		exit (-1);
 	}
         strptr = strtok (line, " \t\r\n"); /* this should be Query */
@@ -2052,10 +2059,10 @@ printf ("entered if statment\n");
    }
 
 
- printf ("Clumped %d sequences into %d clusters\n", nseq, i2);
+ printf("Clumped %d sequences into %d clusters\n", nseq, i2);
  /* keep this print because get # of clustersin awk statement */
   free(pairs);
-printf ("exiting clump\n");
+fprintf (stderr, "%s:%d exiting clump\n", __FILE__, __LINE__);
  return no_of_clumps;
 }  /* end of cluster */
 
Index: sift/src/blocklist.c
===================================================================
--- sift.orig/src/blocklist.c
+++ sift/src/blocklist.c
@@ -9,7 +9,7 @@
 #include <string.h>
 #include "blocklist.h"
 
-#define MAXSEQ 400
+#define MAXSEQ 20000
 
 /*======================================================================
 routines for a list of blocks
Index: sift/src/choose_seqs_via_psiblastseedmedian.c
===================================================================
--- sift.orig/src/choose_seqs_via_psiblastseedmedian.c
+++ sift/src/choose_seqs_via_psiblastseedmedian.c
@@ -1,6 +1,6 @@
 /* (C) Copyright 2000, Fred Hutchinson Cancer Research Center */
 /* Use, modification or distribution of these programs is subject to */
-/* the terms of the non-commercial licensing agreement in license.h. */           
+/* the terms of the non-commercial licensing agreement in license.h. */
 /* choose_seqs_via_psiblast.c */
 /* 02-14-01 use median threshold
 05-18-01, changed to add PSIBLAST_TURN sequences at once, if threshold has not
@@ -8,7 +8,7 @@
 	 recalculate median threshold for the 1 .. PSIBLAST_TURN sequences
 	 that have been added.
 	Should reduce time for calculation of median threshold O (length * seq)
-	  by PSIBLAST_TURN x fold	 
+	  by PSIBLAST_TURN x fold
 */
 #define EXTERN
 #include "blocksprogs.h"
@@ -20,7 +20,7 @@
 #include "Matrix_Info.c"
 #include "Protdist.c"
 #include "stringhash.c"
-#include "Psiblast.c" 
+#include "Psiblast.c"
 #include "PN_blocks.c"
 #include "Clumping.c"
 
@@ -29,9 +29,9 @@
 
 void getargs (int argc, char* argv[],
 		 char query_seq_file[LARGE_BUFF_LENGTH],
-		FILE** seqfp, 
+		FILE** seqfp,
 		FILE** outfp,
-		double* clumping_threshold, 
+		double* clumping_threshold,
 		char pid[SMALL_BUFF_LENGTH],
 		double* median_threshold);
 
@@ -53,10 +53,10 @@ main (int argc, char* argv[])
 	FILE* outfp; FILE* temp_chk_fp;
 	FILE* seqfp;
 	int nseqs, db_type, seq_type;
-	int i, k, index, nseqs_written; double dtemp;
+	int i, k, index = 0, nseqs_written; double dtemp;
 	double clumping_threshold;
 	double info_median;
-	Block* workingblock; 
+	Block* workingblock;
 	HashTable seqnamehash;
 	char seqname[KEY_WIDTH];
 	char pid[SMALL_BUFF_LENGTH];
@@ -226,15 +226,15 @@ error file */
 /*		print_block_ids (workingblock, outfp, TRUE); */
 		/* should free memeory, clean up later */
 /*		fclose (outfp); fclose (errorfp); fclose (logfp);
-		exit (0);*/ 
+		exit (0);*/
 	/* exit 0 else will generate an error in shell that calls this program*/
 	}
 	/* now of the last PSIBLAST_TURN sequences added, find out which one gives
-	   approaches the right median */	
+	   approaches the right median */
 	num_seqs_removed = 0;
 	while (median < median_threshold) {
 		workingblock->num_sequences--;
-		median = calculate_median_information_of_block (workingblock, 
+		median = calculate_median_information_of_block (workingblock,
 							FALSE, FALSE);
 		num_seqs_removed++;
 	}
@@ -243,30 +243,30 @@ error file */
 
 	fprintf (logfp, "********FINAL BLOCK ****** ");
 	fprintf (logfp, "last block : median %.3f with %d sequences\n", median,
-			workingblock->num_sequences); 
-/*	output_block_s (workingblock, outfp, FLOAT_OUTPUT); */ 
+			workingblock->num_sequences);
+/*	output_block_s (workingblock, outfp, FLOAT_OUTPUT); */
 
 
-/*	print_block_sequences (workingblock, outfp); */ 
-	print_block_ids (workingblock, outfp, TRUE); 
+/*	print_block_sequences (workingblock, outfp); */
+	print_block_ids (workingblock, outfp, TRUE);
 
-	workingblock->num_sequences+= num_seqs_removed; 
+	workingblock->num_sequences+= num_seqs_removed;
 				/* increase it back to deallocate
-					memory properly */	
+					memory properly */
 	free_seqs (seqs, nseqs);
 	free_block (workingblock);
 	DestroyTable (seqnamehash);
 	fprintf (logfp, "SUCCESSFUL\n");
-	fclose (outfp);	
+	fclose (outfp);
 	fclose (errorfp);
-	fclose (logfp);	
+	fclose (logfp);
 	rm_file (errorfilename);
 	exit (0);
 } /* end of main */
 
 /* return the number of sequences written */
 int
-write_seqs_not_in_hash (char query_database_file[LARGE_BUFF_LENGTH], 
+write_seqs_not_in_hash (char query_database_file[LARGE_BUFF_LENGTH],
 			 Sequence* seqs[MAXSEQ], int nseqs,
                                          HashTable hash)
 {
@@ -277,7 +277,7 @@ write_seqs_not_in_hash (char query_datab
 
 	nseqs_written = 0;
 	if ( (outfp = fopen (query_database_file, "w")) == NULL) {
-		fprintf (errorfp, "couldn't write to %s \n", 
+		fprintf (errorfp, "couldn't write to %s \n",
 			query_database_file);
 		exit (-1);
 	}
@@ -291,15 +291,15 @@ write_seqs_not_in_hash (char query_datab
 
 	fclose (outfp);
 	return nseqs_written;
- 
+
 } /* end write_seqs_not_in_block */
-		
+
 void
-getargs (int argc, char* argv[], 
+getargs (int argc, char* argv[],
 	char query_seq_file[LARGE_BUFF_LENGTH],
-	FILE** seqfp, 
-	FILE** outfp, 
-	double* clumping_threshold, 
+	FILE** seqfp,
+	FILE** outfp,
+	double* clumping_threshold,
 	char pid[SMALL_BUFF_LENGTH],
 	double* median_threshold)
 {
@@ -359,7 +359,7 @@ getargs (int argc, char* argv[],
 	}
 
 	if (argc > 4) *clumping_threshold = atof (argv[4]);
-	else 
+	else
 	{
 		printf ("Enter clumping threshold\n");
 		scanf ("%lf\n", clumping_threshold);
@@ -381,10 +381,10 @@ getargs (int argc, char* argv[],
 	}
 
 
-} /* end of getargs */ 
+} /* end of getargs */
 
 void
-write_seq_to_file (char filename[LARGE_BUFF_LENGTH], Sequence* seq) 
+write_seq_to_file (char filename[LARGE_BUFF_LENGTH], Sequence* seq)
 {
 	FILE* fp;
 
Index: sift/src/clump_output_alignedseq.c
===================================================================
--- sift.orig/src/clump_output_alignedseq.c
+++ sift/src/clump_output_alignedseq.c
@@ -25,7 +25,7 @@ option 1 -- print out sequences that hav
 #include "Clumping.c"
 
 #define MINSEQ 2 
-#define MAXSEQ 400
+#define MAXSEQ 20000
 #define INDEX(n, col, row) (col*n - (col*(col+3))/2 - 1 + row)
 #define MIN_CLUSTERS 3
 
Index: sift/src/info_on_seqs.c
===================================================================
--- sift.orig/src/info_on_seqs.c
+++ sift/src/info_on_seqs.c
@@ -11,7 +11,7 @@
 #include "Psiblast.c"
 /* #include "Information.c */
 
-#define MAXSEQ 400 /* Maximum number of sequences */
+#define MAXSEQ 20000 /* Maximum number of sequences */
 #define LINE_LEN 800
 #define FALSE 0
 #define TRUE 1
@@ -200,10 +200,10 @@ output_predictions (AAnode* polymorph_da
 	int substitution, original_aa;
 	int substitution_exists;
 	int pos;
-	double median;
+	double median = 0;
 	AAnode current;
-	Block* block_with_seqs_at_pos;
-	double* info_array;
+	Block* block_with_seqs_at_pos = NULL;
+	double* info_array = NULL;
 	int block_constructed;
 	
 	substitution_exists = FALSE;
@@ -339,7 +339,7 @@ comments_on_info(Block* oldblock, int po
        fprintf (outfp, "%d\n", residues_stored[pos]);
 */
 	/* the array will be sorted in call for median_of_array*/
-printf ("looking for median\n");
+fprintf( stderr, "looking for median\n");
 	median = median_of_array (info_array, prot_length);
        printf ("found mediant %.2f\n", median);
 	 fprintf (outfp, "%.3f\t%d\t%d\n",
@@ -354,7 +354,7 @@ printf ("looking for median\n");
 	assert (oldblock->sequences[0].sequence != NULL);
 	assert (oldblock->sequences != NULL);
 	assert (oldblock != NULL);
-printf ("finished comments oninfo\n");
+fprintf( stderr, "finished comments oninfo\n");
 }
 
 double
Index: sift/src/Makefile
===================================================================
--- /dev/null
+++ sift/src/Makefile
@@ -0,0 +1,45 @@
+include-prefix := $(prefix)
+lib-prefix := $(prefix)
+
+BIN :=	choose_seqs_via_psiblastseedmedian \
+	clump_output_alignedseq \
+	consensus_to_seq \
+	info_on_seqs \
+	psiblast_res_to_fasta_dbpairwise \
+	seqs_from_psiblast_res
+
+CC := gcc
+CFLAGS := -I$(include-prefix)/include/blimps -O2 -D__MAKE_PREFIX__=\"$(prefix)\" $(CFLAGS)
+LDFLAGS := -L$(lib-prefix)/lib -lblimps $(LDFLAGS)
+
+all: bin
+
+bin: $(BIN)
+
+clean:
+	rm -f *.o $(BIN)
+
+distclean: clean
+	rm -f deps.mk
+
+install:
+	mkdir -p $(DESTDIR)$(prefix)/lib/sift/bin && \
+	cp -a \
+		choose_seqs_via_psiblastseedmedian \
+		clump_output_alignedseq \
+		consensus_to_seq \
+		info_on_seqs \
+		psiblast_res_to_fasta_dbpairwise \
+		seqs_from_psiblast_res \
+		$(DESTDIR)$(prefix)/lib/sift/bin/
+
+help:
+
+.PHONY: all bin clean distclean help install
+
+deps.mk:
+	$(CC) -MM $(CFLAGS) $(addsuffix .c,$(BIN)) > $@
+
+include deps.mk
+
+# vim:ai:
Index: sift/src/Matrix_Info.c
===================================================================
--- sift.orig/src/Matrix_Info.c
+++ sift/src/Matrix_Info.c
@@ -384,7 +384,7 @@ void output_Matrix_Info (Matrix_Info* in
   int pos_observed_tolerant, pos_error_tn, pos_notobserved_intolerant,
 	pos_error_fp, pos_total;
   char c; int l;
-  int print_correct, print_incorrect, print_X, print_type;
+  int print_correct, print_incorrect, print_X, print_type = 0;
 
 	print_correct = 1; print_incorrect = 2; print_X =3; 
   error_fp=0; error_tn = 0, total=0;
@@ -520,7 +520,7 @@ void output_Matrix_Info (Matrix_Info* in
                                                 pos_error_tn++;
 						error_tn++;
 						 print_type = print_incorrect;
-                                        } else {printf ("something is wrong\n");}
+                                        } else {fprintf( stderr, "%s:%d something is wrong\n", __FILE__, __LINE__ );}
                                 	break;
 				case 2: /* +- phenotype is - */
                                         if ( matrix->weights[aa_atob[(int)c]][l] > 0.0) {
@@ -531,7 +531,7 @@ void output_Matrix_Info (Matrix_Info* in
                                                 pos_notobserved_intolerant++;
 						notobserved_intolerant++; 
 						print_type = print_correct;
-                                        }else {printf ("what?\n"); }
+                                        }else {fprintf( stderr, "%s:%d what?\n", __FILE__, __LINE__ ); }
                                         break;
                         	default:
 					fprintf(errorfp, "severity option error %d\n", severity_option);
@@ -612,7 +612,7 @@ void output_Matrix_Info_float (Matrix_In
   int pos_observed_tolerant, pos_error_tn, pos_notobserved_intolerant,
         pos_error_fp, pos_total;
   char c; int l;
-  int print_correct, print_incorrect, print_X, print_type;
+  int print_correct, print_incorrect, print_X, print_type = 0;
 
   print_correct = 1; print_incorrect = 2; print_X =3;
   error_fp=0; error_tn = 0, total=0;
@@ -735,7 +735,7 @@ void output_Matrix_Info_float (Matrix_In
                                                 pos_error_tn++;
                                                 error_tn++;
                                                  print_type = print_incorrect;
-                                        } else {printf ("something is wrong\n");}
+                                        } else {fprintf( stderr, "%s:%d something is wrong\n", __FILE__, __LINE__ );}
                                         break;
                                 case 2: /* +- phenotype is - */
                                         if ( matrix->weights[aa_atob[(int) c]][l] > 0.01) {
@@ -847,10 +847,10 @@ void read_matrix_20_aa_body(mfp, matrix)
    */
 
   len = 0;
-printf ("matrix width %d\n", matrix->width);
+fprintf( stderr, "matrix width %d\n", matrix->width);
   /* skip the letters */
   fgets(Buffer, LARGE_BUFF_LENGTH, mfp);
-printf ("skiipping letters %s\n", Buffer);
+fprintf( stderr, "skipping letters %s\n", Buffer);
   /* read in the numbers */
   while (fgets(Buffer, LARGE_BUFF_LENGTH, mfp) &&
          !blank_line(Buffer) &&
@@ -923,7 +923,7 @@ int
 min_aa_in_column (Matrix * matrix, int pos)
 {
 	double min;
-	int min_aa, aa;
+	int min_aa = 0, aa;
 
 	min = 1000;
 	for (aa = 0; aa < AAS; aa++) {
@@ -1038,7 +1038,7 @@ void output_Matrix_Info_float_uncertaint
   int pos_observed_tolerant, pos_error_tn, pos_notobserved_intolerant,
         pos_error_fp, pos_total;
   char c; int l;
-  int print_correct, print_incorrect, print_X, print_type;
+  int print_correct, print_incorrect, print_X, print_type = 0;
   int uncertain_aa, uncertain_tolerant, uncertain_intolerant;
   int pos_uncertain_aa, pos_uncertain_tolerant, pos_uncertain_intolerant;
   int total_correct, total_counted;
Index: sift/src/PN_blocks.c
===================================================================
--- sift.orig/src/PN_blocks.c
+++ sift/src/PN_blocks.c
@@ -668,7 +668,7 @@ remove_seq0_Xes_from_block (Block* block
         Block* newblock;
         Residue* residue_pointer;
         int i, pos;
-	int non_X_length, newblockpos;
+	int non_X_length, newblockpos = 0;
 
         non_X_length = 0;
 	for (i=0; i < block->width; i++) {
Index: sift/src/PN_convert.c
===================================================================
--- sift.orig/src/PN_convert.c
+++ sift/src/PN_convert.c
@@ -1,6 +1,6 @@
 /* (C) Copyright 2000, Fred Hutchinson Cancer Research Center */
 /* Use, modification or distribution of these programs is subject to */
-/* the terms of the non-commercial licensing agreement in license.h. */   
+/* the terms of the non-commercial licensing agreement in license.h. */
 
 /* convert.c: functions for different methods of converting a block into a */
 /*            matrix */
@@ -8,8 +8,8 @@
 /* Change log information is at the end of the file. */
 /* PN_convert.c copied from convert.c to allow for large block widths */
 
-/*07-13-00 changed in counts() so that if an X is not observed, counts is NOT 
-evenly distributed throughout.  For gaps, counts is evenly distributed 
+/*07-13-00 changed in counts() so that if an X is not observed, counts is NOT
+evenly distributed throughout.  For gaps, counts is evenly distributed
 throughout.
 */
 /*	system headers not in global.h */
@@ -18,6 +18,9 @@ throughout.
 
 #include <assert.h>
 #include <math.h>
+#include <errno.h>
+#include <string.h>
+#include "sift_blimps.h"
 #include "PN_convert.h"
 #include "queue.c"
 #include "SortList.c"
@@ -45,7 +48,7 @@ struct float_qij *Qij;
 void pb_weights(/*block*/);
 
 /*
- * Matrix construction methods.  Build matricies from blocks and 
+ * Matrix construction methods.  Build matricies from blocks and
  * sequence weights.
  */
 
@@ -131,7 +134,7 @@ Matrix *PN_block_to_matrix(block, conver
     break;
   case 22:  /* instead of adding RTot * diffaas*/
 	    /* as in option 20, add RTot * (diffass - 1), thus not adding*/
-	    /* any pseudocounts to completely conserved columns */ 
+	    /* any pseudocounts to completely conserved columns */
 	    /* qij's as pseudocounts */
     PN_altschul_data_dependent_conversion_method (block, matrix, 22);
     break;
@@ -139,13 +142,13 @@ Matrix *PN_block_to_matrix(block, conver
 	   /* exp. pseudocounts*/
     PN_altschul_data_dependent_conversion_method (block, matrix, 23);
     break;
-  case 24: 
+  case 24:
     PN_altschul_data_dependent_conversion_method (block, matrix, 24);
     break;
   case 25:
     PN_altschul_data_dependent_conversion_method (block, matrix, 25);
     break;
-  case 26: 
+  case 26:
     PN_altschul_data_dependent_conversion_method (block, matrix, 26);
     break;
   case 27:
@@ -170,7 +173,7 @@ Matrix *PN_block_to_matrix(block, conver
 	qij_matrix_profile (block, matrix, Qij);
 	break;
    default: /* the default case */
-    sprintf(ErrorBuffer, 
+    sprintf(ErrorBuffer,
 	    "Invalid block to matrix conversion method specified, %d.",
 	    conversion_method);
     ErrorReport(WARNING_ERR_LVL);
@@ -211,10 +214,10 @@ Matrix *PN_block_to_matrix_RTot_par(bloc
 	    ErrorReport(WARNING_ERR_LVL);
 
 	 sprintf(ErrorBuffer,     /* ^^^^----------------vvvvvvvvvvvvvvvvvvv */                    "Using the default conversion method of Altschul's data-dependent method.\n");
- 
+
 	 ErrorReport(WARNING_ERR_LVL);
     	altschul_data_dependent_conversion_method(block, matrix, 0);
-  } 
+  }
 
   /* return the matrix */
   return matrix;
@@ -239,11 +242,11 @@ static struct working *make_col()
 {
   struct working *col;
   int aa;
-  
+
   CheckMem(
 	   col = (struct working *) malloc(sizeof(struct working))
 	   );
-  
+
   col->totcnt = col->totreg = 0.0;
   for (aa=0; aa < AASALL; aa++) {
     col->cnt[aa] = col->reg[aa] = 0.0;
@@ -260,7 +263,7 @@ struct work_pssm *PN_make_pssm(int lengt
   struct work_pssm *pssm;
   int pos, aa;
   double* double_pointer;
- 
+
   CheckMem(
 	   pssm = (struct work_pssm *) malloc(sizeof(struct work_pssm))
 	   );
@@ -268,7 +271,7 @@ struct work_pssm *PN_make_pssm(int lengt
 	double_pointer = (double*) calloc (length * AASALL, sizeof (double));
 	pssm->value = (double **) calloc (length, sizeof (double*));
 	pssm->sum = (double *) calloc (length, sizeof (double));
- 
+
   for (pos = 0; pos < length; pos++) {
 	pssm->value[pos] = &(double_pointer[pos * AASALL]);
   }
@@ -304,7 +307,7 @@ void counts_no_gaps (Block* block, struc
     }
   } /* end of for */
 } /* end of subroutine */
-	
+
 /*======================================================================*/
 static void counts(block, col, pos)
      Block *block;
@@ -314,7 +317,7 @@ static void counts(block, col, pos)
   int seq, aa, aa1;
 
   col->totcnt = col->totraw = col->totreg = 0.0;
-  for (aa = 0; aa < AASALL; aa++) { 
+  for (aa = 0; aa < AASALL; aa++) {
     col->cnt[aa] = col->raw[aa] = col->reg[aa] = 0.0;
   }
 
@@ -356,7 +359,7 @@ static int count_residues(col)
      struct working *col;
 {
   int aa, nr;
-  
+
   nr = 0;
   for (aa = 1; aa < AAS; aa++) {
     if (col->cnt[aa] > 0.0) nr++;
@@ -373,9 +376,9 @@ static void pseudo_alts(col, qij, beta)
      double beta;
 {
   int aa, row;
- 
+
    col->totreg = 0.0;
- 
+
   /*---------- get the pseudo counts -------------------------------*/
   for (aa=1; aa < AAS; aa++) {
     col->reg[aa] = 0.0;
@@ -393,7 +396,7 @@ static void pseudo_alts(col, qij, beta)
 int
 find_min_aa_in_pssm (struct working* col, struct work_pssm* pssm, const int pos)
 {
-	int aa, min_aa;
+	int aa, min_aa = 0;
 	double min_value;
 
 	min_value = 1000;
@@ -420,7 +423,7 @@ void range_on_pssm (struct working* col,
 	min_aa = find_min_aa_in_pssm(col, pssm, pos);
         min = pssm->value[pos][min_aa] * threshold;
         for (aa = 0; aa < AAS; aa++) {
-                pssm->value[pos][aa] -= min; 
+                pssm->value[pos][aa] -= min;
 	}
 
 
@@ -436,14 +439,14 @@ scoring_matrix_profile (Block* block, Ma
 	FILE* matrixfp;
 	char matrix_file[LARGE_BUFF_LENGTH];
 	int pos, original_aa, aa;
-	char* blimps_dir;
+	const char* blimps_dir;
 
 	/* read matrix */
-        blimps_dir = getenv ("BLIMPS_DIR");
+        blimps_dir = getblimpsdir();
 	sprintf (matrix_file, "%s/docs/blosum62.bla.new", blimps_dir);
 
-/*	strcpy (matrix_file, "/tuna/blocks_5.0/blosum/blosum62.bla.new");*/ 
- 
+/*	strcpy (matrix_file, "/tuna/blocks_5.0/blosum/blosum62.bla.new");*/
+
    if ( (matrixfp = fopen (matrix_file, "r")) == NULL) {
         fprintf (errorfp, "can't read the matrix %s\n", matrix_file);
         exit (-1);
@@ -502,17 +505,17 @@ static void compute_BZX(frequency, matri
   /*
    * find the partitions of D, N, E, and Q for B and Z
    */
-  part_D = frequency[aa_atob['D']] / 
+  part_D = frequency[aa_atob['D']] /
     ( frequency[aa_atob['D']] + frequency[aa_atob['N']] );
-  part_N = frequency[aa_atob['N']] / 
+  part_N = frequency[aa_atob['N']] /
     ( frequency[aa_atob['D']] + frequency[aa_atob['N']] );
-  part_E = frequency[aa_atob['E']] / 
+  part_E = frequency[aa_atob['E']] /
     ( frequency[aa_atob['E']] + frequency[aa_atob['Q']] );
-  part_Q = frequency[aa_atob['Q']] / 
+  part_Q = frequency[aa_atob['Q']] /
     ( frequency[aa_atob['E']] + frequency[aa_atob['Q']] );
 
     /* fill in the matrix for B, Z, X, gap, stop and non */
-    matrix->weights[aa_atob['B']][col] = 
+    matrix->weights[aa_atob['B']][col] =
       (part_D * matrix->weights[aa_atob['D']][col] +
        part_N * matrix->weights[aa_atob['N']][col]);
     matrix->weights[aa_atob['Z']][col] =
@@ -538,7 +541,7 @@ static void compute_BZX(frequency, matri
 
 /*=========================================================================
       Adds negative minval to give all positive matrix,
-      then multiplies by 99/maxval to give scores ranging from 0 to 99 
+      then multiplies by 99/maxval to give scores ranging from 0 to 99
       NOTE: Not 0 to 100 because "output_matrix" routine might not leave
 	    enough space.
 ===========================================================================*/
@@ -558,7 +561,7 @@ static void positive_matrix(freqs, pssm,
       if (pssm->value[pos][aa] > maxval) maxval = pssm->value[pos][aa];
     }
   }
-   
+
   if (minval < 0.0) {
     factor = 99.0 / (maxval - minval);
   }
@@ -587,7 +590,7 @@ initialize_cutoff_freqs (double* newfreq
 {
 	int aa;
 
-/* old version. changed July 2, 2001 to make it linux compatible 
+/* old version. changed July 2, 2001 to make it linux compatible
 	assert (oldfreqs[MATRIX_AA_WIDTH] != NULL);
 	assert (newfreqs[MATRIX_AA_WIDTH] != NULL);
 */
@@ -602,7 +605,7 @@ initialize_cutoff_freqs (double* newfreq
 
 
 /* pseudocounts from Altschul's 1997 NAR gapped blast and PSI-BLAST paper */
-void 
+void
 psiblast_alts (Block* block, Matrix* matrix, double* freqs, struct float_qij* qij)
 {
 	double beta;
@@ -652,14 +655,14 @@ psiblast_alts (Block* block, Matrix* mat
   free (pssm->value); free(pssm->sum);
   free(pssm);
 
-} 
+}
 
-int 
+int
 find_max_aa_in_col (struct working* col)
 {
-	int aa, max_aa;
+	int aa, max_aa = 0;
 	double max = 0.0;
-	
+
 	for (aa = 1; aa < AAS; aa++) {
 		if (col->cnt[aa] > max) {
 			max = col->cnt[aa];
@@ -673,7 +676,7 @@ find_max_aa_in_col (struct working* col)
 int
 find_max_aa_in_pssm (struct work_pssm* pssm , int pos)
 {
-	int aa, max_aa;
+	int aa, max_aa = 0;
 	double max;
 
 	max = 0.0;
@@ -685,7 +688,7 @@ find_max_aa_in_pssm (struct work_pssm* p
 	}
 	return max_aa;
 }
-		
+
 /*==========================================================================
      Uses Altschul's method of getting pseudo-counts with a qij matrix,
 ===========================================================================*/
@@ -705,12 +708,12 @@ static void PN_make_alts(block, matrix,
   int original_aa;
   struct dirichlet* diric;
   int min_aa, max_aa;
-  double min_freq, no_of_gaps;
+  double min_freq = 0, no_of_gaps;
   double cutoff_freq[MATRIX_AA_WIDTH];
   int rank_matrix[AAS][AAS];
   double number_of_observed_aas;
   int diri_pseudo;
-  char* blimps_dir;
+  const char* blimps_dir;
   char diri_file[LARGE_BUFF_LENGTH];
 
 	if (scale == 30) {
@@ -723,15 +726,15 @@ static void PN_make_alts(block, matrix,
   col = make_col();
   pssm = PN_make_pssm(block->width);
 
-  blimps_dir = getenv ("BLIMPS_DIR");
-  printf ("blimps dir is %s\n", blimps_dir);
-  sprintf (diri_file , "%s/docs/default.diri", blimps_dir);  
-  printf  ("diri file is %s\n", diri_file);
+  blimps_dir = getblimpsdir();
+  fprintf( stderr, "blimps dir is %s\n", blimps_dir);
+  sprintf (diri_file , "%s/docs/default.diri", blimps_dir);
+  fprintf( stderr, "diri file is %s\n", diri_file);
 
 /*  diric = load_diri_file ("/howard2/pauline/src/merge-opt.13compnew"); */
    diric = load_diri_file (diri_file);
   construct_rank_matrix ( rank_matrix);
-printf ("diri file loaded\n");
+fprintf( stderr, "diri file loaded\n");
   /*--------------  Do one position at a time -------------------*/
   for (pos = 0; pos < block->width; pos++)
   {
@@ -745,8 +748,8 @@ printf ("diri file loaded\n");
 	if (itemp ==1 ) {epsilon = 0; }
 	else {
 		original_aa = block->residues[0][pos];
-                dtemp = similarity_dependent_scale_0 ( col, rank_matrix, original_aa);  
-		epsilon = exp (dtemp); 
+                dtemp = similarity_dependent_scale_0 ( col, rank_matrix, original_aa);
+		epsilon = exp (dtemp);
        }
 
     } else if (scale == 20) {
@@ -762,7 +765,7 @@ printf ("diri file loaded\n");
     /*---------- get the pseudo counts -------------------------------*/
     if (scale == 27 || scale == 29 || scale == 30 || scale == 26) {
                 diri_pseudo = TRUE;
-		pseudo_diric (col, diric, epsilon ); 
+		pseudo_diric (col, diric, epsilon );
     } else {
         pseudo_alts(col, qij, epsilon);
     }
@@ -781,8 +784,8 @@ printf ("diri file loaded\n");
 
        /*    Count+pseudo proportions; returned if scale == 20   */
        if (scale <= 20 || scale == 22 || scale == 25 || scale == 23
-                || scale == 26) 
-                               
+                || scale == 26)
+
        {
           pssm->value[pos][aa] = col->cnt[aa] + col->reg[aa];
         if ( (col->totcnt + col->totreg) > 0.0)
@@ -839,7 +842,7 @@ printf ("diri file loaded\n");
   /*       by subtracting the min. value for all positions ----- */
   if (!scale) positive_matrix(freqs, pssm, matrix);
 
-printf ("left make _alts\n");
+fprintf( stderr, "left make _alts\n");
   free (diric);
   free(col);
   free_struct_work_pssm (pssm );
@@ -852,7 +855,7 @@ printf ("left make _alts\n");
 option:  diri_pseudocounts
 	  TRUE: use 13-component Dirichlet
 	  FALSE use BLOSUM62 qij's
-option:  gap: TRUE -allow everything 
+option:  gap: TRUE -allow everything
 	      FALSE - just look at 20 amino acids
 option:  exp (m)
 	 m=0 # of amino acids at pos (default)
@@ -868,9 +871,9 @@ SIFT_prediction (Block* block, int diri_
 	Matrix* pssm;
 
 	pssm =  copy_block_info_to_matrix (block);
-	
+
         if (Qij == NULL) {
-                printf ("qij matrix missng\n");
+                fprintf( stderr, "qij matrix missing\n");
                 exit (-1);
         }
         normalize  (block);
@@ -912,13 +915,13 @@ void calculate_counts (Block* block)
 		for (aa = 1; aa < AAS; aa++) {
 			printf ("pos %d aa %c counts %.2f weight %.2f\n",
 			pos, aa_btoa[aa], col->cnt[aa], col->totcnt);
-		} 
+		}
 	}
 }
 
-static void SIFT_alts(Block* block, Matrix* matrix, double* freqs, 
-		struct float_qij* qij, 
-		int diri_pseudocounts, int gap_option, 
+static void SIFT_alts(Block* block, Matrix* matrix, double* freqs,
+		struct float_qij* qij,
+		int diri_pseudocounts, int gap_option,
 		int exp_option, int subtract_threshold)
 {
   double dtemp, dtemp2, epsilon;
@@ -933,7 +936,7 @@ static void SIFT_alts(Block* block, Matr
   int div_by_max;
   int rank_matrix[AAS][AAS];
   FILE* rfp;
-  char* blimps_dir;
+  const char* blimps_dir;
   char diri_file[LARGE_BUFF_LENGTH];
 
   div_by_max = TRUE;
@@ -941,25 +944,25 @@ static void SIFT_alts(Block* block, Matr
   col = make_col();
   pssm = PN_make_pssm(block->width);
 
-   blimps_dir = getenv ("BLIMPS_DIR");
+   blimps_dir = getblimpsdir();
   sprintf (diri_file , "%s/docs/default.diri", blimps_dir);
 
    diric = load_diri_file (diri_file);
 
   if (exp_option == 1) {
-          
-	construct_rank_matrix ( rank_matrix); 
+
+	construct_rank_matrix ( rank_matrix);
    }
 
   /*--------------  Do one position at a time -------------------*/
-  for (pos = 0; pos < block->width; pos++) 
+  for (pos = 0; pos < block->width; pos++)
   {
     /*-------- count the number of each aa in this position ------------*/
     if (gap_option) {
 	counts (block,col, pos);
     } else {
-	counts_no_gaps(block, col, pos); 
-   } 
+	counts_no_gaps(block, col, pos);
+   }
 
     /*-------- determine total number of pseudo-counts in column ------*/
     epsilon = 0;
@@ -969,24 +972,24 @@ static void SIFT_alts(Block* block, Matr
     if (exp_option == 1) {
 	/*printf ("pos %d :  ", pos); */
 	dtemp = similarity_dependent_scale_0(col, rank_matrix, original_aa);
-	if (itemp == 1) { 
-		epsilon = 0; 
-	} else { 
+	if (itemp == 1) {
+		epsilon = 0;
+	} else {
 		epsilon = exp (dtemp);
 	}
-    } else { 
+    } else {
 	if (itemp == 1) { epsilon = 0; }
         else if (itemp > 7) { epsilon = 1000; }
         else { epsilon = exp( (double) itemp) ; }
- 
-   } 
-	
+
+   }
+
     /*---------- get the pseudo counts -------------------------------*/
     if (diri_pseudocounts) {
-	pseudo_diric (col, diric, epsilon ); 
+	pseudo_diric (col, diric, epsilon );
     } else {
 	pseudo_alts(col, qij, epsilon);
-    } 
+    }
 
     /*---------   Fill in the matrix entries --------------------*/
     pssm->sum[pos] = 0.0;
@@ -1007,11 +1010,11 @@ static void SIFT_alts(Block* block, Matr
        for (aa = 1; aa < AAS; aa++) {
 		pssm->value[pos][aa] /= min_freq;
 	}
-   } 
+   }
 
    if (subtract_threshold) {
 	   for (aa = 1; aa < AAS; aa++) {
-	        pssm->value[pos][aa] -= TOLERANCE_PROB_THRESHOLD; 
+	        pssm->value[pos][aa] -= TOLERANCE_PROB_THRESHOLD;
    	}
    }
 
@@ -1027,7 +1030,7 @@ static void SIFT_alts(Block* block, Matr
 	if (  (matrix->weights[original_aa][pos] < TOLERANCE_PROB_THRESHOLD
 			 && (!subtract_threshold))
 		||
-	      (matrix->weights[original_aa][pos] < 0.0 && subtract_threshold)		
+	      (matrix->weights[original_aa][pos] < 0.0 && subtract_threshold)
 	) {
 		printf ("WARNING!!! Amino acid %c at pos %d in your original sequence had score %.3f and was not allowed by the prediction.<BR>\n", aa_btoa[original_aa], pos + 1, matrix->weights[original_aa][pos]);
 	}
@@ -1060,7 +1063,7 @@ void SIFT_alts_test(Block* block, Matrix
   int div_by_max;
   int rank_matrix[AAS][AAS];
   FILE* rfp;
-  char* blimps_dir;
+  const char* blimps_dir;
   char diri_file[LARGE_BUFF_LENGTH];
   char matrix_file[LARGE_BUFF_LENGTH];
 
@@ -1070,7 +1073,7 @@ void SIFT_alts_test(Block* block, Matrix
   col = make_col();
   pssm = PN_make_pssm(block->width);
   diri_pseudocounts = TRUE;
-   blimps_dir = getenv ("BLIMPS_DIR");
+   blimps_dir = getblimpsdir();
 
    sprintf (diri_file , "%s/docs/default.diri", blimps_dir);
 
@@ -1080,8 +1083,8 @@ void SIFT_alts_test(Block* block, Matrix
 
         construct_rank_matrix ( rank_matrix);
    }
-  sprintf (matrix_file, "%s/docs/default.qij");
-  init_frq_qij_for_matrix (matrix_file); 
+  sprintf (matrix_file, "%s/docs/default.qij", blimps_dir );
+  init_frq_qij_for_matrix (matrix_file);
 
   for (pos = 0; pos < block->width; pos++)
   {
@@ -1200,7 +1203,7 @@ gap_pseudocounts ( struct working* col,
 
 }
 
-void 
+void
 ratio_mutated_to_normal (struct working* col, int standard_aa)
 {
 	int aa;
@@ -1218,7 +1221,7 @@ assign_gap_positive_scores (Matrix* matr
 {
 	int gaps;
 	int seq;
-	
+
 	assert (matrix->block != NULL);
 /* 	printf ("entering gap_positive scores\n"); */
 	gaps = 0;
@@ -1230,7 +1233,7 @@ assign_gap_positive_scores (Matrix* matr
 	if (gaps == 0) { /* printf ("no gaps\n"); */return; }
 	else { /* printf ("gaps %d\n", gaps) ; */
 			assign_positive_scores_to_column (matrix, pos, gaps); }
-	
+
 } /* end of assign_gap_positive_scores */
 
 void
@@ -1242,7 +1245,7 @@ assign_positive_scores_to_column (Matrix
 	for (aa = 1; aa < AAS; aa++) {
 		matrix->weights[aa][pos] = 0.05;
 	}
-} /* end of positive_column */  		 
+} /* end of positive_column */
 
 /*=========================================================================
     Normalize sequence weights to add up to the number of sequences
@@ -1274,11 +1277,11 @@ PN_altschul_data_dependent_conversion_me
     }
 
   /* check to see if the block has sequence weights */
-printf ("enter normalize block\n");
+fprintf( stderr, "enter normalize block\n");
   normalize(block);   /*  Make weights sum to number of sequences */
-printf ("enter PN_make_alts\n");
-  PN_make_alts(block, matrix, frequency, Qij, RTot, scale); 
-printf ("exit PN_make_alts\n");
+fprintf( stderr, "enter PN_make_alts\n");
+  PN_make_alts(block, matrix, frequency, Qij, RTot, scale);
+fprintf( stderr, "exit PN_make_alts\n");
 }
 
 /*
@@ -1304,7 +1307,7 @@ printf ("exit PN_make_alts\n");
  */
 
 
-/* 
+/*
  * basic_matrix_construction
  *   This is the most general matrix construction method.  Each
  *   occurence of a residue in a sequence contributes the sequence
@@ -1316,7 +1319,7 @@ printf ("exit PN_make_alts\n");
  *     X, '-', '*', & non-code scores are read straight from the frequencies
  *     the frequencies for B and Z are ignored, when a B or Z is encountered
  *       it is partitioned between D & N or E & Q.
- *     the matrix scores for B and Z are computed from the matrix scores of 
+ *     the matrix scores for B and Z are computed from the matrix scores of
  *       D & N and E & Q.
  *   Parameters:
  *     Block *block:       the block to be converted
@@ -1360,13 +1363,13 @@ static void basic_matrix_construction(bl
   /*
    * find the partitions of D, N, E, and Q for B and Z
    */
-  part_D = frequency[aa_atob['D']] / 
+  part_D = frequency[aa_atob['D']] /
     ( frequency[aa_atob['D']] + frequency[aa_atob['N']] );
-  part_N = frequency[aa_atob['N']] / 
+  part_N = frequency[aa_atob['N']] /
     ( frequency[aa_atob['D']] + frequency[aa_atob['N']] );
-  part_E = frequency[aa_atob['E']] / 
+  part_E = frequency[aa_atob['E']] /
     ( frequency[aa_atob['E']] + frequency[aa_atob['Q']] );
-  part_Q = frequency[aa_atob['Q']] / 
+  part_Q = frequency[aa_atob['Q']] /
     ( frequency[aa_atob['E']] + frequency[aa_atob['Q']] );
 
 
@@ -1401,13 +1404,13 @@ static void basic_matrix_construction(bl
       /* otherwise, if it is B, partition B between D and N */
       else if (res == aa_atob['B']) {
 	if (frequency[aa_atob['D']] != 0.0) { /* try to protect div by zero */
-	  count[aa_atob['D']] += 
+	  count[aa_atob['D']] +=
 	    (part_D * seq_weight[seq]) / frequency[aa_atob['D']];
 	  total +=
 	    (part_D * seq_weight[seq]) / frequency[aa_atob['D']];
 	}
 	if (frequency[aa_atob['N']] != 0.0) { /* try to protect div by zero */
-	  count[aa_atob['N']] += 
+	  count[aa_atob['N']] +=
 	    (part_N * seq_weight[seq]) / frequency[aa_atob['N']];
 	  total +=
 	    (part_N * seq_weight[seq]) / frequency[aa_atob['N']];
@@ -1416,13 +1419,13 @@ static void basic_matrix_construction(bl
       /* otherwise, if it is Z, partition Z between E and Q */
       else if (res == aa_atob['Z']) {
 	if (frequency[aa_atob['E']] != 0.0) { /* try to protect div by zero */
-	  count[aa_atob['E']] += 
+	  count[aa_atob['E']] +=
 	    (part_E * seq_weight[seq]) / frequency[aa_atob['E']];
 	  total +=
 	    (part_E * seq_weight[seq]) / frequency[aa_atob['E']];
 	}
 	if (frequency[aa_atob['Q']] != 0.0) { /* try to protect div by zero */
-	  count[aa_atob['Q']] += 
+	  count[aa_atob['Q']] +=
 	    (part_Q * seq_weight[seq]) / frequency[aa_atob['Q']];
 	  total +=
 	    (part_Q * seq_weight[seq]) / frequency[aa_atob['Q']];
@@ -1450,7 +1453,7 @@ static void basic_matrix_construction(bl
     }
 
     /* fill in the matrix for B, Z, X, gap, stop and non */
-    matrix->weights[aa_atob['B']][col] = 
+    matrix->weights[aa_atob['B']][col] =
       (part_D * matrix->weights[aa_atob['D']][col] +
        part_N * matrix->weights[aa_atob['N']][col]);
     matrix->weights[aa_atob['Z']][col] =
@@ -1485,7 +1488,7 @@ get_consensus (Matrix* matrix)
 	int pos;
 
 	seq = (Sequence *) malloc (sizeof (Sequence));
-	seq->sequence = (Residue *) calloc (matrix->width, sizeof (Residue) );	
+	seq->sequence = (Residue *) calloc (matrix->width, sizeof (Residue) );
 	strcpy (seq->name, "CONSENSUS");
 	seq->info[0] = '\0';
 	seq->position = 0;
@@ -1495,7 +1498,7 @@ get_consensus (Matrix* matrix)
 	for (pos = 0; pos < matrix->width; pos++) {
 		res = find_max_aa_in_pos (matrix, pos);
 		seq->sequence[pos] = res;
-		printf ("res %c pos %d\n", aa_btoa[seq->sequence[pos]], pos);  
+		//fprintf( stderr, "res %c pos %d\n", aa_btoa[seq->sequence[pos]], pos);
 	}
 	return seq;
 
@@ -1557,7 +1560,7 @@ cumulative_prob (double col[MATRIX_AA_WI
 {
 	int i;
 	double index;
-	
+
 
 	index = 0;
 
@@ -1569,7 +1572,7 @@ cumulative_prob (double col[MATRIX_AA_WI
 }
 
 
-/* returns a state , given a cumulative probability vector P with 
+/* returns a state , given a cumulative probability vector P with
 MATRIX_AA_WIDTH states ranging from 0 to 1 */
 int
 random_pick (double* P)
@@ -1580,13 +1583,13 @@ random_pick (double* P)
 /*	printf ("random pick: "); */
         random =   (double) rand() /  (double) RAND_MAX * 100 ;
         while (random > P[i] && i < MATRIX_AA_WIDTH) {
-/*                printf ("| %.3f, %c |", P[i], aa_btoa[i]); */ 
+/*                printf ("| %.3f, %c |", P[i], aa_btoa[i]); */
 		i++;
         }
 /*	printf ("picked %c with rand %.3f prob %.3f\n", aa_btoa[i], random, P[i]); */
 	if (i == MATRIX_AA_WIDTH) { /* no aa in this column, return an X */
 		return (aa_atob['X']);
-	} else {	
+	} else {
         	return (i);
 	}
 }
@@ -1772,21 +1775,21 @@ int scores[24][24];
 
 /*=====================================================================*/
 /*   This routine initializes the blimps global variables
-        Qij, RTot and frequency[]      
+        Qij, RTot and frequency[]
 Input Parameters .qij file
 		 .out file (Jorja's format, to get frq)
 */
-void init_frq_qij_for_matrix(char qijname[LARGE_BUFF_LENGTH]) 
+void init_frq_qij_for_matrix(char qijname[LARGE_BUFF_LENGTH])
 {
    FILE *fqij;
- 
+
    if (Qij != NULL) {
 		free (Qij);
 		Qij = NULL;
    }
    if ( (fqij=fopen(qijname, "r")) != NULL)
    { Qij = load_qij(fqij); fclose(fqij);  }
-   else {printf ("could not open %s qij file\n", qijname); }
+   else {fprintf( stderr, "could not open %s qij file\n", qijname); }
    RTot = LOCAL_QIJ_RTOT;
 }  /* end of frq_qij */
 
@@ -1843,7 +1846,7 @@ void pseudo_diric(struct working* col, s
       {
          col->probj[j] = log(diric->q[j]) + col->probn[j] - denom;
 /*       printf("j=%d probn[j]=%f probj[j]=%f\n",
-             j, exp(col->probn[j]), exp(col->probj[j])); */ 
+             j, exp(col->probn[j]), exp(col->probj[j])); */
 
       }
 
@@ -1852,31 +1855,31 @@ void pseudo_diric(struct working* col, s
 	 for (aa = 1; aa < AAS; aa++)
       {
          for (j = 0; j < diric->ncomp; j++) {
-		col->reg[aa] +=   
+		col->reg[aa] +=
 				(exp(col->probj[j]) * diric->alpha[j][aa]);
-			/*  * epsilon); */ 
+			/*  * epsilon); */
             }
 	 col->totreg += col->reg[aa];
 	}
 /*	printf (" total prob. %.2f\n", col->totreg); */
-/* scale dirichlet to probabilities */      
+/* scale dirichlet to probabilities */
 	total = 0.0;
 	for (aa = 1; aa < AAS; aa ++) {
 		col->reg[aa] /= col->totreg;
 		total += col->reg[aa];
 	}
 /*	printf ("%.2f total\n", total); */
- 
+
 /*	printf ("%c %.3f", aa_btoa[aa], col->reg[aa]);
-	if (col->cnt[aa] > 0.0) {printf ("*\n"); } else { printf ("\n");} */ 
+	if (col->cnt[aa] > 0.0) {printf ("*\n"); } else { printf ("\n");} */
 
 }  /* end of pseudo_diric */
 
 /* aa observed in block that has small pseudocount */
-int 
+int
 find_min_aa_in_col_reg (struct working* col)
 {
-        int aa, min_aa;
+        int aa, min_aa = 0;
         double min;
 
         min = 10000;
@@ -1890,10 +1893,10 @@ find_min_aa_in_col_reg (struct working*
         return min_aa;
 }
 
-char 
+char
 find_min_aa_in_col (struct working* col)
 {
-	int aa, min_aa;
+	int aa, min_aa = 0;
 	double min;
 
 	min = 1000;
@@ -1921,7 +1924,7 @@ struct dirichlet *load_diri_file (char f
         struct dirichlet *diric;
 	double denom;
 	double background_frequency[21];
-    printf ("filename is %s\n", filename);
+    fprintf( stderr, "filename is %s\n", filename);
 	if ((fin = fopen (filename, "r")) == NULL) {
 		fprintf (errorfp, "Cannot open dirichlet file %s\n", filename);
 		exit (-1);
@@ -1972,7 +1975,7 @@ struct dirichlet *load_diri_file (char f
 	for (aa = 1; aa < AAS; aa++) {
 		denom = 0.0;
 		for (i = 0; i < numc; i++) {
-			denom += (diric->q[i] * diric->alpha[i][aa] / 
+			denom += (diric->q[i] * diric->alpha[i][aa] /
 							diric->altot[i]);
 		}
 		background_frequency[aa] = denom;
@@ -1980,7 +1983,7 @@ struct dirichlet *load_diri_file (char f
 	for (i =0; i < numc; i++) {
 	/*	printf ("Component %d ratio of aa relative to background \n", i); */
 		for (aa = 1; aa < AAS; aa++) {
-			diric->frequency_to_background_ratio[i][aa] =  
+			diric->frequency_to_background_ratio[i][aa] =
 	diric->alpha[i][aa]/(diric->altot[i] * background_frequency[aa]);
 		}
 	}
@@ -1990,7 +1993,7 @@ struct dirichlet *load_diri_file (char f
 
 
 
-void 
+void
 cutoff_target_freq (double* cutoff_freq, int original_aa, struct float_qij *qij)
 {
 
@@ -2008,8 +2011,9 @@ cutoff_target_freq (double* cutoff_freq,
 void init_frq_qij()
 {
    FILE *fqij;
-   char *blimps_dir, qijname[80], frqname[80];
-   blimps_dir = getenv ("BLIMPS_DIR");
+   const char *blimps_dir;
+   char qijname[80], frqname[80];
+   blimps_dir = getblimpsdir();
 	/*"/howard/servers/blimps/blimps";*/ /* getenv("BLIMPS_DIR"); */
    if (blimps_dir != NULL)
    {
@@ -2025,6 +2029,13 @@ void init_frq_qij()
    Qij = NULL;
    if ( (fqij=fopen(qijname, "r")) != NULL)
    { Qij = load_qij(fqij); fclose(fqij);  }
+   else
+   {
+      fprintf (stderr, "Can't open file '%s': %s.\n", qijname, strerror(errno) );
+      fprintf (stderr, "Current dir:\n", qijname );
+      system( "pwd" );
+      exit (-1);
+   }
    RTot = LOCAL_QIJ_RTOT;
 }  /* end of frq_qij */
 
@@ -2043,7 +2054,7 @@ similarity_dependent_scale_0 (struct wor
   original_aa = max_aa; /* change to max aa 10/24/00 */
 
   n = 0;
-  sum = 0.0; 
+  sum = 0.0;
   for (aa = 1; aa <= 20 ; aa++) {
         if (col->cnt[aa] > 0.0) {
                 n++;
@@ -2065,20 +2076,20 @@ construct_rank_matrix (int rank_matrix[A
 	struct float_qij* rank_Qij;
 	FILE* qijfp;
 	int aa;
-	char* blimps_dir;
+	const char* blimps_dir;
 	char filename[80];
 
-	blimps_dir = getenv ("BLIMPS_DIR");
+	blimps_dir = getblimpsdir();
 	sprintf (filename, "%s/docs/default.sij", blimps_dir);
-	
+
 	if ( (qijfp = fopen (filename, "r"))
 							 == NULL) {
 		fprintf (stderr, "Can't opeen blosum62.sij file in construct_rank_matrix looked in %s\n", blimps_dir);
 		exit (-1);
 	}
- 
+
 	rank_Qij = load_qij (qijfp);
-        fclose (qijfp);	
+        fclose (qijfp);
 
         for (original_aa = 0; original_aa < AAS; original_aa++) {
                 copy_values_to_ranklist (aalist, original_aa, rank_Qij);
@@ -2096,14 +2107,14 @@ assign_ranks (int rank_matrix[AAS][AAS],
 
         for (rank = 0; rank < AAS; rank++) {
                 aa = aalist[rank].aa;
-                rank_matrix[original_aa][aa] = rank + 1; 
+                rank_matrix[original_aa][aa] = rank + 1;
 			/* otherwise rank starts from 0
                              to AAS-1 rather than 1 to AAS */
         }
 }
 
 void
-copy_values_to_ranklist (struct rank_cell aalist[AAS], int original_aa, 
+copy_values_to_ranklist (struct rank_cell aalist[AAS], int original_aa,
 			struct float_qij* rankQij) {
 
         int aa;
@@ -2111,8 +2122,8 @@ copy_values_to_ranklist (struct rank_cel
 	/* 01/03/00 rankQij has -1 for gap, which will mess up
 	ranks.  Assign it a really negative value so it will have
 	the lowest rank */
-	
-	aalist[0].aa = 0; 
+
+	aalist[0].aa = 0;
 	aalist[0].value = -50;
 
         for (aa = 1; aa < AAS; aa++) {
@@ -2180,7 +2191,7 @@ number_of_real_aminoacids (Block* block,
 
 	count = 0;
 	for (seq = 0; seq < block->num_sequences; seq++) {
-		if (block->residues[seq][pos] >= 1 && 
+		if (block->residues[seq][pos] >= 1 &&
 			block->residues[seq][pos] <=20) {
 			count++;
 		}
@@ -2189,7 +2200,7 @@ number_of_real_aminoacids (Block* block,
 } /* end of number_of_real_aminoacids */
 
 double*
-calculate_basic_aa_fraction (Block* block) 
+calculate_basic_aa_fraction (Block* block)
 {
 	double* fraction_stored;
 	double percent_obsaa_div_seq;
@@ -2219,15 +2230,15 @@ calculate_basic_aa_stored (Block* block)
 }
 
 void
-free_struct_work_pssm (struct work_pssm* pssm) 
+free_struct_work_pssm (struct work_pssm* pssm)
 {
 	free (pssm->value[0]); /* holy cow, Ithink this works. This points
                                to space allocated in double pointer*/
 	free (pssm->value); /* this points to an array of block length .
-		  each cell points to values allocated by double pointer*/ 
+		  each cell points to values allocated by double pointer*/
 	free (pssm->sum);
 	free (pssm);
-	pssm = NULL;	
+	pssm = NULL;
 
 }
 
Index: sift/src/Protdist.c
===================================================================
--- sift.orig/src/Protdist.c
+++ sift/src/Protdist.c
@@ -124,7 +124,7 @@ seq_with_max_dist (struct score_pair* pa
 {
 	double max_dist;
 	int i;
-	int index_of_max_seq;
+	int index_of_max_seq = 0;
 
 	max_dist = 0;
 
Index: sift/src/Psiblast.c
===================================================================
--- sift.orig/src/Psiblast.c
+++ sift/src/Psiblast.c
@@ -1,6 +1,6 @@
 /* (C) Copyright 2000, Fred Hutchinson Cancer Research Center */
 /* Use, modification or distribution of these programs is subject to */
-/* the terms of the non-commercial licensing agreement in license.h. */   
+/* the terms of the non-commercial licensing agreement in license.h. */
 
 #ifndef _PSIBLAST_C_
 #define _PSIBLAST_C_
@@ -20,7 +20,7 @@ read_psiblast_entry ( FILE* fp, char Buf
 /* passing first line in entry that begins with >seq_id in Buffer */
         Aligned_Pair* alignment, *new_alignment;
 	Aligned_Pair * cursor;
-	
+
         alignment = initialize_Aligned_Pair (Buffer);
 	cursor = alignment;
 
@@ -35,14 +35,14 @@ read_psiblast_entry ( FILE* fp, char Buf
 		new_alignment =initialize_Aligned_Pair (Buffer);
 		cursor->next = new_alignment;
 		cursor = new_alignment;
-	 	reading_alignment_at_score_line (cursor, Buffer, fp);		
+	 	reading_alignment_at_score_line (cursor, Buffer, fp);
 	}
 	return (alignment);
 
 } /* end of read_psiblast entry*/
 
 Aligned_Pair*
-initialize_Aligned_Pair (char Buffer[LARGE_BUFF_LENGTH]) 
+initialize_Aligned_Pair (char Buffer[LARGE_BUFF_LENGTH])
 {
 	Aligned_Pair* alignment;
 	char* stringptr;
@@ -70,7 +70,7 @@ initialize_Aligned_Pair (char Buffer[LAR
 } /* end of initialize_Aligned_Pair*/
 
 void
-reading_alignment_at_score_line (Aligned_Pair* alignment, 
+reading_alignment_at_score_line (Aligned_Pair* alignment,
 				char Buffer[LARGE_BUFF_LENGTH], FILE* fp)
 {
         char* buff;
@@ -167,7 +167,7 @@ void process_sequence_line(Sequence* seq
   /* Note: The buff may have characters that are not residues, this is */
   /*       ok, there will just be a little extra space */
   while ((saved_length + estimated_length) > seq->max_length) {
-    resize_sequence(seq); 
+    resize_sequence(seq);
   }
 
   /* temporarily increase the room to put the sequence into */
@@ -194,23 +194,23 @@ free_aligned_pair (Aligned_Pair* alignme
 		free (alignment);
 	}
 	alignment = NULL;
-	
+
 }
 
-void block_to_checkpoint_file (Block* block, FILE* fp, FILE* outfp) 
+void block_to_checkpoint_file (Block* block, FILE* fp, FILE* outfp)
 {
 
 	Matrix* pssm;
-	long ltemp;
+	int32_t ltemp;
 	int pos;
 	char ctemp[12];
 	int aa; double dtemp;
-printf ("in block to checkpoint file\n");
+fprintf( stderr, "in block to checkpoint file\n");
 	pssm = PN_block_to_matrix (block, 20);
-/*	print_matrix (pssm);*/ 
-printf ("after conversion\n");
-	ltemp = (long) block->width;
-	fwrite (&ltemp, sizeof (long), 1, fp);
+/*	print_matrix (pssm);*/
+fprintf( stderr, "after conversion\n");
+	ltemp = (int32_t) block->width;
+	fwrite (&ltemp, sizeof(ltemp), 1, fp);
 	for (pos = 0; pos < block->width; pos++)
 	{
 		ctemp[0] = toupper (aa_btoa[block->sequences[0].sequence[pos]]);
@@ -313,7 +313,7 @@ get_top_seq (char next_seq_to_add[], Has
 
 
 	if (read_psiblast_header_until_first_no_error (psiblastfp, FALSE) == -1) {
-		next_seq_to_add[0] = '\0'; 
+		next_seq_to_add[0] = '\0';
 	} else {
 
 	fgets (line, LINE_LEN, psiblastfp);
@@ -322,24 +322,24 @@ get_top_seq (char next_seq_to_add[], Has
 	assert ( strlen(strptr) < KEY_WIDTH);
 	strncpy (name, strptr, KEY_WIDTH);
 	name[KEY_WIDTH-1] = '\0';
-	} 
+	}
 	while (Exists(name, namehash)) {
-		fgets (line, LINE_LEN, psiblastfp); 
+		fgets (line, LINE_LEN, psiblastfp);
 		strptr = strtok(line, " \t\n");
         	if (strptr == NULL) {
-			printf ("entered no line\n");
+			fprintf( stderr, "entered no line\n");
 			name[0] = '\0';
 		} else {
 			strncpy (name, strptr, KEY_WIDTH);
 			/* 	strptr[strlen(strptr)] = '\0' ; */
-			name[KEY_WIDTH-1] = '\0';      
+			name[KEY_WIDTH-1] = '\0';
 		}
 	}
 	strncpy (next_seq_to_add, name, KEY_WIDTH);
 	next_seq_to_add[KEY_WIDTH -1] = '\0';
 
 	fclose (psiblastfp);
- 
+
 } /* end get_top_seq */
 
 char* substring(Sequence* seq, int begin, int len)
Index: sift/src/psiblast_res_to_fasta_dbpairwise.c
===================================================================
--- sift.orig/src/psiblast_res_to_fasta_dbpairwise.c
+++ sift/src/psiblast_res_to_fasta_dbpairwise.c
@@ -32,8 +32,8 @@ Output2: Sequences found with residues f
 #include "Protdist.c"
 #include "Psiblast.c"
 
-#define MAXSEQ 400 /* Maximum number of sequences */
-#define MIN_SEQ 5
+#define MAXSEQ 20000 /* Maximum number of sequences */
+#define MIN_SEQ 2
 #define LINE_LEN 800
 #define FALSE 0
 #define TRUE 1
@@ -113,17 +113,17 @@ int main
 
 	free_seqs (alignedseqs, nseqs);
         if (nseqs < MIN_SEQ) {
-                fprintf (errorfp, "ERROR! Not enough sequences (only %d) found by the PSI-BLAST search! Program terminated.\n", nseqs -1);
-                exit (-1);
+                fprintf (stderr,  "Warning: few sequences (only %d, MIN_SEQ = %d) found by the PSI-BLAST search.\n", nseqs -1, MIN_SEQ);
+                fprintf (errorfp, "Warning: few sequences (only %d, MIN_SEQ = %d) found by the PSI-BLAST search.\n", nseqs -1, MIN_SEQ);
+                exit(0);
         } else if (nseqs > MAXSEQ) {
-                fprintf (errorfp, "WARNING: exceeded maximum # of alignments in processing PSIBLAST result\n");
-                exit (-1);
+                fprintf (stderr,  "ERROR: exceeded maximum number of alignments (%d > %d) in processing PSIBLAST result\n", nseqs, MAXSEQ );
+                fprintf (errorfp, "ERROR: exceeded maximum number of alignments (%d > %d) in processing PSIBLAST result\n", nseqs, MAXSEQ );
+                exit(-1);
         }
 	fclose (errorfp);
 	rm_file (errorfilename);
 	exit (0);
-
-
 } /* end main */
 
 void getargs (int argc, char* argv[], FILE** psiblastfp, 
@@ -201,6 +201,7 @@ read_sequence_from_filename (char filena
 	Sequence* seq;
 
 	if ((fp = fopen (filename, "r")) == NULL) {
+		fprintf (stderr,  "couldn't open %s in processing PSIBLAST results\n", filename);
 		fprintf (errorfp, "couldn't open %s in processing PSIBLAST results\n", filename);
 		exit (-1);
 	}
Index: sift/src/seqs_from_psiblast_res.c
===================================================================
--- sift.orig/src/seqs_from_psiblast_res.c
+++ sift/src/seqs_from_psiblast_res.c
@@ -23,7 +23,7 @@ and prints out the complete sequence fro
 #include "stringhash.c"
 #include "Psiblast.c"
 
-#define MAXSEQ 400 /* Maximum number of sequences */
+#define MAXSEQ 20000 /* Maximum number of sequences */
 #define LINE_LEN 800
 #define FALSE 0
 #define TRUE 1
Index: sift/src/sift_blimps.h
===================================================================
--- /dev/null
+++ sift/src/sift_blimps.h
@@ -0,0 +1,12 @@
+#ifndef SIFT_BLIMPS_H
+#define SIFT_BLIMPS_H
+
+inline const char*		getblimpsdir()
+{
+	const char* blimps_dir = getenv ("BLIMPS_DIR");
+	if( blimps_dir == NULL ) blimps_dir = __MAKE_PREFIX__ "/share/sift/blimps";
+
+	return blimps_dir;
+}
+
+#endif
Index: sift/src/SortList.c
===================================================================
--- sift.orig/src/SortList.c
+++ sift/src/SortList.c
@@ -13,7 +13,7 @@ int
 lowest_scoring_aa (Matrix* matrix, int pos)
 {
 	struct working* col;
-	int aa, min_aa;
+	int aa, min_aa = 0;
 	double min;
 
 	min = 10000;
Index: sift/SIFT_for_submitting_fasta_seq.csh.pod
===================================================================
--- /dev/null
+++ sift/SIFT_for_submitting_fasta_seq.csh.pod
@@ -0,0 +1,55 @@
+=head1 NAME
+
+SIFT_for_submitting_fasta_seq.csh - predict effect of an amino acid substitution on protein function
+
+=head1 SYNOPSIS
+
+SIFT_for_submitting_fasta_seq.csh <FASTA_FILE> <BLAST_DB> <SUBSTITUTIONS_FILE> [BLAST_PROCESSORS]
+
+=head1 DESCRIPTION
+
+SIFT predicts whether an amino acid substitution affects protein function based on sequence homology and the physical properties of amino acids.
+
+Results are stored in F<< ./<seq_file>.SIFTprediction >>.
+
+This program is used for FASTA input and is part of the SIFT suite.
+
+=head1 OPTIONS
+
+=over
+
+=item <FASTA_FILE>
+
+Protein sequence in fasta format.
+
+=item <BLAST_DB>
+
+Protein database to search.  These sequences are assumed to be functional.
+
+=item <SUBSTITUTIONS_FILE>
+
+File of substitutions to be predicted.  See /usr/share/doc/sift/examples/lacI.subst for an example of the format.  If you give '-', scores for all mutations of the entire protein sequence are printed.
+
+=item [BLAST_PROCESSORS]
+
+Number of processors/cores to use when running blast via the B<-a> argument.
+
+=back
+
+=head1 EXAMPLES
+
+ SIFT_for_submitting_fasta_seq.csh /usr/share/doc/sift/examples/lacI.fasta [BLAST_DB] /usr/share/doc/sift/examples/lacI.subst
+
+=head1 AUTHOR
+
+Pauline Ng
+
+=head1 COPYRIGHT AND LICENSE
+
+(C) Copyright 1993-2001, Fred Hutchinson Cancer Research Center
+
+Noncommercial license. See /usr/share/doc/sift/copyright for details.
+
+=head1 SEE ALSO
+
+L<info_on_seqs>
Index: sift/src/Clumping.c
===================================================================
--- sift.orig/src/Clumping.c
+++ sift/src/Clumping.c
@@ -175,7 +175,7 @@ printf ("entered if statment\n");
  printf ("Clumped %d sequences into %d clusters\n", nseq, iclus);
  /* keep this print because get # of clustersin awk statement */
   free(pairs);
-printf ("exiting clump\n");
+fprintf( stderr, "%s:%d exiting clump\n", __FILE__, __LINE__);
  return clusters_of_seqs;
 }  /* end of cluster */
 
@@ -432,7 +432,7 @@ printf ("entered if statment\n");
  printf ("Clumped %d sequences into %d clusters\n", nseq, i2);
  /* keep this print because get # of clustersin awk statement */
   free(pairs);
-printf ("exiting clump\n");
+fprintf( stderr, "%s:%d exiting clump\n", __FILE__, __LINE__);
  return no_of_clumps;
 }  /* end of cluster */
 
Index: sift/info_on_seqs.pod
===================================================================
--- /dev/null
+++ sift/info_on_seqs.pod
@@ -0,0 +1,46 @@
+=head1 NAME
+
+info_on_seqs - perform final step of SIFT prediction
+
+=head1 SYNOPSIS
+
+info_on_seqs <FASTA_FILE> <SUBSTITUTIONS_FILE> <OUTPUT>
+
+=head1 DESCRIPTION
+
+You should use L<SIFT_for_submitting_fasta_seq.csh> instead of this program unless you know what you are doing.
+
+This program prepares the final SIFT prediction.  In addition to the command line arguments, it expects certain files present I<next to> the FASTA_FILE.
+
+=head1 OPTIONS
+
+=over
+
+=item <FASTA_FILE>
+
+Protein sequence in fasta format.
+
+=item <SUBSTITUTIONS_FILE>
+
+File of substitutions to be predicted.  See /usr/share/doc/sift/examples/lacI.subst for an example of the format.  If you give '-', scores for all mutations of the entire protein sequence are printed.
+
+=item <OUTPUT>
+
+Output file.
+
+=back
+
+=head1 AUTHOR
+
+Pauline Ng
+
+=head1 COPYRIGHT AND LICENSE
+
+(C) Copyright 1993-2001, Fred Hutchinson Cancer Research Center
+
+Noncommercial license. See /usr/share/doc/sift/copyright for details.
+
+=head1 SEE ALSO
+
+L<SIFT_for_submitting_fasta_seq.csh>
+