Пример #1
0
static boolean looksTabular(const struct vcfInfoDef *def, struct vcfInfoElement *el)
/* Return TRUE if def->description seems to contain a |-separated description of columns
 * and el's first non-empty string value has the same number of |-separated parts. */
{
if (!def || def->type != vcfInfoString || isEmpty(def->description))
    return FALSE;
if (regexMatch(def->description, COL_DESC_REGEX))
    {
    int descColCount = countChars(def->description, '|') + 1;
    if (descColCount >= MIN_COLUMN_COUNT)
        {
        int j;
        for (j = 0;  j < el->count;  j++)
            {
            char *val = el->values[j].datString;
            if (isEmpty(val))
                continue;
            int elColCount = countChars(val, '|') + 1;
            if (elColCount == descColCount)
                return TRUE;
            }
        }
    }
return FALSE;
}
Пример #2
0
void endBrace()
{
    FILE *fp;
    char *buffer;

   	buffer = "}";

    fp = fopen("./c_code_temp.c", "a+");

    printf("asd %d\n", countChars());
    ftruncate(fileno(fp), countChars() - 5);

   	fprintf(fp, "%s\n", buffer);
    fclose(fp);
}
Пример #3
0
int countColumns(struct slName *list, char *formatType)
/* Return number of columns. */
{
int count = 0;
char *line = list->name;
if (sameString(formatType, cgfFormatTab))
    count = countChars(line, '\t') + 1;
else if (sameString(formatType, cgfFormatComma))
    count = countChars(line, ',') + 1;
else if (sameString(formatType, cgfFormatSpace))
    count = chopByWhite(line, NULL, 0);
else
    internalErr();
return count;
}
Пример #4
0
char *replace(char *input, char *what, char *with)
{
    char *out, *tmp, *str, *save, *token;
    int num = 0, size = 0;

    if ((what == NULL) || (strlen(what) == 0))
        return input;

    num = countChars((const char *)input, what[0]);
    size = (strlen(input) + num + 1);

    out = (char *)malloc( size * sizeof(char) );
    memset(out, 0, size);

    tmp = strdup( (char *)input );
    for (str = tmp; ; str = NULL) {
        token = strtok_r(str, what, &save);
        if (token == NULL)
            break;
        strcat(out, token);
        strcat(out, with);
    }
    out[ size - 1 ] = 0;

    return out;
}
struct bed *loadBedFileWithHeader(char *fileName)
/* Read in a bed file into a bed list, dealing with header for custom track if necessary. */
{
struct bed *bedList = NULL, *bed = NULL;
struct lineFile *lf = lineFileOpen(fileName, TRUE);
char *row[12];
int lineSize;
char *line;
/* Skip the headers. */
while(lineFileNext(lf, &line, &lineSize)) 
    {
    if(countChars(line, '\t') > 10) 
	{
	lineFileReuse(lf);
	break;
	}
    }
/* Load in the records. */
while(lineFileRow(lf, row)) 
    {
    bed = bedLoad12(row);
    slAddHead(&bedList, bed);
    }
lineFileClose(&lf);
slReverse(&bedList);
return bedList;
}
Пример #6
0
boolean anyCdnaSeq(char *name, struct dnaSeq **retDna, struct wormCdnaInfo *retInfo)
/* Get a single  cDNA sequence. Optionally (if retInfo is non-null) get additional
 * info about the sequence. */
{
static FILE *cdnaFa;
static struct snof *cdnaSnof = NULL;
long offset;
char *faComment;
char **pFaComment = (retInfo == NULL ? NULL : &faComment);

if (cdnaSnof == NULL)
    {
    char buf[512];

    cdnaSnof = snofMustOpen(cdnaName);
    sprintf(buf, "%s%s", cdnaName, ".fa");
    cdnaFa = mustOpen(buf, "rb");
    }
if (!snofFindOffset(cdnaSnof, name, &offset))
    return FALSE;
fseek(cdnaFa, offset, SEEK_SET);
if (!faReadNext(cdnaFa, name, TRUE, pFaComment, retDna))
    return FALSE;
if (retInfo != NULL)
    {
    /* Kludge - only look up info if format is more or less right. */
    int fieldCount = countChars(faComment, '|');
    if (fieldCount >= 8)
        wormFaCommentIntoInfo(faComment, retInfo);
    else
        zeroBytes(retInfo, sizeof(*retInfo));
    }
return TRUE;
}
Пример #7
0
int main(){
    std::cout << '\n' << getCustomString() << '\n';
    std::cout << countChars("This is a sentence", 't') << '\n';
    std::cout << countCharsCustom('f') << '\n';

    return 0;
}
Пример #8
0
void writeCode(char *command)
{
	FILE *fp;
	static bool firstWrite = true;
	char *buffer;

	fp = fopen("./c_code_temp.c", "a+");

    ftruncate(fileno(fp), countChars() - 2);

	if (firstWrite == true)
	{
		buffer = "int main(void) {";
	}

	if (firstWrite == true)
	{
		fprintf(fp, "%s\n", buffer);
		firstWrite = false;
	}
	fprintf(fp, "%s\n", command);
	fprintf(fp, "}\n");

	fclose(fp);
}
Пример #9
0
struct tabRow *tabRowByChar(struct slName *lineList, char c, char *fileName,
	boolean varCol)
