src/hg/hgc/bamClick.c 1.3

1.3 2009/08/21 05:27:29 angie
Use the new bamToFfAli and the old ffShAliPart to display aligned bases.
Index: src/hg/hgc/bamClick.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/hgc/bamClick.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -b -B -U 4 -r1.2 -r1.3
--- src/hg/hgc/bamClick.c	3 Aug 2009 22:00:24 -0000	1.2
+++ src/hg/hgc/bamClick.c	21 Aug 2009 05:27:29 -0000	1.3
@@ -24,14 +24,24 @@
 {
 const bam1_core_t *core = &bam->core;
 char *itemName = bam1_qname(bam);
 int length = bamGetTargetLength(bam);
-printPosOnChrom(seqName, core->pos, core->pos+length, (core->flag & BAM_FREVERSE) ? "-" : "+",
-		FALSE, itemName);
+int tStart = core->pos, tEnd = tStart+length;
+boolean isRc = ((core->flag & BAM_FREVERSE) != 0);
+printPosOnChrom(seqName, tStart, tEnd, (isRc ? "-" : "+"), 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><BR>\n", bamGetCigar(bam));
-char *qSeq = bamGetQuerySequence(bam);
-printf("<B>Read Sequence: </B><tt>%s</tt><BR>\n", qSeq);
-//TODO: show flags, display alignment properly, maybe display quality scores
+puts("<BR>");
+char nibName[HDB_MAX_PATH_STRING];
+hNibForChrom(database, seqName, nibName);
+struct dnaSeq *genoSeq = hFetchSeq(nibName, seqName, tStart, tEnd);
+struct ffAli *ffa = bamToFfAli(bam, genoSeq, tStart);
+char *qSeq = ffa->nStart;
+ffShAliPart(stdout, ffa,
+	    itemName, qSeq, strlen(qSeq), 0, genoSeq->name, genoSeq->dna, genoSeq->size, tStart,
+	    8, FALSE, isRc, FALSE, TRUE, TRUE, TRUE, TRUE, 0, 0, tStart, tEnd);
+//TODO: show flags properly, show tags, maybe display quality scores
 }
 
 static int oneBam(const bam1_t *bam, void *data)
 /* This is called on each record retrieved from a .bam file. */