src/hg/hgc/bamClick.c 1.9

1.9 2009/09/23 23:50:30 angie
Added bamShowFlagsEnglish to explain the flag bits.
Index: src/hg/hgc/bamClick.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/hgc/bamClick.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -b -B -U 4 -r1.8 -r1.9
--- src/hg/hgc/bamClick.c	14 Sep 2009 23:44:25 -0000	1.8
+++ src/hg/hgc/bamClick.c	23 Sep 2009 23:50:30 -0000	1.9
@@ -27,15 +27,17 @@
 int tLength = bamGetTargetLength(bam);
 int tStart = core->pos, tEnd = tStart+tLength;
 boolean isRc = bamIsRc(bam);
 printPosOnChrom(seqName, tStart, tEnd, NULL, FALSE, itemName);
-printf("<B>Flags: </B><tt>0x%02x</tt><BR>\n", core->flag);
 printf("<B>Alignment Quality: </B>%d<BR>\n", core->qual);
 printf("<B>CIGAR string: </B><tt>%s</tt> (", bamGetCigar(bam));
 bamShowCigarEnglish(bam);
 printf(")<BR>\n");
 printf("<B>Tags:</B>");
 bamShowTags(bam);
+puts("<BR>");
+printf("<B>Flags: </B><tt>0x%02x:</tt><BR>\n &nbsp;&nbsp;", core->flag);
+bamShowFlagsEnglish(bam);
 puts("<BR><BR>");
 char nibName[HDB_MAX_PATH_STRING];
 hNibForChrom(database, seqName, nibName);
 struct dnaSeq *genoSeq = hFetchSeq(nibName, seqName, tStart, tEnd);
@@ -77,9 +79,8 @@
 
 static void bamPairDetails(const bam1_t *leftBam, const bam1_t *rightBam)
 /* Print out details for paired-end reads. */
 {
-//TODO: tell them which one they clicked (match itemStart w/core->pos)
 showOverlap(leftBam, rightBam);
 printf("<TABLE><TR><TD><H4>Left end read</H4>\n");
 singleBamDetails(leftBam);
 printf("</TD><TD><H4>Right end read</H4>\n");
@@ -156,12 +157,15 @@
 	    {
 	    struct hashCookie cookie2 = hashFirst(pairHash);
 	    while ((hel = hashNext(&cookie2)) != NULL)
 		{
+		bam1_t *bam = hel->val;
+		const bam1_core_t *core = &bam->core;
+		if (core->flag & BAM_FPROPER_PAIR)
 		printf("<B>Note: </B>unable to find paired end "
-		       "for this %s within +-%d of viewing window<BR>\n",
+			   "for %s within +-%d of viewing window<BR>\n",
 		       hel->name, pairSearchRange);
-		singleBamDetails((bam1_t *)hel->val);
+		singleBamDetails(bam);
 		}
 	    }
 	}
     }