当前位置: 首页>>代码示例>>C++>>正文


C++ freeHash函数代码示例

本文整理汇总了C++中freeHash函数的典型用法代码示例。如果您正苦于以下问题:C++ freeHash函数的具体用法?C++ freeHash怎么用?C++ freeHash使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了freeHash函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main(int argc, char *argv[])
/* The program */
{
struct psl *pslList = NULL, *psl;
struct hash *queryHash, *targetHash;
struct lineFile *vulg;
aaSeq *querySeqs;
struct dnaSeq *targetSeqs;
if (argc != 5)
    usage();
/* Load up everything at beginning */
vulg = lineFileOpen(argv[1], TRUE);
querySeqs = dnaLoadAll(argv[2]);
targetSeqs = dnaLoadAll(argv[3]);
queryHash = seqHash(querySeqs);
targetHash = seqHash(targetSeqs);
/* Main business */
pslList = vulgarToPsl(vulg, queryHash, targetHash);
pslWriteAll(pslList, argv[4], FALSE);
/* Free up everything */
freeDnaSeqList(&querySeqs);
freeDnaSeqList(&targetSeqs);
freeHash(&targetHash);
freeHash(&queryHash);
pslFreeList(&pslList);
lineFileClose(&vulg);
return 0;
}
开发者ID:blumroy,项目名称:kentUtils,代码行数:28,代码来源:vulgarToPsl.c

示例2: g2gSeqOverlap

void g2gSeqOverlap(char *pairFileName, char *g2gPsl, char *outName)
/* g2gSeqOverlap - make a big .fa file with overlap sequence. */
{
boolean firstA;
FILE *f = mustOpen(outName, "w");
struct hash *cloneHash = newHash(16);
struct hash *pairHash = newHash(17);
struct seqPair *pair, *pairList;
int dotty = 0;

printf("Reading %s. ", pairFileName);
fflush(stdout);
pairList = readPairList(pairFileName, cloneHash, pairHash);
printf("Got %d pairs\n", slCount(pairList));
printf("Processing %s\n", g2gPsl);
fillInPsls(g2gPsl, pairHash);
printf("Writing overlaps to %s\n", outName);
for (pair = pairList; pair != NULL; pair = pair->next)
    {
    if ((++dotty % 100) == 0)
	{
	printf(".");
	fflush(stdout);
	}
    if (pair->a.overlap >= pair->b.overlap)
	writeOverlaps(f, &pair->a);
    else
	writeOverlaps(f, &pair->b);
    }
printf("\n");
fclose(f);
freeHash(&cloneHash);
freeHash(&pairHash);
}
开发者ID:CEpBrowser,项目名称:CEpBrowser--from-UCSC-CGI-BIN,代码行数:34,代码来源:g2gSeqOverlap.c

示例3: checkTagIsInside

static void checkTagIsInside(struct htmlPage *page, char *outsiders, char *insiders,  
	struct htmlTag *startTag, struct htmlTag *endTag)
/* Check that insiders are all bracketed by outsiders. */
{
char *outDupe = cloneString(outsiders);
char *inDupe = cloneString(insiders);
char *line, *word;
int depth = 0;
struct htmlTag *tag;
struct hash *outOpen = newHash(8);
struct hash *outClose = newHash(8);
struct hash *inHash = newHash(8);
char buf[256];

/* Create hashes of all insiders */
line = inDupe;
while ((word = nextWord(&line)) != NULL)
    {
    touppers(word);
    hashAdd(inHash, word, NULL);
    }

/* Create hash of open and close outsiders. */
line = outDupe;
while ((word = nextWord(&line)) != NULL)
    {
    touppers(word);
    hashAdd(outOpen, word, NULL);
    safef(buf, sizeof(buf), "/%s", word);
    hashAdd(outClose, buf, NULL);
    }

/* Stream through tags making sure that insiders are
 * at least one deep inside of outsiders. */
for (tag = startTag; tag != NULL; tag = tag->next)
    {
    char *type = tag->name;
    if (hashLookup(outOpen, type ))
        ++depth;
    else if (hashLookup(outClose, type))
        --depth;
    else if (hashLookup(inHash, type))
        {
	if (depth <= 0)
	    {
	    if (!startsWith("<INPUT TYPE=HIDDEN NAME=", tag->start))  // one exception hardwired
		tagAbort(page, tag, "%s outside of any of %s", type, outsiders);
	    }
	}
    }
freeHash(&inHash);
freeHash(&outOpen);
freeHash(&outClose);
freeMem(outDupe);
freeMem(inDupe);
}
开发者ID:elmargb,项目名称:kentUtils,代码行数:56,代码来源:htmlPage.c

