struct atom *atomLoad(char **row)
/* Load a atom from row fetched with select * from atom
 * from database.  Dispose of this with atomFree(). */
{
struct atom *ret;

AllocVar(ret);
ret->name = cloneString(row[0]);
ret->instance = sqlUnsigned(row[1]);
ret->species = cloneString(row[2]);
ret->chrom = cloneString(row[3]);
ret->start = sqlUnsigned(row[4]);
ret->end = sqlUnsigned(row[5]);
safecpy(ret->strand, sizeof(ret->strand), row[6]);
ret->fivePrime = cloneString(row[7]);
ret->threePrime = cloneString(row[8]);
return ret;
}
Exemple #2
0
void traceInfoStaticLoad(char **row, struct traceInfo *ret)
/* Load a row from traceInfo table into ret.  The contents of ret will
 * be replaced at the next call to this function. */
{

ret->ti = row[0];
ret->templateId = row[1];
ret->size = sqlUnsigned(row[2]);
}
Exemple #3
0
void cnpSharpCutoffStaticLoad(char **row, struct cnpSharpCutoff *ret)
/* Load a row from cnpSharpCutoff table into ret.  The contents of ret will
 * be replaced at the next call to this function. */
{

ret->sample = row[0];
ret->batch = sqlUnsigned(row[1]);
ret->value = atof(row[2]);
}
Exemple #4
0
void ld2StaticLoad(char **row, struct ld2 *ret)
/* Load a row from ld2 table into ret.  The contents of ret will
 * be replaced at the next call to this function. */
{

ret->chrom = row[0];
ret->chromStart = sqlUnsigned(row[1]);
ret->chromEnd = sqlUnsigned(row[2]);
ret->name = row[3];
ret->ldCount = sqlUnsigned(row[4]);
ret->dprime = row[5];
ret->rsquared = row[6];
ret->lod = row[7];
ret->avgDprime = row[8][0];
ret->avgRsquared = row[9][0];
ret->avgLod = row[10][0];
ret->tInt = row[11][0];
}
Exemple #5
0
void checkForGeoMirrorRedirect(struct cart *cart)
// Implement Geo/IP based redirection.
{
char *thisNodeStr = geoMirrorNode();
if (thisNodeStr)   // if geo-mirroring is enabled
    {
    char *redirectCookie = findCookieData("redirect");
    char *redirect = cgiOptionalString("redirect");

    // if we're not already redirected
    if (redirect == NULL && redirectCookie == NULL) 
        {
        int thisNode = sqlUnsigned(thisNodeStr);
        struct sqlConnection *centralConn = hConnectCentral();
        char *ipStr = cgiRemoteAddr();
        int node = defaultNode(centralConn, ipStr);

        // if our node is not the node that's closest.
        if (thisNode != node)
            {
	    char *geoSuffix = cfgOptionDefault("browser.geoSuffix","");
            char query[1056];
            sqlSafef(query, sizeof query, "select domain from gbNode%s where node = %d", geoSuffix, node);
            char *newDomain = sqlQuickString(centralConn, query);
            char *oldDomain = cgiServerName();
            char *port = cgiServerPort();
            char *uri = cgiRequestUri();
            char *sep = strchr(uri, '?') ? "&" : "?";
            int newUriSize = strlen(uri) + 1024;
            char *newUri = needMem(newUriSize);
            char *oldUri = needMem(newUriSize);
            safef(oldUri, newUriSize, "http%s://%s:%s%s%sredirect=manual&source=%s", 
		cgiServerHttpsIsOn() ? "s" : "", oldDomain, port, uri, sep, oldDomain);
            safef(newUri, newUriSize, "http%s://%s:%s%s%sredirect=manual&source=%s", 
		cgiServerHttpsIsOn() ? "s" : "", newDomain, port, uri, sep, oldDomain);

	    printf("<TR><TD COLSPAN=3 id='redirectTd' onclick=\"javascript:document.getElementById('redirectTd').innerHTML='';\">"
	    "<div style=\"margin: 10px 25%%; border-style:solid; border-width:thin; border-color:#97D897;\">"
	    "<h3 style=\"background-color: #97D897; text-align: left; margin-top:0px; margin-bottom:0px;\">"
	    "&nbsp;You might want to navigate to your nearest mirror - %s"
	    "</h3> "
	    "<ul style=\"margin:5px;\">",
	    newDomain);
	    
	    printf("<li>User settings (sessions and custom tracks) <B>will differ</B> between sites."
		"<idiv style=\"float:right;\"><a href=\"../goldenPath/help/genomeEuro.html#sessions\">Read more.</a></idiv>");
	    printf("<li>Take me to  <a href=\"%s\">%s</a> </li>",
		newUri, newDomain);
	    printf("<li>Let me stay here   <a href=\"%s\">%s</a>",
		oldUri, oldDomain );
	    printf("</div></TD></TR>\n");
            exit(0);
            }
        hDisconnectCentral(&centralConn);
        }
    }
}
Exemple #6
0
static void brokenRefPepGetSeqScan(struct sqlConnection *conn,
                                   struct extFileTbl* extFileTbl,
                                   struct brokenRefPepTbl *brpTbl)
