void doParDetails(struct trackDb *tdb, char *name) /* show details of a PAR item. */ { // load entire PAR table (t's tiny) and partition struct bed *pars = loadParTable(tdb); if (slCount(pars) & 1) errAbort("par items not paired in %s", tdb->table); struct bed *clickedPar = getClickedPar(name, &pars); struct bed *homPar = getHomologousPar(clickedPar, &pars); slSort(&pars, parCmp); cartWebStart(cart, database, "Pseudoautosomal regions"); webPrintLinkTableStart(); // header webPrintLabelCell(""); webPrintLabelCell("Selected PAR"); webPrintLabelCell("Homologous PAR"); // selected webPrintLinkTableNewRow(); printHomPairRow(clickedPar, homPar); if (pars != NULL) printOtherPars(clickedPar, pars); webPrintLinkTableEnd(); printTrackHtml(tdb); webEnd(); bedFreeList(&pars); bedFree(&clickedPar); bedFree(&homPar); }
static void prMiscDiffHdr(unsigned miscDiffFlds) /* print a header row for miscDiffs table */ { webPrintLabelCell("mRNA start"); webPrintLabelCell("mRNA end"); if (miscDiffFlds & gbMiscDiffGene) webPrintLabelCell("Gene"); if (miscDiffFlds & gbMiscDiffReplace) webPrintLabelCell("Replace"); if (miscDiffFlds & gbMiscDiffNotes) webPrintLabelCell("Notes"); }
void printIndex(struct section *sectionList) /* Print index to section. */ { int maxPerRow = 6, itemPos = 0; int rowIx = 0; struct section *section; hPrintf("<BR>\n"); hPrintf("<BR>\n"); webPrintLinkTableStart(); webPrintLabelCell("Page Index"); itemPos += 1; for (section=sectionList; section != NULL; section = section->next) { if (++itemPos > maxPerRow) { hPrintf("</TR><TR>"); itemPos = 1; ++rowIx; } webPrintLinkCellStart(); hPrintf("<A HREF=\"#%s\" class=\"toc\">%s</A>", section->name, section->shortLabel); webPrintLinkCellEnd(); } webFinishPartialLinkTable(rowIx, itemPos, maxPerRow); webPrintLinkTableEnd(); }
static void prOrfeomeCloneLinks(struct sqlConnection *conn, char *acc, struct cloneInfo *ci) /* print table of clone links */ { webPrintLinkTableStart(); webPrintLabelCell("Links"); webPrintLinkTableNewRow(); if (ci->gi > 0) prOrderLink("ORFeome", ci); #if 0 // link to ORFeome database // FIXME: this doesn't appear to work, need to ask Christa // http://www.orfeomecollaboration.org/bin/cloneStatus.pl #endif if (ci->imageId > 0) prImageLink(ci); prGenbankLink(ci); if (ci->refSeqAccv != NULL) prRefSeqLinks(ci); if (sqlTableExists(conn, "ccdsGene")) prCcdsLinks(conn, ci); if (sqlTableExists(conn, "knownGene")) prUcscGenesLinks(conn, ci); webPrintLinkTableEnd(); }
static void printHomPairRow(struct bed *parA, struct bed *parB) /* print a homologous pair */ { if (!sameString(parA->name, parB->name)) errAbort("invalid PAR homologous pair: %s and %s", parA->name, parB->name); webPrintLabelCell(parA->name); printParLink(parA); printParLink(parB); }
static void prRefSeqSims(struct cloneInfo *ci) /* print similarity information for RefSeqs */ { webNewSection("RefSeq CDS isoform similarity of %s clone %s", cdnaInfoDbName(ci), ci->acc); webPrintLinkTableStart(); webPrintLabelCell("RefSeq"); webPrintLabelCell("Position"); webPrintLabelCell("Similarity"); struct geneSim *gs; for (gs = ci->refSeqs->genes; gs != NULL; gs = gs->next) prRefSeqSim(ci, gs); webPrintLinkTableEnd(); printf("This table compares the similarity of the BLAT genomic alignments of " "the CDS of this %s clone with alignment of RefSeq mRNA CDSs. This is a metric " "of the similarity of the exon structure of the mRNAs, rather than a measure of their " "nucleotide sequence similarity.", cdnaInfoDbName(ci)); }
void correlatePage(struct sqlConnection *conn) /* Put up correlation page. */ { cartWebStart(cart, database, "Correlations of all pairs of graphs"); hPrintf("<FORM ACTION=\"../cgi-bin/hgGenome\" METHOD=GET>\n"); cartSaveSession(cart); struct slRef *ggRefList = ggAllVisible(conn); struct slRef *aRef, *bRef; hPrintf("<TABLE><TR><TD>"); webPrintLinkTableStart(); webPrintLabelCell("Graph A"); webPrintLabelCell("Graph B"); webPrintLabelCell("R"); webPrintLabelCell("R-Squared"); for (aRef = ggRefList; aRef != NULL; aRef = aRef->next) { for (bRef = aRef->next; bRef != NULL; bRef = bRef->next) { hPrintf("</TR><TR>"); correlateGraphs(aRef->val, bRef->val); } } webPrintLinkTableEnd(); hPrintf("</TD><TD>"); hPrintf("<CENTER>"); cgiMakeButton("submit", "return to graphs"); hPrintf("</CENTER>"); hPrintf("</TD></TR></TABLE>"); hPrintf("<P>R, also known as Pearson's correlation coefficient, is a measure "); hPrintf("of the extent that two graphs move together. The value of R ranges "); hPrintf("between -1 and 1. A positive R indicates that the graphs tend to "); hPrintf("move in the same direction, while a negative R indicates that they "); hPrintf("tend to move in opposite directions.</P>\n"); hPrintf("<P>R-Squared (which is indeed just R*R) measures how much of the "); hPrintf("variation in one graph can be explained by a linear dependence on "); hPrintf("the other graph. R-Squared ranges between 0 when the two graphs are "); hPrintf("independent to 1 when the graphs are completely dependent.</P>"); hPrintf("</FORM>"); cartWebEnd(); }
static void prAligns(struct sqlConnection *conn, struct cloneInfo *ci) /* print table of alignments */ { struct psl* pslList = getAlignments(conn, ci->pslTbl, ci->acc); assert(pslList != NULL); slSort(&pslList, pslCmpMatch); // header, print note about order only if we have multiple alignments and didn't // come from another details page webNewSection("Alignments"); if ((pslList->next != NULL) && (winStart < winEnd)) printf("<span style='font-size:smaller;'><em>The alignment you clicked on is shown first.</em></span>\n"); webPrintLinkTableStart(); webPrintLabelCell("genomic (browser)"); webPrintLabelCell("span"); webPrintLabelCell(" "); webPrintLabelCell("mRNA (alignment details)"); webPrintLabelCell("identity"); webPrintLabelCell("aligned"); // print with clicked alignment first struct psl* psl; int pass; for (pass = 1; pass <= 2; pass++) { for (psl = pslList; psl != NULL; psl = psl->next) if ((pass == 1) == (psl->tStart == ci->start)) { webPrintLinkTableNewRow(); prAlign(conn, ci->pslTbl, psl); } } webPrintLinkTableEnd(); }
static void printClusterTableHeader(struct slName *otherCols, boolean withAbbreviation, boolean withDescription, boolean withSignal) /* Print out header fields table of tracks in cluster */ { webPrintLabelCell("#"); if (withSignal) webPrintLabelCell("signal"); if (withAbbreviation) webPrintLabelCell("abr"); struct slName *col; for (col = otherCols; col != NULL; col = col->next) webPrintLabelCell(col->name); if (withDescription) webPrintLabelCell("description"); webPrintLabelCell("more info"); }
static void prMgcCloneLinks(struct sqlConnection *conn, struct mgcDb *mgcDb, struct cloneInfo *ci) /* print table of clone links */ { webPrintLinkTableStart(); webPrintLabelCell("Links"); if (ci->gi > 0) prOrderLink(mgcDb->name, ci); // link to MGC database webPrintLinkTableNewRow(); webPrintLinkCellStart(); printf("<a href=\""); printMgcUrl(ci->imageId); printf("\" TARGET=_blank>%s clone database</a>", mgcDb->name); webPrintLinkCellEnd(); prImageLink(ci); prGenbankLink(ci); if (ci->refSeqAccv != NULL) prRefSeqLinks(ci); if (sqlTableExists(conn, "ccdsGene")) prCcdsLinks(conn, ci); if (sqlTableExists(conn, "knownGene")) prUcscGenesLinks(conn, ci); // Brent lab validation database if (isInMBLabValidDb(ci->acc)) { webPrintLinkTableNewRow(); webPrintLinkCellStart(); printf("<a href=\""); printMBLabValidDbUrl(ci->acc); printf("\" TARGET=_blank>Brent Lab Clone Validation</a>"); webPrintLinkCellEnd(); } webPrintLinkTableEnd(); }
static void rnaStructurePrint(struct section *section, struct sqlConnection *conn, char *geneId) /* Print out rnaStructure table. */ { static boolean firstTime = TRUE; static char *names[2] = {"5' UTR", "3' UTR"}; static char *tables[2] = {"foldUtr5", "foldUtr3"}; int side; if (firstTime) { rnaTrashDirsInit(tables, ArraySize(tables)); firstTime = FALSE; } webPrintLinkTableStart(); webPrintLabelCell("Region"); webPrintLabelCell("Fold Energy"); webPrintLabelCell("Bases"); webPrintLabelCell("Energy/Base"); webPrintWideCenteredLabelCell("Display As", 3); for (side = 0; side < ArraySize(names); ++side) { char *table = tables[side]; struct sqlResult *sr; char query[256], **row; safef(query, sizeof(query), "select * from %s where name = '%s'", table, geneId); sr = sqlGetResult(conn, query); if ((row = sqlNextRow(sr)) != NULL) { struct rnaFold fold; int bases; char psName[128]; /* Load fold and save it as postScript. */ rnaFoldStaticLoad(row, &fold); safef(psName, sizeof(psName), "../trash/%s/%s_%s.ps", table, table, geneId); if (!fileExists(psName)) { FILE *f; f = popen("../cgi-bin/RNAplot", "w"); if (f != NULL) { fprintf(f, ">%s\n", psName); /* This tells where to put file. */ fprintf(f, "%s\n%s\n", fold.seq, fold.fold); pclose(f); } } /* Print row of table, starting with energy terms . */ hPrintf("</TR><TR>"); bases = strlen(fold.seq); webPrintLinkCell(names[side]); webPrintLinkCellStart(); hPrintf("%1.2f", fold.energy); webPrintLinkCellEnd(); webPrintLinkCellStart(); hPrintf("%d", bases); webPrintLinkCellEnd(); webPrintLinkCellStart(); hPrintf("%1.3f", fold.energy/bases); webPrintLinkCellEnd(); /* Print link to png image. */ webPrintLinkCellStart(); hPrintf("<A HREF=\"%s?%s&%s=%s&%s=%s&%s=%s\" class=\"toc\" TARGET=_blank>", geneCgi, cartSidUrlString(cart), hggMrnaFoldRegion, table, hggMrnaFoldPs, psName, hggDoRnaFoldDisplay, "picture"); hPrintf(" Picture "); hPrintf("</A>"); webPrintLinkCellEnd(); /* Print link to PostScript. */ webPrintLinkCellStart(); hPrintf("<A HREF=\"%s\" class=\"toc\">", psName); hPrintf(" PostScript "); hPrintf("</A>"); webPrintLinkCellEnd(); /* Print link to text. */ webPrintLinkCellStart(); hPrintf("<A HREF=\"%s?%s&%s=%s&%s=%s\" class=\"toc\" TARGET=_blank>", geneCgi, cartSidUrlString(cart), hggMrnaFoldRegion, table, hggDoRnaFoldDisplay, "text"); hPrintf(" Text "); hPrintf("</A>"); webPrintLinkCellEnd(); } sqlFreeResult(&sr); } webPrintLinkTableEnd(); hPrintf("<BR>The RNAfold program from the "); hPrintf("<A HREF=\"http://www.tbi.univie.ac.at/~ivo/RNA/\" TARGET=_blank>"); hPrintf("Vienna RNA Package</A> is used to perform the "); hPrintf("secondary structure predictions and folding calculations. "); hPrintf("The estimated folding energy is in kcal/mol. The more "); hPrintf("negative the energy, the more secondary structure the RNA "); hPrintf("is likely to have."); }
static void otherOrgsPrint(struct section *section, struct sqlConnection *conn, char *geneId) /* Print the otherOrgs section. */ { struct otherOrg *otherOrg, *otherOrgList = section->items; hPrintf( "Orthologies between human, mouse, and rat are computed by taking the " "best BLASTP hit, and filtering out non-syntenic hits. For " "more distant species reciprocal-best BLASTP hits are used. " "Note that the absence of an ortholog in the table below may " "reflect incomplete annotations in the other species rather than " "a true absence of the orthologous gene."); webPrintLinkTableStart(); for (otherOrg = otherOrgList; otherOrg != NULL; otherOrg = otherOrg->next) webPrintLabelCell(otherOrg->shortLabel); hPrintf("</TR>\n<TR>"); for (otherOrg = otherOrgList; otherOrg != NULL; otherOrg = otherOrg->next) { char *pos = otherOrgPosition(otherOrg, conn, geneId); otherOrgPrintLink(otherOrg, "Genome Browser", "No ortholog", TRUE, pos, otherOrg->genomeUrl); freeMem(pos); } hPrintf("</TR>\n<TR>"); for (otherOrg = otherOrgList; otherOrg != NULL; otherOrg = otherOrg->next) { char *id = otherOrgId(otherOrg, conn, geneId); otherOrgPrintLink(otherOrg, "Gene Details", " ", TRUE, id, otherOrg->geneUrl); freeMem(id); } hPrintf("</TR>\n<TR>"); for (otherOrg = otherOrgList; otherOrg != NULL; otherOrg = otherOrg->next) { char *id = otherOrgId(otherOrg, conn, geneId); otherOrgPrintLink(otherOrg, "Gene Sorter", " ", TRUE, id, otherOrg->sorterUrl); freeMem(id); } hPrintf("</TR>\n<TR>"); for (otherOrg = otherOrgList; otherOrg != NULL; otherOrg = otherOrg->next) { char *id = otherOrgId(otherOrg, conn, geneId); id = otherOrgExternalId(otherOrg, id); otherOrgPrintLink(otherOrg, otherOrg->otherName, " ", FALSE, id, otherOrg->otherUrl); freeMem(id); } hPrintf("</TR>\n<TR>"); for (otherOrg = otherOrgList; otherOrg != NULL; otherOrg = otherOrg->next) { char *id = otherOrgProteinId(otherOrg, conn, geneId); otherOrgPepLink(otherOrg, hggDoOtherProteinSeq, "Protein Sequence", id, conn); freeMem(id); } hPrintf("</TR>\n<TR>"); for (otherOrg = otherOrgList; otherOrg != NULL; otherOrg = otherOrg->next) { char *id = otherOrgProteinId(otherOrg, conn, geneId); otherOrgPepLink(otherOrg, hggDoOtherProteinAli, "Alignment", id, conn); freeMem(id); } webPrintLinkTableEnd(); }
static void prCellLabelVal(char *label, char *val) /* print label and value as adjacent cells */ { webPrintLabelCell(label); webPrintLinkCell(val); }
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); }