0a875074931c855db2e0d1886665e5343b304878 angie Fri Jul 29 16:49:56 2011 -0700 MLQ #4765: User translated BED6 to BAM, with '*' (placeholder) for the querysequence and quality scores, and our BAM display code didn't anticipate missing seq & base quals. Handle that case since it is legal BAM, albeit an unusual use of BAM. :) diff --git src/hg/hgc/bamClick.c src/hg/hgc/bamClick.c index 7df5090..9471b4b 100644 --- src/hg/hgc/bamClick.c +++ src/hg/hgc/bamClick.c @@ -43,37 +43,41 @@ bamShowCigarEnglish(bam); printf(")<BR>\n"); printf("<B>Tags:</B>"); bamShowTags(bam); puts("<BR>"); printf("<B>Flags: </B><tt>0x%02x:</tt><BR>\n ", core->flag); bamShowFlagsEnglish(bam); 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); +char *qSeq = bamGetQuerySequence(bam, FALSE); +if (isNotEmpty(qSeq) && !sameString(qSeq, "*")) + { char *qSeq = NULL; struct ffAli *ffa = bamToFfAli(bam, genoSeq, tStart, useStrand, &qSeq); printf("<B>Alignment of %s to %s:%d-%d%s:</B><BR>\n", itemName, seqName, tStart+1, tEnd, (isRc ? " (reverse complemented)" : "")); ffShowSideBySide(stdout, ffa, qSeq, 0, genoSeq->dna, tStart, tLength, 0, tLength, 8, isRc, FALSE); -if (!skipQualityScore) + } +if (!skipQualityScore && core->l_qseq > 0) { printf("<B>Sequence quality scores:</B><BR>\n<TT><TABLE><TR>\n"); UBYTE *quals = bamGetQueryQuals(bam, useStrand); int i; for (i = 0; i < core->l_qseq; i++) { if (i > 0 && (i % 24) == 0) printf("</TR>\n<TR>"); printf("<TD>%c<BR>%d</TD>", qSeq[i], quals[i]); } printf("</TR></TABLE></TT>\n"); } } static void showOverlap(const bam1_t *leftBam, const bam1_t *rightBam)