6419fc05af66878081e2b7d4d944900ec42d7cb1 tdreszer Fri Jun 22 15:29:37 2012 -0700 First of many checkins as dictated by Jim's OCD. Formatting space after if and limiting lines to 100 chars. Changes limited to lines last touched by tdreszer (git blame) so as not to ruin history. None of these changes should affect executables in any way. Only affect is to my sanity and Jim's. diff --git src/hg/hgGeneRing/hgGeneRing.c src/hg/hgGeneRing/hgGeneRing.c index 7bb8fb0..34821b2 100644 --- src/hg/hgGeneRing/hgGeneRing.c +++ src/hg/hgGeneRing/hgGeneRing.c @@ -1,970 +1,946 @@ /* hgGeneRing - Gene Network Browser. */ #include "common.h" #include "linefile.h" #include "hash.h" #include "cheapcgi.h" #include "htmshell.h" #include "obscure.h" #include "web.h" #include "cart.h" #include "hdb.h" #include "dbDb.h" #include "hgFind.h" #include "hCommon.h" #include "hui.h" #include "interaction.h" #include "bdgpGeneInfo.h" #include "portable.h" char *errMsg = NULL; char *geneList = NULL; struct slName *geneNames = NULL; struct hash *aliasHash = NULL; struct interaction *interactions = NULL; struct node { char *name; /* name or id - use also as hash key */ char *alias; /* if used */ struct nodelist *xrays; /* out-going rays in directed graph */ struct nodelist *nrays; /* in-coming rays in directed graph */ boolean ring; /* member of gene-ring? */ int ringRank; /* number of ring members connected to by x or n rays */ int xpos; /* x position */ int ypos; /* y position */ }; struct nodelist { struct nodelist *next; /* next in list */ struct node *node; }; struct nodelist* allNodes = NULL; struct hash *nodeHash = NULL; int ringCount = 0; int insideCount = 0; int outsideCount = 0; struct cart *cart = NULL; struct hash *oldVars = NULL; char *clade = NULL; char *organism = NULL; char *db = NULL; /* ------ old junk cloned from hgGateway --------- */ void hgGateway() /* hgGateway - Human Genome Browser Gateway. */ { char *defaultPosition = hDefaultPos(db); char *position = cloneString(cartUsualString(cart, "position", defaultPosition)); boolean gotClade = hGotClade(); /* JavaScript to copy input data on the change genome button to a hidden form This was done in order to be able to flexibly arrange the UI HTML */ char *onChangeDB = "onchange=\"document.orgForm.db.value = document.mainForm.db.options[document.mainForm.db.selectedIndex].value; document.orgForm.submit();\""; char *onChangeOrg = "onchange=\"document.orgForm.org.value = document.mainForm.org.options[document.mainForm.org.selectedIndex].value; document.orgForm.db.value = 0; document.orgForm.submit();\""; char *onChangeClade = "onchange=\"document.orgForm.clade.value = document.mainForm.clade.options[document.mainForm.clade.selectedIndex].value; document.orgForm.org.value = 0; document.orgForm.db.value = 0; document.orgForm.submit();\""; if (sameString(position, "genome") || sameString(position, "hgBatch")) position = defaultPosition; -puts( -"
\n" ); puts("\n"
- );
- printf("geneList: %s \n", - geneList - ); - puts( - " |
" + " |
\n");
+ printf("geneList: %s \n", geneList ); + puts(" |
" "gene-list\n" " |
" - "screen\n" - ); - puts( - " |
\n"); uglyf("name xrays nrays ring? ringRank \n"); uglyf("-------------------------------------- \n"); } for(nl=allNodes;nl;nl=nl->next) { if (nl->node->ring) { ringCount++; } else { if (nl->node->ringRank > 1) { insideCount++; } else { outsideCount++; } } if (showAll) { uglyf("%11s %4d %4d %4s %3d \n", nl->node->name, slCount(nl->node->xrays), slCount(nl->node->nrays), nl->node->ring ? "ring":"not!", nl->node->ringRank ); } } if (showAll) { uglyf("\n"); } // TODO: add some real code for freeing these things properly // e.g. for xrays and nrays lists, free up the nodelist list itself, // but not the *node values themselves, which are allocated // in the main nodelist/hash. If the nodelist is freed up // properly then hash freeing should be easy enough. // Do we use valgrind or some other util to verify mem-release? return TRUE; } /* Count up elements in list that are outside ring. */ int slCountOutside(void *list) { struct slList *pt = (struct slList *)list; int len = 0; while (pt != NULL) { struct node *n = ((struct nodelist *)pt)->node; if ((!n->ring) && (n->ringRank==1)) len += 1; pt = pt->next; } return len; } #define NODE_SIZE 10 void addMap(struct nodelist *nl) { struct node *node = nl->node; int x=node->xpos; int y=node->ypos; int r=NODE_SIZE; char *name = node->name; if (node->alias) { name = node->alias; } printf( "", x,y,r, name, node->name, name, name ); } void drawScreen() /* Draw Gene Ring using given genes and interactions and display it in a page as a .gif */ { #define SCREEN_SIZE 800 #define RING_SIZE 200 #define INRING_SIZE 140 #define OUTRING_SIZE 340 struct tempName filename; int width,height; char *mapName="ring_map"; ZeroVar(&filename); makeTempName(&filename, "hgGeneRing_screen", ".gif"); printf("\n"); mgSaveGif(mg, filename.forCgi, FALSE); width=height=SCREEN_SIZE; printf("
" "back " "gene-list " "refresh " " |