/* load refSeq peps that have seq or extFile problems, including
 * checking fasta file contents*/
{
static char *query = NOSQLINJ "select id, acc, version, size, gbExtFile, file_offset, file_size "
    "from gbSeq where (acc like \"NP__%\") or (acc like \"YP__%\")";
struct sqlResult *sr = sqlGetResult(conn, query);
char **row;

while ((row = sqlNextRow(sr)) != NULL)
    brokenRefPepSeqCheck(conn, extFileTbl, brpTbl,
                         sqlSigned(row[0]), row[1], sqlSigned(row[2]),
                         sqlUnsigned(row[3]), sqlUnsigned(row[4]),
                         sqlLongLong(row[5]), sqlUnsigned(row[6]));
sqlFreeResult(&sr);
}
Exemple #7
0
struct snpTmp *snpTmpLoad(char **row)
/* Load a snpTmp from row fetched with select * from snpTmp
 * from database.  Dispose of this with snpTmpFree(). */
{
struct snpTmp *ret;

AllocVar(ret);
ret->chrom = cloneString(row[0]);
ret->chromStart = sqlUnsigned(row[1]);
ret->chromEnd = sqlUnsigned(row[2]);
ret->name = cloneString(row[3]);
strcpy(ret->strand, row[4]);
ret->refNCBI = cloneString(row[5]);
ret->locType = cloneString(row[6]);
ret->func = cloneString(row[7]);
ret->contigName = cloneString(row[8]);
return ret;
}
Exemple #8
0
void chromInfoStaticLoad(char **row, struct chromInfo *ret)
/* Load a row from chromInfo table into ret.  The contents of ret will
 * be replaced at the next call to this function. */
{

ret->chrom = row[0];
ret->size = sqlUnsigned(row[1]);
ret->fileName = row[2];
}
void hugoMultiStaticLoad(char **row, struct hugoMulti *ret)
/* Load a row from hugoMulti table into ret.  The contents of ret will
 * be replaced at the next call to this function. */
{

ret->hgnc = sqlUnsigned(row[0]);
ret->symbol = row[1];
ret->name = row[2];
ret->map = row[3];
ret->omimId = row[4];
ret->pmId1 = sqlUnsigned(row[5]);
ret->pmId2 = sqlUnsigned(row[6]);
ret->refSeqAcc = row[7];
ret->aliases = row[8];
ret->locusLinkId = sqlUnsigned(row[9]);
ret->gdbId = row[10];
ret->swissProt = row[11];
}
Exemple #10
0
static unsigned parseUnsignedVal(struct lineFile *lf, char *var, char *val)
/* Return val as an integer, printing error message if it's not. */
{
char c = val[0];
if (!isdigit(c))
    errAbort("Expecting numerical value for %s, got %s, line %d of %s", 
    	var, val, lf->lineIx, lf->fileName);
return sqlUnsigned(val);
}
Exemple #11
0
static int longRangeHeight(struct track *tg, enum trackVisibility vis)
/* calculate height of all the snakes being displayed */
{
if ( tg->visibility == tvDense)
    return  tl.fontHeight;
char buffer[1024];
safef(buffer, sizeof buffer, "%s.%s", tg->tdb->track, LONG_HEIGHT );
return tg->height = sqlUnsigned(cartUsualString(cart, buffer, LONG_DEFHEIGHT));
}
struct tfbsCons *tfbsConsLoad(char **row)
/* Load a tfbsCons from row fetched with select * from tfbsCons
 * from database.  Dispose of this with tfbsConsFree(). */
{
struct tfbsCons *ret;

AllocVar(ret);
ret->chrom = cloneString(row[0]);
ret->chromStart = sqlUnsigned(row[1]);
ret->chromEnd = sqlUnsigned(row[2]);
ret->name = cloneString(row[3]);
ret->score = sqlUnsigned(row[4]);
strcpy(ret->strand, row[5]);
strcpy(ret->species, row[6]);
strcpy(ret->factor, row[7]);
strcpy(ret->id, row[8]);
return ret;
}
struct cgh *cghLoad(char **row)
/* Load a cgh from row fetched with select * from cgh
 * from database.  Dispose of this with cghFree(). */
{
struct cgh *ret;

AllocVar(ret);
ret->chrom = cloneString(row[0]);
ret->chromStart = sqlUnsigned(row[1]);
ret->chromEnd = sqlUnsigned(row[2]);
ret->name = cloneString(row[3]);
ret->score = atof(row[4]);
ret->type = sqlUnsigned(row[5]);
ret->tissue = cloneString(row[6]);
ret->clone = cloneString(row[7]);
ret->spot = sqlUnsigned(row[8]);
return ret;
}
struct estOrientInfo *estOrientInfoLoad(char **row)
/* Load a estOrientInfo from row fetched with select * from estOrientInfo
 * from database.  Dispose of this with estOrientInfoFree(). */
{
struct estOrientInfo *ret;

AllocVar(ret);
ret->chrom = cloneString(row[0]);
ret->chromStart = sqlUnsigned(row[1]);
ret->chromEnd = sqlUnsigned(row[2]);
ret->name = cloneString(row[3]);
ret->intronOrientation = sqlSigned(row[4]);
ret->sizePolyA = sqlSigned(row[5]);
ret->revSizePolyA = sqlSigned(row[6]);
ret->signalPos = sqlSigned(row[7]);
ret->revSignalPos = sqlSigned(row[8]);
return ret;
}
void cdsPickStaticLoad(char **row, struct cdsPick *ret)
/* Load a row from cdsPick table into ret.  The contents of ret will
 * be replaced at the next call to this function. */
{

ret->name = row[0];
ret->start = sqlSigned(row[1]);
ret->end = sqlSigned(row[2]);
ret->source = row[3];
ret->score = sqlDouble(row[4]);
ret->startComplete = sqlUnsigned(row[5]);
ret->endComplete = sqlUnsigned(row[6]);
ret->swissProt = row[7];
ret->uniProt = row[8];
ret->refProt = row[9];
ret->refSeq = row[10];
ret->ccds = row[11];
}
Exemple #16
0
void wabaCrudeStaticLoad(char **row, struct wabaCrude *ret)
/* Load a row from wabaCrude table into ret.  The contents of ret will
 * be replaced at the next call to this function. */
{
int sizeOne,i;
char *s;

ret->score = sqlUnsigned(row[0]);
ret->qFile = row[1];
ret->qSeq = row[2];
ret->qStart = sqlUnsigned(row[3]);
ret->qEnd = sqlUnsigned(row[4]);
ret->strand = sqlSigned(row[5]);
ret->tFile = row[6];
ret->tSeq = row[7];
ret->tStart = sqlUnsigned(row[8]);
ret->tEnd = sqlUnsigned(row[9]);
}
void tRNAsStaticLoad(char **row, struct tRNAs *ret)
/* Load a row from tRNAs table into ret.  The contents of ret will
 * be replaced at the next call to this function. */
{

ret->chrom = row[0];
ret->chromStart = sqlUnsigned(row[1]);
ret->chromEnd = sqlUnsigned(row[2]);
ret->name = row[3];
ret->score = sqlUnsigned(row[4]);
safecpy(ret->strand, sizeof(ret->strand), row[5]);
ret->aa = row[6];
ret->ac = row[7];
ret->intron = row[8];
ret->trnaScore = sqlFloat(row[9]);
ret->genomeUrl = row[10];
ret->trnaUrl = row[11];
}
Exemple #18
0
struct mouseSynWhd *mouseSynWhdLoad(char **row)
/* Load a mouseSynWhd from row fetched with select * from mouseSynWhd
 * from database.  Dispose of this with mouseSynWhdFree(). */
{
struct mouseSynWhd *ret;

AllocVar(ret);
ret->chrom = cloneString(row[0]);
ret->chromStart = sqlUnsigned(row[1]);
ret->chromEnd = sqlUnsigned(row[2]);
ret->name = cloneString(row[3]);
ret->score = sqlUnsigned(row[4]);
strcpy(ret->strand, row[5]);
ret->mouseStart = sqlUnsigned(row[6]);
ret->mouseEnd = sqlUnsigned(row[7]);
ret->segLabel = cloneString(row[8]);
return ret;
}
void getWeight()
/* hash all snp IDs into global weightHash */
{
char query[512];
struct sqlConnection *conn = hAllocConn();
struct sqlResult *sr;
char **row;
int weight = 0;
int count0 = 0;
int count1 = 0;
int count2 = 0;
int count3 = 0;
int count10 = 0;
struct hashEl *hel = NULL;
    
weightHash = newHash(16);

verbose(1, "hashing MapInfo...\n");
sqlSafef(query, sizeof(query), "select snp_id, weight, assembly from MapInfo");
sr = sqlGetResult(conn, query);
while ((row = sqlNextRow(sr)) != NULL)
    {
    if (!sameString(row[2],  mapGroup)) continue;
    hel = hashLookup(weightHash, row[0]);
    // storing weight as a string
    if (hel == NULL)
        hashAdd(weightHash, cloneString(row[0]), cloneString(row[1]));
    else
        verbose(1, "duplicate entry for %s\n", row[0]);
    weight = sqlUnsigned(row[1]);
    switch (weight)
        {
	case 0:
	    count0++;
	    break;
        case 1:
            count1++;
	    break;
       case 2:
          count2++;
	  break;
       case 3:
          count3++;
	  break;
       case 10:
          count10++;
	  break;
       }
    }
sqlFreeResult(&sr);
hFreeConn(&conn);
verbose(1, "count of snps with weight 0 = %d\n", count0);
verbose(1, "count of snps with weight 1 = %d\n", count1);
verbose(1, "count of snps with weight 2 = %d\n", count2);
verbose(1, "count of snps with weight 3 = %d\n", count3);
verbose(1, "count of snps with weight 10 = %d\n", count10);
}
Exemple #20
0
void lowelabPfamHitsStaticLoad(char **row, struct lowelabPfamHits *ret)
/* Load a row from lowelabPfamHits table into ret.  The contents of ret will
 * be replaced at the next call to this function. */
{

ret->chrom = row[0];
ret->chromStart = sqlUnsigned(row[1]);
ret->chromEnd = sqlUnsigned(row[2]);
ret->name = row[3];
ret->score = sqlUnsigned(row[4]);
safecpy(ret->strand, sizeof(ret->strand), row[5]);
ret->pfamAC = row[6];
ret->pfamID = row[7];
ret->swissAC = row[8];
ret->protCoord = row[9];
ret->ident = sqlUnsigned(row[10]);
ret->percLen = sqlUnsigned(row[11]);
}
Exemple #21
0
struct cytoBand *cytoBandLoad(char **row)
/* Load a cytoBand from row fetched with select * from cytoBand
 * from database.  Dispose of this with cytoBandFree(). */
{
struct cytoBand *ret;
int sizeOne,i;
char *s;

AllocVar(ret);
ret->chrom = cloneString(row[0]);
ret->chromStart = sqlUnsigned(row[1]);
ret->chromEnd = sqlUnsigned(row[2]);
ret->name = cloneString(row[3]);
ret->gieStain = cloneString(row[4]);
ret->firmStart = sqlUnsigned(row[5]);
ret->firmEnd = sqlUnsigned(row[6]);
return ret;
}
static boolean nextRow(struct sqlResult *sr, char **chromRet, int *startRet)
/* read the next row */
{
char **row = sqlNextRow(sr);
if (row == NULL)
    return FALSE;
*chromRet = row[0];
*startRet = sqlUnsigned(row[1]);
return TRUE;
}
struct rhMapInfo *rhMapInfoLoad(char **row)
/* Load a rhMapInfo from row fetched with select * from rhMapInfo
 * from database.  Dispose of this with rhMapInfoFree(). */
{
    struct rhMapInfo *ret;

    AllocVar(ret);
    ret->name = cloneString(row[0]);
    ret->zfinId = cloneString(row[1]);
    ret->linkageGp = cloneString(row[2]);
    ret->position = sqlUnsigned(row[3]);
    ret->distance = sqlUnsigned(row[4]);
    ret->markerType = cloneString(row[5]);
    ret->source = cloneString(row[6]);
    ret->mapSite = cloneString(row[7]);
    ret->leftPrimer = cloneString(row[8]);
    ret->rightPrimer = cloneString(row[9]);
    return ret;
}
Exemple #24
0
void taxonXrefStaticLoad(char **row, struct taxonXref *ret)
/* Load a row from taxonXref table into ret.  The contents of ret will
 * be replaced at the next call to this function. */
{

ret->organism = row[0];
ret->taxon = sqlUnsigned(row[1]);
ret->name = row[2];
ret->toGenus = row[3];
}
Exemple #25
0
struct vntr *vntrLoad(char **row)
/* Load a vntr from row fetched with select * from vntr
 * from database.  Dispose of this with vntrFree(). */
{
struct vntr *ret;

AllocVar(ret);
ret->chrom = cloneString(row[0]);
ret->chromStart = sqlUnsigned(row[1]);
ret->chromEnd = sqlUnsigned(row[2]);
ret->name = cloneString(row[3]);
ret->repeatCount = atof(row[4]);
ret->distanceToLast = sqlSigned(row[5]);
ret->distanceToNext = sqlSigned(row[6]);
ret->forwardPrimer = cloneString(row[7]);
ret->reversePrimer = cloneString(row[8]);
ret->pcrLength = cloneString(row[9]);
return ret;
}
Exemple #26
0
void gtexTissueStaticLoad(char **row, struct gtexTissue *ret)
/* Load a row from gtexTissue table into ret.  The contents of ret will
 * be replaced at the next call to this function. */
{

ret->id = sqlUnsigned(row[0]);
ret->name = row[1];
ret->description = row[2];
ret->organ = row[3];
}
Exemple #27
0
struct hash *bbiChromSizesFromFile(char *fileName)
/* Read two column file into hash keyed by chrom. */
{
struct hash *hash = hashNew(0);
struct lineFile *lf = lineFileOpen(fileName, TRUE);
char *row[2];
while (lineFileRow(lf, row))
    hashAddInt(hash, row[0], sqlUnsigned(row[1]));
return hash;
}
Exemple #28
0
void landmarkAttrLinkStaticLoad(char **row, struct landmarkAttrLink *ret)
/* Load a row from landmarkAttrLink table into ret.  The contents of ret will
 * be replaced at the next call to this function. */
{

ret->attrId = sqlUnsigned(row[0]);
ret->raKey = row[1];
ret->attrAcc = row[2];
ret->displayVal = row[3];
}
struct rnaGene *rnaGeneLoad(char **row)
/* Load a rnaGene from row fetched with select * from rnaGene
 * from database.  Dispose of this with rnaGeneFree(). */
{
struct rnaGene *ret;

AllocVar(ret);
ret->chrom = cloneString(row[0]);
ret->chromStart = sqlUnsigned(row[1]);
ret->chromEnd = sqlUnsigned(row[2]);
ret->name = cloneString(row[3]);
ret->score = sqlUnsigned(row[4]);
strcpy(ret->strand, row[5]);
ret->source = cloneString(row[6]);
ret->type = cloneString(row[7]);
ret->fullScore = atof(row[8]);
ret->isPsuedo = sqlUnsigned(row[9]);
return ret;
}
Exemple #30
0
void gtexDonorStaticLoad(char **row, struct gtexDonor *ret)
/* Load a row from gtexDonor table into ret.  The contents of ret will
 * be replaced at the next call to this function. */
{

ret->name = row[0];
ret->gender = row[1];
ret->age = sqlUnsigned(row[2]);
ret->deathClass = sqlSigned(row[3]);
}