92cdfdab1ced85ac262e907c48d086bb88a431c1
kent
  Wed Feb 13 14:01:21 2013 -0800
Fixed off by one bug.
diff --git src/kehayden/reverseCenReads/reverseCenReads.c src/kehayden/reverseCenReads/reverseCenReads.c
index bdca8d0..7c5541e 100644
--- src/kehayden/reverseCenReads/reverseCenReads.c
+++ src/kehayden/reverseCenReads/reverseCenReads.c
@@ -1,56 +1,56 @@
 /* reverseCenReads - Reverse order of monomers in semi-parsed centromeric reads.. */
 #include "common.h"
 #include "linefile.h"
 #include "hash.h"
 #include "options.h"
 
 void usage()
 /* Explain usage and exit. */
 {
 errAbort(
   "reverseCenReads - Reverse order of monomers in semi-parsed centromeric reads.\n"
   "usage:\n"
   "   reverseCenReads input.txt output.txt\n"
   "Assumes first word in each line is readID, and rest of words are monomers.\n"
   );
 }
 
 /* Command line validation table. */
 static struct optionSpec options[] = {
    {NULL, 0},
 };
 
 void reverseCenReads(char *input, char *output)
 /* reverseCenReads - Reverse order of monomers in semi-parsed centromeric reads.. */
 {
 struct lineFile *lf = lineFileOpen(input, TRUE);
 FILE *f = mustOpen(output, "w");
 char *line;
 int maxWords = 16;
 char *words[maxWords];
 while (lineFileNext(lf, &line, NULL))
     {
     int wordCount = chopByWhite(line, words, maxWords);
     if (wordCount >= maxWords)
         errAbort("Too many words (%d) line %d of %s", wordCount, lf->lineIx, lf->fileName);
     if (wordCount < 2)
         errAbort("Need at least 2 words, got %d line %d of %s", 
 	    wordCount, lf->lineIx, lf->fileName);
     fprintf(f, "%s", words[0]);	/* First word - readId - not reversed. */
     int i;
-    for (i=wordCount-1; i>1; --i)
+    for (i=wordCount-1; i>=1; --i)
         fprintf(f, "\t%s", words[i]);
     fprintf(f, "\n");
     }
 carefulClose(&f);
 }
 
 int main(int argc, char *argv[])
 /* Process command line. */
 {
 optionInit(&argc, argv, options);
 if (argc != 3)
     usage();
 reverseCenReads(argv[1], argv[2]);
 return 0;
 }