ff9313091f342ffe62a124427b5c9d6a516faaea
hiram
Thu Oct 15 15:03:07 2015 -0700
fixup gcc warnings for -Wunused-but-set-variable refs #16121
diff --git src/hg/hgc/hgc.c src/hg/hgc/hgc.c
index e89235c..8f0d449 100644
--- src/hg/hgc/hgc.c
+++ src/hg/hgc/hgc.c
@@ -1334,41 +1334,30 @@
atomStaticLoad(row, &ret);
//atomOutput(&ret, stdout, '\t', '\n');
linkToOtherBrowser(ret.species, ret.chrom, ret.start, ret.end);
if (sameString(ret.chrom, seqName) && (start == ret.start) &&
sameString(ret.species, database))
printf("* ");
else
printf(" ");
printf( "%4d %-10s %-5s %12d %12d %10d %c %-10s %-10s\n",
ret.instance, ret.species,ret.chrom, ret.start + 1, ret.end,
ret.end - ret.start + 1, ret.strand[0],ret.fivePrime,ret.threePrime);
}
printf("");
sqlFreeResult(&sr);
-#if 0
-//struct tempName launchFile;
-char *fileName = "../trash/braney.launch";
-FILE *launchF;
-//trashDirFile(&launchFile, "braney", "launch", ".txt");
-//printf("writing %s\n",fileName);
-launchF = mustOpen(fileName, "w");
-fprintf(launchF, "%s\n", item);
-fclose(launchF);
-#endif
-
if (!sameString("atom20080226d", table))
return;
printf("
");
printf("");
printf("");
printf("");
printf("Suh Trees \n");
printf(" ",item);
printf(" |  ",item);
printf(" |
---|
");
printf("NJ Trees \n");
printf(" ",item);
printf(" |  ",item);
printf(" |
---|
");
@@ -2298,31 +2287,31 @@
freeDyString(&dyT);
freeDyString(&dyQ);
freeDyString(&dyQprot);
freeDyString(&dyTprot);
}
}
}
struct axt *getAxtListForGene(struct genePred *gp, char *nib, char *fromDb, char *toDb,
struct lineFile *lf)
/* get all axts for a gene */
{
struct axt *axt, *axtGap;
struct axt *axtList = NULL;
int prevEnd = gp->txStart;
-int prevStart = gp->txEnd;
+// int prevStart = gp->txEnd; unused variable
int tmp;
while ((axt = axtRead(lf)) != NULL)
{
if (sameString(gp->chrom, axt->tName)
&& ( ( (axt->tStart <= gp->cdsStart && axt->tEnd >= gp->cdsStart)
|| (axt->tStart <= gp->cdsEnd && axt->tEnd >= gp->cdsEnd ) )
|| ( axt->tStart < gp->cdsEnd && axt->tEnd > gp->cdsStart ) ) )
{
if (gp->strand[0] == '-')
{
reverseComplement(axt->qSym, axt->symCount);
reverseComplement(axt->tSym, axt->symCount);
tmp = hChromSize(fromDb, axt->qName) - axt->qStart;
axt->qStart = hChromSize(fromDb, axt->qName) - axt->qEnd;
@@ -2330,31 +2319,31 @@
if (prevEnd < (axt->tStart)-1)
{
axtGap = createAxtGap(nib,gp->chrom,prevEnd,(axt->tStart),gp->strand[0]);
reverseComplement(axtGap->qSym, axtGap->symCount);
reverseComplement(axtGap->tSym, axtGap->symCount);
slAddHead(&axtList, axtGap);
}
}
else if (prevEnd < (axt->tStart))
{
axtGap = createAxtGap(nib,gp->chrom,prevEnd,(axt->tStart),gp->strand[0]);
slAddHead(&axtList, axtGap);
}
slAddHead(&axtList, axt);
prevEnd = axt->tEnd;
- prevStart = axt->tStart;
+ // prevStart = axt->tStart; unused variable
}
if (sameString(gp->chrom, axt->tName) && (axt->tStart > gp->txEnd))
{
if ((prevEnd < axt->tStart) && prevEnd < min(gp->txEnd, axt->tStart))
{
axtGap = createAxtGap(nib,gp->chrom,prevEnd,min(axt->tStart,gp->txEnd),gp->strand[0]);
if (gp->strand[0] == '-')
{
reverseComplement(axtGap->qSym, axtGap->symCount);
reverseComplement(axtGap->tSym, axtGap->symCount);
}
slAddHead(&axtList, axtGap);
}
else
if (axtList == NULL)
@@ -2371,31 +2360,31 @@
}
}
if (gp->strand[0] == '+')
slReverse(&axtList);
return axtList ;
}
struct axt *getAxtListForRange(struct genePred *gp, char *nib, char *fromDb, char *toDb,
char *alignment, char *qChrom, int qStart, int qEnd)
/* get all axts for a chain */
{
struct lineFile *lf ;
struct axt *axt, *axtGap;
struct axt *axtList = NULL;
int prevEnd = gp->txStart;
-int prevStart = gp->txEnd;
+// int prevStart = gp->txEnd; unused variable
int tmp;
lf = lineFileOpen(getAxtFileName(gp->chrom, toDb, alignment, fromDb), TRUE);
printf("file %s\n",lf->fileName);
while ((axt = axtRead(lf)) != NULL)
{
/* if (sameString(gp->chrom , axt->tName))
* printf("axt %s qstart %d axt tStart %d\n",axt->qName, axt->qStart,axt->tStart); */
if ( sameString(gp->chrom, axt->tName)
&& sameString( qChrom, axt->qName)
&& positiveRangeIntersection( qStart, qEnd, axt->qStart, axt->qEnd)
&& positiveRangeIntersection(gp->txStart, gp->txEnd, axt->tStart, axt->tEnd) )
{
if (gp->strand[0] == '-')
{
@@ -2407,31 +2396,31 @@
if (prevEnd < (axt->tStart)-1)
{
axtGap = createAxtGap(nib,gp->chrom,prevEnd,(axt->tStart)-1,gp->strand[0]);
reverseComplement(axtGap->qSym, axtGap->symCount);
reverseComplement(axtGap->tSym, axtGap->symCount);
slAddHead(&axtList, axtGap);
}
}
else if (prevEnd < (axt->tStart)-1)
{
axtGap = createAxtGap(nib,gp->chrom,prevEnd,(axt->tStart)-1,gp->strand[0]);
slAddHead(&axtList, axtGap);
}
slAddHead(&axtList, axt);
prevEnd = axt->tEnd;
- prevStart = axt->tStart;
+ // prevStart = axt->tStart; unused variable
}
if (sameString(gp->chrom, axt->tName) && (axt->tStart > gp->txEnd+20000))
{
if (axt->tStart > prevEnd)
{
axtGap = createAxtGap(nib,gp->chrom,prevEnd+1,(axt->tStart)-1,gp->strand[0]);
if (gp->strand[0] == '-')
{
reverseComplement(axtGap->qSym, axtGap->symCount);
reverseComplement(axtGap->tSym, axtGap->symCount);
}
slAddHead(&axtList, axtGap);
}
break;
}
@@ -3478,49 +3467,45 @@
if (net->qNewR >= 0)
printLabeledPercent(otherOrg, "new repeat bases", net->qOldR, qSize);
if (net->tEnd >= net->tStart)
printLabeledNumber(org, "size", net->tEnd - net->tStart);
if (net->qEnd >= net->qStart)
printLabeledNumber(otherOrg, "size", net->qEnd - net->qStart);
printf(" Fields above refer to entire chain or gap, not just the part inside the window. \n");
netAlignFree(&net);
}
void tfbsConsSites(struct trackDb *tdb, char *item)
/* detail page for tfbsConsSites track */
{
boolean printedPlus = FALSE;
boolean printedMinus = FALSE;
-char *dupe, *words[16];
-int wordCount;
int start = cartInt(cart, "o");
struct sqlConnection *conn = hAllocConn(database);
char table[64];
boolean hasBin;
char query[512];
struct sqlResult *sr;
char **row;
struct tfbsConsSites *tfbsConsSites;
struct tfbsConsSites *tfbsConsSitesList = NULL;
struct tfbsConsFactors *tfbsConsFactor;
struct tfbsConsFactors *tfbsConsFactorList = NULL;
boolean firstTime = TRUE;
char *mappedId = NULL;
-dupe = cloneString(tdb->type);
genericHeader(tdb, item);
-wordCount = chopLine(dupe, words);
hFindSplitTable(database, seqName, tdb->table, table, &hasBin);
sqlSafef(query, sizeof query, "select * from %s where name = '%s' and chrom = '%s' and chromStart = %d",
table, item, seqName, start);
sr = sqlGetResult(conn, query);
while ((row = sqlNextRow(sr)) != NULL)
{
tfbsConsSites = tfbsConsSitesLoad(row+hasBin);
slAddHead(&tfbsConsSitesList, tfbsConsSites);
}
sqlFreeResult(&sr);
slReverse(&tfbsConsSitesList);
hFindSplitTable(database, seqName, "tfbsConsFactors", table, &hasBin);
@@ -3565,58 +3550,53 @@
{
htmlHorizontalLine();
printf("Transcription Factors known to bind to this site:
");
for(tfbsConsFactor =tfbsConsFactorList ; tfbsConsFactor != NULL ; tfbsConsFactor = tfbsConsFactor ->next)
{
if (!sameString(tfbsConsFactor->species, "N"))
{
printf(" Factor: %s \n", tfbsConsFactor->factor);
printf("Species: %s \n", tfbsConsFactor->species);
printf("SwissProt ID: %s \n", sameString(tfbsConsFactor->id, "N")? "unknown": tfbsConsFactor->id);
}
}
}
printTrackHtml(tdb);
-freez(&dupe);
hFreeConn(&conn);
}
void tfbsCons(struct trackDb *tdb, char *item)
/* detail page for tfbsCons track */
{
boolean printFactors = FALSE;
boolean printedPlus = FALSE;
boolean printedMinus = FALSE;
-char *dupe, *words[16];
-int wordCount;
int start = cartInt(cart, "o");
struct sqlConnection *conn = hAllocConn(database);
char table[64];
boolean hasBin;
char query[512];
struct sqlResult *sr;
char **row;
struct tfbsCons *tfbs;
struct tfbsCons *tfbsConsList = NULL;
struct tfbsConsMap tfbsConsMap;
boolean firstTime = TRUE;
char *mappedId = NULL;
-dupe = cloneString(tdb->type);
genericHeader(tdb, item);
-wordCount = chopLine(dupe, words);
hFindSplitTable(database, seqName, tdb->table, table, &hasBin);
sqlSafef(query, sizeof query, "select * from %s where name = '%s' and chrom = '%s' and chromStart = %d",
table, item, seqName, start);
sr = sqlGetResult(conn, query);
while ((row = sqlNextRow(sr)) != NULL)
{
tfbs = tfbsConsLoad(row+hasBin);
slAddHead(&tfbsConsList, tfbs);
}
sqlFreeResult(&sr);
slReverse(&tfbsConsList);
if (hTableExists(database, "tfbsConsMap"))
@@ -3665,74 +3645,68 @@
/* print only the positive strand when factors are on both strands */
if ((tfbs->strand[0] == '-') && printedPlus)
continue;
if (!sameString(tfbs->species, "N"))
{
printf(" Factor: %s \n", tfbs->factor);
printf("Species: %s \n", tfbs->species);
printf("SwissProt ID: %s \n", sameString(tfbs->id, "N")? "unknown": tfbs->id);
}
}
}
printTrackHtml(tdb);
-freez(&dupe);
hFreeConn(&conn);
}
void firstEF(struct trackDb *tdb, char *item)
{
-char *dupe, *words[16];
-int wordCount;
int start = cartInt(cart, "o");
struct sqlConnection *conn = hAllocConn(database);
char table[64];
boolean hasBin;
struct bed *bed;
char query[512];
struct sqlResult *sr;
char **row;
boolean firstTime = TRUE;
/* itemForUrl = item; */
-dupe = cloneString(tdb->type);
genericHeader(tdb, item);
-wordCount = chopLine(dupe, words);
printCustomUrl(tdb, item, FALSE);
/* printCustomUrl(tdb, itemForUrl, item == itemForUrl); */
hFindSplitTable(database, seqName, tdb->table, table, &hasBin);
sqlSafef(query, sizeof query, "select * from %s where name = '%s' and chrom = '%s' and chromStart = %d",
table, item, seqName, start);
sr = sqlGetResult(conn, query);
while ((row = sqlNextRow(sr)) != NULL)
{
if (firstTime)
firstTime = FALSE;
else
htmlHorizontalLine();
bed = bedLoadN(row+hasBin, 6);
printf("Item: %s \n", bed->name);
printf("Probability: %g \n", bed->score / 1000.0);
printf("Strand: %s \n", bed->strand);
printPos(bed->chrom, bed->chromStart, bed->chromEnd, NULL, TRUE, bed->name);
}
printTrackHtml(tdb);
-freez(&dupe);
hFreeConn(&conn);
}
void doBed5FloatScore(struct trackDb *tdb, char *item)
/* Handle click in BED 5+ track: BED 5 with 0-1000 score (for useScore
* shading in hgTracks) plus real score for display in details page. */
{
struct sqlConnection *conn = hAllocConn(database);
struct sqlResult *sr = NULL;
char table[64];
boolean hasBin;
struct bed5FloatScore *b5;
struct dyString *query = newDyString(512);
char **row;
boolean firstTime = TRUE;
@@ -5287,58 +5261,58 @@
if ((s = skipLeadingSpaces(s)) != NULL && s[0] != 0)
{
int len = strlen(s);
appendAuthor(dy, s, len);
}
}
/* --- !!! Riken code is under development Fan. 4/16/02 */
void printRikenInfo(char *acc, struct sqlConnection *conn )
/* Print Riken annotation info */
{
struct sqlResult *sr;
char **row;
char query[512];
char *seqid, *accession, *comment;
-char *qualifier, *anntext, *datasrc, *srckey, *href, *evidence;
+// char *qualifier, *anntext, *datasrc, *srckey, *href, *evidence;
accession = acc;
sqlSafef(query, sizeof(query),
"select seqid from rikenaltid where altid='%s';", accession);
sr = sqlMustGetResult(conn, query);
row = sqlNextRow(sr);
if (row != NULL)
{
seqid=cloneString(row[0]);
sqlSafef(query, sizeof(query),
"select Qualifier, Anntext, Datasrc, Srckey, Href, Evidence "
"from rikenann where seqid='%s';", seqid);
sqlFreeResult(&sr);
sr = sqlMustGetResult(conn, query);
row = sqlNextRow(sr);
while (row !=NULL)
{
- qualifier = row[0];
- anntext = row[1];
- datasrc = row[2];
- srckey = row[3];
- href = row[4];
- evidence = row[5];
+ // qualifier = row[0]; unused variable
+ // anntext = row[1]; unused variable
+ // datasrc = row[2]; unused variable
+ // srckey = row[3]; unused variable
+ // href = row[4]; unused variable
+ // evidence = row[5]; unused variable
row = sqlNextRow(sr);
}
sqlSafef(query, sizeof(query),
"select comment from rikenseq where id='%s';", seqid);
sqlFreeResult(&sr);
sr = sqlMustGetResult(conn, query);
row = sqlNextRow(sr);
if (row != NULL)
{
comment = row[0];
printf("Riken/comment: %s \n",comment);
}
}
@@ -5435,36 +5409,37 @@
assert(msg != NULL);
char *msg2= "Care should be taken in using alignments of this sequence as evidence of transcription.";
printf("Warning: %s %s %s \n", acc, msg, msg2);
}
static void printRnaSpecs(struct trackDb *tdb, char *acc, struct psl *psl)
/* Print auxiliarry info on RNA. */
{
struct dyString *dy = newDyString(1024);
struct sqlConnection *conn = hAllocConn(database);
struct sqlConnection *conn2= hAllocConn(database);
struct sqlResult *sr;
char **row;
char rgdEstId[512];
char query[256];
-char *type,*direction,*source,*orgFullName,*library,*clone,*sex,*tissue,
+char *type,*direction,*orgFullName,*library,*clone,*sex,*tissue,
*development,*cell,*cds,*description, *author,*geneName,
*date,*productName;
-int seqSize,fileSize;
-long fileOffset;
-char *ext_file;
+// char *source; unused variable
+// int seqSize,fileSize; unused variables
+// long fileOffset; unused variable
+// char *extFile; unused variable
boolean hasVersion = hHasField(database, "gbCdnaInfo", "version");
boolean haveGbSeq = sqlTableExists(conn, "gbSeq");
char *seqTbl = haveGbSeq ? "gbSeq" : "seq";
char *version = NULL;
struct trackDb *tdbRgdEst;
char *chrom = cartString(cart, "c");
int start = cartInt(cart, "o");
int end = cartUsualInt(cart, "t",0);
struct gbWarn *gbWarn = checkGbWarn(conn, acc);
/* This sort of query and having to keep things in sync between
* the first clause of the select, the from clause, the where
* clause, and the results in the row ... is really tedious.
* One of my main motivations for going to a more object
* based rather than pure relational approach in general,
@@ -5501,38 +5476,40 @@
" where gbCdnaInfo.acc = '%s' and gbCdnaInfo.id = %s.id ",
seqTbl, acc, seqTbl);
dyStringAppend(dy,
"and gbCdnaInfo.source = source.id and gbCdnaInfo.organism = organism.id "
"and gbCdnaInfo.library = library.id and gbCdnaInfo.mrnaClone = mrnaClone.id "
"and gbCdnaInfo.sex = sex.id and gbCdnaInfo.tissue = tissue.id "
"and gbCdnaInfo.development = development.id and gbCdnaInfo.cell = cell.id "
"and gbCdnaInfo.cds = cds.id and gbCdnaInfo.description = description.id "
"and gbCdnaInfo.author = author.id and gbCdnaInfo.geneName = geneName.id "
"and gbCdnaInfo.productName = productName.id");
sr = sqlMustGetResult(conn, dy->string);
row = sqlNextRow(sr);
if (row != NULL)
{
- type=row[0];direction=row[1];source=row[2];orgFullName=row[3];library=row[4];clone=row[5];
+ type=row[0];direction=row[1];
+ // source=row[2]; unused variable
+ orgFullName=row[3];library=row[4];clone=row[5];
sex=row[6];tissue=row[7];development=row[8];cell=row[9];cds=row[10];description=row[11];
author=row[12];geneName=row[13];productName=row[14];
- seqSize = sqlUnsigned(row[15]);
+ // seqSize = sqlUnsigned(row[15]); unused variable
date = row[16];
- ext_file = row[17];
- fileOffset=sqlUnsigned(row[18]);
- fileSize=sqlUnsigned(row[19]);
+ // ext_file = row[17]; unused variable
+ // fileOffset=sqlUnsigned(row[18]); unused variable
+ // fileSize=sqlUnsigned(row[19]); unused variable
boolean isEst = sameWord(type, "est");
if (hasVersion)
{
version = row[20];
}
/* Now we have all the info out of the database and into nicely named
* local variables. There's still a few hoops to jump through to
* format this prettily on the web with hyperlinks to NCBI. */
printf("Information on %s table, splitTable, &hasBin);
sqlSafef(query, sizeof query, "select * from %s where frag = '%s' and chromStart = %d",
splitTable, fragName, start);
sr = sqlMustGetResult(conn, query);
row = sqlNextRow(sr);
agpFragStaticLoad(row+hasBin, &frag);
printf("Clone Fragment ID: %s \n", frag.frag);
printf("Clone Fragment Type: %s \n", frag.type);
printf("Clone Bases: %d-%d \n", frag.fragStart+1, frag.fragEnd);
@@ -6412,31 +6390,31 @@
{
sqlSafef(query2, sizeof query2, "select * from certificate where accession1='%s';", tmpString);
}
else
{
sqlSafef(query2, sizeof query2, "select * from certificate where accession2='%s';", tmpString);
}
sr2 = sqlMustGetResult(conn2, query2);
row2 = sqlNextRow(sr2);
while (row2 != NULL)
{
printf(" ");
accession1 = row2[0];
accession2 = row2[1];
spanner = row2[2];
- evaluation = row2[3];
+ // evaluation = row2[3]; unused variable
variation = row2[4];
varEvidence = row2[5];
contact = row2[6];
remark = row2[7];
comment = row2[8];
if (first)
{
secondAcc = accession2;
}
else
{
secondAcc = accession1;
}
@@ -8584,31 +8562,31 @@
pslList->misMatch,
pslList->nCount,
pslList->tBaseInsert, hOrganism(database),
pslList->qBaseInsert, item,
pslScore(pslList));
printTrackHtml(tdb);
hFreeConn(&conn);
}
void printEnsemblCustomUrl(struct trackDb *tdb, char *itemName, boolean encode,
char *archive)
/* Print Ensembl Gene URL. */
{
char *shortItemName;
-char *genomeStr = "";
+// char *genomeStr = ""; unused variable
char *genomeStrEnsembl = "";
struct sqlConnection *conn = hAllocConn(database);
char cond_str[256], cond_str2[256], cond_str3[256];
char *proteinID = NULL;
char *ensPep;
char *chp;
char ensUrl[256];
char *ensemblIdUrl = trackDbSettingOrDefault(tdb, "ensemblIdUrl", "http://www.ensembl.org");
/* shortItemName is the name without the "." + version */
shortItemName = cloneString(itemName);
/* ensembl gene names are different from their usual naming scheme on ce6 */
if (! startsWith("ce6", database))
{
chp = strstr(shortItemName, ".");
@@ -8631,37 +8609,34 @@
char query[512];
char *geneName = NULL;
if (hTableExists(database, "ensemblToGeneName"))
{
sqlSafef(query, sizeof(query), "select value from ensemblToGeneName where name='%s'", itemName);
geneName = sqlQuickString(conn, query);
}
char *ensemblSource = NULL;
if (hTableExists(database, "ensemblSource"))
{
sqlSafef(query, sizeof(query), "select source from ensemblSource where name='%s'", itemName);
ensemblSource = sqlQuickString(conn, query);
}
-boolean nonCoding = FALSE;
sqlSafefFrag(query, sizeof(query), "name = \"%s\"", itemName);
struct genePred *gpList = genePredReaderLoadQuery(conn, "ensGene", query);
if (gpList && gpList->name2)
{
- if (gpList->cdsStart == gpList->cdsEnd)
- nonCoding = TRUE;
printf("Ensembl Gene Link: ");
if ((strlen(gpList->name2) < 1) || sameString(gpList->name2, "noXref"))
printf("none \n");
else
printf("%s ", ensUrl, gpList->name2, gpList->name2);
}
genePredFreeList(&gpList);
printf("Ensembl Transcript: ");
printf("", ensUrl, shortItemName);
printf("%s ", itemName);
if (hTableExists(database, "superfamily"))
@@ -8697,30 +8672,31 @@
{
if (hTableExists(database, "ensemblXref"))
{
proteinID=sqlGetField(database, "ensemblXref","translation_name",cond_str);
}
}
}
if (proteinID != NULL)
{
printf("Ensembl Protein: ");
printf("",
ensUrl, proteinID);
printf("%s \n", proteinID);
}
+#ifdef NOT
/* get genomeStr to be used in Superfamily URL */
if (sameWord(organism, "human"))
{
genomeStr = "hs";
}
else
{
if (sameWord(organism, "mouse"))
{
genomeStr = "mm";
}
else
{
if (sameWord(organism, "rat"))
{
@@ -8728,31 +8704,30 @@
}
else
{
if (sameWord(organism, "dog"))
{
genomeStr = "dg";
}
else
{
warn("Organism %s not found!", organism);
return;
}
}
}
}
-#ifdef NOT
/* superfamily does not update with ensGene updates, stop printing an
invalid URL */
sqlSafefFrag(cond_str, "name='%s'", shortItemName);
char *ans = sqlGetField(conn, database, "superfamily", "name", cond_str);
if (ans != NULL)
{
/* double check to make sure trackDb is also updated to be in sync with existence of supfamily table */
struct trackDb *tdbSf = hashFindVal(trackHash, "superfamily");
if (tdbSf != NULL)
{
char supfamURL[512];
printf("Superfamily Link: ");
safef(supfamURL, sizeof(supfamURL), "",
tdbSf->url, genomeStr, proteinID);
printf("%s%s \n", supfamURL, proteinID);
@@ -9114,56 +9089,49 @@
printf(" ");
printPosOnChrom(chrom, atoi(chromStart), atoi(chromEnd), NULL, TRUE, transcript);
}
sqlFreeResult(&sr);
}
printTrackHtml(tdb);
}
void doOmimAv(struct trackDb *tdb, char *avName)
/* Process click on an OMIM AV. */
{
struct sqlConnection *conn = hAllocConn(database);
struct sqlResult *sr;
char **row;
char query[256];
-char *chrom, *chromStart, *chromEnd;
char *chp;
char *omimId, *avSubFdId;
char *avDescStartPos, *avDescLen;
char *omimTitle = cloneString("");
char *geneSymbol = NULL;
int iAvDescStartPos = 0;
int iAvDescLen = 0;
struct lineFile *lf;
char *line;
int lineSize;
cartWebStart(cart, database, "%s (%s)", tdb->longLabel, avName);
sqlSafef(query, sizeof(query), "select * from omimAv where name = '%s'", avName);
sr = sqlGetResult(conn, query);
if ((row = sqlNextRow(sr)) == NULL)
errAbort("Couldn't find %s in omimAv table - database inconsistency.", avName);
-else
- {
- chrom = cloneString(row[1]);
- chromStart = cloneString(row[2]);
- chromEnd = cloneString(row[3]);
- }
sqlFreeResult(&sr);
omimId = strdup(avName);
chp = strstr(omimId, ".");
*chp = '\0';
chp++;
avSubFdId = chp;
sqlSafef(query, sizeof(query), "select title, geneSymbol from hgFixed.omimTitle where omimId = %s", omimId);
sr = sqlGetResult(conn, query);
if ((row = sqlNextRow(sr)) != NULL)
{
omimTitle = cloneString(row[0]);
@@ -9480,59 +9448,60 @@
/* Print details of a COSMIC entry. */
{
struct sqlConnection *conn = hAllocConn(database);
struct sqlConnection *conn2 = hAllocConn(database);
char query[1024];
char query2[1024];
struct sqlResult *sr;
struct sqlResult *sr2;
char **row;
char **row2;
char *chp;
char indent1[40] = {" "};
char indent2[40] = {""};
-char *source, *cosmic_mutation_id, *gene_name, *accession_number;
+char *gene_name, *accession_number;
+// char $source, *cosmic_mutation_id; unused variable
char *mut_description, *mut_syntax_cds, *mut_syntax_aa;
char *chromosome, *grch37_start, *grch37_stop, *mut_nt;
char *mut_aa, *tumour_site, *mutated_samples, *examined_samples, *mut_freq;
char *url = tdb->url;
char *chrom, *chromStart, *chromEnd;
chrom = cartOptionalString(cart, "c");
chromStart = cartOptionalString(cart, "o");
chromEnd = cartOptionalString(cart, "t");
sqlSafef(query, sizeof(query),
"select source,cosmic_mutation_id,gene_name,accession_number,mut_description,mut_syntax_cds,mut_syntax_aa,"
"chromosome,grch37_start,grch37_stop,mut_nt,mut_aa,tumour_site,mutated_samples,examined_samples,mut_freq"
" from cosmicRaw where cosmic_mutation_id='%s'",
itemName);
sr = sqlMustGetResult(conn, query);
row = sqlNextRow(sr);
if (row != NULL)
{
int ii;
boolean multipleTumorSites;
char *indentString;
ii=0;
- source = row[ii];ii++;
- cosmic_mutation_id = row[ii];ii++;
+ ii++; // source = row[ii];ii++; unused variable
+ ii++; // cosmic_mutation_id = row[ii];ii++; unused variable
gene_name = row[ii];ii++;
accession_number = row[ii];ii++;
mut_description = row[ii];ii++;
mut_syntax_cds = row[ii];ii++;
mut_syntax_aa = row[ii];ii++;
chromosome = row[ii];ii++;
grch37_start = row[ii];ii++;
grch37_stop = row[ii];ii++;
mut_nt = row[ii];ii++;
mut_aa = row[ii];ii++;
tumour_site = row[ii];ii++;
mutated_samples = row[ii];ii++;
examined_samples = row[ii];ii++;
mut_freq = row[ii];ii++;
@@ -10358,69 +10327,65 @@
printOmimLocationDetails(tdb, item, FALSE);
printTrackHtml(tdb);
}
void printOmimAvSnpDetails(struct trackDb *tdb, char *itemName, boolean encode)
/* Print details of an OMIM AvSnp entry. */
{
struct sqlConnection *conn = hAllocConn(database);
char query[256];
struct sqlResult *sr;
char **row;
char *url = tdb->url;
char *title1 = NULL;
char *title2 = NULL;
char *chrom, *chromStart, *chromEnd;
-char *omimId;
char *avId;
char *dbSnpId;
char *chp;
-char *seqId = NULL;
char avString[255];
char *avDesc = NULL;
chrom = cartOptionalString(cart, "c");
chromStart = cartOptionalString(cart, "o");
chromEnd = cartOptionalString(cart, "t");
avId = strdup(itemName);
chp = strstr(avId, "-");
if (chp != NULL) *chp = '\0';
safef(avString, sizeof(avString), "%s", itemName);
chp = strstr(itemName, ".");
*chp = '\0';
-omimId = strdup(itemName);
chp = avString;
chp = strstr(avString, ".");
*chp = '#';
if (url != NULL && url[0] != 0)
{
sqlSafef(query, sizeof(query),
"select title1, title2, format(seqNo/10000,4), v.description"
" from omimGeneMap m, omimAv v"
" where m.omimId=%s and m.omimId=v.omimId and v.avId='%s';", itemName, avId);
sr = sqlMustGetResult(conn, query);
row = sqlNextRow(sr);
if (row != NULL)
{
- seqId = strdup(row[2]);
if (row[0] != NULL)
{
title1 = cloneString(row[0]);
}
if (row[1] != NULL)
{
title2 = cloneString(row[1]);
}
avDesc = cloneString(row[3]);
}
sqlFreeResult(&sr);
printf("OMIM Allelic Variant: ");
printf("", url, avString);
printf("%s", avId);
@@ -10748,51 +10713,50 @@
printTrackHtml(tdb);
hFreeConn(&conn);
}
void doRgdGene2(struct trackDb *tdb, char *rgdGeneId)
/* Process click on a RGD gene. */
{
struct sqlConnection *conn = hAllocConn(database);
struct sqlResult *sr;
char **row;
char query[256];
char *sqlRnaName = rgdGeneId;
char *rgdId = NULL;
char *chp;
char *GeneID, *Name, *note;
-char *rgdPathwayId;
char *rgdPathwayName;
/* Make sure to escape single quotes for DB parseability */
if (strchr(rgdGeneId, '\''))
sqlRnaName = replaceChars(rgdGeneId, "'", "''");
cartWebStart(cart, database, "%s", tdb->longLabel);
chp = strstr(rgdGeneId, ":");
if (chp != NULL)
{
chp++;
rgdId = strdup(chp);
}
else
{
errAbort("Couldn't find %s.", rgdGeneId);
}
-sqlSafef(query, sizeof(query), "select GeneID, Name, note from rgdGeneXref where rgdGeneId = '%s'", rgdGeneId);
+sqlSafef(query, sizeof(query), "select GeneID, Name, note from rgdGeneXref where rgdGeneId = '%s'", sqlRnaName);
sr = sqlGetResult(conn, query);
if ((row = sqlNextRow(sr)) == NULL)
errAbort("Couldn't find %s in rgdGeneXref table - database inconsistency.", rgdGeneId);
GeneID = cloneString(row[0]);
Name = cloneString(row[1]);
note = cloneString(row[2]);
sqlFreeResult(&sr);
printf("Gene %s\n", Name);
printf("RGD Gene Report: url, rgdId);
printf("\" TARGET=_blank>RGD:%s", rgdId);
@@ -10844,31 +10808,30 @@
row = sqlNextRow(sr);
}
}
sqlFreeResult(&sr);
htmlHorizontalLine();
printf("RGD Pathway(s)\n");
sqlSafef(query, sizeof(query),
"select p.rgdPathwayId, p.name from rgdGenePathway g, rgdPathway p where g.rgdGeneId = '%s' and g.rgdPathwayId=p.rgdPathwayId", rgdGeneId);
sr = sqlGetResult(conn, query);
if ((row = sqlNextRow(sr)) == NULL)
errAbort("Couldn't find %s in rgdGenePathway table - database inconsistency.", rgdGeneId);
printf("");
while (row != NULL)
{
- rgdPathwayId = cloneString(row[0]);
rgdPathwayName = cloneString(row[1]);
printf("- %s
", rgdPathwayName);
row = sqlNextRow(sr);
}
sqlFreeResult(&sr);
printf(" ");
printf(" %s ", "Click here for more RGD pathway details related to this gene...");
htmlHorizontalLine();
printTrackHtml(tdb);
hFreeConn(&conn);
}
@@ -12247,41 +12210,37 @@
void doSangerGene(struct trackDb *tdb, char *geneName, char *pepTable, char *mrnaTable, char *extraTable)
/* Handle click on Sanger gene track. */
{
genericHeader(tdb, geneName);
showSangerExtra(geneName, extraTable);
geneShowCommon(geneName, tdb, pepTable);
printTrackHtml(tdb);
}
void doTrnaGenesGb(struct trackDb *tdb, char *trnaName)
{
struct tRNAs *trna;
char query[512];
struct sqlConnection *conn = hAllocConn(database);
struct sqlResult *sr;
-char *dupe, *words[16];
char **row;
-int wordCount;
int rowOffset;
int start = cartInt(cart, "o");
int end = cartInt(cart, "t");
genericHeader(tdb,trnaName);
-dupe = cloneString(tdb->type);
-wordCount = chopLine(dupe, words);
rowOffset = hOffsetPastBin(database, seqName, tdb->table);
sqlSafef(query, ArraySize(query),
"select * from %s where name = '%s' and chromStart=%d and chromEnd=%d",
tdb->table, trnaName, start, end);
sr = sqlGetResult(conn, query);
/* use TABLE to align image with other info side by side */
printf("");
while ((row = sqlNextRow(sr)) != NULL)
{
char imgFileName[512];
char encodedName[255];
char *chp1, *chp2;
@@ -13469,36 +13428,35 @@
if (hTableExists(database, chainTable_chrom) )
{
/* lookup chain if not stored */
char **row;
struct sqlResult *sr = NULL;
sqlDyStringPrintf(dy, "select id, score, qStart, qEnd, qStrand, qSize from %s where ",
chainTable_chrom);
hAddBinToQuery(chromStart, chromEnd, dy);
dyStringPrintf(dy, "tEnd > %d and tStart < %d ", chromStart,chromEnd);
dyStringAppend(dy, " order by qStart");
sr = sqlGetResult(conn, dy->string);
while ((row = sqlNextRow(sr)) != NULL)
{
- int chainId = 0, score;
+ int chainId = 0;
unsigned int qStart, qEnd, qSize;
struct chain *chain = NULL;
char qStrand;
chainId = sqlUnsigned(row[0]);
- score = sqlUnsigned(row[1]);
qStart = sqlUnsigned(row[2]);
qEnd = sqlUnsigned(row[3]);
qStrand =row[4][0];
qSize = sqlUnsigned(row[5]);
if (qStrand == '-')
{
unsigned int tmp = qSize - qEnd;
qEnd = qSize - qStart;
qStart = tmp;
}
chain = NULL;
if (chainId != 0)
{
chain = chainLoadIdRange(database, chainTable, chrom, chromStart, chromEnd, chainId);
if (chain != NULL)
@@ -15354,47 +15312,45 @@
}
return rsId;
}
void doSnpEntrezGeneLink(struct trackDb *tdb, char *name)
/* print link to EntrezGene for this SNP */
{
char *table = tdb->table;
if (hTableExists(database, "knownGene") && hTableExists(database, "refLink") &&
hTableExists(database, "mrnaRefseq") && hTableExists(database, table))
{
struct sqlConnection *conn = hAllocConn(database);
struct sqlResult *sr;
char **row;
char query[512];
- int rowOffset;
sqlSafef(query, sizeof(query),
"select distinct "
" rl.locusLinkID, "
" rl.name "
"from knownGene kg, "
" refLink rl, "
" %s snp, "
" mrnaRefseq mrs "
"where snp.chrom = kg.chrom "
" and kg.name = mrs.mrna "
" and mrs.refSeq = rl.mrnaAcc "
" and kg.txStart < snp.chromStart "
" and kg.txEnd > snp.chromEnd "
" and snp.name = '%s'", table, name);
- rowOffset = hOffsetPastBin(database, seqName, table);
sr = sqlGetResult(conn, query);
while ((row = sqlNextRow(sr)) != NULL)
{
printf(" Entrez Gene for ", row[0]);
printf("%s \n", row[1]);
}
sqlFreeResult(&sr);
hFreeConn(&conn);
}
}
void doSnpOld(struct trackDb *tdb, char *itemName)
/* Put up info on a SNP. */
{
@@ -18418,31 +18374,30 @@
hFreeConn(&conn2);
hFreeConn(&conn);
}
void doJaxPhenotype(struct trackDb *tdb, char *item)
/* Show gene prediction position and other info. */
{
struct sqlConnection *conn = hAllocConn(database);
struct sqlResult *sr = NULL;
char **row = NULL;
boolean hasBin;
char query[512];
char aliasTable[256], phenoTable[256];
struct slName *phenoList = NULL, *pheno = NULL;
boolean first = TRUE;
-int chromStart=0, chromEnd=0;
char *selectedPheno = NULL;
/* Parse out the selected phenotype passed in from hgTracks. */
if ((selectedPheno = strstr(item, " source=")) != NULL)
{
*selectedPheno = '\0';
selectedPheno += strlen(" source=");
}
genericHeader(tdb, item);
safef(aliasTable, sizeof(aliasTable), "%sAlias", tdb->table);
safef(phenoTable, sizeof(phenoTable), "jaxAllelePheno");
sqlSafefFrag(query, sizeof(query), "name = \"%s\"", item);
sr = hRangeQuery(conn, tdb->table, seqName, winStart, winEnd, query,
&hasBin);
while ((row = sqlNextRow(sr)) != NULL)
@@ -18457,32 +18412,30 @@
if (hTableExists(database, aliasTable))
{
struct sqlConnection *conn2 = hAllocConn(database);
char query2[512];
char buf[512];
char *mgiId;
sqlSafef(query2, sizeof(query2),
"select alias from %s where name = '%s'", aliasTable, item);
mgiId = sqlQuickQuery(conn2, query2, buf, sizeof(buf));
if (mgiId != NULL)
printCustomUrl(tdb, mgiId, TRUE);
hFreeConn(&conn2);
}
printPos(bed->chrom, bed->chromStart, bed->chromEnd, bed->strand,
FALSE, NULL);
- chromStart = bed->chromStart;
- chromEnd = bed->chromEnd;
bedFree(&bed);
}
pheno = slNameNew(row[hasBin+12]);
slAddHead(&phenoList, pheno);
}
sqlFreeResult(&sr);
printf("Phenotype(s) at this locus: ");
first = TRUE;
slNameSort(&phenoList);
for (pheno = phenoList; pheno != NULL; pheno = pheno->next)
{
if (first)
first = FALSE;
else
printf(", ");
@@ -19468,48 +19421,44 @@
printf("Genbank accession: %s \n", chick->gbkAcc);
printf("BLAT alignment: %s \n", chick->blat);
printf("Source annotation: %s \n", chick->sourceAnnot);
printf("TIGR assigned TC: %s \n", chick->tigrTc);
printf("TIGR TC annotation: %s \n", chick->tigrTcAnnot);
printf("BLAST determined annotation: %s \n", chick->blastAnnot);
printf("Comment: %s \n", chick->comment);
}
genericBedClick(conn, tdb, item, start, 1);
printTrackHtml(tdb);
hFreeConn(&conn);
}
void perlegenDetails(struct trackDb *tdb, char *item)
{
-char *dupe, *words[16];
-int wordCount;
int start = cartInt(cart, "o");
struct sqlConnection *conn = hAllocConn(database);
char table[64];
boolean hasBin;
struct bed *bed;
char query[512];
struct sqlResult *sr;
char **row;
boolean firstTime = TRUE;
int numSnpsReq = -1;
if(tdb == NULL)
errAbort("TrackDb entry null for perlegen, item=%s\n", item);
-dupe = cloneString(tdb->type);
genericHeader(tdb, item);
-wordCount = chopLine(dupe, words);
printCustomUrl(tdb, item, FALSE);
hFindSplitTable(database, seqName, tdb->table, table, &hasBin);
sqlSafef(query, sizeof query, "select * from %s where name = '%s' and chrom = '%s' and chromStart = %d",
table, item, seqName, start);
sr = sqlGetResult(conn, query);
while ((row = sqlNextRow(sr)) != NULL)
{
char *name;
/* set up for first time */
if (firstTime)
firstTime = FALSE;
else
htmlHorizontalLine();
bed = bedLoadN(row+hasBin, 12);
@@ -19542,93 +19491,85 @@
}
/* finish off report ... */
printf("Block: %s \n", name);
printf("Number of SNPs in block: %d \n", bed->blockCount);
printf("Number of SNPs to represent block: %d \n",numSnpsReq);
printf("Strand: %s \n", bed->strand);
bedPrintPos(bed, 3, tdb);
}
printTrackHtml(tdb);
hFreeConn(&conn);
}
void haplotypeDetails(struct trackDb *tdb, char *item)
{
-char *dupe, *words[16];
-int wordCount;
int start = cartInt(cart, "o");
struct sqlConnection *conn = hAllocConn(database);
char table[64];
boolean hasBin;
struct bed *bed;
char query[512];
struct sqlResult *sr;
char **row;
boolean firstTime = TRUE;
if(tdb == NULL)
errAbort("TrackDb entry null for haplotype, item=%s\n", item);
-dupe = cloneString(tdb->type);
genericHeader(tdb, item);
-wordCount = chopLine(dupe, words);
printCustomUrl(tdb, item, TRUE);
hFindSplitTable(database, seqName, tdb->table, table, &hasBin);
sqlSafef(query, sizeof query, "select * from %s where name = '%s' and chrom = '%s' and chromStart = %d",
table, item, seqName, start);
sr = sqlGetResult(conn, query);
while ((row = sqlNextRow(sr)) != NULL)
{
/* set up for first time */
if (firstTime)
firstTime = FALSE;
else
htmlHorizontalLine();
bed = bedLoadN(row+hasBin, 12);
/* finish off report ... */
printf("Block: %s \n", bed->name);
printf("Number of SNPs in block: %d \n", bed->blockCount);
/* printf("Number of SNPs to represent block: %d \n",numSnpsReq);*/
printf("Strand: %s \n", bed->strand);
bedPrintPos(bed, 3, tdb);
}
printTrackHtml(tdb);
hFreeConn(&conn);
}
void mitoDetails(struct trackDb *tdb, char *item)
{
-char *dupe, *words[16];
-int wordCount;
int start = cartInt(cart, "o");
struct sqlConnection *conn = hAllocConn(database);
char table[64];
boolean hasBin;
struct bed *bed;
char query[512];
struct sqlResult *sr;
char **row;
boolean firstTime = TRUE;
int numSnpsReq = -1;
if(tdb == NULL)
errAbort("TrackDb entry null for mitoSnps, item=%s\n", item);
-dupe = cloneString(tdb->type);
genericHeader(tdb, item);
-wordCount = chopLine(dupe, words);
printCustomUrl(tdb, item, TRUE);
hFindSplitTable(database, seqName, tdb->table, table, &hasBin);
sqlSafef(query, sizeof query, "select * from %s where name = '%s' and chrom = '%s' and chromStart = %d",
table, item, seqName, start);
sr = sqlGetResult(conn, query);
while ((row = sqlNextRow(sr)) != NULL)
{
char *name;
/* set up for first time */
if (firstTime)
firstTime = FALSE;
else
htmlHorizontalLine();
bed = bedLoadN(row+hasBin, 12);
@@ -19660,48 +19601,44 @@
break;
}
/* finish off report ... */
printf("Block: %s \n", name);
printf("Number of SNPs in block: %d \n", bed->blockCount);
printf("Number of SNPs to represent block: %d \n",numSnpsReq);
printf("Strand: %s \n", bed->strand);
bedPrintPos(bed, 3, tdb);
}
printTrackHtml(tdb);
hFreeConn(&conn);
}
void ancientRDetails(struct trackDb *tdb, char *item)
{
-char *dupe, *words[16];
-int wordCount;
struct sqlConnection *conn = hAllocConn(database);
char table[64];
boolean hasBin;
struct bed *bed = NULL;
char query[512];
struct sqlResult *sr = NULL;
char **row;
boolean firstTime = TRUE;
double ident = -1.0;
struct ancientRref *ar = NULL;
if(tdb == NULL)
errAbort("TrackDb entry null for ancientR, item=%s\n", item);
-dupe = cloneString(tdb->type);
genericHeader(tdb, item);
-wordCount = chopLine(dupe, words);
printCustomUrl(tdb, item, TRUE);
hFindSplitTable(database, seqName, tdb->table, table, &hasBin);
sqlSafef(query, sizeof query, "select * from %s where name = '%s' and chrom = '%s'",
table, item, seqName );
sr = sqlGetResult(conn, query);
while ((row = sqlNextRow(sr)) != NULL)
{
char *name;
/* set up for first time */
if (firstTime)
firstTime = FALSE;
else
htmlHorizontalLine();
bed = bedLoadN(row+hasBin, 12);
@@ -20435,31 +20372,30 @@
{
int humMusWinSize = 50;
int i;
char table[64];
boolean hasBin;
struct sample *smp;
char query[512];
char tempTableName[1024];
struct sqlResult *sr;
char **row;
char **pslRow;
boolean firstTime = TRUE;
struct psl *thisPsl;
char str[256];
char thisItem[256];
-char *cgiItem;
char otherString[256] = "";
struct sqlResult *pslSr;
struct sqlConnection *conn2 = hAllocConn(database);
int thisStart, thisEnd;
int left = cartIntExp( cart, "l" );
int right = cartIntExp( cart, "r" );
char *winOn = cartUsualString( cart, "win", "F" );
hFindSplitTable(database, seqName, tdb->table, table, &hasBin);
sqlSafef(query, sizeof query, "select * from %s where name = '%s' and chrom = '%s'",
table, item, seqName);
sr = sqlGetResult(conn, query);
while ((row = sqlNextRow(sr)) != NULL)
{
if (firstTime)
@@ -20471,31 +20407,30 @@
hFindSplitTable(database, seqName, pslTableName, table, &hasBin);
sqlSafef(query, sizeof query, "select * from %s where tName = '%s' and tEnd >= %d and tStart <= %d"
, table, smp->chrom, smp->chromStart+smp->samplePosition[0]
, smp->chromStart+smp->samplePosition[smp->sampleCount-1] );
pslSr = sqlGetResult(conn2, query);
if(!sameString(winOn,"T"))
{
while(( pslRow = sqlNextRow(pslSr)) != NULL )
{
thisPsl = pslLoad( pslRow+hasBin );
firstAndLastPosition( &thisStart, &thisEnd, thisPsl );
snprintf(thisItem, 256, "%s:%d-%d %s:%d-%d", thisPsl->qName,
thisPsl->qStart, thisPsl->qEnd, thisPsl->tName,
thisPsl->tStart, thisPsl->tEnd );
- cgiItem = cgiEncode(thisItem);
longXenoPsl1Given(tdb, thisItem, otherOrg, "chromInfo",
otherDb, thisPsl, pslTableName );
safef(otherString, sizeof otherString, "%d&win=T", thisPsl->tStart );
hgcAnchorSomewhere( tdb->track, cgiEncode(item), otherString, thisPsl->tName );
printf("View individual alignment windows\n");
printf("
");
}
}
else
{
cartSetString( cart, "win", "F" );
printf("Alignments Windows \n"
"start stop"
" L-score " );
while(( pslRow = sqlNextRow(pslSr)) != NULL )
@@ -20569,65 +20504,63 @@
smp->chromStart+smp->samplePosition[smp->sampleCount-1] );
printf("Content-Type: text/html\n\n \n",
filename);
}
}
void humMusClickHandler(struct trackDb *tdb, char *item,
char *targetName, char *targetDb, char *targetTable, boolean printWindowFlag )
/* Put up sample track info. */
{
-char *type, *words[16], *dupe = cloneString(tdb->type);
+char *words[16], *dupe = cloneString(tdb->type);
int num;
int wordCount;
int start = cartInt(cart, "o");
struct sqlConnection *conn = hAllocConn(database);
genericHeader(tdb, item);
wordCount = chopLine(dupe, words);
if (wordCount > 0)
{
- type = words[0];
num = 0;
if (wordCount > 1)
num = atoi(words[1]);
if (num < 3) num = 3;
humMusSampleClick( conn, tdb, item, start, num, targetName, targetDb, targetTable, printWindowFlag );
}
printTrackHtml(tdb);
freez(&dupe);
hFreeConn(&conn);
}
void footPrinterClickHandler(struct trackDb *tdb, char *item )
/* Put up generic track info. */
{
-char *type, *words[16], *dupe = cloneString(tdb->type);
+char *words[16], *dupe = cloneString(tdb->type);
int num;
int wordCount;
int start = cartInt(cart, "o");
struct sqlConnection *conn = hAllocConn(database);
wordCount = chopLine(dupe, words);
if (wordCount > 0)
{
- type = words[0];
num = 0;
if (wordCount > 1)
num = atoi(words[1]);
if (num < 3) num = 3;
footPrinterSampleClick(conn, tdb, item, start, num);
}
printTrackHtml(tdb);
freez(&dupe);
hFreeConn(&conn);
}
void hgCustom(char *trackId, char *fileItem)
/* Process click on custom track. */
{
char *fileName, *itemName;
@@ -21255,76 +21188,72 @@
}
bedFree(&bed);
}
else
errAbort("query returned no results: \"%s\"", query);
sqlFreeResult(&sr);
hFreeConn(&conn);
printTrackHtml(tdb);
}
void doScaffoldEcores(struct trackDb *tdb, char *item)
/* Creates details page and gets the scaffold co-ordinates for unmapped */
/* genomes for display and to use to create the correct outside link URL */
{
-char *dupe, *words[16];
-int wordCount;
+char *words[16];
int start = cartInt(cart, "o");
struct sqlConnection *conn = hAllocConn(database);
int num;
struct bed *bed = NULL;
char query[512];
struct sqlResult *sr;
char **row;
char *scaffoldName;
int scaffoldStart, scaffoldEnd;
struct dyString *itemUrl = newDyString(128), *d;
char *old = "_";
char *new = "";
char *pat = "fold";
int hasBin = 1;
-dupe = cloneString(tdb->type);
-wordCount = chopLine(dupe, words);
/* get bed size */
num = 0;
num = atoi(words[1]);
/* get data for this item */
sqlSafef(query, sizeof query, "select * from %s where name = '%s' and chromStart = %d", tdb->table, item, start);
sr = sqlGetResult(conn, query);
while ((row = sqlNextRow(sr)) != NULL)
bed = bedLoadN(row+hasBin, num);
genericHeader(tdb, item);
/* convert chromosome co-ordinates to scaffold position and */
/* make into item for URL */
if (hScaffoldPos(database, bed->chrom, bed->chromStart, bed->chromEnd, &scaffoldName, &scaffoldStart, &scaffoldEnd) )
{
scaffoldStart += 1;
dyStringPrintf(itemUrl, "%s:%d-%d", scaffoldName, scaffoldStart, scaffoldEnd);
/* remove underscore in scaffold name and change to "scafN" */
d = dyStringSub(itemUrl->string, old, new);
itemUrl = dyStringSub(d->string, pat, new);
printCustomUrl(tdb, itemUrl->string, TRUE);
}
genericBedClick(conn, tdb, item, start, num);
printTrackHtml(tdb);
dyStringFree(&itemUrl);
-freez(&dupe);
sqlFreeResult(&sr);
hFreeConn(&conn);
}
char *stripBDGPSuffix(char *name)
/* cloneString(name), and if it ends in -R[A-Z], strip that off. */
{
char *stripped = cloneString(name);
int len = strlen(stripped);
if (stripped[len-3] == '-' &&
stripped[len-2] == 'R' &&
isalpha(stripped[len-1]))
stripped[len-3] = 0;
return(stripped);
}
@@ -22559,61 +22488,59 @@
qSeq = loadGenomePart(db, psl->qName, psl->qStart, psl->qEnd);
safef(name, sizeof name, "%s in %s(%d-%d)", item,psl->qName, psl->qStart, psl->qEnd);
writeFramesetType();
puts("");
printf("\n%s %dk\n\n\n", name, psl->qStart/1000);
showSomeAlignment2(psl, qSeq, gftDnaX, psl->qStart, psl->qEnd, name, item, "", psl->qStart, psl->qEnd);
}
void doPutaFrag(struct trackDb *tdb, char *item)
/* display the potential pseudo and coding track */
{
struct sqlConnection *conn = hAllocConn(database);
struct sqlResult *sr = NULL;
char **row, table[256], query[256], *parts[6];
struct putaInfo *info = NULL;
-struct psl *psl = NULL;
int start = cartInt(cart, "o"), end = cartInt(cart, "t");
char *db = cgiString("db");
char *name = cartString(cart, "i"), *chr = cartString(cart, "c");
char pslTable[256];
-char otherString[256], *tempName = NULL;
-int partCount;
+char otherString[256];
safef(table, sizeof table, "putaInfo");
safef(pslTable, sizeof pslTable, "potentPsl");
cartWebStart(cart, database, "Putative Coding or Pseudo Fragments");
sqlSafef(query, sizeof query, "SELECT * FROM %s WHERE name = '%s' "
"AND chrom = '%s' AND chromStart = %d "
"AND chromEnd = %d",
table, name, chr, start, end);
sr = sqlMustGetResult(conn, query);
row = sqlNextRow(sr);
if(row != NULL)
{
info = putaInfoLoad(row+1);
}
else
{
errAbort("Can't find information for %s in data base\n", name);
}
sqlFreeResult(&sr);
-tempName = cloneString(name);
-partCount = chopByChar(tempName, '|',parts, 4);
+char *tempName = cloneString(name);
+chopByChar(tempName, '|',parts, 4);
printf("%s is homologous to the known gene: %s \n", parts[0]);
printf("%s is aligned here with score : %d
\n", parts[0], info->score);
/* print the info about the stamper gene */
printf(" %s \n", parts[0]);
printf("Genomic location of the mapped part of %s: %s(%s):%d-%d \n",
parts[0], hgTracksName(), db, info->oChrom, info->oChromStart, info->oChromEnd,
info->oChrom, parts[2],info->oChromStart+1, info->oChromEnd);
printf("Mapped %s Exons: %d of %d. Mapped %s CDS exons: %d of %d \n", parts[0], info->qExons[0], info->qExons[1], parts[0], info->qExons[2], info->qExons[3]);
printf("Aligned %s bases:%d of %d with %f identity. Aligned %s CDS bases: %d of %d with %f identity.
\n", parts[0],info->qBases[0], info->qBases[1], info->id[0], parts[0], info->qBases[2], info->qBases[3], info->id[1]);
@@ -22645,31 +22572,30 @@
/* show genome sequence */
hgcAnchorSomewhere("htcGeneInGenome", cgiEncode(info->name), tdb->track, seqName);
printf("View DNA for this putative fragment \n");
/* show the detail alignment */
sqlSafef(query, sizeof query, "SELECT * FROM %s WHERE "
"tName = '%s' AND tStart = %d "
"AND tEnd = %d AND strand = '%c%c'",
pslTable, info->chrom, info->chromStart, info->chromEnd, parts[2][0], info->strand[0]);
sr = sqlMustGetResult(conn, query);
row = sqlNextRow(sr);
if(row != NULL)
{
- psl = pslLoad(row+1);
safef(otherString, sizeof otherString, "&db=%s&pslTable=%s&chrom=%s&cStart=%d&cEnd=%d&strand=%s&qStrand=%s",
database, pslTable, info->chrom,info->chromStart, info->chromEnd, info->strand, parts[2]);
hgcAnchorSomewhere("potentPsl", cgiEncode(parts[0]), otherString, info->chrom);
printf(" View details of parts of alignment .\n");
}
sqlFreeResult(&sr);
putaInfoFree(&info);
hFreeConn(&conn);
}
void doInterPro(struct trackDb *tdb, char *itemName)
{
char condStr[255];
char *desc;
struct sqlConnection *conn;
@@ -24104,31 +24030,31 @@
printTrackHtml(tdb);
hFreeConn(&conn);
}
void doUCSFDemo(struct trackDb *tdb, char *item)
{
genericHeader(tdb, item);
printf("Name: %s \n", item);
/* this prints the detail page for the clinical information for Cancer Demo datasets */
char *table = tdb->table;
char *cliniTable=NULL, *key=NULL;
char query[256];
struct sqlConnection *conn = hAllocConn(database);
-struct sqlResult *sr, *startSr;
+struct sqlResult *sr;
char **row;
if (sameString(table, "CGHBreastCancerUCSF") || sameString(table, "expBreastCancerUCSF"))
{
cliniTable = "phenBreastTumors";
key = "id";
/* er, pr */
printf(" ");
printf("\n");
printf("ER | PR | \n");
sqlSafef(query, sizeof(query), "select er, pr from %s where %s = '%s' ", cliniTable, key, item);
sr = sqlGetResult(conn, query);
if ((row = sqlNextRow(sr)) != NULL)
{
@@ -24289,32 +24215,30 @@
{
cliniTable = "tspLungClinical";
key = "tumorID";
}
else
return;
htmlHorizontalLine();
sqlSafef(query, sizeof(query),
"select * from %s where %s = '%s' ", cliniTable, key,item);
sr = sqlGetResult(conn, query);
if ((row = sqlNextRow(sr)) != NULL)
{
- startSr = sr;
-
int numFields = sqlCountColumns(sr);
int i;
char *fieldName=NULL, *value=NULL;
for (i=0; i< numFields; i++)
{
fieldName = sqlFieldName(sr);
value = row[i];
printf("%s: %s \n", fieldName, value);
}
}
sqlFreeResult(&sr);
//printTrackHtml(tdb);
//hFreeConn
}
|
---|