src/hg/tcga/bamBam/bamBam.c 1.8

1.8 2009/10/01 22:24:58 jsanborn
finally fixed terrible bug, implemented seeking
Index: src/hg/tcga/bamBam/bamBam.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/tcga/bamBam/bamBam.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -b -B -U 4 -r1.7 -r1.8
--- src/hg/tcga/bamBam/bamBam.c	30 Sep 2009 04:45:06 -0000	1.7
+++ src/hg/tcga/bamBam/bamBam.c	1 Oct 2009 22:24:58 -0000	1.8
@@ -26,8 +26,9 @@
   "bamBam - Perform analysis on two BAM files.\n"
   "usage:\n"
   "   bamBam [options] <left.bam> <right.bam>\n"
   "options:\n"
+  "   -position=chrX:1-100 - Position to do analysis. [None]\n" 
   "   -minSupport=INT - Minimum Support (i.e. num reads) to call a variant. [2]\n"
   "   -minQ=INT       - Minimum acceptable base quality. [0]\n"
   "   -minMapQ=INT    - Minimum acceptable mapping quality. [0]\n"
   "   -avgMapQ=INT    - Minimum acceptable avg mapping quality. [0]\n"
@@ -36,8 +37,9 @@
   );
 }
 
 static struct optionSpec options[] = {
+    {"position", OPTION_STRING},
     {"minSupport", OPTION_INT},
     {"minQ", OPTION_INT},
     {"minMapQ", OPTION_INT},
     {"avgMapQ", OPTION_INT},
@@ -452,9 +454,9 @@
 {
 if (insL >= ap->minSupp)
     {
     *isIns = 1;
-    if (insR >= ap->minSupp)
+    if (insR > 0)  // if you see even once, believe it.
 	*insGerm = 1;
     else 
 	*insGerm = 0;
     return 1;
@@ -462,9 +464,9 @@
 
 if (delL >= ap->minSupp)
     {
     *isDel = 1;
-    if (delR >= ap->minSupp)
+    if (delR > 0)  // if you see even once, believe it.
 	*delGerm = 1;
     else
 	*delGerm = 0;
     return 1;
@@ -654,9 +656,10 @@
 ap.avgMapQ = avgMapQ;
 ap.minSupp = minSupport;
 ap.minChiSq = minChiSq;
 ap.sites   = 0;
-bam_bam_file(inbamL, inbamR, perform_analysis, &ap);
+
+bam_bam_file(inbamL, inbamR, position, perform_analysis, &ap);
 fprintf(stderr, "# qualified sites = %d\n", ap.sites);
 }
 
 
@@ -683,8 +686,10 @@
 if (optionExists("avgMapQ"))
     avgMapQ = optionInt("avgMapQ", 0);
 if (optionExists("minChiSq"))
     minChiSq = optionInt("minChiSq", 0);
+if (optionExists("position"))
+    position = optionVal("position", NULL);
 
 char *inbamL = argv[1];
 char *inbamR = argv[2];
 bamBam(inbamL, inbamR);