示例4: jkUniq

void jkUniq(char *fileName)
/* Remove dupe lines from file. */
{
struct slName *lineList = NULL, *lineEl;
struct lineFile *lf = lineFileOpen(fileName, TRUE);
char *line;
int lineSize;
struct hash *hash = newHash(0);
FILE *f;

while (lineFileNext(lf, &line, &lineSize))
    {
    if (!hashLookup(hash, line))
	{
	hashAdd(hash, line, NULL);
	lineEl = newSlName(line);
	slAddHead(&lineList, lineEl);
	}
    }
slReverse(&lineList);
lineFileClose(&lf);
f = mustOpen(fileName, "w");
for (lineEl = lineList; lineEl != NULL; lineEl = lineEl->next)
    {
    fputs(lineEl->name, f);
    fputc('\n', f);
    }
fclose(f);
slFreeList(&lineList);
freeHash(&hash);
}
开发者ID:CEpBrowser,项目名称:CEpBrowser--from-UCSC-CGI-BIN,代码行数:31,代码来源:jkUniq.c

示例5: main

int main (int argc, char *argv[])
{
    char benchmarkPath[BUFFERSIZE], auxFile[BUFFERSIZE], placefile[BUFFERSIZE];

    if(argc != 4) {
        printf("Usage: %s <benchmark_dir> <aux_file> <placement_file>\n",
               argv[0]);
        printf("    <benchmark_dir> is the benchmark file directory.\n");
        printf("    <aux_file> is the bookshelf format auxiliary file");
        printf(" (assume in <benchmark_dir>).\n");
        printf("    <placement_file> is the placement file");
        printf(" (assume in current directory).\n");
        exit(1);
    }    

    strcpy(benchmarkPath, argv[1]);
    strcpy(auxFile, argv[2]);
    strcpy(placefile, argv[3]);

    readAuxFile(benchmarkPath, auxFile);
    createHash(benchmarkPath, nodesFile);
    readNodesFile(benchmarkPath, nodesFile);
    readNetsFile(benchmarkPath, netsFile);
    readPlFile(".", placefile);
    freeHash();

    readLUT();

    printf("Half-perimeter wirelength: %.2f\n", HPwl());
    printf("FLUTE wirelength         : %.2f\n", flutewl());
}
开发者ID:SpexGuy,项目名称:Silicon,代码行数:31,代码来源:flute-ckt.c

示例6: findStanAlignments

void findStanAlignments(char *db, char *stan, char *image, char *pslOut)
{
struct hash *iHash = newHash(5);
struct stanMad *smList = NULL, *sm = NULL;
FILE *out = mustOpen(pslOut, "w");
int count =0;
struct sqlConnection *conn = NULL;
warn("Getting sql Connection...");
conn = hAllocConn(db);
warn("Reading in image clones...");
readInImageHash(iHash, image);
warn("Loading Stanford Alignments..");
smList = stanMadLoadAll(stan);
warn("Finding best Alignments...");
for(sm = smList; sm != NULL; sm = sm->next)
    {
    if(differentString(sm->type,"Control"))
	{
	if((count++ % 10000) ==0)
	    {
	    printf(".");
	    fflush(stdout);
	    }
	outputAlignmentForStan(conn, sm, iHash, out);
	}
    }
printf("\n");
warn("Done. Cleaning up...");
stanMadFreeList(&smList);
freeHash(&iHash);
hFreeConn(&conn);

}
开发者ID:elmargb,项目名称:kentUtils,代码行数:33,代码来源:findStanAlignments.c

