9d6fd6ec96984d7ffb645436ab109b03d5b0b151 markd Fri Feb 10 23:12:21 2012 -0800 Fixed various GENCODE hgc layout problems RM: 6872 diff --git src/hg/hgc/gencodeClick.c src/hg/hgc/gencodeClick.c index c8d6260..6520e75 100644 --- src/hg/hgc/gencodeClick.c +++ src/hg/hgc/gencodeClick.c @@ -182,247 +182,248 @@ } static void writeBasicInfoHtml(struct trackDb *tdb, char *gencodeId, struct genePred *transAnno, struct wgEncodeGencodeAttrs *transAttrs, int geneChromStart, int geneChromEnd, struct wgEncodeGencodeGeneSource *geneSource, struct wgEncodeGencodeTranscriptSource *transcriptSource, bool haveTsl, struct wgEncodeGencodeTranscriptionSupportLevel *tsl) /* write basic HTML info for all genes */ { /* * notes: * - According to Steve: `status' is not the same for ensembl and havana. So either avoid displaying it * or display it as `automatic status' or `manual status'. */ // basic gene and transcript information -printf("\n"); +printf("
\n"); printf("\n"); printf("\n"); printf("\n"); printf("\n"); -// FIXME: white-space style should be in CCS, but don't want to risk breaking -// other things. printf("\n"); printf("\n", transAnno->strand); printf("\n", transAttrs->transcriptType, transAttrs->geneType); /* FIXME: add href o */ printf("\n", transAttrs->transcriptStatus, transAttrs->geneStatus); printf("\n", getLevelDesc(transAttrs->level), transAttrs->level); printf("\n", getMethodDesc(transcriptSource->source), getMethodDesc(geneSource->source)); if (haveTsl) { char *tslDesc = getSupportLevelDesc(tsl); printf("\n", tslDesc, tslDesc); } printf("\n", transAttrs->geneName); printf("\n", transAttrs->ccdsId); // FIXME: add sequence here?? printf("
TranscriptGene
Gencode id"); prTdExtIdAnchor(tdb, transAttrs->transcriptId, "ensemblTranscriptIdUrl"); prTdExtIdAnchor(tdb, transAttrs->geneId, "ensemblGeneIdUrl"); printf("
HAVANA manual id"); prTdExtIdAnchor(tdb, transAttrs->havanaTranscriptId, "vegaTranscriptIdUrl"); prTdExtIdAnchor(tdb, transAttrs->havanaGeneId, "vegaGeneIdUrl"); printf("
Position"); -printf(""); +printf(""); writePosLink(transAnno->chrom, transAnno->txStart, transAnno->txEnd); -printf(""); +printf(""); writePosLink(transAnno->chrom, geneChromStart, geneChromEnd); printf("
Strand%s
Biotype%s%s
Status%s%s
Annotation Level%s (%d)
Annotation Method%s%s
Transcription Support Level%s
HUGO gene%s
CCDS%s
\n"); } static void writeSequenceHtml(struct trackDb *tdb, char *gencodeId, struct genePred *transAnno) /* write links to get sequences */ { printf("\n"); printf("\n"); printf("\n"); if (transAnno->cdsStart < transAnno->cdsEnd) { // protein coding - printf("\n"); } else { // non-protein coding - printf("\n"); + printf("Predicted mRNA\n"); } printf("
Sequences
"); + printf("
"); hgcAnchorSomewhere("htcGeneMrna", gencodeId, tdb->table, seqName); printf("Predicted mRNA"); - printf(""); + printf(""); hgcAnchorSomewhere("htcTranslatedPredMRna", gencodeId, "translate", seqName); printf("Predicted protein
"); + printf("
"); hgcAnchorSomewhere("htcGeneMrna", gencodeId, tdb->table, seqName); - printf("Predicted mRNA
\n"); } static void writeAnnotationRemarkHtml(struct wgEncodeGencodeAnnotationRemark *remarks) /* write HTML links to remarks */ { printf("\n"); printf("\n"); printf("\n"); +// make sure at least one empty row in printed +if (remarks == NULL) + printf("\n"); struct wgEncodeGencodeAnnotationRemark *remark; for (remark = remarks; remark != NULL; remark = remark->next) { char *encRemark = htmlEncode(remark->remark); printf("\n", encRemark); freeMem(encRemark); } printf("
Annotation Remarks
%s
\n"); } static void writePdbLinkHtml(struct wgEncodeGencodePdb *pdbs) /* write HTML links to PDB */ { printf("\n"); printf("\n"); printf("\n"); struct wgEncodeGencodePdb *pdb = pdbs; int i, rowCnt = 0; while ((pdb != NULL) || (rowCnt == 0)) { printf(""); for (i = 0; i < 3; i++) { - printf("\n"); rowCnt++; } printf("
Protein Data Bank
"); + printf(""); if (pdb != NULL) { printf("%s", pdb->pdbId, pdb->pdbId); pdb = pdb->next; } } printf("
\n"); } static void writePubMedEntry(struct wgEncodeGencodePubMed *pubMed) /* write HTML table entry for a pubMed */ { -printf("pubMedId); printf("\" target=_blank>%d", pubMed->pubMedId); } static void writePubMedLinkHtml(struct wgEncodeGencodePubMed *pubMeds) /* write HTML links to PubMed */ { printf("\n"); printf("\n"); printf("\n"); struct wgEncodeGencodePubMed *pubMed = pubMeds; int i, rowCnt = 0; while ((pubMed != NULL) || (rowCnt == 0)) { printf(""); for (i = 0; i < 3; i++) { if (pubMed != NULL) { writePubMedEntry(pubMed); pubMed = pubMed->next; } else - printf("\n"); rowCnt++; } printf("
PubMed
"); + printf(""); } printf("
\n"); } static void writeRefSeqEntry(struct wgEncodeGencodeRefSeq *refSeq) /* write HTML table entry for a RefSeq */ { -printf("rnaAcc); printf("\" target=_blank>%s", refSeq->rnaAcc); -printf(""); +printf(""); if (!isEmpty(refSeq->pepAcc)) { printf("pepAcc); printf("\" target=_blank>%s", refSeq->pepAcc); } } static void writeRefSeqLinkHtml(struct wgEncodeGencodeRefSeq *refSeqs) /* write HTML links to RefSeq */ { printf("\n"); printf("\n"); -printf("\n"); +printf("\n"); printf("\n"); struct wgEncodeGencodeRefSeq *refSeq = refSeqs; int rowCnt = 0; while ((refSeq != NULL) || (rowCnt == 0)) { printf(""); if (refSeq != NULL) { writeRefSeqEntry(refSeq); refSeq = refSeq->next; } else - printf("\n"); rowCnt++; } printf("
RefSeq
RNAProtein
RNAProtein
"); + printf(""); printf("
\n"); } static void writeUniProtEntry(struct wgEncodeGencodeUniProt *uniProt) /* write HTML table entry for a UniProt */ { -printf("%s", (uniProt->dataset == wgEncodeGencodeUniProtSwissProt) ? "SwissProt" : "TrEMBL"); -printf("%s", (uniProt->dataset == wgEncodeGencodeUniProtSwissProt) ? "SwissProt" : "TrEMBL"); +printf("acc); printf("\" target=_blank>%s", uniProt->acc); -printf("name); printf("\" target=_blank>%s", uniProt->name); } static void writeUniProtLinkHtml(struct wgEncodeGencodeUniProt *uniProts) /* write HTML links to UniProt */ { printf("\n"); printf("\n"); -printf("\n"); +printf("\n"); printf("\n"); int i, rowCnt = 0; struct wgEncodeGencodeUniProt *uniProt = uniProts; while ((uniProt != NULL) || (rowCnt == 0)) { printf(""); for (i = 0; i < 2; i++) { if (uniProt != NULL) { writeUniProtEntry(uniProt); uniProt = uniProt->next; } else - printf("\n"); rowCnt++; } printf("
UniProt
Data setAccessionNameData setAccessionName
Data setAccessionNameData setAccessionName
"); + printf(""); } printf("
\n"); } struct supportEvid /* temporary struct for subset of supporting information displayed */ { struct supportEvid *next; char *seqId; /* sequence id (memory not owned) */ char *seqSrc; /* evidence source database (memory not owned) */ }; @@ -485,93 +486,93 @@ static struct supportEvid *loadSupportEvid(struct wgEncodeGencodeTranscriptSupport *transcriptSupports, struct wgEncodeGencodeExonSupport *exonSupports) /* load transcript and supporting evidence into a common structure */ { struct supportEvid *supportEvids = NULL; transcriptSupportToSupportEvid(&supportEvids, transcriptSupports); exonSupportToSupportEvid(&supportEvids, exonSupports); sortUniqSupportExidence(&supportEvids); return supportEvids; } static void writeSupportExidenceEntry(struct supportEvid *supportEvid) /* write HTML table entry for a supporting evidence */ { // FIXME: should link to sources when possible -printf("%s", supportEvid->seqSrc); -printf("%s", supportEvid->seqId); +printf("%s", supportEvid->seqSrc); +printf("%s", supportEvid->seqId); } static void writeSupportingEvidenceLinkHtml(struct wgEncodeGencodeTranscriptSupport *transcriptSupports, struct wgEncodeGencodeExonSupport *exonSupports) /* write HTML links to supporting evidence */ { struct supportEvid *supportEvids = loadSupportEvid(transcriptSupports, exonSupports); printf("\n"); printf("\n"); -printf("\n"); +printf("\n"); printf("\n"); struct supportEvid *supportEvid = supportEvids; int i, rowCnt = 0; while ((supportEvid != NULL) || (rowCnt == 0)) { printf(""); for (i = 0; i < 2; i++) { if (supportEvid != NULL) { writeSupportExidenceEntry(supportEvid); supportEvid = supportEvid->next; } else - printf("\n"); rowCnt++; } printf("
Supporting Evidence
SourceSequenceSourceSequence
SourceSequenceSourceSequence
"); + printf(""); } printf("
\n"); slFreeList(&supportEvids); } static void writeTagEntry(struct wgEncodeGencodeTag *tag) /* write HTML table entry for a Tag */ { -// FIXME: link to help -printf("%s", tag->tag); +// FIXME: link to help once gencodegenes.org has it +printf("%s", tag->tag); } static void writeTagLinkHtml(struct wgEncodeGencodeTag *tags) /* write HTML links to Tag */ { printf("\n"); printf("\n"); printf("\n"); int i, rowCnt = 0; struct wgEncodeGencodeTag *tag = tags; while ((tag != NULL) || (rowCnt == 0)) { printf(""); for (i = 0; i < 3; i++) { if (tag != NULL) { writeTagEntry(tag); tag = tag->next; } else - printf("\n"); rowCnt++; } printf("
Tags
"); + printf(""); } printf("
\n"); } static void doGencodeGeneTrack(struct trackDb *tdb, char *gencodeId, struct sqlConnection *conn, struct genePred *transAnno) /* Process click on a GENCODE gene annotation track. */ { struct wgEncodeGencodeAttrs *transAttrs = transAttrsLoad(tdb, conn, gencodeId); char *gencodeGeneId = transAttrs->geneId; struct wgEncodeGencodeGeneSource *geneSource = metaDataLoad(tdb, conn, gencodeGeneId, "wgEncodeGencodeGeneSource", "geneId", sqlQueryMust|sqlQuerySingle, (sqlLoadFunc)wgEncodeGencodeGeneSourceLoad); struct wgEncodeGencodeTranscriptSource *transcriptSource = metaDataLoad(tdb, conn, gencodeId, "wgEncodeGencodeTranscriptSource", "transcriptId", sqlQueryMust|sqlQuerySingle, (sqlLoadFunc)wgEncodeGencodeTranscriptSourceLoad); bool haveRemarks = (trackDbSetting(tdb, "wgEncodeGencodeAnnotationRemark") != NULL);