2c4c813bcb91cf575584d868a1d145f3a3bc6416 kate Mon Nov 17 00:28:14 2014 -0800 Add peptide table with sequence and other info for details page. refs #25054 diff --git src/hg/hgc/hgc.c src/hg/hgc/hgc.c index dd3c9fc..9b6ba86 100644 --- src/hg/hgc/hgc.c +++ src/hg/hgc/hgc.c @@ -40,30 +40,31 @@ #include "agpGap.h" #include "ctgPos.h" #include "contigAcc.h" #include "ctgPos2.h" #include "clonePos.h" #include "bactigPos.h" #include "rmskOut.h" #include "xenalign.h" #include "isochores.h" #include "simpleRepeat.h" #include "cpgIsland.h" #include "cpgIslandExt.h" #include "genePred.h" #include "genePredReader.h" #include "pepPred.h" +#include "peptideAtlasPeptide.h" #include "wabAli.h" #include "genomicDups.h" #include "est3.h" #include "rnaGene.h" #include "tRNAs.h" #include "gbRNAs.h" #include "encode/encodeRna.h" #include "hgMaf.h" #include "maf.h" #include "stsMarker.h" #include "stsMap.h" #include "rhMapZfishInfo.h" #include "recombRate.h" #include "recombRateRat.h" #include "recombRateMouse.h" @@ -20816,30 +20817,101 @@ "select * from sgdOtherDescription where name = '%s'", item); sr = sqlGetResult(conn, query); while ((row = sqlNextRow(sr)) != NULL) { sgdDescriptionStaticLoad(row, &sgd); dyStringPrintf(dy, "Description: %s
\n", sgd.description); dyStringPrintf(dy, "Type: %s
\n", sgd.type); } sqlFreeResult(&sr); } hFreeConn(&conn); genericClickHandlerPlus(tdb, item, NULL, dy->string); dyStringFree(&dy); } + +void doPeptideAtlas(struct trackDb *tdb, char *item) +/* PeptideAtlas item details display. Peptide details are in hgFixed.Peptides */ +{ +char query[512]; +struct sqlResult *sr; +char **row; + +int start = cartInt(cart, "o"); +int end = cartInt(cart, "t"); + +genericHeader(tdb, item); +printCustomUrl(tdb, item, FALSE); +struct sqlConnection *conn = hAllocConn(database); +char peptideTable[128]; +safef(peptideTable, sizeof(peptideTable), "%sPeptides", tdb->table); + +// peptide info +struct sqlConnection *connFixed= hAllocConn("hgFixed"); +if (sqlTableExists(connFixed, peptideTable)) + { + sqlSafef(query, sizeof(query), "select * from %s where accession = '%s'", peptideTable, item); + sr = sqlGetResult(connFixed, query); + row = sqlNextRow(sr); + if (row != NULL) + { + struct peptideAtlasPeptide *peptideInfo; + AllocVar(peptideInfo); + peptideAtlasPeptideStaticLoad(row, peptideInfo); + printf("Peptide sequence: %s
\n", peptideInfo->sequence); + printf("Peptide size: %d
\n", (int)strlen(peptideInfo->sequence)); + printf("Samples where observed: %d
\n", peptideInfo->sampleCount); + printf("Proteotypic score: %.3f
\n", peptideInfo->proteotypicScore); + printf("Hydrophobicity: %.3f

\n", peptideInfo->hydrophobicity); + } + sqlFreeResult(&sr); + } +hFreeConn(&connFixed); + +// peptide mappings +sqlSafef(query, sizeof(query), "select * from %s where name = '%s' order by chrom, chromStart, chromEnd", + tdb->table, item); +sr = sqlGetResult(conn, query); +row = sqlNextRow(sr); +struct bed *bed = NULL, *beds = NULL; +int rowOffset = hOffsetPastBin(database, seqName, tdb->table); +while (row != NULL) + { + bed = bedLoadN(row + rowOffset, 12); + if (sameString(bed->chrom, seqName) && bed->chromStart == start && bed->chromEnd == end) + bedPrintPos(bed, 12, tdb); + else + slAddHead(&beds, bed); + row = sqlNextRow(sr); + } +if (beds != NULL) + { + slSort(&beds, bedCmp); + printf("
Other mappings of this peptide: %d
\n", slCount(beds)); + for (bed = beds; bed != NULL; bed = bed->next) + { + printf("    " + "", + hgTracksPathAndSettings(), database, bed->chrom, bed->chromStart+1, bed->chromEnd); + printf("%s:%d-%d
\n", bed->chrom, bed->chromStart+1, bed->chromEnd); + } + } +hFreeConn(&conn); +printTrackHtml(tdb); +} + static void doSgdClone(struct trackDb *tdb, char *item) /* Display information about other Sacchromyces Genome Database * other (not-coding gene) info. */ { struct sqlConnection *conn = hAllocConn(database); struct dyString *dy = dyStringNew(1024); if (sqlTableExists(conn, "sgdClone")) { /* print out url with ATCC number */ struct sgdClone sgd; struct sqlResult *sr; char query[256], **row; sqlSafef(query, sizeof(query), "select * from sgdClone where name = '%s'", item); @@ -21984,30 +22056,31 @@ if (hTableExists(database, "anoEstExpressed")) { char query[512]; sqlSafef(query, sizeof(query), "select 1 from anoEstExpressed where name = '%s'", item); if (sqlQuickNum(conn, query)) puts("Expressed: yes
"); else puts("Expressed: no
"); } hFreeConn(&conn); printTrackHtml(tdb); } + void mammalPsgTableRow(char *test, char *description, float pVal, unsigned isFdrSignificant) /* print single row of the overview table for mammal PSG track */ { char *start = ""; char *end = ""; if (isFdrSignificant) { start = ""; end = ""; } if (pVal<=1) { printf("\n", @@ -25599,45 +25672,48 @@ { doQPCRPrimers(tdb, item); } else if (sameString("lrg", table)) { doLrg(tdb, item); } else if (sameString("lrgTranscriptAli", table)) { doLrgTranscriptPsl(tdb, item); } else if (sameWord(table, "htcLrgCdna")) { htcLrgCdna(item); } +else if (startsWith("peptideAtlas", table)) + { + doPeptideAtlas(tdb, item); + } else if (isHubTrack(table) && startsWith("snake", trackHubSkipHubName(table))) { doSnakeClick(tdb, item); } #ifdef USE_TABIX else if (tdb != NULL && startsWithWord("vcfTabix", tdb->type)) { doVcfTabixDetails(tdb, item); } #endif // USE_TABIX else if (tdb != NULL && startsWithWord("vcf", tdb->type)) { doVcfDetails(tdb, item); } - else if (tdb != NULL) { genericClickHandler(tdb, item, NULL); } else { cartWebStart(cart, database, "%s", track); printf("Sorry, clicking there doesn't do anything yet (%s).", track); } /* End of 1000+ line dispatch on table involving 100+ if/elses. */ cartHtmlEnd(); } struct hash *orgDbHash = NULL;
%s%s%s%s%s%s%s%.02g%s