示例7: newHash

struct dgEdgeRef *dgFindSubEdges(struct diGraph *dg, struct dgNodeRef *subGraph)
/* Return list of edges in graph that connected together nodes in subGraph. */
{
struct hash *hash = newHash(0);
struct dgNodeRef *nr;
struct dgConnection *con;
struct dgEdgeRef *erList = NULL, *er;
struct dgNode *node;

/* Build up hash of nodes in subGraph. */
for (nr = subGraph; nr != NULL; nr = nr->next)
    {
    node = nr->node;
    hashAdd(hash, node->name, node);
    }

for (nr = subGraph; nr != NULL; nr = nr->next)
    {
    node = nr->node;
    for (con = node->nextList; con != NULL; con = con->next)
	{
	if (hashLookup(hash, con->node->name))
	    {
	    AllocVar(er);
	    er->edge = con->edgeOnList->val;
	    slAddHead(&erList, er);
	    }
	}
    }
freeHash(&hash);
return erList;
}
开发者ID:andrelmartins,项目名称:bigWig,代码行数:32,代码来源:diGraph.c

示例8: tabPepPred

void tabPepPred(char *database, int fileCount, char *fileNames[], char *table)
/* Load a tab separated peptide file. */
{
struct hash *uniq = newHash(16);
struct lineFile *lf = lineFileOpen(fileNames[0], TRUE);
char *words[2];

if (fileCount != 1)
    errAbort("Only one file allowed for tab separated peptides");

makeCustomTable(database, table, createString);

printf("Processing %s\n", fileNames[0]);
while (lineFileRow(lf, words))
    {
    char *upperCase;
    if (hashLookupUpperCase(uniq, words[0]) != NULL)
	errAbort("Duplicate (case insensitive) '%s' line %d of %s", words[0], lf->lineIx, lf->fileName);
    upperCase = cloneString(words[0]);
    touppers(upperCase);
    hashAdd(uniq, upperCase, NULL);
    freeMem(upperCase);
    }
lineFileClose(&lf);
printf("Loading %s\n", fileNames[0]);
loadTableFromTabFile(database, table, fileNames[0]);
freeHash(&uniq);
}
开发者ID:elmargb,项目名称:kentUtils,代码行数:28,代码来源:hgPepPred.c

示例9: pruneRelease

static struct trackDb * pruneRelease(struct trackDb *tdbList)
/* Prune out alternate track entries for another release */
{
/* Build up list that only includes things in this release.  Release
 * can be inherited from parents. */
struct trackDb *tdb;
struct trackDb *relList = NULL;
struct hash *haveHash = hashNew(3);

while ((tdb = slPopHead(&tdbList)) != NULL)
    {
    char *rel = trackDbSetting(tdb, "release");
    unsigned trackRelBits = buildReleaseBits(rel);

    if (trackRelBits & releaseBit)
	{
	/* we want to include this track, check to see if we already have it */
	struct hashEl *hel;
	if ((hel = hashLookup(haveHash, tdb->track)) != NULL)
	    errAbort("found two copies of table %s: one with release %s, the other %s\n",
		tdb->track, (char *)hel->val, release);

	hashAdd(haveHash, tdb->track, rel);
	hashRemove(tdb->settingsHash, "release");
	slAddHead(&relList, tdb);
	}
    else
	verbose(3,"pruneRelease: removing '%s', release: '%s' != '%s'\n",
	    tdb->track, rel, release);
    }

freeHash(&haveHash);
return relList;
}
开发者ID:elmargb,项目名称:kentUtils,代码行数:34,代码来源:hgTrackDb.c

示例10: agpHashFree