/* Convert lines to rows based on character separation.  If varCol is TRUE then not
 * all rows need to have same number of columns. */
{
struct slName *line;
struct tabRow *rowList = NULL, *row;

if (varCol)
    {
    for (line = lineList; line != NULL; line = line->next)
        {
	char *s = line->name;
	int rowSize = countChars(s, c) + 1;
	row = tabRowNew(rowSize);
	chopByChar(s, c, row->columns, rowSize);
	slAddHead(&rowList, row);
	}
    }
else
    {
    if (lineList)
        {
	int rowSize = countChars(lineList->name, c) + 1;
	int extraSize = rowSize+1;
	int ix = 1;
	for (line = lineList; line != NULL; line = line->next, ++ix)
	    {
	    int oneSize;
	    row = tabRowNew(rowSize);
	    oneSize = chopByChar(line->name, c, row->columns, extraSize);
	    if (oneSize != rowSize)
	        {
		if (oneSize > rowSize)
		    errAbort("Got more than the expected %d columns line %d of %s",
			    rowSize, ix, fileName);
		else
		    errAbort("Expecting %d columns got %d, line %d of %s",
		    	rowSize, oneSize, ix, fileName);

		}
	    slAddHead(&rowList, row);
	    }
	}
    }
return rowList;
}
Пример #10
0
static int bigWarnNumLines(char *errMsg)
/* Count number of lines in err msg */
{
int n = countChars(errMsg, '\n');
int sl = strlen(errMsg);
if ((sl > 0) && (errMsg[sl-1]!='\n'))
    ++n;
return n;
}
Пример #11
0
char *makeEscapedString(char *in, char toEscape)
/* Return string that is a copy of in, but with all
 * toEscape characters preceded by '\' 
 * When done freeMem result. */
{
int newSize = strlen(in) + countChars(in, toEscape);
char *out = needMem(newSize+1);
escCopy(in, out, toEscape, '\\');
return out;
}
Пример #12
0
char *makeQuotedString(char *in, char quoteChar)
/* Create a string surrounded by quoteChar, with internal
 * quoteChars escaped.  freeMem result when done. */
{
int newSize = 2 + strlen(in) + countChars(in, quoteChar);
char *out = needMem(newSize+1);
out[0] = quoteChar;
escCopy(in, out+1, quoteChar, '\\');
out[newSize-1] = quoteChar;
return out;
}
Пример #13
0
static boolean isGtfGroup(char *group)
/* Return TRUE if group field looks like GTF */
{
if (strstr(group, "gene_id") == NULL)
    return FALSE;
if (countChars(group, '"') >= 2)
    return TRUE;
if (strstr(group, "transcript_id") != NULL)
    return TRUE;
return FALSE;
}
Пример #14
0
struct mafComp *mafCompFakeFromAliSym(struct dnaSeq *seq)
/* Fake up a mafComp from a dnaSeq with dashes. */
{
struct mafComp *mc;
AllocVar(mc);
mc->src = cloneString(seq->name);
mc->srcSize = mc->size = seq->size - countChars(seq->dna, '-');
mc->strand = '+';
mc->start = 0;
mc->text = cloneString(seq->dna);
return mc;
}
Пример #15
0
int commaSepCount(char *s)
/* Count number of comma-separated items assuming there can be a terminal non-separating comma
 * or not. */
{
if (isEmpty(s))
    return 0;
int commaCount = countChars(s, ',');
int sepCount = commaCount;
char lastC = lastChar(s);
if (lastC == ',')
    --sepCount;
return sepCount + 1;
}
Пример #16
0
struct hash *hashPsls(char *pslFileName)
{
struct psl *pslList = NULL, *psl = NULL, *pslSubList = NULL, *pslNext = NULL;
struct hash *pslHash = newHash(15);
char *last = NULL;

char key[128];
char *tmp = NULL;
pslList = pslLoadAll(pslFileName);

/* Fix psl names */
for(psl = pslList; psl != NULL; psl = psl->next)
    {
    tmp = strrchr(psl->qName, ';');
    *tmp = '\0';
    tmp = strstr(psl->qName,prefix);
    assert(tmp);
    /* checks if there are 2 occurrences of ":" in probe name as in full name */
    /* if probe name is shortened to fit in the seq table, there is only 1 ":"*/
    /* e.g. full: consensus:HG-U133A:212933_x_at; short:HG-U133A:212933_x_at;*/

    if (countChars(psl->qName, *prefix) == 2) 
        {
        tmp = strstr(tmp+1,prefix);
        assert(tmp);
        }
    tmp = tmp + strlen(prefix);
    safef(psl->qName, strlen(psl->qName), "%s", tmp);
    }

/* Sort based on query name. */

slSort(&pslList, pslCmpQuery);
/* For each psl, if it is has the same query name add it to the
   sublist. Otherwise store the sublist in the hash and start
   another. */
for(psl = pslList; psl != NULL; psl = pslNext)
    {
    pslNext = psl->next;
    if(last != NULL && differentWord(last, psl->qName))
	{
	hashAddUnique(pslHash, last, pslSubList);
	pslSubList = NULL;
	}
    slAddTail(&pslSubList, psl);
    last = psl->qName;
    }
/* Add the last sublist */
hashAddUnique(pslHash, last, pslSubList);
return pslHash;
}
Пример #17
0
int main(){	
	char str[TAM];
	int n;
	
	printf("Introduza a string(max %d car.):", TAM);
	gets(str);
	n=countChars(str);
	printf("\nA string tem %d caracteres.", n);
	
	printInvertString(str, n);

	
	return 0;
}
Пример #18
0
void InducedSorting::WorkingClass::_setUpBaskets() {
    _baskets.resize(_alpSize);
    
    //calc basket size
    vector <size_t> countChars(_alpSize, 0);
    
    for(size_t i = 0;i < _str.size(); ++i) {
        ++countChars[_str[i]];
    }
    
    //set up basket size
    for(size_t i = 0;i < _alpSize; ++i) {
        _baskets[i].resize(countChars[i], SIZE_T_MAX);
    }
}
Пример #19
0
void checkFaOutput(struct htmlPage *page, int expectedCount, boolean lessOk)
/* Check that page contains expected number of sequences.  If lessOk is set
 * (needed to handle some multiply mapped cases in refSeq) then just check
 * that have at least one if expecting any. */
{
if (page != NULL)
    {
    int count = countChars(page->htmlText, '>');
    if (count != expectedCount)
	{
	if (!lessOk || count > expectedCount || (expectedCount > 0 && count <= 0))
	    qaStatusSoftError(tablesTestList->status, 
		    "Got %d sequences, expected %d", count, expectedCount);
	}
    }
}
Пример #20
0
static void parseFilterColumn(struct vcfFile *vcff, struct vcfRecord *record, char *filterStr)
/* Transform ;-separated filter codes into count + string array. */
{
// We don't want to modify something allocated with vcfFilePooledStr because that uses
// hash element names for storage!  So don't make a vcfFilePooledStr copy of filterStr and
// chop that; instead, chop a temp string and pool the words separately.
static struct dyString *tmp = NULL;
if (tmp == NULL)
    tmp = dyStringNew(0);
dyStringClear(tmp);
dyStringAppend(tmp, filterStr);
record->filterCount = countChars(filterStr, ';') + 1;
record->filters = vcfFileAlloc(vcff, record->filterCount * sizeof(char **));
(void)chopByChar(tmp->string, ';', record->filters, record->filterCount);
int i;
for (i = 0;  i < record->filterCount;  i++)
    record->filters[i] = vcfFilePooledStr(vcff, record->filters[i]);
}
Пример #21
0
int main(int argc, char **argv) {

    int* freq = countChars(data, (int)strlen(data));
    
#ifdef DEBUG_MODE
    printInputCharTable(freq);
    puts("");
#endif

    nodeStructure** nodePointers = getFirstNodePointers(freq);
    int len =pointerCounter(nodePointers);
    
#ifdef DEBUG_MODE
    printf("\nTotal: %d.\n\n", len);
#endif
    
    nodeStructure *rootNode = makeTree(nodePointers, len);

#ifdef DEBUG_MODE
    printf("\nrooot %p found.\n", rootNode);
#endif
   
#ifdef DEBUG_MODE
//    puts("\nnow backwards...\n");
//    drawTree(rootNode);
//    puts("\n\ncodes:\n");
//    printCodes(rootNode);
#endif
    
    puts("\ncodes:\n");
    
    makeCodes(rootNode, 0);
    
//    for(int i = 0; printf("%s\n", (char*)codes[i]), i < 0x100; i++); // it works! 😱
    
    puts("");
    
    printf("%s - %lu bytes\n", data, strlen(data));
    bitStreamOut((int)strlen(data), data);
    
    puts("");
  
    return 0;
}
Пример #22
0
char *expandRelativePath(char *baseDir, char *relPath)
/* Expand relative path to more absolute one. */
{
char *e = baseDir + strlen(baseDir);
int slashCount;
char *rel = relPath;
char *result;
int size, baseSize;
undosPath(baseDir);
undosPath(relPath);
slashCount = countChars(baseDir, '/');
if (baseDir[0] == 0)
    slashCount = -1;
while (startsWith("../", rel))
    {
    if (slashCount < 0)
        {
	warn("More ..'s in \"%s\" than directories in \"%s\"", relPath, baseDir);
	return NULL;
	}
    else if (slashCount == 0)
        e = baseDir;
    else
        e = findSlashBefore(baseDir, e);
    slashCount -= 1;
    rel += 3;
    }
baseSize = e - baseDir;
size = strlen(rel) + 1;
if (baseSize > 0)
    size += baseSize + 1;
if (baseSize > 0)
    {
    result = needMem(size);
    memcpy(result, baseDir, baseSize);
    result[baseSize] = '/';
    strcpy(result + baseSize + 1, rel);
    }
else
    result = cloneString(rel);
return result;
}
Пример #23
0
struct variant *variantFromVcfAnnoRow(struct annoRow *row, char *refAllele, struct lm *lm,
				      struct dyString *dyScratch)
