c46be5cebadbe532ca7f7fc2a5cde930554c7ae7 braney Tue May 2 11:20:34 2017 -0700 first check in of hgComposite code. diff --git src/hg/hgComposite/hgComposite.c src/hg/hgComposite/hgComposite.c new file mode 100644 index 0000000..bfe17c0 --- /dev/null +++ src/hg/hgComposite/hgComposite.c @@ -0,0 +1,846 @@ +/* hgVai - Variant Annotation Integrator. */ + +/* Copyright (C) 2014 The Regents of the University of California + * See README in this or parent directory for licensing information. */ +#include "common.h" +#include "linefile.h" +#include "hash.h" +#include "options.h" +#include "jksql.h" +#include "htmshell.h" +#include "web.h" +#include "cheapcgi.h" +#include "cart.h" +#include "cartTrackDb.h" +#include "genbank.h" +#include "hgConfig.h" +#include "hgHgvs.h" +#include "hui.h" +#include "grp.h" +#include "hCommon.h" +#include "hgFind.h" +#include "hPrint.h" +#include "jsHelper.h" +#include "memalloc.h" +#include "textOut.h" +#include "trackHub.h" +#include "hubConnect.h" +#include "twoBit.h" +#include "gpFx.h" +#include "bigGenePred.h" +#include "udc.h" +#include "knetUdc.h" +#include "cartTrackDb.h" +#include "trashDir.h" +#include "customComposite.h" + +#define hgCompEditPrefix "hgCompositeEdit_" +#define hgsAddTrack hgCompEditPrefix "addTrack" +#define hgsChangeGroup hgCompEditPrefix "changeGroup" +#define hgsCurrentGroup hgCompEditPrefix "currentGroup" +#define hgsCurrentComposite hgCompEditPrefix "currentComposite" +#define hgsNewCompositeName hgCompEditPrefix "newCompositeName" +#define hgsNewCompositeShortLabel hgCompEditPrefix "newCompositeShortLabel" +#define hgsNewCompositeLongLabel hgCompEditPrefix "newCompositeLongLabel" +//#define hgCompositePrefix "hgComposite_" +#define hgDoNewComposite hgCompEditPrefix "doNewComposite" + +struct track +{ +struct track *next; +char *name; +char *shortLabel; +}; + +struct composite +{ +struct composite *next; +char *name; +char *shortLabel; +char *longLabel; +struct track *trackList; +}; + + +/* 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. */ +struct grp *fullGroupList = NULL; /* List of all groups. */ + +// Null terminated list of CGI Variables we don't want to save permanently: +char *excludeVars[] = {"Submit", "submit", "hgva_startQuery", hgsAddTrack, hgsNewCompositeName, hgsNewCompositeShortLabel, hgsNewCompositeLongLabel, hgsChangeGroup, NULL}; + +void nbSpaces(int count) +/* Print some non-breaking spaces. */ +{ +int i; +for (i=0; i\n" + "div.sectionLite { border-width: 1px; border-color: #"HG_COL_BORDER"; border-style: solid;" + " background-color: #FFFFFF; padding-left: 10px; padding-right: 10px; " + " padding-top: 8px; padding-bottom: 5px; margin-top: 5px; margin-bottom: 5px }\n" + ".sectionLiteHeader { font-weight: bold; font-size:larger; color:#000000;" + " text-align:left; vertical-align:bottom; white-space:nowrap; }\n" + "div.sectionLiteHeader.noReorderRemove { padding-bottom:5px; }\n" + "div.sourceFilter { padding-top: 5px; padding-bottom: 5px }\n" + "\n"); +} + + +INLINE void startCollapsibleSection(char *sectionSuffix, char *title, boolean onByDefault) +// Wrap shared args to jsBeginCollapsibleSectionFontSize +{ +jsBeginCollapsibleSectionFontSize(cart, "hgva", sectionSuffix, title, onByDefault, "1.1em"); +} + +INLINE void startSmallCollapsibleSection(char *sectionSuffix, char *title, boolean onByDefault) +// Wrap shared args to jsBeginCollapsibleSectionFontSize +{ +jsBeginCollapsibleSectionFontSize(cart, "hgva", sectionSuffix, title, onByDefault, "0.9em"); +} + +#define endCollapsibleSection jsEndCollapsibleSection + + +static struct dyString *onChangeStart() +/* Start up a javascript onChange command */ +{ +struct dyString *dy = jsOnChangeStart(); +return dy; +} + + +static char *onChangeClade() +/* Return javascript executed when they change clade. */ +{ +struct dyString *dy = onChangeStart(); +jsDropDownCarryOver(dy, "clade"); +dyStringAppend(dy, " document.hiddenForm.org.value=0;"); +dyStringAppend(dy, " document.hiddenForm.db.value=0;"); +return jsOnChangeEnd(&dy); +} + +static char *onChangeOrg() +/* Return javascript executed when they change organism. */ +{ +struct dyString *dy = onChangeStart(); +jsDropDownCarryOver(dy, "clade"); +jsDropDownCarryOver(dy, "org"); +dyStringAppend(dy, " document.hiddenForm.db.value=0;"); +return jsOnChangeEnd(&dy); +} + +static char *onChangeDb() +/* Return javascript executed when they change database. */ +{ +struct dyString *dy = onChangeStart(); +jsDropDownCarryOver(dy, "clade"); +jsDropDownCarryOver(dy, "db"); +return jsOnChangeEnd(&dy); +} + +INLINE void printOption(char *val, char *selectedVal, char *label) +/* For rolling our own select without having to build conditional arrays/lists. */ +{ +printf("