8becf9b2b3c1c29387350e6a1cb7f5fe27b60cd8
ceisenhart
  Wed Feb 26 16:34:37 2014 -0800
fixed problem in command line argument check, updated usage output
diff --git src/hg/bedIntersect/bedIntersect.c src/hg/bedIntersect/bedIntersect.c
index db6f8bf..71b9e81 100644
--- src/hg/bedIntersect/bedIntersect.c
+++ src/hg/bedIntersect/bedIntersect.c
@@ -16,30 +16,31 @@
     {"aHitAny", OPTION_BOOLEAN},
     {"bScore", OPTION_BOOLEAN},
     {"minCoverage", OPTION_FLOAT},
     {"tab", OPTION_BOOLEAN},
     {"allowStartEqualEnd", OPTION_BOOLEAN},
     {NULL, 0}
 };
 
 
 void usage()
 /* Explain usage and exit. */
 {
 errAbort(
   "bedIntersect - Intersect two bed files\n"
   "usage:\n"
+  "bed columns four(name) and five(score) are optional\n" 
   "   bedIntersect a.bed b.bed output.bed\n"
   "options:\n"
   "   -aHitAny        output all of a if any of it is hit by b\n"
   "   -minCoverage=0.N  min coverage of b to output match (or if -aHitAny, of a).\n"
   "                   Not applied to 0-length items.  Default %f\n"
   "   -bScore         output score from b.bed (must be at least 5 field bed)\n"
   "   -tab            chop input at tabs not spaces\n"
   "   -allowStartEqualEnd  Don't discard 0-length items of a or b\n"
   "                        (e.g. point insertions)\n",
    minCoverage
   );
 }
 
 struct bed5 
 /* A five field bed. */
@@ -177,26 +178,26 @@
 	    for (hit = hitList; hit != NULL; hit = hit->next)
 	        {
 		if (getCov(start, end, hit->val) >= minCoverage)
 		    outputBed(f, row, wordCount, start, end, hit->val);
 		}
 	    }
 	slFreeList(&hitList);
 	}
     }
 }
 
 int main(int argc, char *argv[])
 /* Process command line. */
 {
 optionInit(&argc, argv, optionSpecs);
-
 aHitAny = optionExists("aHitAny");
 bScore = optionExists("bScore");
 minCoverage = optionFloat("minCoverage", minCoverage);
 strictTab = optionExists("tab");
 allowStartEqualEnd = optionExists("allowStartEqualEnd");
+if(argc==4)
+   bedIntersect(argv[1], argv[2], argv[3]);
 if(argc!=4)
    usage();
-bedIntersect(argv[1], argv[2], argv[3]);
 return 0;
 }