/* Translate vcf array of words into variant (allocated by lm, overwriting dyScratch
 * as temporary scratch string). */
{
char **words = row->data;
char *alStr = vcfGetSlashSepAllelesFromWords(words, dyScratch);
// The reference allele is the first allele in alStr -- and it may be trimmed on both ends with
// respect to the raw VCF ref allele in words[3], so copy vcfRefAllele back out of alStr.
// That ensures that variantNew will get the reference allele that matches the slash-separated
// allele string.
int refLen = strlen(alStr);
char *p = strchr(alStr, '/');
if (p)
    refLen = p - alStr;
char vcfRefAllele[refLen + 1];
safencpy(vcfRefAllele, sizeof(vcfRefAllele), alStr, refLen);
unsigned alCount = countChars(alStr, '/') + 1;
return variantNew(row->chrom, row->start, row->end, alCount, alStr, vcfRefAllele, lm);
}
Пример #24
0
YakMessage* createNamesMessage(char** names, int namesCount) {

	YakMessage* msg = (YakMessage*)malloc(sizeof(YakMessage));
	int size = countChars(names, namesCount);

	msg->header.type = NAMES;
	msg->header.version = YAK_VERSION;
	msg->header.dataSize = size * (sizeof(char) + sizeof(int));
	msg->data = malloc(msg->header.dataSize);

	int index = 0;
	for(int i=0; i<namesCount; i++) {
		int len = strlen(names[i]);
		msg->data[index++] = (BYTE)len;
		copyStringToData(index, names[i], msg);
		index += len;
	}

	return msg;
}
Пример #25
0
int main()
{
    int sum = 0;
    for (int n = 1; n <= 1000; n++) {
#if 0
        int ones      = n/   1 % 10;
        int tens      = n/  10 % 10;
        int hundreds  = n/ 100 % 10;
        int thousands = n/1000 % 10;
        std::cout << n << "\n";
        std::cout << "ones: " << ones << "\n";
        std::cout << "tens: " << tens << "\n";
        std::cout << "hundreds: " << hundreds << "\n";
        std::cout << "thousands: " << thousands << "\n";
#endif
        std::string result = toString(n);
        int length = countChars(result);
        sum += length;
        std::cout << n << " " << length << " " << sum << ": " << result << "\n";
    }
}
Пример #26
0
char * projectString(char *s, char *ref, char refChar, char insertChar)
/* Insert 'insertChar' in 's' at every position 'ref' has 'refChar'. */
{
int i,j,size = strlen(ref);
char *copy = (char *) needMem(size + 1);

if (strlen(s) != strlen(ref) - countChars(ref, refChar))
  errAbort("ERROR from rnautil::projectString: Input string 's' has wrong length.\n"); 

for (i = 0, j = 0; i < size; i++)
    {
    if (ref[i] == refChar)
	copy[i] = insertChar;
    else
	{	
	copy[i] = s[j];
	j++;
	}
    }
return copy;
}
Пример #27
0
static int delimitedTableSize(struct slName *list, int colDelim)
/* Return number of columns in list delimited by delimiter.  Returns
 * 0 if count is inconsistent. */
{
struct slName *el;
int expected = 0;
for (el = list; el != NULL; el = el->next)
    {
    int count = countChars(el->name, colDelim) + 1;
    if (expected == 0)
	{
        expected = count;
	}
    else
	{
        if (expected != count)
	    return 0;
	}
    }
return expected;
}
Пример #28
0
void verifyJoinedFormat(char *s)
/* Verify that s consists of lines with two tab-separated fields,
 * and that the second field has some n/a and some comma-separated lists. */
{
char *e;
int lineIx = 0;
boolean gotCommas = FALSE, gotNa = FALSE;

while (s != NULL && s[0] != 0)
    {
    char *row[3];
    int fieldCount;
    ++lineIx;
    e = strchr(s, '\n');
    if (e != NULL)
       *e++ = 0;
    if (s[0] != '#')
	{
	fieldCount = chopTabs(s, row);
	if (fieldCount != 2)
	    {
	    qaStatusSoftError(tablesTestList->status, 
		    "Got %d fields line %d of  joined result, expected 2", 
		    fieldCount, lineIx);
	    break;
	    }
	if (sameString(row[1], "n/a"))
	     gotNa = TRUE;
	if (countChars(s, ',') >= 2)
	     gotCommas = TRUE;
	}
    s = e;
    }
if (!gotCommas)
    qaStatusSoftError(tablesTestList->status, 
           "Expected some rows in join to have comma separated lists.");
if (!gotNa)
    qaStatusSoftError(tablesTestList->status, 
           "Expected some rows in joint to have n/a.");
}
Пример #29
0
/**
 * Encodes a set of data with DC's version of huffman encoding..
 * @todo Use real streams maybe? or something else than string (operator[] contains a compare, slow...)
 */
