0be7b604dc94f877a813c77d1caffb6caa5ff267
hiram
Wed Dec 10 11:06:58 2025 -0800
improved prompt tags for the expandable sectios refs #35776
diff --git src/hg/hgc/togaClick.c src/hg/hgc/togaClick.c
index 9d8f957bbbf..de092e4773d 100644
--- src/hg/hgc/togaClick.c
+++ src/hg/hgc/togaClick.c
@@ -281,30 +281,36 @@
}
void print_with_newlines(const char *str) {
int line_length = 80; // Number of characters per line
int length = strlen(str);
int i = 0;
while (i < length) {
/* Print up to 80 characters or the remainder of the string */
int chars_to_print = (length - i < line_length) ? (length - i) : line_length;
printf("%.*s
", chars_to_print, &str[i]);
i += chars_to_print;
}
}
+static void panelPrompt(char *target, char *prompt)
+/* output span element for an expandable text element */
+{
+printf("
%s:\n", target, prompt);
+printf("
\n", target);
+}
void doHillerLabTOGAGeneBig(char *database, struct trackDb *tdb, char *item, char *table_name)
/* Put up TOGA Gene track info. */
// To think about -> put into a single bigBed
// string: HTML formatted inact mut
// string: HTML formatted exon ali section
{
int start = cartInt(cart, "o");
int end = cartInt(cart, "t");
char *chrom = cartString(cart, "c");
char *fileName = bbiNameFromSettingOrTable(tdb, NULL, tdb->table);
struct bbiFile *bbi = bigBedFileOpenAlias(hReplaceGbdb(fileName), chromAliasFindAliases);
struct lm *lm = lmInit(0);
struct bigBedInterval *bbList = bigBedIntervalQuery(bbi, chrom, start, end, 0, lm);
struct bigBedInterval *bb;
@@ -323,32 +329,31 @@
char startBuf[16], endBuf[16];
bigBedIntervalToRow(bb, chrom, startBuf, endBuf, fields, bbi->fieldCount);
break;
}
printf("
Projection v2 %s
\n", item);
struct togaDataBB *info = togaDataBBLoad(&fields[11], bbi->fieldCount); // Bogdan: why 11? 0-11 are bed-like fields likely
printf("
Reference transcript: %s
", info->ref_link);
printf("
Genomic locus in reference: %s
\n", info->ref_region);
printf("
Genomic locus in query: %s
\n", info->query_region);
printf("
Projection classification: %s
\n", info->status);
printf("
Probability that query locus is orthologous: %s
\n", info->chain_score);
// list of chain features (for orthology classification)
-printf("
Show features used for ortholog probability:\n");
-printf("
\n");
+panelPrompt("collapseChain", "Show features used for ortholog probability");
printf("
\n");
printf("- Synteny (log10 value): %s
\n", info->chain_synteny);
printf("- Global CDS fraction: %s
\n", info->chain_gl_cds_fract);
printf("- Local CDS fraction: %s
\n", info->chain_loc_cds_fract);
printf("- Local intron fraction: %s
\n", info->chain_intron_cov);
printf("- Local CDS coverage: %s
\n", info->chain_exon_cov);
printf("- Flank fraction: %s
\n", info->chain_flank);
printf("
\n");
printf("
\nFeature description:\n");
printf("For each projection (one reference transcript and one overlapping chain),\n");
printf("TOGA computes the following features by intersecting the reference coordinates of aligning\n");
printf("blocks in the chain with different gene parts (coding exons, UTR (untranslated region) exons, introns)\n");
printf("and the respective intergenic regions.\n
\n");
@@ -380,108 +385,101 @@
printf("
"local CDS coverage" as c / CDS, which is only used for single-exon genes. \n");
printf("\n");
printf("
\n");
printf("
\n");
// show inact mut plot
printf("
Visualization of inactivating mutations on exon-intron structure
\n");
printf("%s\n", info->svg_line);
printf("
Exons shown in grey are missing (often overlap assembly gaps).\nExons shown in");
printf(" red or blue are deleted or do not align at all.\nRed indicates that the exon deletion ");
printf("shifts the reading frame, while blue indicates that exon deletion(s) are framepreserving.
\n");
// GLP features
-printf("
Show features used for transcript classification\n");
-printf("
\n");
+panelPrompt("collapseGLP", "Show features used for transcript classification");
printf("
\n");
printf("- Percent intact, ignoring missing sequence: %s
\n", info->perc_intact_ign_M);
printf("- Percent intact, treating missing as intact sequence: %s
\n", info->perc_intact_int_M);
printf("- Proportion of intact codons: %s
\n", info->intact_codon_prop);
printf("- Percent of CDS not covered by this chain (0 unless the chain covers only a part of the gene): %s
\n", info->ouf_prop);
if (sameWord(info->mid_intact, ONE_))
{
printf("- Middle 80 percent of CDS intact: %s
\n", YES_);
} else {
printf("- Middle 80 percent of CDS intact: %s
\n", NO_);
}
if (sameWord(info->mid_pres, ONE_))
{
printf("- Middle 80 percent of CDS present: %s
\n", YES_);
} else {
printf("- Middle 80 percent of CDS present: %s
\n", NO_);
}
if (info->numExonsMutated != NULL && info->percentExonsMutated != NULL) {
printf("- Number of exons with inactivating mutations: %s (%s%% of the present exons; threshold is 20%%)
\n", info->numExonsMutated, info->percentExonsMutated);
}
printf("
\n
\n");
printf("
\n");
printf("
Predicted protein sequence
\n");
-printf("
Show protein sequence of query\n");
-printf("
\n");
+panelPrompt("collapseProt", "Show protein sequence of query");
printf("
");
HLprintQueryProtSeqForAli(info->prot_alignment);
printf("\n
\n
\n");
if (info->protseqFrameCorrected != NULL) {
- printf("
Show frame-corrected protein sequence of query (potential frameshifts are masked)\n");
- printf("
\n");
+ panelPrompt("collapseProtFrameCorrected", "Show frame-corrected protein sequence of query (potential frameshifts are masked)");
printf("
");
print_with_newlines(info->protseqFrameCorrected);
printf("\n
\n
\n");
}
if (info->CDSseq != NULL) {
printf("
\n");
printf("
Predicted coding (DNA) sequence
\n");
- printf("
Show coding sequence of query\n");
- printf("
\n");
+ panelPrompt("collapseCDS", "Show coding sequence of query");
printf("
");
print_with_newlines(info->CDSseq);
printf("\n
\n
\n");
}
// and show protein sequence
printf("
\n");
printf("
Protein sequence alignment
\n");
-printf("
Show alignment between reference and query\n");
-printf("
\n");
+panelPrompt("collapseProtAli", "Show alignment between reference and query");
printf("
%s\n", info->prot_alignment);
printf("
\n");
// show inactivating mutations if required
printf("
\n");
printf("
List of inactivating mutations
\n");
-printf("
Show inactivating mutations\n");
-printf("
\n");
+panelPrompt("collapseMuts", "Show inactivating mutations");
printf("
\n"); // init table
printf("| Exon number | Codon number | Mutation class | Mutation | Treated as inactivating | Mutation ID | \n");
printf("
\n");
printf("%s\n", info->inact_mut_html_table);
printf("
\n");
printf("
\n\n");
// show exons data
printf("
\n");
printf("
Exon alignments
\n");
-printf("
Show exon sequences and features\n");
-printf("
\n");
+panelPrompt("collapseExons", "Show exon sequences and features");
printf("
%s
\n", info->exon_ali_html);
printf("
\n");
printf("
\n
\n");
printTrackHtml(tdb); // and do I need this?
}
void doHillerLabTOGAGene(char *database, struct trackDb *tdb, char *item, char *table_name)
/* Put up TOGA Gene track info. */
{
//int start = cartInt(cart, "o");
char headerTitle[512];
char suffix[512];
@@ -523,32 +521,31 @@
sqlSafef(query, sizeof(query), "select * from %s where transcript='%s'", togaDataTableName, item);
sr = sqlGetResult(conn, query);
if ((row = sqlNextRow(sr)) != NULL) {
info = togaDataLoad(row); // parse sql output
// fill HTML template:
printf("
Reference transcript: %s",
info->ref_trans_id, info->ref_trans_id);
printf("
Genomic locus in reference: %s
\n", info->ref_region);
printf("
Genomic locus in query: %s
\n", info->query_region);
printf("
Projection classification: %s
\n", info->status);
printf("
Probability that query locus is orthologous: %s
\n", info->chain_score);
// list of chain features (for orthology classification)
- printf("
Show features used for ortholog probability\n");
- printf("
\n");
printf("- Synteny (log10 value): %s
\n", info->chain_synteny);
printf("- Global CDS fraction: %s
\n", info->chain_gl_cds_fract);
printf("- Local CDS fraction: %s
\n", info->chain_loc_cds_fract);
printf("- Local intron fraction: %s
\n", info->chain_intron_cov);
printf("- Local CDS coverage: %s
\n", info->chain_exon_cov);
printf("- Flank fraction: %s
\n", info->chain_flank);
printf("
\n");
printf("
\n
Feature description:\n");
printf("For each projection (one reference transcript and one overlapping chain),\n");
printf("TOGA computes the following features by intersecting the reference coordinates of aligning\n");
printf("blocks in the chain with different gene parts (coding exons, UTR (untranslated region) exons, introns)\n");
printf("and the respective intergenic regions.\n
\n");
@@ -580,86 +577,82 @@
printf("
"local CDS coverage" as c / CDS, which is only used for single-exon genes. \n");
printf("\n");
printf("\n
\n
\n");
htmlHorizontalLine();
// show inact mut plot
printf("
Visualization of inactivating mutations on exon-intron structure
\n");
printf("%s
\n", info->svg_line);
printf("
Exons shown in grey are missing (often overlap assembly gaps).\nExons shown in");
printf(" red or blue are deleted or do not align at all.\nRed indicates that the exon deletion ");
printf("shifts the reading frame, while blue indicates that exon deletion(s) are framepreserving.
\n");
// GLP features
- printf("
Show features used for transcript classification\n");
- printf("
\n");
+ panelPrompt("collapseGLP", "Show features used for transcript classification");
printf("
\n");
printf("- Percent intact, ignoring missing sequence: %s
\n", info->perc_intact_ign_M);
printf("- Percent intact, treating missing as intact sequence: %s
\n", info->perc_intact_int_M);
printf("- Proportion of intact codons: %s
\n", info->intact_codon_prop);
printf("- Percent of CDS not covered by this chain (0 unless the chain covers only a part of the gene): %s
\n", info->ouf_prop);
if (sameWord(info->mid_intact, ONE_))
{
printf("- Middle 80 percent of CDS intact: %s
\n", YES_);
} else {
printf("- Middle 80 percent of CDS intact: %s
\n", NO_);
}
if (sameWord(info->mid_pres, ONE_))
{
printf("- Middle 80 percent of CDS present: %s
\n", YES_);
} else {
printf("- Middle 80 percent of CDS present: %s
\n", NO_);
}
printf("
\n
\n
\n");
printf("
Query protein sequence
");
- printf("
Show protein sequence of query\n");
- printf("
\n");
+ panelPrompt("collapseProt", "Show protein sequence of query");
printf("
{protein seq of the query without dashes or other things. Should end with *}\n");
printf("
\n
\n
\n");
// and show protein sequence
htmlHorizontalLine();
printf("
Protein sequence alignment
\n");
- printf("
Show alignment between reference and query\n");
- printf("
\n");
+ panelPrompt("collapseProtAli", "Show alignment between reference and query");
printf("
%s
\n", info->prot_alignment);
printf("
\n
\n");
// do not forget to free toga data struct
togaDataFree(&info);
} else {
// no data found, need to report this
printf("
No found data for %s
\n", item);
}
sqlFreeResult(&sr);
}
// show inactivating mutations if required
printf("
List of inactivating mutations
\n");
if (hTableExists(database, togaInactMutTableName))
{
char query[256];
struct sqlResult *sr = NULL;
char **row;
sqlSafef(query, sizeof(query), "select * from %s where transcript='%s'", togaInactMutTableName, item);
sr = sqlGetResult(conn, query);
- printf("
Show inactivating mutations\n");
- printf("
\n");
+ panelPrompt("collapseMuts", "Show inactivating mutations");
printf("
\n"); // init table
printf("| Exon number | Codon number | Mutation class | Mutation | Treated as inactivating | Mutation ID | \n");
printf("
\n");
while ((row = sqlNextRow(sr)) != NULL)
{
struct togaInactMut *info = NULL;
info = togaInactMutLoad(row);
printf("\n");
printf("| %s | \n", info->exon_num);
printf("%s | \n", info->position);
printf("%s | \n", info->mut_class);
printf("%s | \n", info->mutation);
if (sameWord(info->is_inact, ONE_)){
printf("%s | \n", YES_);
} else {
@@ -673,32 +666,31 @@
printf("
\n");
printf("
\n
\n");
} else {
printf("
Sorry, cannot find TOGAInactMut table.\n");
}
// show exons data
htmlHorizontalLine();
printf("
Exon alignments
\n");
if (hTableExists(database, togaNuclTableName))
{
char query[256];
struct sqlResult *sr = NULL;
char **row;
- printf("
Show exon sequences and features\n");
- printf("
\n");
+ panelPrompt("collapseExons", "Show exon sequences and features");
sqlSafef(query, sizeof(query), "select * from %s where transcript='%s'", togaNuclTableName, item);
sr = sqlGetResult(conn, query);
while ((row = sqlNextRow(sr)) != NULL)
{
struct togaNucl *info = NULL;
info = togaNuclLoad(row);
printf("
Exon number: %s
\n", info->exon_num);
printf("Exon region: %s
\n", info->exon_region);
printf("Nucleotide percent identity: %s | BLOSUM: %s
\n", info->pid, info->blosum);
if (sameWord(info->gaps, ONE_)){
printf("Intersects assembly gaps: %s
\n", YES_);
} else {
printf("Intersects assembly gaps: %s
\n", NO_);
}