7ab28d1f5d3428156b5d5831426591e9df121b08 angie Fri Sep 13 12:19:12 2013 -0700 New and improved Database of Genomic Variants (DGV). It is now acomposite track as requested by the submitter, and the tables have more columns than the older dgv tables. The track description needs to be updated to make more clear what DGV gets from dbVar/DGVa and what it adds. refs #11200 diff --git src/hg/hgc/hgc.c src/hg/hgc/hgc.c index 5ce66e1..8595ce4 100644 --- src/hg/hgc/hgc.c +++ src/hg/hgc/hgc.c @@ -77,30 +77,31 @@ #include "snp.h" #include "snpMap.h" #include "snpExceptions.h" #include "snp125Exceptions.h" #include "snp125CodingCoordless.h" #include "cnpIafrate.h" #include "cnpIafrate2.h" #include "cnpLocke.h" #include "cnpSebat.h" #include "cnpSebat2.h" #include "cnpSharp.h" #include "cnpSharp2.h" #include "delHinds2.h" #include "delConrad2.h" #include "dgv.h" +#include "dgvPlus.h" #include "tokenizer.h" #include "softberryHom.h" #include "borkPseudoHom.h" #include "sanger22extra.h" #include "refLink.h" #include "hgConfig.h" #include "estPair.h" #include "softPromoter.h" #include "customTrack.h" #include "trackHub.h" #include "hubConnect.h" #include "sage.h" #include "sageExp.h" #include "pslWScore.h" #include "lfs.h" @@ -16137,30 +16138,143 @@ } printf("<B>Variant Type:</B> %s<BR>\n", dgv.varType); printf("<B>Reference:</B> <A HREF=\""); printEntrezPubMedUidAbstractUrl(stdout, dgv.pubMedId); printf("\" TARGET=_BLANK>%s</A><BR>\n", dgv.reference); printf("<B>Method/platform:</B> %s<BR>\n", dgv.method); printf("<B>Sample:</B> %s<BR>\n", dgv.sample); if (isNotEmpty(dgv.landmark)) printf("<B>Landmark:</B> %s<BR>\n", dgv.landmark); } sqlFreeResult(&sr); hFreeConn(&conn); printTrackHtml(tdb); } +#define CORIELL_ID_URL_BASE "http://ccr.coriell.org/Sections/Search/Sample_Detail.aspx?Ref=" + +static void maybePrintCoriellLinks(char *commaSepIds) +/* If id looks like a Coriell ID, print a link to Coriell, otherwise just print id. */ +{ +struct slName *id, *sampleIds = slNameListFromComma(commaSepIds); +for (id = sampleIds; id != NULL; id = id->next) + { + if (startsWith("NA", id->name) && countLeadingDigits(id->name+2) == strlen(id->name+2)) + { + // I don't know why coriell doesn't have direct links to NA's but oh well, + // we can substitute 'GM' for 'NA' to get to the page... + char *gmId = cloneString(id->name); + gmId[0] = 'G'; gmId[1] = 'M'; + printf("<A HREF=\""CORIELL_ID_URL_BASE"%s\" TARGET=_BLANK>%s</A>", gmId, id->name); + freeMem(gmId); + } + else + printf("%s", id->name); + if (id->next != NULL) + printf(", "); + } +slNameFreeList(&sampleIds); +} + +static void printBrowserPosLinks(char *commaSepIds) +/* Print hgTracks links with position=id. */ +{ +struct slName *id, *sampleIds = slNameListFromComma(commaSepIds); +for (id = sampleIds; id != NULL; id = id->next) + { + char *searchTerm = cgiEncode(trimSpaces(id->name)); + printf("<A HREF=\"%s&position=%s\">%s</A>", hgTracksPathAndSettings(), searchTerm, id->name); + if (id->next != NULL) + printf(", "); + freeMem(searchTerm); + } +slNameFreeList(&sampleIds); +} + +void doDgvPlus(struct trackDb *tdb, char *id) +/* Details for Database of Genomic Variants, July 2013 and later. */ +{ +struct dgvPlus dgv; +struct sqlConnection *conn = hAllocConn(database); +struct sqlResult *sr; +char **row; +char query[512]; +int rowOffset = hOffsetPastBin(database, seqName, tdb->table); +int start = cartInt(cart, "o"); +int end = cartInt(cart, "t"); +genericHeader(tdb, id); +printCustomUrl(tdb, id, FALSE); + +sqlSafef(query, sizeof(query), "select * from %s where name = '%s' " + "and chrom = '%s' and chromStart = %d and chromEnd = %d", + tdb->table, id, seqName, start, end); +sr = sqlGetResult(conn, query); +while ((row = sqlNextRow(sr)) != NULL) + { + dgvPlusStaticLoad(row+rowOffset, &dgv); + printf("<B>Position:</B> " + "<A HREF=\"%s&db=%s&position=%s%%3A%d-%d\">%s:%d-%d</A><BR>\n", + hgTracksPathAndSettings(), database, + dgv.chrom, dgv.chromStart+1, dgv.chromEnd, + dgv.chrom, dgv.chromStart+1, dgv.chromEnd); + printBand(dgv.chrom, dgv.chromStart, dgv.chromEnd, FALSE); + printf("<B>Genomic size:</B> %d<BR>\n", dgv.chromEnd - dgv.chromStart); + printf("<B>Variant type:</B> %s<BR>\n", dgv.varType); + printf("<B>Reference:</B> <A HREF=\""); + printEntrezPubMedUidAbstractUrl(stdout, dgv.pubMedId); + printf("\" TARGET=_BLANK>%s</A><BR>\n", dgv.reference); + printf("<B>Method:</B> %s<BR>\n", dgv.method); + if (isNotEmpty(dgv.platform)) + printf("<B>Platform:</B> %s<BR>\n", dgv.platform); + if (isNotEmpty(dgv.cohortDescription)) + printf("<B>Sample cohort description:</B> %s<BR>\n", dgv.cohortDescription); + if (isNotEmpty(dgv.samples)) + { + printf("<B>Sample IDs:</B> "); + maybePrintCoriellLinks(dgv.samples); + printf("<BR>\n"); + } + printf("<B>Sample size:</B> %u<BR>\n", dgv.sampleSize); + if (dgv.observedGains != 0 || dgv.observedLosses != 0) + { + printf("<B>Observed gains:</B> %u<BR>\n", dgv.observedGains); + printf("<B>Observed losses:</B> %u<BR>\n", dgv.observedLosses); + } + if (isNotEmpty(dgv.mergedVariants)) + { + printf("<B>Merged variants:</B> "); + printBrowserPosLinks(dgv.mergedVariants); + printf("<BR>\n"); + } + if (isNotEmpty(dgv.supportingVariants)) + { + printf("<B>Supporting variants:</B> "); + printBrowserPosLinks(dgv.supportingVariants); + printf("<BR>\n"); + } + if (isNotEmpty(dgv.genes)) + { + printf("<B>Genes:</B> "); + printBrowserPosLinks(dgv.genes); + printf("<BR>\n"); + } + } +sqlFreeResult(&sr); +hFreeConn(&conn); +printTrackHtml(tdb); +} + void doAffy120K(struct trackDb *tdb, char *itemName) /* Put up info on an Affymetrix SNP. */ { char *table = tdb->table; struct snp snp; int start = cartInt(cart, "o"); struct sqlConnection *conn = hAllocConn(database); struct sqlResult *sr; char **row; char query[256]; int rowOffset; cartWebStart(cart, database, "Single Nucleotide Polymorphism (SNP)"); printf("<H2>Single Nucleotide Polymorphism (SNP) %s</H2>\n", itemName); sqlSafef(query, sizeof query, "select * " @@ -24642,30 +24756,34 @@ { doCnpSharp2(tdb, item); } else if (sameWord(table, "delHinds2")) { doDelHinds2(tdb, item); } else if (sameWord(table, "delConrad2")) { doDelConrad2(tdb, item); } else if (sameWord(table, "dgv") || sameWord(table, "dgvBeta")) { doDgv(tdb, item); } +else if (sameWord(table, "dgvMerged") || sameWord(table, "dgvSupporting")) + { + doDgvPlus(tdb, item); + } else if (sameWord(table, "affy120K")) { doAffy120K(tdb, item); } else if (sameWord(table, "affy10K")) { doAffy10K(tdb, item); } else if (sameWord(table, "uniGene_2") || sameWord(table, "uniGene")) { doSageDataDisp(table, item, tdb); } else if (sameWord(table, "uniGene_3")) { doUniGene3(tdb, item);