void agpHashFree(struct hash **pAgpHash)
/* Free up the hash created with agpLoadAll. */
{
struct hash *agpHash = *pAgpHash;
hashTraverseEls(agpHash, freeAgpHashEl);
freeHash(&agpHash);
*pAgpHash = NULL;
}
开发者ID:blumroy,项目名称:kentUtils,代码行数:8,代码来源:agp.c

示例11: joinerFree

void joinerFree(struct joiner **pJoiner)
/* Free up memory associated with joiner */
{
struct joiner *joiner = *pJoiner;
if (joiner != NULL)
    {
    freeMem(joiner->fileName);
    joinerSetFreeList(&joiner->jsList);
    freeHashAndVals(&joiner->symHash);
    hashFreeList(&joiner->exclusiveSets);
    freeHash(&joiner->databasesChecked);
    freeHash(&joiner->databasesIgnored);
    joinerDependencyFreeList(&joiner->dependencyList);
    joinerIgnoreFreeList(&joiner->tablesIgnored);
    freez(pJoiner);
    }
}
开发者ID:bowhan,项目名称:kent,代码行数:17,代码来源:joiner.c

示例12: associationCellPrint

static void associationCellPrint(struct column *col, struct genePos *gp, 
	struct sqlConnection *conn)
/* Print cell in association table. */
{
char query[1024];
struct sqlResult *sr;
char **row;
boolean gotOne = FALSE;
char *key = (col->protKey 
    ? (kgVersion == KG_III ? lookupProtein(conn, gp->name) : gp->protein)
    : gp->name);
struct hash *uniqHash = NULL;

if (col->weedDupes) uniqHash = newHash(8);
hPrintf("<TD>");
safef(query, sizeof(query), col->queryOne, key);
sr = sqlGetResult(conn, query);
while ((row = sqlNextRow(sr)) != NULL)
    {
    char *s = row[0];
    boolean needQuote;
    if (uniqHash != NULL)
        {
	if (hashLookup(uniqHash, s))
	    continue;
	else
	    hashAdd(uniqHash, s, NULL);
	}
    needQuote = hasWhiteSpace(s);
    if (!gotOne)
        gotOne = TRUE;
    else
	hPrintf("&nbsp;");
    if (needQuote)
        hPrintf("'");
    if (col->itemUrl)
	{
	hPrintf("<A HREF=\"");
	hPrintf(col->itemUrl, row[1]);
	hPrintf("\" TARGET=_blank>");
	}
    hPrintEncodedNonBreak(s);
    if (col->itemUrl)
        {
	hPrintf("</A>");
	}
    if (needQuote)
        hPrintf("'");
    }
sqlFreeResult(&sr);
if (!gotOne)
    {
    hPrintf("n/a");
    }
hPrintf("</TD>");
freeHash(&uniqHash);
}
开发者ID:CEpBrowser,项目名称:CEpBrowser--from-UCSC-CGI-BIN,代码行数:57,代码来源:association.c

示例13: getAllSplices

