5add048a3ba033e17e6c0f5643e9985ef8a15f44 max Thu Jun 13 02:59:16 2024 -0700 adding legend under cigar display on bam hgc page, refs #33292 diff --git src/hg/hgc/bamClick.c src/hg/hgc/bamClick.c index 2d3c9b8..f80a35f 100644 --- src/hg/hgc/bamClick.c +++ src/hg/hgc/bamClick.c @@ -72,71 +72,77 @@ /* Print out the properties of this alignment. */ { const bam1_core_t *core = &bam->core; char *itemName = bam1_qname(bam); int tLength = bamGetTargetLength(bam); int tStart = core->pos, tEnd = tStart+tLength; boolean isRc = useStrand && bamIsRc(bam); printPosOnChrom(seqName, tStart, tEnd, NULL, FALSE, itemName); if (!skipQualityScore) printf("<B>Alignment Quality: </B>%d<BR>\n", core->qual); if (core->n_cigar > 50) printf("<B>CIGAR string: </B> Cannot show long CIGAR string, more than 50 operations. Contact us if you need to see the full CIGAR string here.<BR>\n"); else { printf("<B>CIGAR string: </B><tt>%s</tt>", bamGetCigar(bam)); - //bamShowCigarEnglish(bam); printf("<BR>\n"); + //bamShowCigarEnglish(bam); + printf("<p><B>CIGAR Legend:</B><BR>" + "<b>M</b> : alignment match (seq. match or mismatch), <b>I</b> : insert from genome, <b>D</b> : deletion from genome, " + "<b>N</b> : skipped from genome, <BR>" + "<b>S</b> : soft clipping, <b>H</b> : hard clipping, <b>P</b> : padding, " + "<b>=</b> : sequence match, <b>X</b> : sequence mismatch\n"); + printf("</p>\n"); } int clippedBases[4]; getClippedBases(bam, clippedBases); printf("<B>Start clipping:</B> hard: %d soft: %d</BR>\n", clippedBases[0], clippedBases[1]); printf("<B>End clipping:</B> hard: %d soft: %d</BR> \n", clippedBases[3], clippedBases[2]); 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>"); struct dnaSeq *genoSeq = hChromSeq(database, seqName, tStart, tEnd); char *qSeq = bamGetQuerySequence(bam, FALSE); if (core->l_qseq > 5000) - printf("<B>Alignment not shown, very long sequence</B><BR>\n"); + printf("<B>Alignment not shown, query sequence is %d bp long > 5000bp</B><BR>\n", core->l_qseq); else { 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 && core->l_qseq > 0) { if (core->l_qseq > 5000) { - printf("<B>Sequence too long to show quality scores</B><BR>\n"); + printf("<B>Sequence quality not shown, query sequence %d bp long > 5000bp</B><BR>\n", core->l_qseq); } else { 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"); } }