\n"
-"\n"
+"\n"
"\n"
"\n"
"\n"
"\n"
"");
if (gotClade)
puts("clade | ");
puts(
"genome | \n"
"assembly | \n"
"position | \n"
"image width | \n"
" | \n"
" \n"
);
if (gotClade)
{
puts("\n");
printCladeListHtml(organism, onChangeClade);
puts(" | \n");
}
puts("\n");
if (gotClade)
printGenomeListForCladeHtml(db, onChangeOrg);
else
printGenomeListHtml(db, onChangeOrg);
puts(" | \n");
puts("\n");
/* HACK ALERT - Zoo needs to have different pulldown behavior - Hiram */
if ( startsWith( "Zoo", organism ) ) {
puts("");
} else {
printAssemblyListHtml(db, onChangeDB);
}
puts(" | \n");
puts("\n");
cgiMakeTextVar("position", addCommasToPos(position), 30);
printf(" | \n");
#ifdef SORRY_GILL_I_HIT_INSTEAD_OF_SUBMIT_TOO_MANY_TIMES
puts("\n");
cgiMakeOnClickButton("document.mainForm.position.value=''","clear");
printf(" | \n");
#endif /* SORRY_GILL_I_HIT_INSTEAD_OF_SUBMIT_TOO_MANY_TIMES */
cartSetString(cart, "position", position);
cartSetString(cart, "db", db);
cartSetString(cart, "org", organism);
if (gotClade)
cartSetString(cart, "clade", clade);
freez(&defaultPosition);
position = NULL;
puts("\n");
cgiMakeIntVar("pix", cartUsualInt(cart, "pix", hgDefaultPixWidth), 4);
cartSaveSession(cart);
printf(" | \n");
printf("");
cgiMakeButton("Submit", "Submit");
printf(" | \n");
puts(
" \n"
" | \n"
"Click here to reset the browser user interface settings to their defaults. \n"
"\n"
" | \n"
);
cgiMakeButton("customTrackPage", "Add Your Own Custom Tracks");
puts("\n"
" | \n"
" | \n"
" \n"
);
puts("");
hgPositionsHelpHtml(organism, db);
puts("\n"
);
puts(" ");
}
/* end of hgGateway junk that this code was cloned from */
/* ----------------------------------------------------------------------- */
boolean getGenesAsList()
/* create name-list from geneString,
so that we don't have to keep re-parsing
the cart string in different places
*/
{
char* ss = cloneString(geneList);
char* s = ss;
char* w = NULL;
int c=0;
char emsg[256];
/* clean up unwanted characters if any */
subChar(ss, ',' ,' ');
subChar(ss, '\t',' ');
subChar(ss, '\n',' ');
subChar(ss, '\r',' ');
while (1)
{
if (!(w = nextWord(&s))) break;
if(slNameInList(geneNames, w))
/* could be optimized, but not expecting large lists for ring */
{
safef(emsg,sizeof(emsg), "Duplicate gene id (%s) found in list.",w);
errMsg = cloneString(emsg);
freez(&ss);
return FALSE;
}
slNameAddHead(&geneNames, w);
c++;
}
slReverse(&geneNames);
if (c==0)
{
errMsg = "No genes in list. Please specify genes for ring.";
return FALSE;
}
freez(&ss);
return TRUE;
}
void updateGeneList()
/* update the cart list of genes */
{
char *sep = "";
struct slName *sn = geneNames;
struct dyString *geneList=newDyString(512);
while(sn)
{
dyStringPrintf(geneList,"%s%s",sep,sn->name);
sep=" ";
sn=sn->next;
}
cartSetString(cart, "ring_geneList", geneList->string);
freeDyString(&geneList);
}
struct bdgpGeneInfo *bdgpGeneInfoLoadByQuery(struct sqlConnection *conn, char *query)
/* Load all interaction from table that satisfy the query given.
* Where query is of the form 'select * from example where something=something'
* or 'select example.* from example, anotherTable where example.something =
* anotherTable.something'.
* Dispose of this with bdgpGeneInfoFreeList(). */
{
struct bdgpGeneInfo *list = NULL, *el;
struct sqlResult *sr;
char **row;
sr = sqlGetResult(conn, query);
while ((row = sqlNextRow(sr)) != NULL)
{
el = bdgpGeneInfoLoad(row);
slAddHead(&list, el);
}
slReverse(&list);
sqlFreeResult(&sr);
return list;
}
void getGeneAliasesFromTable(char* table)
/* read all the gene aliases from database, return bdgpGeneInfo-list */
{
struct bdgpGeneInfo *result = NULL, *this=NULL;
struct dyString *query=newDyString(512);
char *sep = "where";
struct slName *sn = geneNames;
dyStringPrintf(query,"select * from %s",table);
while(sn)
{
char * nm = sn->name;
if (startsWith("CG",nm))
{
dyStringPrintf(query," %s bdgpName='%s'",sep,nm);
sep = "or";
}
else if (!startsWith("FBgn",nm))
{
dyStringPrintf(query," %s symbol='%s'",sep,nm);
sep = "or";
}
sn = sn->next;
}
//uglyf(" SQL=%s
\n",query->string);
struct sqlConnection* conn = hAllocConn();
result = bdgpGeneInfoLoadByQuery(conn, query->string);
for(this=result;this;this=this->next)
{
//uglyf(" adding %s=%s \n",this->bdgpName,this->flyBaseId); // debug
hashAdd(aliasHash,this->bdgpName,cloneString(this->flyBaseId));
//uglyf(" adding %s=%s \n",this->symbol,this->flyBaseId); // debug
hashAdd(aliasHash,this->symbol,cloneString(this->flyBaseId));
}
// Mysterious crashes if I free this list:
//bdgpGeneInfoFreeList(&result);
hFreeConn(&conn);
freeDyString(&query);
}
struct interaction *getGenesFromTable(char* table)
/* read all the gene interactions from database, returns interaction-list */
{
struct interaction *result = NULL;
struct dyString *query=newDyString(512);
char *sep = "where";
struct slName *sn = geneNames;
getGeneAliasesFromTable("bdgpGeneInfo"); /* load aliases into hash */
dyStringPrintf(query,"select * from %s",table);
while(sn)
{
struct hashEl *hel = NULL, *hf=NULL;
char * nm = sn->name;
char * alias = NULL;
if (!startsWith("FBgn",nm))
{
if (hf = hashLookup(aliasHash,nm))
{
alias = sn->name;
//uglyf(" aliasing %s with %s \n",nm,(char *)hf->val); // debug
nm = (char *)hf->val;
}
}
hel = hashStore(nodeHash,nm);
if (!hel->val) /* add geneList elements to the hash */
{
struct node *n;
struct nodelist *nl;
AllocVar(n);
AllocVar(nl);
n->name = cloneString(nm);
n->alias = cloneString(alias);
n->ring = TRUE; /* this is a special ring member */
nl->node = n;
slAddHead(&allNodes,nl); /* all nodes going in hash are added to all-nodes list */
hel->val = n;
}
dyStringPrintf(query," %s fromX='%s' or toY='%s'",sep,nm,nm);
sep = "or";
sn = sn->next;
}
//uglyf(" SQL=%s
\n",query->string);
struct sqlConnection* conn = hAllocConn();
result = interactionLoadByQuery(conn, query->string);
hFreeConn(&conn);
freeDyString(&query);
return result;
}
void getGeneList()
/* hgGeneRing - Gene Network Browser. */
{
/* not much point in this, though called old it's the same as current
at this point. It is not the old value from before the last submit.
char *oldGeneList = hashFindVal(oldVars, "ring_geneList");
*/
if (!sameString(errMsg,""))
{
printf("%s\n",errMsg);
}
puts(
" |