Exemple #1
0
struct cartDb *cartDbLoad(char **row)
/* Load a cartDb from row fetched with select * from cartDb
 * from database.  Dispose of this with cartDbFree(). */
{
struct cartDb *ret;

AllocVar(ret);
ret->id = sqlUnsigned(row[0]);
ret->contents = cloneString(row[1]);
ret->reserved = sqlSigned(row[2]);
ret->firstUse = cloneString(row[3]);
ret->lastUse = cloneString(row[4]);
ret->useCount = sqlSigned(row[5]);
if (cartDbUseSessionKey())
    ret->sessionKey = cloneString(row[6]);
return ret;
}
Exemple #2
0
void fbRefStaticLoad(char **row, struct fbRef *ret)
/* Load a row from fbRef table into ret.  The contents of ret will
 * be replaced at the next call to this function. */
{

    ret->id = sqlSigned(row[0]);
    ret->text = row[1];
}
void wgEncodeGencodeTranscriptionSupportLevelStaticLoad(char **row, struct wgEncodeGencodeTranscriptionSupportLevel *ret)
/* Load a row from wgEncodeGencodeTranscriptionSupportLevel table into ret.  The contents of ret will
 * be replaced at the next call to this function. */
{

ret->transcriptId = row[0];
ret->level = sqlSigned(row[1]);
}
Exemple #4
0
void fbAlleleStaticLoad(char **row, struct fbAllele *ret)
/* Load a row from fbAllele table into ret.  The contents of ret will
 * be replaced at the next call to this function. */
{

    ret->id = sqlSigned(row[0]);
    ret->geneId = row[1];
    ret->name = row[2];
}
Exemple #5
0
void symTestStaticLoad(char **row, struct symTest *ret)
/* Load a row from symTest table into ret.  The contents of ret will
 * be replaced at the next call to this function. */
{

ret->id = sqlSigned(row[0]);
ret->sex = sqlEnumParse(row[1], values_sex, &valhash_sex);
ret->skills = sqlSetParse(row[2], values_skills, &valhash_skills);
}
Exemple #6
0
void snpExtFileStaticLoad(char **row, struct snpExtFile *ret)
/* Load a row from snpExtFile table into ret.  The contents of ret will
 * be replaced at the next call to this function. */
{

ret->chrom = row[0];
ret->path = row[1];
ret->size = sqlSigned(row[2]);
}
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 #8
0
struct bdgpExprLink *bdgpExprLinkLoad(char **row)
/* Load a bdgpExprLink from row fetched with select * from bdgpExprLink
 * from database.  Dispose of this with bdgpExprLinkFree(). */
{
struct bdgpExprLink *ret;

AllocVar(ret);
ret->symbol = cloneString(row[0]);
ret->bdgpName = cloneString(row[1]);
ret->flyBaseId = cloneString(row[2]);
ret->est = cloneString(row[3]);
ret->imageCount = sqlSigned(row[4]);
ret->bodyPartCount = sqlSigned(row[5]);
ret->plate = cloneString(row[6]);
ret->platePos = sqlSigned(row[7]);
ret->newRelease = row[8][0];
return ret;
}
static struct refSeqVerInfo *refSeqVerInfoNewDb(char **row)
/* construct a refSeqVerInfo object from a database query */
{
struct refSeqVerInfo *rsvi;
AllocVar(rsvi);
rsvi->acc = cloneString(row[0]);
rsvi->ver = sqlSigned(row[1]);
return rsvi;
}
Exemple #10
0
struct txEdgeBed *txEdgeBedLoad(char **row)
/* Load a txEdgeBed from row fetched with select * from txEdgeBed
 * from database.  Dispose of this with txEdgeBedFree(). */
{
struct txEdgeBed *ret;

AllocVar(ret);
ret->chrom = cloneString(row[0]);
ret->chromStart = sqlSigned(row[1]);
ret->chromEnd = sqlSigned(row[2]);
ret->name = cloneString(row[3]);
ret->score = sqlSigned(row[4]);
safecpy(ret->strand, sizeof(ret->strand), row[5]);
safecpy(ret->startType, sizeof(ret->startType), row[6]);
ret->type = sqlEnumParse(row[7], values_type, &valhash_type);
safecpy(ret->endType, sizeof(ret->endType), row[8]);
return ret;
}
Exemple #11
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);
}
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;
}
Exemple #13
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]);
}
Exemple #14
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 #15
0
void geneScoreStaticLoad(char **row, struct geneScore *ret)
/* Load a row from geneScore table into ret.  The contents of ret will
 * be replaced at the next call to this function. */
{

ret->name = row[0];
ret->chrom = row[1];
ret->txStart = sqlSigned(row[2]);
ret->score = atof(row[3]);
}
Exemple #16
0
struct docIdSub *docIdSubLoad(char **row)
/* Load a docIdSub from row fetched with select * from docIdSub
 * from database.  Dispose of this with docIdSubFree(). */
{
struct docIdSub *ret;

AllocVar(ret);
ret->ix = sqlSigned(row[0]);
ret->status = sqlSigned(row[1]);
ret->assembly = cloneString(row[2]);
ret->submitDate = cloneString(row[3]);
ret->md5sum = cloneString(row[4]);
ret->valReport = cloneString(row[5]);
ret->valVersion = cloneString(row[6]);
ret->metaData = cloneString(row[7]);
ret->submitPath = cloneString(row[8]);
ret->submitter = cloneString(row[9]);
return ret;
}
void tomRoughStaticLoad(char **row, struct tomRough *ret)
/* Load a row from tomRough table into ret.  The contents of ret will
 * be replaced at the next call to this function. */
{
ret->omimId = sqlSigned(row[0]);
ret->chromosome = row[1];
ret->startBand = row[2];
ret->endBand = row[3];
ret->description = row[4];
}
Exemple #18
0
struct splignAlign *splignAlignLoad(char **row)
/* Load a splignAlign from row fetched with select * from splignAlign
 * from database.  Dispose of this with splignAlignFree(). */
{
struct splignAlign *ret;

AllocVar(ret);
ret->query = cloneString(row[0]);
ret->target = cloneString(row[1]);
ret->perId = atof(row[2]);
ret->match = sqlSigned(row[3]);
ret->qStart = sqlSigned(row[4]);
ret->qEnd = sqlSigned(row[5]);
ret->tStart = sqlSigned(row[6]);
ret->tEnd = sqlSigned(row[7]);
ret->type = cloneString(row[8]);
ret->anotation = cloneString(row[9]);
return ret;
}
Exemple #19
0
struct hash *readCsizeHash(char *filename)
/* read in a chrom sizes file */
{
    struct lineFile *lf = lineFileOpen(filename, TRUE);
    struct hash *cHash = hashNew(10);
    char *words[2];
    while (lineFileRowTab(lf, words))
	hashAddInt(cHash, words[0], sqlSigned(words[1]));
    lineFileClose(&lf);
    return cHash;
}
struct wgEncodeGencodeTranscriptionSupportLevel *wgEncodeGencodeTranscriptionSupportLevelLoad(char **row)
/* Load a wgEncodeGencodeTranscriptionSupportLevel from row fetched with select * from wgEncodeGencodeTranscriptionSupportLevel
 * from database.  Dispose of this with wgEncodeGencodeTranscriptionSupportLevelFree(). */
{
struct wgEncodeGencodeTranscriptionSupportLevel *ret;

AllocVar(ret);
ret->transcriptId = cloneString(row[0]);
ret->level = sqlSigned(row[1]);
return ret;
}
void mouseSynStaticLoad(char **row, struct mouseSyn *ret)
/* Load a row from mouseSyn 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->segment = sqlSigned(row[4]);
}
struct wgEncodeGencodePubMed *wgEncodeGencodePubMedLoad(char **row)
/* Load a wgEncodeGencodePubMed from row fetched with select * from wgEncodeGencodePubMed
 * from database.  Dispose of this with wgEncodeGencodePubMedFree(). */
{
struct wgEncodeGencodePubMed *ret;

AllocVar(ret);
ret->transcriptId = cloneString(row[0]);
ret->pubMedId = sqlSigned(row[1]);
return ret;
}
static struct hash *loadSizes(char *szFile)
/* load sizes into a hash */
{
struct hash *sizes = hashNew(0);
struct lineFile *lf = lineFileOpen(szFile, TRUE);
char *row[2];
while (lineFileNextRowTab(lf, row, 2))
    hashAddInt(sizes, row[0], sqlSigned(row[1]));

return sizes;
}
Exemple #24
0
void bwtool_shift(struct hash *options, char *favorites, char *regions, unsigned decimals, enum wigOutType wot,
		  boolean condense, char *val_s, char *bigfile, char *tmp_dir, char *outputfile)