void CryptoManager::encodeHuffman(const string& is, string& os) {
	
	// We might as well expect this much data as huffman encoding doesn't go very far...
	os.reserve(is.size());
	if(is.length() == 0) {
		os.append("HE3\x0d");
		
		// Nada...
		os.append(7, '\0');
		return;
	}
	// First, we count all characters
	u_int8_t csum = 0;
	int count[256];
	memset(count, 0, sizeof(count));
	int chars = countChars(is, count, csum);

	// Next, we create a set of nodes and add it to a list, removing all characters that never occur.
	
	list<Node*> nodes;

	int i;
	for(i=0; i<256; i++) {
		if(count[i] > 0) {
			nodes.push_back(new Node(i, count[i]));
		}
	}

	nodes.sort(greaterNode());
#ifdef _DEBUG
	for(list<Node*>::iterator it = nodes.begin(); it != nodes.end(); ++it) dcdebug("%.02x:%d, ", (*it)->chr, (*it)->weight);
	dcdebug("\n");
#endif
	
	walkTree(nodes);
	dcassert(nodes.size() == 1);

	Node* root = nodes.front();
	vector<u_int8_t> lookup[256];
	
	// Build a lookup table for fast character lookups
	buildLookup(lookup, root);
	delete root;

	// Reserve some memory to avoid all those copies when appending...
	os.reserve(is.size() * 3 / 4);

	os.append("HE3\x0d");
	
	// Checksum
	os.append(1, csum);
	string::size_type sz = is.size();
	os.append((char*)&sz, 4);

	// Character count
	os.append((char*)&chars, 2);

	// The characters and their bitlengths
	for(i=0; i<256; i++) {
		if(count[i] > 0) {
			os.append(1, (u_int8_t)i);
			os.append(1, (u_int8_t)lookup[i].size());
		}
	}
	
	BitOutputStream bos(os);
	// The tree itself, ie the bits of each character
	for(i=0; i<256; i++) {
		if(count[i] > 0) {
			bos.put(lookup[i]);
		}
	}
	
	dcdebug("u_int8_ts: %d\n", os.size());
	bos.skipToByte();

	for(string::size_type j=0; j<is.size(); j++) {
		dcassert(lookup[(u_int8_t)is[j]].size() != 0);
		bos.put(lookup[(u_int8_t)is[j]]);
	}
	bos.skipToByte();
}
Пример #30
0
void spDbAddVarSplice(char *database, char *inFile, char *outDir)
/* spDbAddVarSplice - This adds information on the varient splices to the sp/uniProt database. */
{
struct sqlConnection *conn = sqlConnect(database);
char query[256];
makeDir(outDir);
FILE *varProtein = openToWrite(outDir, "varProtein.txt");
FILE *varAcc = openToWrite(outDir, "varAcc.txt");
FILE *varDisplayId = openToWrite(outDir, "varDisplayId.txt");
FILE *varAccToTaxon = openToWrite(outDir, "varAccToTaxon.txt");
FILE *varDescription = openToWrite(outDir, "varDescription.txt");
FILE *varGene = openToWrite(outDir, "varGene.txt");
FILE *varGeneLogic = openToWrite(outDir, "varGeneLogic.txt");
struct lineFile *lf = lineFileOpen(inFile, TRUE);
aaSeq seq;
ZeroVar(&seq);
while (faPepSpeedReadNext(lf, &seq.dna, &seq.size, &seq.name))
    {
    char *row[4];
    char *name = seq.name;
    if (startsWith("sp|", name))	// Skip over sp| introduced Aug 2009
        name += 3;
    int rowSize = chopString(name, "-|", row, ArraySize(row));
    if (rowSize != 3)
        errAbort("Expecting name to be in format accession-N|DISP_ID, got %s\n", name);
    char *acc = row[0];
    char *version = row[1];
    char *displayId = row[2];
    int accLen = strlen(acc);
    int verLen = strlen(version);
    int displayIdLen = strlen(displayId);

    /* Do some tests. */
    if ((accLen != 6 && accLen != 10) || isdigit(acc[0]) || !isdigit(acc[accLen-1]))
        errAbort("wierd accession %s before line %d of %s", acc, lf->lineIx, lf->fileName);
    if (!isdigit(version[0]) || verLen > 4)
        errAbort("wierd version %s before line %d of %s", version, lf->lineIx, lf->fileName);
    if (countChars(displayId, '_') != 1 || displayIdLen < 6 || displayIdLen > 16)
        errAbort("wierd displayId %s before line %d of %s", displayId, lf->lineIx, lf->fileName);
    if (accLen + 1 + verLen >= sizeof(SpAcc))
        errAbort("Need to increase size of SpAcc in spDb.h because of %s-%s - need %d characters but only have %lu", acc, version, accLen + 1 + verLen, sizeof(SpAcc));

    /* Print out parsed results. */
    fprintf(varAcc, "%s-%s\t%s\t%s\n", acc, version, acc, version);
    fprintf(varProtein, "%s-%s\t%s\n", acc, version, seq.dna);
    fprintf(varDisplayId, "%s-%s\t%s-%s\n", acc, version, acc, version);

    /* Look up taxon of base protein and use it to write to varAccToTaxon table. */
    int taxon = spTaxon(conn, acc);
    fprintf(varAccToTaxon, "%s-%s\t%d\n", acc, version, taxon);

    /*Transfer description. */
    char *description = spDescription(conn, acc);
    fprintf(varDescription, "%s-%s\t%s\n", acc, version, description);
    freez(&description);

    /* Transfer gene logic. */
    sqlSafef(query, sizeof(query), "select val from geneLogic where acc = '%s'", acc);
    char *geneLogic = sqlQuickString(conn, query);
    if (geneLogic != NULL)
        fprintf(varGeneLogic, "%s-%s\t%s\n", acc, version, geneLogic);
    freez(&geneLogic);

    /* Transfer genes. */
    struct slName *gene, *geneList = spGenes(conn, acc);
    for (gene = geneList; gene != NULL; gene = gene->next)
        fprintf(varGene, "%s-%s\t%s\n", acc, version, gene->name);
    slFreeList(&geneList);

    }
carefulClose(&varAcc);
carefulClose(&varProtein);
carefulClose(&varDisplayId);
carefulClose(&varAccToTaxon);
carefulClose(&varDescription);
carefulClose(&varGene);
carefulClose(&varGeneLogic);
sqlDisconnect(&conn);
}