void webPrintDoubleCell(double val) /* Print right-justified cell in our colors with two digits to right of decimal. */ { webPrintLinkCellRightStart(); printf("%4.2f", val); webPrintLinkCellEnd(); }
void webPrintIntCell(int val) /* Print right-justified int cell in our colors. */ { webPrintLinkCellRightStart(); printf("%d", val); webPrintLinkCellEnd(); }
static void showTableDataRows(struct fieldedTable *table, int pageSize, int maxLenField, struct hash *tagOutputWrappers, void *wrapperContext) /* Render data rows into HTML */ { int count = 0; struct fieldedRow *row; boolean isNum[table->fieldCount]; int i; for (i=0; i<table->fieldCount; ++i) isNum[i] = fieldedTableColumnIsNumeric(table, i); for (row = table->rowList; row != NULL; row = row->next) { if (++count > pageSize) break; printf("<TR>\n"); int fieldIx = 0; for (fieldIx=0; fieldIx<table->fieldCount; ++fieldIx) { char shortVal[maxLenField+1]; char *longVal = emptyForNull(row->row[fieldIx]); char *val = longVal; int valLen = strlen(val); if (maxLenField > 0 && maxLenField < valLen) { if (valLen > maxLenField) { memcpy(shortVal, val, maxLenField-3); shortVal[maxLenField-3] = 0; strcat(shortVal, "..."); val = shortVal; } } if (isNum[fieldIx]) webPrintLinkCellRightStart(); else webPrintLinkCellStart(); boolean printed = FALSE; if (tagOutputWrappers != NULL && !isEmpty(val)) { char *field = table->fields[fieldIx]; webTableOutputWrapperType *printer = hashFindVal(tagOutputWrappers, field); if (printer != NULL) { printer(table, row, field, longVal, val, wrapperContext); printed = TRUE; } } if (!printed) printf("%s", val); webPrintLinkCellEnd(); } printf("</TR>\n"); } }
static void prAlign(struct sqlConnection *conn, char *pslTbl, struct psl *psl) /* print an alignment */ { // genomic location webPrintLinkCellStart(); printf("<A HREF=\"%s&db=%s&position=%s%%3A%d-%d\">%s:%d-%d</A>", hgTracksPathAndSettings(), database, psl->tName, psl->tStart+1, psl->tEnd, psl->tName, psl->tStart+1, psl->tEnd); webPrintLinkCellEnd(); // genomic span webPrintLinkCellRightStart(); printf("%d", psl->tEnd-psl->tStart); webPrintLinkCellEnd(); // strand webPrintLinkCell(psl->strand); // mRNA location, linked to aligment viewer webPrintLinkCellStart(); char other[128]; safef(other, sizeof(other), "%d&aliTable=%s", psl->tStart, pslTbl); hgcAnchorSomewhere("htcCdnaAli", psl->qName, other, psl->tName); printf("%s:%d-%d</A>", psl->qName, psl->qStart+1, psl->qEnd); webPrintLinkCellEnd(); // identity webPrintLinkCellRightStart(); printf("%.2f%%", 100.0 * pslIdent(psl)); webPrintLinkCellEnd(); // fraction aligned webPrintLinkCellRightStart(); int aligned = psl->match + psl->misMatch + psl->repMatch; printf("%.2f%%", 100.0*aligned/((float)psl->qSize)); webPrintLinkCellEnd(); }
static void prRefSeqSim(struct cloneInfo *ci, struct geneSim *gs) /* print similarity information for a given RefSeq */ { webPrintLinkTableNewRow(); // RefSeq acc and link webPrintLinkCellStart(); printf("<a href=\""); printEntrezNucleotideUrl(stdout, gs->gene->name); printf("\" TARGET=_blank>%s</a>", gs->gene->name); webPrintLinkCellEnd(); // link to browser webPrintLinkCellStart(); printf("<A HREF=\"%s&db=%s&position=%s%%3A%d-%d\" target=_blank>%s:%d-%d</A>", hgTracksPathAndSettings(), database, gs->gene->chrom, gs->gene->txStart+1, gs->gene->txEnd, gs->gene->chrom, gs->gene->txStart+1, gs->gene->txEnd); webPrintLinkCellEnd(); // similarity webPrintLinkCellRightStart(); printf("%0.2f%%", 100.0*gs->sim); webPrintLinkCellEnd(); }
void showCdsEvidence(char *geneName, struct trackDb *tdb, char *evTable) /* Print out stuff from cdsEvidence table. */ { struct sqlConnection *conn = hAllocConn(database); double bestScore = 0; if (sqlTableExists(conn, evTable)) { webNewSection("CDS Prediction Information"); char query[512]; sqlSafef(query, sizeof(query), "select count(*) from %s where name='%s'", evTable, geneName); if (sqlQuickNum(conn, query) > 0) { sqlSafef(query, sizeof(query), "select * from %s where name='%s' order by score desc", evTable, geneName); struct sqlResult *sr = sqlGetResult(conn, query); char **row; webPrintLinkTableStart(); webPrintLabelCell("ORF<BR>size"); webPrintLabelCell("start in<BR>transcript"); webPrintLabelCell("end in<BR>transcript"); webPrintLabelCell("source"); webPrintLabelCell("accession"); webPrintLabelCell("ad-hoc<BR>score"); webPrintLabelCell("start<BR>codon"); webPrintLabelCell("end<BR>codon"); webPrintLabelCell("piece<BR>count"); webPrintLabelCell("piece list"); webPrintLabelCell("frame"); webPrintLinkTableNewRow(); while ((row = sqlNextRow(sr)) != NULL) { struct cdsEvidence *ev = cdsEvidenceLoad(row); webPrintIntCell(ev->end - ev->start); int i; webPrintIntCell(ev->start+1); webPrintIntCell(ev->end); webPrintLinkCell(ev->source); webPrintLinkCell(ev->accession); webPrintLinkCellRightStart(); printf("%3.2f", ev->score); bestScore = max(ev->score, bestScore); webPrintLinkCellEnd(); webPrintLinkCell(ev->startComplete ? "yes" : "no"); webPrintLinkCell(ev->endComplete ? "yes" : "no"); webPrintIntCell(ev->cdsCount); webPrintLinkCellRightStart(); for (i=0; i<ev->cdsCount; ++i) { int start = ev->cdsStarts[i]; int end = start + ev->cdsSizes[i]; printf("%d-%d ", start+1, end); } webPrintLinkCellEnd(); webPrintLinkCellRightStart(); for (i=0; i<ev->cdsCount; ++i) { if (i>0) printf(","); printf("%d", ev->cdsStarts[i]%3 + 1); } webPrintLinkCellEnd(); webPrintLinkTableNewRow(); } sqlFreeResult(&sr); webPrintLinkTableEnd(); printf("This table shows CDS predictions for this transcript from a number of " "sources including alignments against UniProtKB proteins, alignments against Genbank " "mRNAs with CDS regions annotated by the sequence submitter, and " "Victor Solovyev's bestorf program. Each prediction is assigned an ad-hoc score " "score is based on several factors including the quality of " "any associated alignments, the quality of the source, and the length of the " "prediction. For RefSeq transcripts with annotated CDSs the ad-hoc score " "is over a million unless there are severe problems mapping the mRNA to the " "genome. In other cases the score generally ranges from 0 to 50,000. " "The highest scoring prediction in this table is used to define the CDS " "boundaries for this transcript.<P>If no score is 2000 or more, the transcript " "is considered non-coding. In cases where the CDS is subject to " "nonsense-mediated decay the CDS is removed. The CDS is also removed " "from transcripts when evidence points to it being in an artifact of an " "incompletely processed transcript. Specifically if the CDS is entirely " "enclosed in the 3' UTR or an intron of a refSeq or other high quality " "transcript, the CDS is removed."); } else { printf("no significant CDS prediction found, likely %s is noncoding", geneName); } } hFreeConn(&conn); }