/* bwtool_shift - main for shifting program */
{
    const double na = NANUM;
    int shft = sqlSigned(val_s);
    int abs_shft = abs(shft);
    struct metaBig *mb = metaBigOpen_check(bigfile, tmp_dir, regions);
    if (!mb)
	errAbort("problem opening %s", bigfile);
    char wigfile[512];
    safef(wigfile, sizeof(wigfile), "%s.tmp.wig", outputfile);
    FILE *out = mustOpen(wigfile, "w");
    struct bed *section;
    boolean up = TRUE;
    if (shft > 0)
	up = FALSE;
    if (shft == 0)
	errAbort("it doesn't make sense to shift by zero.");
    for (section = mb->sections; section != NULL; section = section->next)
    {
	struct perBaseWig *pbw = perBaseWigLoadSingleContinue(mb, section->chrom, section->chromStart,
							      section->chromEnd, FALSE, na);
	int i;
	/* if the shift size is bigger than the section, NA the entire thing */
	int size = pbw->len;
	if (abs_shft >= size)
	    for (i = 0; i < size; i++)
		pbw->data[i] = na;
	else
	{
	    if (!up)
	    {
		for (i = size-1; i >= abs_shft; i--)
		    pbw->data[i] = pbw->data[i - abs_shft];
		for (; i >= 0; i--)
		    pbw->data[i] = na;
	    }
	    else
	    {
		for (i = 0; i < size - abs_shft; i++)
		    pbw->data[i] = pbw->data[i + abs_shft];
		for (; i < size; i++)
		    pbw->data[i] = na;
	    }
	}
	perBaseWigOutputNASkip(pbw, out, wot, decimals, NULL, FALSE, condense);
	perBaseWigFree(&pbw);
    }
    carefulClose(&out);
    writeBw(wigfile, outputfile, mb->chromSizeHash);
    remove(wigfile);
    metaBigClose(&mb);
}
Exemple #25
0
struct fbRef *fbRefLoad(char **row)
/* Load a fbRef from row fetched with select * from fbRef
 * from database.  Dispose of this with fbRefFree(). */
{
    struct fbRef *ret;

    AllocVar(ret);
    ret->id = sqlSigned(row[0]);
    ret->text = cloneString(row[1]);
    return ret;
}
Exemple #26
0
static struct hash *loadChromSizes(char *chromSizesFile)
/* read the chromosome sizes file. */
{
struct lineFile *lf = lineFileOpen(chromSizesFile, TRUE);
struct hash *sizes = newHash(12);
char *words[2];
while (lineFileRow(lf, words))
    hashAddInt(sizes, words[0], sqlSigned(words[1]));
lineFileClose(&lf);
return sizes;
}
void tilingPathStaticLoad(char **row, struct tilingPath *ret)
/* Load a row from tilingPath table into ret.  The contents of ret will
 * be replaced at the next call to this function. */
{

    ret->chrom = row[0];
    ret->accession = row[1];
    ret->clone = row[2];
    ret->contig = row[3];
    ret->chromIx = sqlSigned(row[4]);
}
Exemple #28
0
void rgdQtlStaticLoad(char **row, struct rgdQtl *ret)
/* Load a row from rgdQtl table into ret.  The contents of ret will
 * be replaced at the next call to this function. */
{

ret->bin = sqlSigned(row[0]);
ret->chrom = row[1];
ret->chromStart = sqlUnsigned(row[2]);
ret->chromEnd = sqlUnsigned(row[3]);
ret->name = row[4];
}
Exemple #29
0
static boolean processCcdsNotesRow(char **row, struct ccdsNotes **ccdsNotesList,
                                   struct hash *gotCcds)
