38a1bb1cdb79051c3c75b7fd45652b7b69a6a439 angie Thu Dec 10 21:16:39 2015 -0800 Corrected the description of knownCanonical for hg38 as suggested by Matt and fixed missing-geneSymbol bug found by Matt -- thanks! refs #16502 diff --git src/hg/hgVai/hgVai.c src/hg/hgVai/hgVai.c index c4c19a4..52c5d84 100644 --- src/hg/hgVai/hgVai.c +++ src/hg/hgVai/hgVai.c @@ -27,31 +27,33 @@ #include "bigGenePred.h" #include "udc.h" #include "knetUdc.h" #include "md5.h" #include "regexHelper.h" #include "hAnno.h" #include "annoGratorQuery.h" #include "annoGratorGpVar.h" #include "annoFormatVep.h" #include "annoStreamBigBed.h" #include "annoStreamDb.h" #include "libifyMe.h" #define GENCODE_TAG_DOC_URL "\"http://www.gencodegenes.org/gencode_tags.html\"" +#define GENCODE_BASIC_DOC_URL "\"http://www.gencodegenes.org/faq.html\"" #define REFSEQ_STATUS_DOC_URL "\"http://www.ncbi.nlm.nih.gov/books/NBK21091/table/ch18.T.refseq_status_codes\"" +#define APPRIS_DOC_URL "\"http://appris.bioinfo.cnio.es/#/help/database\"" /* Global Variables */ struct cart *cart; /* CGI and other variables */ struct hash *oldVars = NULL; /* The cart before new cgi stuff added. */ char *genome = NULL; /* Name of genome - mouse, human, etc. */ char *database = NULL; /* Current genome database - hg17, mm5, etc. */ char *regionType = NULL; /* genome, ENCODE pilot regions, or specific position range. */ struct grp *fullGroupList = NULL; /* List of all groups. */ struct trackDb *fullTrackList = NULL; /* List of all tracks in database. */ static struct pipeline *compressPipeline = (struct pipeline *)NULL; // Null terminated list of CGI Variables we don't want to save permanently: char *excludeVars[] = {"Submit", "submit", "hgva_startQuery", NULL,}; @@ -427,38 +429,54 @@ *retGroupRefList = groupRefList; } } boolean isVariantCustomTrack(struct trackDb *tdb, void *filterData) /* This is a TdbFilterFunction to get custom or hub tracks with type pgSnp or vcf(Tabix). */ { return ((sameString(tdb->grp, "user") || isHubTrack(tdb->track)) && (sameString(tdb->type, "pgSnp") || startsWith("vcf", tdb->type))); } // Function prototype to avoid shuffling code around: char *findLatestSnpTable(char *suffix); /* Return the name of the 'snp1__<suffix>' table with the highest build number, if any. */ -void selectVariants(struct slRef *varGroupList, struct slRef *varTrackList) +void selectVariants() /* Offer selection of user's variant custom tracks, example variants, pasted input etc. */ { +#define PGSNP_OR_VCF "<A HREF='../FAQ/FAQformat.html#format10' TARGET=_BLANK>pgSnp</A> or " \ + "<A HREF='../goldenPath/help/vcf.html' TARGET=_BLANK>VCF</A>" + printf("<div class='sectionLiteHeader'>Select Variants</div>\n"); +/* Check for variant custom tracks. If there are none, tell the user that they should add one. */ +struct slRef *varTrackList = NULL, *varGroupList = NULL; +tdbFilterGroupTrack(fullTrackList, fullGroupList, isVariantCustomTrack, NULL, + &varGroupList, &varTrackList); +if (varTrackList == NULL) + { + printf("Your session doesn't have any custom tracks or hub tracks in " PGSNP_OR_VCF + " format.\n"); + hOnClickButton("document.customTrackForm.submit(); return false;", + "add pgSNP or VCF custom track"); + puts("<BR>"); + } +else if (slCount(varTrackList) > 1) + { printf("If you have more than one custom track or hub track in " - "<A HREF='../FAQ/FAQformat.html#format10' TARGET=_BLANK>pgSnp</A> or " - "<A HREF='../goldenPath/help/vcf.html' TARGET=_BLANK>VCF</A> format, " - "please select the one you wish to annotate:<BR>\n"); + PGSNP_OR_VCF " format, please select the one you wish to annotate:<BR>\n"); + } printf("<B>variants: </B>"); printf("<SELECT ID='hgva_variantTrack' NAME='hgva_variantTrack' " "onchange=\"hgva.changeVariantSource();\">\n"); char *selected = cartUsualString(cart, "hgva_variantTrack", ""); struct slRef *ref; for (ref = varTrackList; ref != NULL; ref = ref->next) { struct trackDb *tdb = ref->val; printOption(tdb->track, selected, tdb->longLabel); } printOption(hgvaSampleVariants, selected, hgvaSampleVariantsLabel); boolean hasSnps = (findLatestSnpTable(NULL) != NULL); if (hasSnps) printOption(hgvaUseVariantIds, selected, hgvaVariantIdsLabel); printf("</SELECT><BR>\n"); @@ -870,43 +888,48 @@ if (versionList != NULL) { if (hTableExists(database, "ensGene")) maybeEnsGene = "ensGene"; versions = slNameListToString(versionList, ' '); } boolean isVisible = (sameString(geneTrack, maybeKnownGene) || sameString(geneTrack, maybeEnsGene) || sameString(geneTrack, maybeRefGene) || isGencodeWithVersion(geneTrack, versionList)); somethingIsVisible |= isVisible; printf("<div class=\"txStatus %s %s %s %s\" style=\"display: %s;\">", maybeKnownGene, maybeRefGene, maybeEnsGene, versions, isVisible ? "block" : "none"); cartMakeCheckBox(cart, "hgva_txStatus_gencode", FALSE); - puts("Include the <A HREF=" GENCODE_TAG_DOC_URL " " - "TARGET=_BLANK>GENCODE tags</A> for each transcript (if available).<BR>"); + puts("Include the <A HREF=" GENCODE_TAG_DOC_URL " TARGET=_BLANK>GENCODE tags</A> (if any) " + "associated with each transcript.<BR>"); puts("</div>"); } if (hTableExists(database, "knownGene") && hTableExists(database, "knownCanonical")) { boolean isVisible = sameString(geneTrack, "knownGene"); somethingIsVisible |= isVisible; printf("<div class=\"txStatus knownGene\" style=\"display: %s;\">", isVisible ? "block" : "none"); cartMakeCheckBox(cart, "hgva_txStatus_knownCanonical", FALSE); - puts("Indicate whether each UCSC Genes transcript is 'canonical' (generally the longest " - "isoform of a gene).<BR>"); + char *desc = hTableExists(database, "knownToTag") ? + "based on <A HREF=" APPRIS_DOC_URL " TARGET=_BLANK>" + "APPRIS</A> status or inclusion in " + "<A HREF=" GENCODE_BASIC_DOC_URL " TARGET=_BLANK>GENCODE Basic</A> subset: " + "principal > alternative > basic > longest isoform" : + "generally the longest isoform of a gene"; + printf("Indicate whether each transcript is 'canonical' (%s).<BR>\n", desc); puts("</div>"); } if (hTableExists(database, "refGene") && hTableExists(database, "refSeqStatus")) { boolean isVisible = sameString(geneTrack, "refGene"); somethingIsVisible |= isVisible; printf("<div class=\"txStatus refGene\" style=\"display: %s;\">", isVisible ? "block" : "none"); cartMakeCheckBox(cart, "hgva_txStatus_refSeqStatus", FALSE); puts("Include the " "<A HREF=" REFSEQ_STATUS_DOC_URL " " "TARGET=_BLANK>RefSeq status</A> of each transcript.<BR>"); puts("</div>"); } printf("<div class=\"noTxStatus\" style=\"display: %s;\">", @@ -1248,38 +1271,33 @@ */ void doMainPage() /* Print out initial HTML of control page. */ { jsInit(); webIncludeResourceFile("jquery-ui.css"); webIncludeResourceFile("ui.dropdownchecklist.css"); boolean alreadyAgreed = cartUsualBoolean(cart, "hgva_agreedToDisclaimer", FALSE); printf("<script>\n" "$(document).ready(function() { hgva.disclaimer.init(%s, hgva.userClickedAgree); });\n" "</script>\n", alreadyAgreed ? "true" : "false"); addSomeCss(); printAssemblySection(); -/* Check for variant custom tracks. If there are none, tell user they need to - * upload at least one. */ -struct slRef *varTrackList = NULL, *varGroupList = NULL; -tdbFilterGroupTrack(fullTrackList, fullGroupList, isVariantCustomTrack, NULL, - &varGroupList, &varTrackList); puts("<BR>"); // Make wrapper table for collapsible sections: -selectVariants(varGroupList, varTrackList); +selectVariants(); char *geneTrack = selectGenes(); if (geneTrack != NULL) { selectRegulatory(); selectAnnotations(geneTrack); selectFilters(); selectOutput(); submitAndDisclaimer(); } printf("</FORM>"); jsReloadOnBackButton(cart); webNewSection("Using the Variant Annotation Integrator"); webIncludeHelpFile("hgVaiHelpText", FALSE); @@ -2426,31 +2444,31 @@ struct joinerDtf *txStatusExtras) /* Add VAI-specific config options, if applicable. */ { struct jsonElement *config = NULL; char *track = tdb->track; struct dyString *dyConfig = dyStringCreate("{ \"naForMissing\": false," " \"relatedTables\": [ "); boolean isFirst = TRUE; // If track is sql-based knownGene and we have kgXref, then add kgXref.geneSymbol after // the columns of knownGene. if (sameString(track, "knownGene") && !isCustomTrack(track) && !isHubTrack(track) && !trackDbSetting(tdb, "bigDataUrl") && hTableExists(db, "kgXref")) { - configAddTableField(dyConfig, ".kgXref", "geneSymbol", &isFirst); + configAddTableField(dyConfig, "kgXref", "geneSymbol", &isFirst); } struct joinerDtf *txStatDtf; for (txStatDtf = txStatusExtras; txStatDtf != NULL; txStatDtf = txStatDtf->next) configAddTableField(dyConfig, txStatDtf->table, txStatDtf->field, &isFirst); // If any of the above apply, close the relatedTables list and config object // and parse into jsonElements. if (! isFirst) { dyStringAppend(dyConfig, " ] }"); config = jsonParse(dyConfig->string); dyStringFree(&dyConfig); } return config; }