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(")
\n");
printf("Tags:");
bamShowTags(bam);
puts("
");
printf("Flags: 0x%02x:
\n ", core->flag);
bamShowFlagsEnglish(bam);
puts("
");
if (bamIsRc(bam))
printf("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.
\n");
puts("
");
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("Alignment of %s to %s:%d-%d%s:
\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("Sequence quality scores:
\n\n");
UBYTE *quals = bamGetQueryQuals(bam, useStrand);
int i;
for (i = 0; i < core->l_qseq; i++)
{
if (i > 0 && (i % 24) == 0)
printf("
\n");
printf("%c %d | ", qSeq[i], quals[i]);
}
printf("
\n");
}
}
static void showOverlap(const bam1_t *leftBam, const bam1_t *rightBam)