/* Process a row from ccdsNoteSelect and add to the list of ccdsNotes rows.
 * only keep ones in gotCcds hash.  Returns True if processed, False if
 * ignored.
 */
{
int ccdsId = sqlSigned(row[0]);
int ccdsVersion = sqlSigned(row[1]);
char *ccdsIdVer = ccdsMkId(ccdsId, ccdsVersion);
if (hashLookup(gotCcds, ccdsIdVer) == NULL)
    return FALSE;
struct ccdsNotes *ccdsNotes;
AllocVar(ccdsNotes);
safecpy(ccdsNotes->ccds, sizeof(ccdsNotes->ccds), ccdsIdVer);
safecpy(ccdsNotes->createDate, sizeof(ccdsNotes->createDate), row[2]);
ccdsNotes->note = cloneString(row[3]);
slAddHead(ccdsNotesList, ccdsNotes);
return TRUE;
}
Exemple #30
0
struct bed6* readBed6SoftAndSize(char* file, int* orig_size)
/* read from a file.  If it's missing fields, fill the bed */
{
    char* words[6];
    if (!fileExists(file))
        errAbort("Can't find file: %s", file);
    struct lineFile* lf = lineFileOpen(file, TRUE);
    struct bed6* list = NULL;
    int num_words = 0;
    int size = 0;
    while ((num_words = lineFileChopTab(lf, words)) > 0) {
        if (num_words < 3)
            errAbort("Expecting BED-3 formatted file (%s) but there are only %d columns on line %d", file, num_words, lf->lineIx);
        struct bed6* newb;
        AllocVar(newb);
        if (size < num_words)
            size = num_words;
        newb->chrom = cloneString(words[0]);
        newb->chromStart = sqlSigned(words[1]);
        newb->chromEnd = sqlSigned(words[2]);
        if (num_words < 4)
            newb->name = cloneString(".");
        else
            newb->name = cloneString(words[3]);
        if (num_words < 5)
            newb->score = 0;
        else
            newb->score = sqlSigned(words[4]);
        if (num_words < 6)
            newb->strand[0] = '+';
        else
            newb->strand[0] = words[5][0];
        newb->strand[1] = '\0';
        slAddHead(&list, newb);
    }
    slReverse(&list);
    lineFileClose(&lf);
    if (orig_size)
        *orig_size = size;
    return list;
}