void getAllSplices(char *database, FILE *f)
/* Write out table linking flybase genes with BDGP transcripts --
 * unfortunately bdgpGeneInfo lacks -R* transcript/isoform identifiers,
 * so strip those off of bdgpGene.name. 
 * This is not necessary with flyBaseGene/flyBase2004Xref where -R*'s 
 * are preserved.
*/
{
struct sqlConnection *conn = sqlConnect(database);
struct sqlResult *sr;
char query[256], **row;
struct geneAlt *altList = NULL, *alt;
struct hash *bdgpHash = newHash(16);	/* Keyed by bdgp gene id. */
struct slName *n;

/* First build up list of all genes with flybase and bdgp ids. */
sqlSafef(query, sizeof(query), "select bdgpName,flyBaseId from bdgpGeneInfo");
sr = sqlGetResult(conn, query);
while ((row = sqlNextRow(sr)) != NULL)
    {
    AllocVar(alt);
    alt->bdgpName = cloneString(row[0]);
    alt->fbName = cloneString(row[1]);
    slAddHead(&altList, alt);
    hashAdd(bdgpHash, alt->bdgpName, alt);
    }
sqlFreeResult(&sr);
slReverse(&altList);

/* Now associate splicing variants. */
sqlSafef(query, sizeof(query), "select name from %s", geneTable);
sr = sqlGetResult(conn, query);
while ((row = sqlNextRow(sr)) != NULL)
    {
    char *s = row[0];
    char *e = rStringIn("-R", s);
    int size = e ? (e - s) : strlen(s);
    char bdgpGene[16];
    if (size >= sizeof(bdgpGene))
        errAbort("'%s' too big", s);
    memcpy(bdgpGene, s, size);
    bdgpGene[size] = 0;
    alt = hashMustFindVal(bdgpHash, bdgpGene);
    n = slNameNew(s);
    slAddTail(&alt->isoformList, n);
    }
sqlFreeResult(&sr);
sqlDisconnect(&conn);

for (alt = altList; alt != NULL; alt = alt->next)
    {
    for (n = alt->isoformList; n != NULL; n = n->next)
	fprintf(f, "%s\t%s\n", alt->fbName, n->name);
    }
freeHash(&bdgpHash);
}
开发者ID:elmargb,项目名称:kentUtils,代码行数:56,代码来源:hgFlyBase.c

示例14: checkOurDir

void checkOurDir(char *ourDir, struct contig *contigList, struct hash *hash)
/* Check that our directories look ok. */
{
struct us
    {
    struct us *next;    /* Next in list */
    char *contig;	/* NT_XXXXXX or NG_XXXXXX */
    char *chrom;        /* 1, 2, 3, etc. */
    };
struct hash *ourHash = newHash(0);
struct us *usList = NULL, *us;
struct fileInfo *chromList = NULL, *chromFi, *ctgList = NULL, *ctgFi;
char chromDir[512], ctgDir[512];
struct contig *contig;
int problemCount = 0;

/* Build up a hash that says where each contig is. */
chromList = listDirX(ourDir, "*", FALSE);
for (chromFi = chromList; chromFi != NULL; chromFi = chromFi->next)
    {
    if (chromFi->isDir && strlen(chromFi->name) <= 2)
        {
	sprintf(chromDir, "%s/%s", ourDir, chromFi->name);
	ctgList = listDirX(chromDir, "N?_*", FALSE);
	for (ctgFi = ctgList; ctgFi != NULL; ctgFi = ctgFi->next)
	    {
	    if (ctgFi->isDir)
	        {
		AllocVar(us);
		slAddHead(&usList, us);
		us->contig = ctgFi->name;
		us->chrom = chromFi->name;
		hashAdd(ourHash, us->contig, us);
		}
	    }
	}
    }
printf("We have %d contigs\n", slCount(usList));

/* Check each contig. */
for (contig = contigList; contig != NULL; contig = contig->next)
    {
    if ((us = hashFindVal(ourHash, contig->name)) == NULL)
        {
	++problemCount;
	printf("%s is not in %s\n", contig->name, ourDir);
	}
    else
        {
	sprintf(ctgDir, "%s/%s/%s", ourDir, us->chrom, us->contig);
	problemCount += checkOurContig(ctgDir, contig);
	}
    }
freeHash(&ourHash);
}
开发者ID:CEpBrowser,项目名称:CEpBrowser--from-UCSC-CGI-BIN,代码行数:55,代码来源:checkYbr.c

示例15: freeHashAndVals

void freeHashAndVals(struct hash **pHash)
/* Free up hash table and all values associated with it.
 * (Just calls freeMem on each hel->val) */
{
struct hash *hash;
if ((hash = *pHash) != NULL)
    {
    hashTraverseVals(hash, freeMem);
    freeHash(pHash);
    }
}
开发者ID:davidhoover,项目名称:kent,代码行数:11,代码来源:hash.c


注:本文中的freeHash函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。