e6b0dc7877ae4b24f56682885e03263fd2da3582
braney
Tue Aug 18 11:37:04 2026 -0700
lib, hgc: encode barChart, BAM and VCF detail text consistently, refs #38123
diff --git src/hg/hgc/bamClick.c src/hg/hgc/bamClick.c
index 76e73c81998..7d18f661886 100644
--- src/hg/hgc/bamClick.c
+++ src/hg/hgc/bamClick.c
@@ -1,27 +1,28 @@
/* bamClick - handler for alignments in BAM format (produced by MAQ,
* BWA and some other short-read alignment tools). */
/* Copyright (C) 2014 The Regents of the University of California
* See kent/LICENSE or http://genome.ucsc.edu/license/ for licensing information. */
#include "common.h"
#include "hash.h"
#include "hdb.h"
#include "hgBam.h"
#include "hgc.h"
#include "hui.h"
+#include "htmshell.h"
#include "knetUdc.h"
#include "udc.h"
#include "chromAlias.h"
#include "hgBam.h"
#include "hgConfig.h"
struct bamTrackData
{
int itemStart;
char *itemName;
struct hash *pairHash;
boolean foundIt;
};
@@ -120,31 +121,32 @@
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(" ");
struct dnaSeq *genoSeq = hChromSeq(database, seqName, tStart, tEnd);
char *qSeq = bamGetQuerySequence(bam, FALSE);
if (core->l_qseq > 5000)
printf("Alignment not shown, query sequence is %d bp long > 5000bp \n", core->l_qseq);
else
{
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,
+ // the read name comes straight out of the BAM file, so encode it before output
+ printf("Alignment of %s to %s:%d-%d%s: \n", htmlEncode(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("Sequence quality not shown, query sequence %d bp long > 5000bp \n", core->l_qseq);
}
else
{
printf("Sequence quality scores: \n