7d996b1e817d9d620d8655f1bc47de453f35fad3 fanhsu Thu Jul 21 14:12:26 2011 -0700 Updated functions for COSMIC and OMIM. diff --git src/hg/hgc/hgc.c src/hg/hgc/hgc.c index 31e14dc..df677c1 100644 --- src/hg/hgc/hgc.c +++ src/hg/hgc/hgc.c @@ -9158,31 +9158,34 @@ chromosome = row[ii];ii++; grch37_start = row[ii];ii++; grch37_stop = row[ii];ii++; mut_nt = row[ii];ii++; mut_aa = row[ii];ii++; tumour_site = row[ii];ii++; mutated_samples = row[ii];ii++; examined_samples = row[ii];ii++; mut_freq = row[ii];ii++; chp = strstr(itemName, "COSM")+strlen("COSM"); printf("<B>COSMIC ID:</B> %s", chp); printf(" (click <A HREF=\"%s&id=%s\" TARGET=_BLANK>here</A> for more details at COSMIC site)\n", url, chp); - printf("<BR><B>Source:</B> %s\n", source); + // Embed URL to COSMIC site per COSMICT request. + printf("<BR><B>Source:</B> "); + printf("<A HREF=\"http://www.sanger.ac.uk/cosmic/\" TARGET=_BLANK>%s</A>\n", source); + printf("<BR><B>Gene Name:</B> %s\n", gene_name); printf("<BR><B>Accession Number:</B> %s\n", accession_number); printf("<BR><B>Genomic Position:</B> %s:%s-%s", chromosome, grch37_start, grch37_stop); printf("<BR><B>Mutation Description:</B> %s\n", mut_description); printf("<BR><B>Mutation Syntax CDS:</B> %s\n", mut_syntax_cds); printf("<BR><B>Mutation Syntax AA:</B> %s\n", mut_syntax_aa); printf("<BR><B>Mutation NT:</B> %s\n", mut_nt); printf("<BR><B>Mutation AA:</B> %s\n", mut_aa); safef(query2, sizeof(query2), "select count(tumour_site) from cosmicRaw where cosmic_mutation_id='%s'", itemName); sr2 = sqlMustGetResult(conn2, query2); row2 = sqlNextRow(sr2); if ((atoi(row2[0])) > 1) @@ -9209,30 +9212,79 @@ int ii; ii=0; tumour_site = row2[ii];ii++; mutated_samples = row2[ii];ii++; examined_samples = row2[ii];ii++; mut_freq = row2[ii];ii++; if (multipleTumorSites) printf("<BR>"); printf("<BR><B>%sTumour Site:</B> %s\n", indentString, tumour_site); printf("<BR><B>%sMutated Samples:</B> %s\n", indentString, mutated_samples); printf("<BR><B>%sExamined Samples:</B> %s\n", indentString, examined_samples); printf("<BR><B>%sMutation Frequency:</B> %s\n", indentString, mut_freq); row2 = sqlNextRow(sr2); } sqlFreeResult(&sr2); + + safef(query2, sizeof(query2), + "select sum(mutated_samples) from cosmicRaw where cosmic_mutation_id='%s'", + itemName); + + sr2 = sqlMustGetResult(conn2, query2); + row2 = sqlNextRow(sr2); + if (row2 != NULL) + { + printf("<BR><BR><B>Total Mutated Samples:</B> %s\n", row2[0]); + //printf("<br>%s ", row2[0]); + } + sqlFreeResult(&sr2); + + safef(query2, sizeof(query2), + "select sum(examined_samples) from cosmicRaw where cosmic_mutation_id='%s'", + itemName); +//printf("<br>%s\n", query2);fflush(stdout); + sr2 = sqlMustGetResult(conn2, query2); + row2 = sqlNextRow(sr2); + if (row2 != NULL) + { + printf("<BR><B>Total Examined Samples:</B> %s\n", row2[0]); + //printf("%s", row2[0]); + //fflush(stdout); + } + sqlFreeResult(&sr2); + safef(query2, sizeof(query2), + "select sum(mutated_samples)*100/sum(examined_samples) from cosmicRaw where cosmic_mutation_id='%s'", + itemName); + sr2 = sqlMustGetResult(conn2, query2); + row2 = sqlNextRow(sr2); + if (row2 != NULL) + { + char *chp; + chp = strstr(row2[0], "."); + if ((chp != NULL) && (strlen(chp) > 3)) + { + chp++; + chp++; + chp++; + chp++; + *chp = '\0'; + } + printf("<BR><B>Total Mutation Frequency:</B> %s%c\n", row2[0], '%'); + //printf("<br>%s", row2[0]); + } + sqlFreeResult(&sr2); + } sqlFreeResult(&sr); hFreeConn(&conn); printf("<HR>"); printPosOnChrom(chrom, atoi(chromStart), atoi(chromEnd), NULL, FALSE, itemName); } void doCosmic(struct trackDb *tdb, char *item) /* Put up COSMIC track info. */ { genericHeader(tdb, item); printCosmicDetails(tdb, item); printTrackHtml(tdb); @@ -9501,30 +9553,35 @@ printf(", "); printf("<A HREF=\"%s%s&hgg_chrom=none\" target=_blank>", "../cgi-bin/hgGene?hgg_gene=", row[0]); printf("%s</A></B>", row[0]); printedCnt++; } if (printedCnt >= 1) printf("<BR>\n"); } sqlFreeResult(&sr); } } printf("<HR>"); printPosOnChrom(chrom, atoi(chromStart), atoi(chromEnd), NULL, FALSE, itemName); } +// old name to be changed later +#define omimPhenotypeClassColName "phenotypeClass" +// new name to be used later +//#define omimPhenotypeClassColName "omimPhenoMapKey" + void printOmimGene2Details(struct trackDb *tdb, char *itemName, boolean encode) /* Print details of an omimGene2 entry. */ { struct sqlConnection *conn = hAllocConn(database); char query[256]; struct sqlResult *sr; char **row; char *url = tdb->url; char *title1 = NULL; char *title2 = NULL; char *geneSymbol = NULL; char *chrom, *chromStart, *chromEnd; chrom = cartOptionalString(cart, "c"); chromStart = cartOptionalString(cart, "o"); @@ -9567,32 +9624,32 @@ { geneSymbol = cloneString(row[0]); } sqlFreeResult(&sr); if (geneSymbol!= NULL) { boolean disorderShown; char *phenotypeClass, *phenotypeId, *disorder; printf("<B>Gene symbol(s):</B> %s", geneSymbol); printf("<BR>\n"); /* display disorder(s) */ safef(query, sizeof(query), - "select description, phenotypeClass, phenotypeId from omimPhenotype where omimId=%s order by description", - itemName); + "select description, %s, phenotypeId from omimPhenotype where omimId=%s order by description", + omimPhenotypeClassColName, itemName); sr = sqlMustGetResult(conn, query); disorderShown = FALSE; while ((row = sqlNextRow(sr)) != NULL) { if (!disorderShown) { printf("<B>Disorder(s):</B><UL>\n"); disorderShown = TRUE; } disorder = row[0]; phenotypeClass = row[1]; phenotypeId = row[2]; printf("<LI>%s", disorder); if (phenotypeId != NULL) { @@ -9746,32 +9803,32 @@ { geneSymbol = cloneString(row[0]); } sqlFreeResult(&sr); safef(query, sizeof(query),"select omimId from omimPhenotype where omimId=%s\n", omimId); if (sqlQuickNum(conn, query) > 0) { char *phenotypeClass, *phenotypeId, *disorder; printf("<B>Gene symbol(s):</B> %s", geneSymbol); printf("<BR>\n"); /* display disorder for genes in morbidmap */ safef(query, sizeof(query), - "select description, phenotypeClass, phenotypeId from omimPhenotype where omimId=%s order by description", - itemName); + "select description, %s, phenotypeId from omimPhenotype where omimId=%s order by description", + omimPhenotypeClassColName, itemName); sr = sqlMustGetResult(conn, query); printf("<B>Disorder(s):</B><UL>\n"); while ((row = sqlNextRow(sr)) != NULL) { disorder = row[0]; phenotypeClass = row[1]; phenotypeId = row[2]; printf("<LI>%s", disorder); if (phenotypeId != NULL) { if (!sameWord(phenotypeId, "-1")) { printf(" (phenotype <A HREF=\"%s%s\" target=_blank>", url, phenotypeId); printf("%s</A></B>)", phenotypeId); } @@ -9897,30 +9954,34 @@ char *title2 = NULL; char *chrom, *chromStart, *chromEnd; char *omimId; char *avId; char *dbSnpId; char *chp; char *seqId = NULL; char avString[255]; char *avDesc = NULL; chrom = cartOptionalString(cart, "c"); chromStart = cartOptionalString(cart, "o"); chromEnd = cartOptionalString(cart, "t"); avId = strdup(itemName); + +chp = strstr(avId, "-"); +if (chp != NULL) *chp = '\0'; + safef(avString, sizeof(avString), "%s", itemName); chp = strstr(itemName, "."); *chp = '\0'; omimId = strdup(itemName); chp = avString; chp = strstr(avString, "."); *chp = '#'; if (url != NULL && url[0] != 0) { safef(query, sizeof(query), "select title1, title2, format(seqNo/10000,4), v.description from omimGeneMap m, omimAv v where m.omimId=%s and m.omimId=v.omimId and v.avId='%s';", itemName, avId);