struct autoTest *autoTestLoad(char **row)
/* Load a autoTest from row fetched with select * from autoTest
 * from database.  Dispose of this with autoTestFree(). */
{
struct autoTest *ret;

AllocVar(ret);
ret->ptCount = sqlSigned(row[5]);
ret->difCount = sqlSigned(row[7]);
ret->valCount = sqlSigned(row[10]);
ret->id = sqlUnsigned(row[0]);
safecpy(ret->shortName, sizeof(ret->shortName), row[1]);
ret->longName = cloneString(row[2]);
{
char *s = cloneString(row[3]);
sqlStringArray(s, ret->aliases, 3);
}
{
char *s = row[4];
if(s != NULL && differentString(s, ""))
   ret->threeD = pointCommaIn(&s, NULL);
}
{
int sizeOne;
sqlShortDynamicArray(row[6], &ret->pts, &sizeOne);
assert(sizeOne == ret->ptCount);
}
{
int sizeOne;
sqlUbyteDynamicArray(row[8], &ret->difs, &sizeOne);
assert(sizeOne == ret->difCount);
}
sqlSignedArray(row[9], ret->xy, 2);
{
int sizeOne;
sqlStringDynamicArray(row[11], &ret->vals, &sizeOne);
assert(sizeOne == ret->valCount);
}
ret->dblVal = sqlDouble(row[12]);
ret->fltVal = sqlFloat(row[13]);
{
int sizeOne;
sqlDoubleDynamicArray(row[14], &ret->dblArray, &sizeOne);
assert(sizeOne == ret->valCount);
}
{
int sizeOne;
sqlFloatDynamicArray(row[15], &ret->fltArray, &sizeOne);
assert(sizeOne == ret->valCount);
}
return ret;
}
Ejemplo n.º 2
0
struct edwFastqFile *edwFastqFileFromNextRa(struct lineFile *lf, struct raToStructReader *reader)
/* Return next stanza put into an edwFastqFile. */
{
enum fields
    {
    readCountField,
    baseCountField,
    readSizeMeanField,
    readSizeStdField,
    readSizeMinField,
    readSizeMaxField,
    qualMeanField,
    qualStdField,
    qualMinField,
    qualMaxField,
    qualTypeField,
    qualZeroField,
    atRatioField,
    aRatioField,
    cRatioField,
    gRatioField,
    tRatioField,
    nRatioField,
    posCountField,
    qualPosField,
    aAtPosField,
    cAtPosField,
    gAtPosField,
    tAtPosField,
    nAtPosField,
    };
if (!raSkipLeadingEmptyLines(lf, NULL))
    return NULL;

struct edwFastqFile *el;
AllocVar(el);

bool *fieldsObserved = reader->fieldsObserved;
bzero(fieldsObserved, reader->fieldCount);

char *tag, *val;
while (raNextTagVal(lf, &tag, &val, NULL))
    {
    struct hashEl *hel = hashLookup(reader->fieldIds, tag);
    if (hel != NULL)
        {
	int id = ptToInt(hel->val);
	if (fieldsObserved[id])
	     errAbort("Duplicate tag %s line %d of %s\n", tag, lf->lineIx, lf->fileName);
	fieldsObserved[id] = TRUE;
	switch (id)
	    {
	    case readCountField:
	        {
	        el->readCount = sqlLongLong(val);
		break;
	        }
	    case baseCountField:
	        {
	        el->baseCount = sqlLongLong(val);
		break;
	        }
	    case readSizeMeanField:
	        {
	        el->readSizeMean = sqlDouble(val);
		break;
	        }
	    case readSizeStdField:
	        {
	        el->readSizeStd = sqlDouble(val);
		break;
	        }
	    case readSizeMinField:
	        {
	        el->readSizeMin = sqlSigned(val);
		break;
	        }
	    case readSizeMaxField:
	        {
	        el->readSizeMax = sqlSigned(val);
		break;
	        }
	    case qualMeanField:
	        {
	        el->qualMean = sqlDouble(val);
		break;
	        }
	    case qualStdField:
	        {
	        el->qualStd = sqlDouble(val);
		break;
	        }
	    case qualMinField:
	        {
	        el->qualMin = sqlDouble(val);
		break;
	        }
	    case qualMaxField:
	        {
	        el->qualMax = sqlDouble(val);
		break;
	        }
	    case qualTypeField:
	        {
	        el->qualType = cloneString(val);
		break;
	        }
	    case qualZeroField:
	        {
	        el->qualZero = sqlSigned(val);
		break;
	        }
	    case atRatioField:
	        {
	        el->atRatio = sqlDouble(val);
		break;
	        }
	    case aRatioField:
	        {
	        el->aRatio = sqlDouble(val);
		break;
	        }
	    case cRatioField:
	        {
	        el->cRatio = sqlDouble(val);
		break;
	        }
	    case gRatioField:
	        {
	        el->gRatio = sqlDouble(val);
		break;
	        }
	    case tRatioField:
	        {
	        el->tRatio = sqlDouble(val);
		break;
	        }
	    case nRatioField:
	        {
	        el->nRatio = sqlDouble(val);
		break;
	        }
	    case posCountField:
	        {
                int arraySize = sqlSigned(val);
                raToStructArraySignedSizer(lf, arraySize, &el->posCount, "posCount");
		break;
	        }
	    case qualPosField:
	        {
                int arraySize;
		sqlDoubleDynamicArray(val, &el->qualPos, &arraySize);
                raToStructArraySignedSizer(lf, arraySize, &el->posCount, "qualPos");
		break;
	        }
	    case aAtPosField:
	        {
                int arraySize;
		sqlDoubleDynamicArray(val, &el->aAtPos, &arraySize);
                raToStructArraySignedSizer(lf, arraySize, &el->posCount, "aAtPos");
		break;
	        }
	    case cAtPosField:
	        {
                int arraySize;
		sqlDoubleDynamicArray(val, &el->cAtPos, &arraySize);
                raToStructArraySignedSizer(lf, arraySize, &el->posCount, "cAtPos");
		break;
	        }
	    case gAtPosField:
	        {
                int arraySize;
		sqlDoubleDynamicArray(val, &el->gAtPos, &arraySize);
                raToStructArraySignedSizer(lf, arraySize, &el->posCount, "gAtPos");
		break;
	        }
	    case tAtPosField:
	        {
                int arraySize;
		sqlDoubleDynamicArray(val, &el->tAtPos, &arraySize);
                raToStructArraySignedSizer(lf, arraySize, &el->posCount, "tAtPos");
		break;
	        }
	    case nAtPosField:
	        {
                int arraySize;
		sqlDoubleDynamicArray(val, &el->nAtPos, &arraySize);
                raToStructArraySignedSizer(lf, arraySize, &el->posCount, "nAtPos");
		break;
	        }
	    default:
	        internalErr();
		break;
	    }
	}
    }

raToStructReaderCheckRequiredFields(reader, lf);
return el;
}