c46e05f162d1eaefe16a84d7df9d2afcaa2dd4bb markd Mon Jun 16 14:54:58 2025 -0700 output BAM alignment type in hgc page diff --git src/hg/hgc/bamClick.c src/hg/hgc/bamClick.c index f80a35f4ff0..53e6c45826f 100644 --- src/hg/hgc/bamClick.c +++ src/hg/hgc/bamClick.c @@ -67,50 +67,62 @@ * to do it right, we would need to reverse the CIGAR string for display. */ static boolean useStrand = FALSE; static boolean skipQualityScore = FALSE; static void singleBamDetails(const bam1_t *bam) /* 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("Alignment Quality: %d
\n", core->qual); + +// alignment type +char *alnType = NULL; +if (bam->core.flag & BAM_FSECONDARY) + alnType = "Secondary"; +else if (bam->core.flag & BAM_FSUPPLEMENTARY) + alnType = "Supplementary"; +else + alnType = "Primary"; +printf("Alignment type: %s
\n", alnType); + +// clipping +int clippedBases[4]; +getClippedBases(bam, clippedBases); +printf("Start clipping: hard: %d soft: %d
\n", clippedBases[0], clippedBases[1]); +printf("End clipping: hard: %d soft: %d
\n", clippedBases[3], clippedBases[2]); + if (core->n_cigar > 50) printf("CIGAR string: Cannot show long CIGAR string, more than 50 operations. Contact us if you need to see the full CIGAR string here.
\n"); else { printf("CIGAR string: %s", bamGetCigar(bam)); printf("
\n"); //bamShowCigarEnglish(bam); printf("

CIGAR Legend:
" "M : alignment match (seq. match or mismatch), I : insert from genome, D : deletion from genome, " "N : skipped from genome,
" "S : soft clipping, H : hard clipping, P : padding, " "= : sequence match, X : sequence mismatch\n"); printf("

\n"); } -int clippedBases[4]; -getClippedBases(bam, clippedBases); -printf("Start clipping: hard: %d soft: %d
\n", clippedBases[0], clippedBases[1]); -printf("End clipping: hard: %d soft: %d
\n", clippedBases[3], clippedBases[2]); - 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("
"); 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