src/hg/hgc/bamClick.c 1.15
1.15 2010/02/13 00:18:39 angie
Fix: handle soft-clipping when fetching query sequence.
Index: src/hg/hgc/bamClick.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/hgc/bamClick.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -b -B -U 4 -r1.14 -r1.15
--- src/hg/hgc/bamClick.c 11 Jan 2010 18:34:25 -0000 1.14
+++ src/hg/hgc/bamClick.c 13 Feb 2010 00:18:39 -0000 1.15
@@ -41,9 +41,13 @@
bamShowTags(bam);
puts("<BR>");
printf("<B>Flags: </B><tt>0x%02x:</tt><BR>\n ", core->flag);
bamShowFlagsEnglish(bam);
-puts("<BR><BR>");
+puts("<BR>");
+if (bamIsRc(bam))
+ printf("<em>Note: although the read was mapped to the reverse strand of the genome, "
+ "the sequence and CIGAR in BAM are relative to the forward strand.</em><BR>\n");
+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, useStrand);
@@ -53,10 +57,12 @@
ffShowSideBySide(stdout, ffa, qSeq, 0, genoSeq->dna, tStart, tLength, 0, tLength, 8, isRc,
FALSE);
printf("<B>Sequence quality scores:</B><BR>\n<TT><TABLE><TR>\n");
UBYTE *quals = bamGetQueryQuals(bam, useStrand);
+int clippedQLen;
+bamGetSoftClipping(bam, NULL, NULL, &clippedQLen);
int i;
-for (i = 0; i < core->l_qseq; i++)
+for (i = 0; i < clippedQLen; i++)
{
if (i > 0 && (i % 24) == 0)
printf("</TR>\n<TR>");
printf("<TD>%c<BR>%d</TD>", qSeq[i], quals[i]);