• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ freeMem函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: checkWigDataFilter

boolean checkWigDataFilter(char *db, char *table,
	char **constraint, double *ll, double *ul)
/*	check if filter exists, return its values, call with db="ct" for
 *	custom tracks	*/
{
char varPrefix[128];
struct hashEl *varList, *var;
char *pat = NULL;
char *cmp = NULL;
if (constraint != NULL)
    *constraint = NULL;	// Make sure return variable gets set to something at least.

if (isCustomTrack(table))
    db = "ct";

safef(varPrefix, sizeof(varPrefix), "%s%s.%s.", hgtaFilterVarPrefix, db, table);

varList = cartFindPrefix(cart, varPrefix);
if (varList == NULL)
    return FALSE;

/*	check varList, look for dataValue.pat and dataValue.cmp	*/

for (var = varList; var != NULL; var = var->next)
    {
    if (endsWith(var->name, ".pat"))
	{
	char *name;
	name = cloneString(var->name);
	tolowers(name);
	/*	make sure we are actually looking at datavalue	*/
	if (stringIn("datavalue", name) || stringIn("score", name))
	    {
	    pat = cloneString(var->val);
	    }
	freeMem(name);
	}
    if (endsWith(var->name, ".cmp"))
	{
	char *name;
	name = cloneString(var->name);
	tolowers(name);
	/*	make sure we are actually looking at datavalue	*/
	if (stringIn("datavalue", name) || stringIn("score", name))
	    {
	    cmp = cloneString(var->val);
	    tolowers(cmp);
	    if (stringIn("ignored", cmp))
		freez(&cmp);
	    }
	freeMem(name);
	}
    }

/*	Must get them both for this to work	*/
if (cmp && pat)
    {
    int wordCount = 0;
    char *words[2];
    char *dupe = cloneString(pat);

    wordCount = chopString(dupe, ", \t\n", words, ArraySize(words));
    switch (wordCount)
	{
	case 2: if (ul) *ul = sqlDouble(words[1]);
	case 1: if (ll) *ll = sqlDouble(words[0]);
		break;
	default:
	    warn("dataValue filter must be one or two numbers (two for 'in range').  "
		 "Please click the filter edit button and either set the comparison to 'ignored' "
		 "or set the dataValue threshold.");
	}
    if (sameWord(cmp,"in range") && (wordCount != 2))
	errAbort("'in range' dataValue filter must have two numbers input\n");

    if (constraint)
	*constraint = cmp;

    return TRUE;
    }
else
    return FALSE;
}	/*	static boolean checkWigDataFilter()	*/
开发者ID:ucscGenomeBrowser,项目名称:kent,代码行数:83,代码来源:wiggle.c


示例2: fetchIntoBuf


//.........这里部分代码省略.........
    /* Find contigious blocks and read them into mergedBuf. */
    fileOffsetSizeFindGap(block, &beforeGap, &afterGap);
    bits64 mergedOffset = block->offset;
    bits64 mergedSize = beforeGap->offset + beforeGap->size - mergedOffset;
    udcSeek(udc, mergedOffset);
    char *mergedBuf = needLargeMem(mergedSize);
    udcMustRead(udc, mergedBuf, mergedSize);
    char *blockBuf = mergedBuf;

    /* Loop through individual blocks within merged section. */
    for (;block != afterGap; block = block->next)
        {
	/* Uncompress if necessary. */
	char *blockPt, *blockEnd;
	if (uncompressBuf)
	    {
	    blockPt = uncompressBuf;
	    int uncSize = zUncompress(blockBuf, block->size, uncompressBuf, bwf->uncompressBufSize);
	    blockEnd = blockPt + uncSize;
	    }
	else
	    {
	    blockPt = blockBuf;
	    blockEnd = blockPt + block->size;
	    }

	/* Deal with insides of block. */
	struct bwgSectionHead head;
	bwgSectionHeadFromMem(&blockPt, &head, isSwapped);
	switch (head.type)
	    {
	    case bwgTypeBedGraph:
		{
		for (i=0; i<head.itemCount; ++i)
		    {
		    bits32 s = memReadBits32(&blockPt, isSwapped);
		    bits32 e = memReadBits32(&blockPt, isSwapped);
		    bitSetRange(covBuf, s, e-s);
		    val = memReadFloat(&blockPt, isSwapped);
		    bits32 j;
		    for (j=s; j<e; ++j)
		        valBuf[j] = val;
		    }
		break;
		}
	    case bwgTypeVariableStep:
		{
		for (i=0; i<head.itemCount; ++i)
		    {
		    bits32 s = memReadBits32(&blockPt, isSwapped);
		    val = memReadFloat(&blockPt, isSwapped);
		    bitSetRange(covBuf, s, head.itemSpan);
		    bits32 e = s + head.itemSpan;
		    bits32 j;
		    for (j=s; j<e; ++j)
		        valBuf[j] = val;
		    }
		break;
		}
	    case bwgTypeFixedStep:
		{
		/* Do a little optimization for the most common and worst case - step1/span1 */
		if (head.itemStep == 1 && head.itemSpan == 1)
		    {
		    bits32 s = head.start;
		    bits32 e = head.end;
		    bitSetRange(covBuf, s, e-s);
		    bits32 j;
		    for (j=s; j<e; ++j)
		        valBuf[j] = memReadFloat(&blockPt, isSwapped);
		    }
		else
		    {
		    bits32 s = head.start;
		    bits32 e = s + head.itemSpan;
		    for (i=0; i<head.itemCount; ++i)
			{
			bitSetRange(covBuf, s, head.itemSpan);
			val = memReadFloat(&blockPt, isSwapped);
			bits32 j;
			for (j=s; j<e; ++j)
			    valBuf[j] = val;
			s += head.itemStep;
			e += head.itemStep;
			}
		    }
		break;
		}
	    default:
		internalErr();
		break;
	    }
	assert(blockPt == blockEnd);
	blockBuf += block->size;
	}
    freeMem(mergedBuf);
    }
freeMem(uncompressBuf);
slFreeList(&blockList);
}
开发者ID:CRG-Barcelona,项目名称:libbeato,代码行数:101,代码来源:bwgValsOnChrom.c


示例3: bigBedTabOut

void bigBedTabOut(char *db, char *table, struct sqlConnection *conn, char *fields, FILE *f)
/* Print out selected fields from Big Bed.  If fields is NULL, then print out all fields. */
{
if (f == NULL)
    f = stdout;

/* Convert comma separated list of fields to array. */
int fieldCount = chopByChar(fields, ',', NULL, 0);
char **fieldArray;
AllocArray(fieldArray, fieldCount);
chopByChar(fields, ',', fieldArray, fieldCount);

/* Get list of all fields in big bed and turn it into a hash of column indexes keyed by
 * column name. */
struct hash *fieldHash = hashNew(0);
struct slName *bb, *bbList = bigBedGetFields(table, conn);
int i;
for (bb = bbList, i=0; bb != NULL; bb = bb->next, ++i)
    hashAddInt(fieldHash, bb->name, i);

// If bigBed has name column, look up pasted/uploaded identifiers if any:
struct hash *idHash = NULL;
if (slCount(bbList) >= 4)
    idHash = identifierHash(db, table);

/* Create an array of column indexes corresponding to the selected field list. */
int *columnArray;
AllocArray(columnArray, fieldCount);
for (i=0; i<fieldCount; ++i)
    {
    columnArray[i] = hashIntVal(fieldHash, fieldArray[i]);
    }

/* Output row of labels */
fprintf(f, "#%s", fieldArray[0]);
for (i=1; i<fieldCount; ++i)
    fprintf(f, "\t%s", fieldArray[i]);
fprintf(f, "\n");

/* Open up bigBed file. */
char *fileName = bigBedFileName(table, conn);
struct bbiFile *bbi = bigBedFileOpen(fileName);
struct asObject *as = bigBedAsOrDefault(bbi);
struct asFilter *filter = NULL;

if (anyFilter())
    {
    filter = asFilterFromCart(cart, db, table, as);
    if (filter)
        {
	fprintf(f, "# Filtering on %d columns\n", slCount(filter->columnList));
	}
    }

/* Loop through outputting each region */
struct region *region, *regionList = getRegions();
for (region = regionList; region != NULL; region = region->next)
    {
    struct lm *lm = lmInit(0);
    struct bigBedInterval *iv, *ivList = bigBedIntervalQuery(bbi, region->chrom,
    	region->start, region->end, 0, lm);
    char *row[bbi->fieldCount];
    char startBuf[16], endBuf[16];
    for (iv = ivList; iv != NULL; iv = iv->next)
        {
	bigBedIntervalToRow(iv, region->chrom, startBuf, endBuf, row, bbi->fieldCount);
	if (asFilterOnRow(filter, row))
	    {
	    if ((idHash != NULL) && (hashLookup(idHash, row[3]) == NULL))
		continue;
	    int i;
	    fprintf(f, "%s", row[columnArray[0]]);
	    for (i=1; i<fieldCount; ++i)
		fprintf(f, "\t%s", row[columnArray[i]]);
	    fprintf(f, "\n");
	    }
	}
    lmCleanup(&lm);
    }

/* Clean up and exit. */
bbiFileClose(&bbi);
hashFree(&fieldHash);
freeMem(fieldArray);
freeMem(columnArray);
}
开发者ID:Nicholas-NVS,项目名称:kentUtils,代码行数:86,代码来源:bigBed.c


示例4: hgncFree

void hgncFree(struct hgnc **pEl)
/* Free a single dynamically allocated hgnc such as created
 * with hgncLoad(). */
{
struct hgnc *el;

if ((el = *pEl) == NULL) return;
freeMem(el->hgncId);
freeMem(el->symbol);
freeMem(el->name);
freeMem(el->status);
freeMem(el->locusType);
freeMem(el->locusGroup);
freeMem(el->prvSymbols);
freeMem(el->prvNames);
freeMem(el->synonyms);
freeMem(el->nameSyns);
freeMem(el->chrom);
freeMem(el->dateApprv);
freeMem(el->dateMod);
freeMem(el->dateSymChange);
freeMem(el->dateNmChange);
freeMem(el->accession);
freeMem(el->enzymeIds);
freeMem(el->entrezId);
freeMem(el->ensId);
freeMem(el->mgdId);
freeMem(el->miscDbs);
freeMem(el->miscIds);
freeMem(el->pubMed);
freeMem(el->refSeqIds);
freeMem(el->geneFamilyNm);
freeMem(el->geneFamilyDesc);
freeMem(el->recType);
freeMem(el->primaryId);
freeMem(el->secondaryId);
freeMem(el->ccdsId);
freeMem(el->vegaId);
freeMem(el->locusDbs);
freeMem(el->gdbMapped);
freeMem(el->entrezMapped);
freeMem(el->omimMapped);
freeMem(el->refSeqMapped);
freeMem(el->uniProtMapped);
freeMem(el->ensMapped);
freeMem(el->ucscMapped);
freeMem(el->mgiMapped);
freeMem(el->rgdMapped);
freez(pEl);
}
开发者ID:bowhan,项目名称:kent,代码行数:50,代码来源:hgnc.c


示例5: rdf_complete

void
rdf_complete(NET_StreamClass *stream)
{
  RDFFile f = (RDFFile)stream->data_object;
  if (strcmp(f->url, gNavCntrUrl) == 0) {
    if (f->resourceCount == 0) {
      parseNextRDFXMLBlob(stream, gDefaultNavcntr, strlen(gDefaultNavcntr));
    } else {
      RDF_Resource browser = RDF_GetResource(NULL, "netscape:browser", 1);

      RDF_Resource updateID = RDF_GetResource(NULL, "updateID", 1);
      char* id = RDF_GetSlotValue(gNCDB, browser, updateID,
                                  RDF_STRING_TYPE, false, true);

      RDF_Resource updateFrom = RDF_GetResource(NULL, "updateURL", 1);
      char* uf = RDF_GetSlotValue(gNCDB, browser, updateFrom,
                                  RDF_STRING_TYPE, false, true);

      RDF_Resource fileSize = RDF_GetResource(NULL, "fileSize", 1);
      char* fs = RDF_GetSlotValue(gNCDB, browser, fileSize,
                                  RDF_STRING_TYPE, false, true);
      uint32 fSize;
      if (fs == NULL) {
        fSize = 3000;
      } else {
        sscanf("%lu", fs, &fSize);
        freeMem(fs);
      }
      if ((uf != NULL) && (id != NULL)) {
#ifdef MOZ_SMARTUPDATE
        AutoUpdateConnnection autoupdt;
        autoupdt = AutoUpdate_Setup(FE_GetRDFContext(), 
                                    id, uf, fSize, 
                                    "http://warp/u/raman/docs/js/download.html");
        autoupdate_Resume(autoupdt);
#endif /* MOZ_SMARTUPDATE */
        freeMem(uf);
        freeMem(id);
      } 

      /* A temporary hack to demo AutoUpdate on windows */
#ifndef MOZ_SMARTUPDATE
#ifndef XP_MAC
      /*
      {
        AutoUpdate_LoadMainScript(FE_GetRDFContext(),
                                  "http://warp/u/raman/docs/js/download.html");
      }
      */
#endif /* !XP_MAC */
#endif /* MOZ_SMARTUPDATE */

    } 
  }
  if (f) {
    freeMem(f->line);
    freeMem(f->currentSlot);
    freeMem(f->holdOver);
    freeNamespaces(f) ;
	f->line = NULL;
	f->currentSlot = NULL;
	f->holdOver = NULL;
  }
}
开发者ID:binoc-software,项目名称:mozilla-cvs,代码行数:64,代码来源:glue.c


示例6: trimUniq

void trimUniq(bioSeq *seqList)
/* Check that all seq's in list have a unique name.  Try and
 * abbreviate longer sequence names. */
{
struct hash *hash = newHash(0);
bioSeq *seq;

for (seq = seqList; seq != NULL; seq = seq->next)
    {
    char *saferString = needMem(strlen(seq->name)+1);
    char *c, *s;

    /*	Some chars are safe to allow through, other chars cause
     *	problems.  It isn't necessarily a URL safe string that is
     *	being calculated here.  The original problem was a user had
     *	the fasta header line of:
     *	chr8|59823648:59825047|+
     *	The plus sign was being taken as the query name and this
     *	created problems as that name was passed on to hgc via
     *	the ss cart variable.  The + sign became part of a URL
     *	eventually.  This loop allows only isalnum and =_/.:;_|
     *	to get through as part of the header name.  These characters
     *	all proved to be safe as single character names, or all
     *	together.
     */
    s = saferString;
    for (c = seq->name; *c != '\0'; ++c)
	{
	if (c && (*c != '\0'))
	    {
	    if ( isalnum(*c) || (*c == '=') || (*c == '-') || (*c == '/') ||
		(*c == '.') || (*c == ':') || (*c == ';') || (*c == '_') ||
		    (*c == '|') )
		*s++ = *c;
	    }
	}
    *s = '\0';
    freeMem(seq->name);
    if (*saferString == '\0')
	{
	freeMem(saferString);
	saferString = cloneString("YourSeq");
	}
    seq->name = saferString;

    if (strlen(seq->name) > 14)	/* Try and get rid of long NCBI .fa cruft. */
        {
	char *nameClone = NULL;
	char *abbrv = NULL;
	char *words[32];
	int wordCount;
	boolean isEns = (stringIn("ENSEMBL:", seq->name) != NULL);

	nameClone = cloneString(seq->name);
	wordCount = chopString(nameClone, "|", words, ArraySize(words));
	if (wordCount > 1)	/* Looks like it's an Ensembl/NCBI 
		                 * long name alright. */
	    {
	    if (isEns)
		{
	        abbrv = words[0];
		if (abbrv[0] == 0) abbrv = words[1];
		}
	    else if (sameString(words[1], "dbSNP"))
	        {
		if (wordCount > 2)
		    abbrv = words[2];
		else
		    abbrv = nameClone;
		}
	    else
		{
		abbrv = words[wordCount-1];
		if (abbrv[0] == 0) abbrv = words[wordCount-2];
		}
	    if (hashLookup(hash, abbrv) == NULL)
	        {
		freeMem(seq->name);
		seq->name = cloneString(abbrv);
		}
	    freez(&nameClone);
	    }
	}
    hashAddUnique(hash, seq->name, hash);
    }
freeHash(&hash);
}
开发者ID:maximilianh,项目名称:kent,代码行数:87,代码来源:hgBlat.c


示例7: doMiddle

void doMiddle()
{
char *seqName;
boolean intronsLowerCase = TRUE;
boolean intronsParenthesized = FALSE;
boolean hiliteNear = FALSE;
int startRange = 0;
int endRange = 0;
boolean gotRange = FALSE;
struct dnaSeq *cdnaSeq;
boolean isChromRange = FALSE;
DNA *dna;
char *translation = NULL;

seqName = cgiString("geneName");
seqName = trimSpaces(seqName);
if (cgiVarExists("intronsLowerCase"))
    intronsLowerCase = cgiBoolean("intronsLowerCase");
if (cgiVarExists("intronsParenthesized"))
    intronsParenthesized = cgiBoolean("intronsParenthesized");
if (cgiVarExists("startRange") && cgiVarExists("endRange" ))
    {
    startRange = cgiInt("startRange");
    endRange = cgiInt("endRange");
    gotRange = TRUE;
    }
if (cgiVarExists("hiliteNear"))
    {
    hiliteNear = TRUE;
    }
fprintf(stdout, "<P><TT>\n");

/* The logic here is a little complex to optimize speed.
 * If we can decide what type of thing the name refers to by
 * simply looking at the name we do.  Otherwise we have to
 * search the database in various ways until we get a hit. */
if (wormIsNamelessCluster(seqName))
    {
    isChromRange = TRUE;
    }
else if (wormIsChromRange(seqName))
    {
    isChromRange = TRUE;
    }
else if (getWormGeneDna(seqName, &dna, TRUE))
    {
    if (cgiBoolean("litLink"))
        {
        char nameBuf[64];
        char *geneName = NULL;
        char *productName = NULL;
        char *coding;
        int transSize;
        struct wormCdnaInfo info;

        printf("<H3>Information and Links for %s</H3>\n", seqName);
        if (wormInfoForGene(seqName, &info))
            {
            if (info.description)
                printf("<P>%s</P>\n", info.description);
            geneName = info.gene;
            productName = info.product;
            }
        else
            {
            if (wormIsGeneName(seqName))
                geneName = seqName;
            else if (wormGeneForOrf(seqName, nameBuf, sizeof(nameBuf)))
                geneName = nameBuf;
            }
        coding = cloneUpperOnly(dna);
        transSize = 1 + (strlen(coding)+2)/3;
        translation = needMem(1+strlen(coding)/3);
        dnaTranslateSome(coding, translation, transSize);
        freez(&coding);

        if (geneName)
            {
            printf("<A HREF=\"http://www.ncbi.nlm.nih.gov/htbin-post/Entrez/query?form=4&db=m"
                    "&term=C+elegans+%s&dispmax=50&relentrezdate=No+Limit\">", geneName);
            printf("PubMed search on gene: </A>%s<BR>\n", geneName);
            }
        if (productName)
            {
            char *encoded = cgiEncode(productName);
            printf("<A HREF=\"http://www.ncbi.nlm.nih.gov/htbin-post/Entrez/query?form=4&db=m"
                    "&term=%s&dispmax=50&relentrezdate=No+Limit\">", encoded);
            printf("PubMed search on product:</A> %s<BR>\n", productName);
            freeMem(encoded);
            }
        /* Process name to get rid of isoform letter for Proteome. */
        if (geneName)
            strcpy(nameBuf, geneName);
        else
            {
            strcpy(nameBuf, seqName);
#ifdef NEVER
            /* Sometimes Proteome requires the letter after the orf name
             * in alt-spliced cases, sometimes it can't handle it.... */
            nameLen = strlen(nameBuf);
//.........这里部分代码省略.........
开发者ID:bowhan,项目名称:kent,代码行数:101,代码来源:getgene.c


示例8: printFreeMemToSerial

void printFreeMemToSerial(char* message) {
  Serial.print(message);
  Serial.print(":\t");
  Serial.println(freeMem(&biggest));
}
开发者ID:znelson,项目名称:cabin,代码行数:5,代码来源:FreeMem.cpp


示例9: freeMem

	~shared_array()
	{
		*refCount--;
		if(*refCount == 0)
			freeMem();
	}
开发者ID:playwithfree,项目名称:squeezed,代码行数:6,代码来源:render.cpp


示例10: finalizeReads

void finalizeReads()
{
	if (!seqCompressed)
	{
		fclose(_r_fp1);
		if ( pairedEndMode && _r_fp2 != _r_fp1 )
		{
			fclose(_r_fp2);
		}
	}
	else
	{
		gzclose(_r_gzfp1);
		if ( pairedEndMode && _r_gzfp2 != _r_gzfp1)
		{
			gzclose(_r_gzfp2);
		}
	}
	freeMem(_r_seq, sizeof(Read)*_r_maxSeqCnt);
	freeMem(_r_samplingLocs, sizeof(int)*(_r_samplingLocsSize+1));
	int size = sizeof(int)*_r_samplingLocsSize;
	freeMem(_r_samplingLocsSeg, size);
	freeMem(_r_samplingLocsOffset, size);
	freeMem(_r_samplingLocsLen, size);
	freeMem(_r_samplingLocsLenFull, size);
	freeMem(_r_alphIndex, 128);

	if (pairedEndMode && _r_buf1 != _r_buf2)
	{
		freeMem(_r_buf2, 10000000);
		freeMem(_r_buf2_pos, sizeof(int));
		freeMem(_r_buf2_size, sizeof(int));
	}
	freeMem(_r_buf1, 10000000);
	freeMem(_r_buf1_pos, sizeof(int));
	freeMem(_r_buf1_size, sizeof(int));

	if (!nohitDisabled)
	{
		fclose(_r_umfp);
	}
}
开发者ID:bnelsj,项目名称:mrsfast,代码行数:42,代码来源:Reads.c


示例11: dyStringNew

char *mdbSelectsHtmlRows(struct sqlConnection *conn,struct slPair *mdbSelects,
                         struct slPair *mdbVars,int cols,boolean fileSearch)
// genereates the html for the table rows containing mdb var and val selects.
// Assume tableSearch unless fileSearch
{
struct dyString *output = dyStringNew(1024);

dyStringPrintf(output,"<tr><td colspan='%d' align='right' class='lineOnTop' style='height:20px; "
                      "max-height:20px;'><em style='color:%s; width:200px;'>ENCODE terms</em>"
                      "</td></tr>\n", cols,COLOR_DARKGREY);

struct slPair *mdbSelect = mdbSelects;
int row = 0;
for (;mdbSelect != NULL; mdbSelect = mdbSelect->next)
    {
    char buf[256];
    char *dropDownHtml = NULL;

    #define PLUS_MINUS_BUTTON "<input type='button' id='%sButton%d' value='%c' " \
                              "style='font-size:.7em;' title='%s' " \
                              "onclick='findTracks.mdbSelectPlusMinus(this,%d)'>"
    #define ADD_PM_BUTTON(type,num,value) \
            dyStringPrintf(output,PLUS_MINUS_BUTTON, (type), (num), (value), \
                           ((value) == '+' ? "add another row after":"delete"), (num))

    dyStringAppend(output,"<tr valign='top' class='mdbSelect'><td nowrap>\n");
    row++;

    if (slCount(mdbSelects) > 2 || row > 2)
        ADD_PM_BUTTON("minus", row, '-');
    else
        dyStringAppend(output,"&nbsp;");
    ADD_PM_BUTTON("plus", row, '+');

    dyStringAppend(output,"</td><td>and&nbsp;</td><td colspan=3 nowrap>\n");
    safef(buf, sizeof(buf), "%s%i", METADATA_NAME_PREFIX, row);

    // Left side select of vars
    dropDownHtml = cgiMakeSingleSelectDropList(buf, mdbVars,mdbSelect->name, NULL,"mdbVar",
                             "style='font-size:.9em;' onchange='findTracks.mdbVarChanged(this);'");
    if (dropDownHtml)
        {
        dyStringAppend(output,dropDownHtml);
        freeMem(dropDownHtml);
        }

    // Right side select of vals
    safef(buf, sizeof(buf), "%s%i", METADATA_VALUE_PREFIX, row);
    enum cvSearchable searchBy = cvSearchMethod(mdbSelect->name);
    if (searchBy == cvSearchBySingleSelect || searchBy == cvSearchByMultiSelect)
        {
        dyStringPrintf(output,"</td>\n<td align='right' id='isLike%i' style='width:10px; "
                              "white-space:nowrap;'>is%s</td>\n<td nowrap id='%s' "
                              "style='max-width:600px;'>\n",
                              row,(searchBy == cvSearchByMultiSelect?" among":""),buf);
        struct slPair *pairs = mdbValLabelSearch(conn, mdbSelect->name, MDB_VAL_STD_TRUNCATION,
                                                 FALSE, !fileSearch, fileSearch);
                                                        // not tags, either a file or table search
        if (slCount(pairs) > 0)
            {
            char *dropDownHtml = cgiMakeSelectDropList((searchBy == cvSearchByMultiSelect),
                                                buf, pairs,mdbSelect->val, ANYLABEL,"mdbVal",
                                                "style='min-width:200px; font-size:.9em;' "
                                                "onchange='findTracks.mdbValChanged(this);'");
            if (dropDownHtml)
                {
                dyStringAppend(output,dropDownHtml);
                freeMem(dropDownHtml);
                }
            slPairFreeList(&pairs);
            }
        }
    else if (searchBy == cvSearchByFreeText)
        {
        dyStringPrintf(output,"</td><td align='right' id='isLike%i' style='width:10px; "
                              "white-space:nowrap;'>contains</td>\n<td nowrap id='%s' "
                              "style='max-width:600px;'>\n",row,buf);
        dyStringPrintf(output,"<input type='text' name='%s' value='%s' class='mdbVal freeText' "
                              "style='max-width:310px; width:310px; font-size:.9em;' "
                              "onchange='findTracks.mdbVarChanged(true);'>\n",
                              buf,(mdbSelect->val ? (char *)mdbSelect->val: ""));
        }
    else if (searchBy == cvSearchByWildList)
        {
        dyStringPrintf(output,"</td><td align='right' id='isLike%i' style='width:10px; "
                              "white-space:nowrap;'>is among</td>\n<td nowrap id='%s' "
                              "style='max-width:600px;'>\n",row,buf);
        dyStringPrintf(output,"<input type='text' name='%s' value='%s' class='mdbVal wildList' "
                              "title='enter comma separated list of values' "
                              "style='max-width:310px; width:310px; font-size:.9em;' "
                              "onchange='findTracks.mdbVarChanged(true);'>\n",
                              buf,(mdbSelect->val ? (char *)mdbSelect->val: ""));
        }
    //else if (searchBy == cvSearchByDateRange || searchBy == cvSearchByIntegerRange)
    //    {
    //    // TO BE IMPLEMENTED
    //    }
    dyStringPrintf(output,"<span id='helpLink%i'>&nbsp;</span></td>\n", row);
    dyStringPrintf(output,"</tr>\n");
    }
//.........这里部分代码省略.........
开发者ID:davidhoover,项目名称:kent,代码行数:101,代码来源:search.c


示例12: getMem


//.........这里部分代码省略.........
		if (_r_seq[i].hits[0] == 1)			// marked reads are not indexed
		{
			_r_seq[i].hits[0] = 0;
			for (j=0; j< 2*_r_samplingLocsSize; j++)
			{
				tmp[pos].hv = -1;
				tmp[pos].checksum = 0;
				tmp[pos].seqInfo = pos +(div*id*2*_r_samplingLocsSize);
				pos++;
			}
		}
		else
		{
			for (j=0; j< _r_samplingLocsSize; j++)
			{
				hvtmp = hashVal(_r_seq[i].seq+_r_samplingLocs[j]);
				cstmp = checkSumVal(_r_seq[i].seq+_r_samplingLocs[j]+WINDOW_SIZE);
				if (hvtmp == -1 || cstmp == -1)
				{
					tmp[pos].hv = -1;
					tmp[pos].checksum = 0;
				}
				else
				{
					tmp[pos].hv = hvtmp;
					tmp[pos].checksum = cstmp;
				}
				tmp[pos].seqInfo = pos +(div*id*2*_r_samplingLocsSize);
				pos++;
			}

			for (j=0; j<_r_samplingLocsSize; j++)
			{
				hvtmp = hashVal(_r_seq[i].rseq+_r_samplingLocs[j]);
				cstmp = checkSumVal(_r_seq[i].rseq+_r_samplingLocs[j]+WINDOW_SIZE);
				
				if (hvtmp == -1  || cstmp == -1)
				{
					tmp[pos].hv = -1;
					tmp[pos].checksum = 0;
				}
				else
				{
					tmp[pos].hv = hvtmp;
					tmp[pos].checksum = cstmp;
				}
				tmp[pos].seqInfo = pos+(div*id*2*_r_samplingLocsSize);
				pos++;
			}

		}
		tmpSize+=2*_r_samplingLocsSize;
	}
	
	introSortPair( tmp, 0, tmpSize-1);

	int uniq = 0;
	int prev = -2;
	int beg = -1;
	int end = -1;

	for (i=0; i<tmpSize; i++)
	{
		if (prev != tmp[i].hv)
		{
			uniq ++;
			prev = tmp[i].hv;
		}
	}

	_r_readIndexSize[id] = uniq;
	_r_readIndex[id] = getMem(sizeof(ReadIndexTable)*_r_readIndexSize[id]);


	prev = -2;
	j=0;
	beg =0;
	while (beg < tmpSize)
	{
		end = beg;
		while (end+1<tmpSize && tmp[end+1].hv==tmp[beg].hv)
			end++;

		_r_readIndex[id][j].hv = tmp[beg].hv;

		_r_readIndex[id][j].list = getMem(sizeof(GeneralIndex)*(end-beg+2));
		_r_readIndex[id][j].list[0].info = end-beg+1;

		for (i=1; i <= _r_readIndex[id][j].list[0].info; i++)
		{
			_r_readIndex[id][j].list[i].info=tmp[beg+i-1].seqInfo;
			_r_readIndex[id][j].list[i].checksum=tmp[beg+i-1].checksum;
		}

		j++;
		beg = end+1;
	}
	freeMem(tmp, sizeof(Pair)*(div*_r_samplingLocsSize*2));
	return NULL;
}
开发者ID:bnelsj,项目名称:mrsfast,代码行数:101,代码来源:Reads.c


示例13: doSummaryStatsWiggle


//.........这里部分代码省略.........
	else
	    sumSquares = sumData * sumData;

	/*	global accumulators for overall summary	*/
	statsSpan = wds->stats->span;
	statsSumData += sumData;
	statsSumSquares += sumSquares;
	if (wds->stats->lowerLimit < lowerLimit)
	    lowerLimit = wds->stats->lowerLimit;
	if ((wds->stats->lowerLimit + wds->stats->dataRange) > upperLimit)
	    upperLimit = wds->stats->lowerLimit + wds->stats->dataRange;

	if (statsHeaderDone)
	    wds->statsOut(wds, database, "stdout", TRUE, TRUE, FALSE, TRUE);
	else
	    {
	    wds->statsOut(wds, database, "stdout", TRUE, TRUE, TRUE, TRUE);
	    statsHeaderDone = TRUE;
	    }
	wds->freeStats(wds);
	gotSome = TRUE;
	}
    if ((regionCount > MAX_REGION_DISPLAY) &&
		(regionsDone >= MAX_REGION_DISPLAY))
	{
	hPrintf("<TR><TH ALIGN=CENTER COLSPAN=12> Can not display more "
	    "than %d regions, <BR> would take too much time </TH></TR>\n",
		MAX_REGION_DISPLAY);
	break;	/*	exit this for loop	*/
	}
    }	/*for (region = regionList; region != NULL; region = region->next) */

if (hasConstraint)
    freeMem(dataConstraint);	/* been cloned into wds */

if (1 == regionCount)
    {
    statsPreamble(wds, regionList->chrom, regionList->start, regionList->end,
	span, valuesMatched, table2);
    /* 3 X TRUE = sort results, html table output, with header,
     *	the FALSE means close the table after printing, no more rows to
     *	come.  The case in the if() statement was already taken care of
     *	in the statsPreamble() printout.  No need to do that again.
     */

    if ( ! ((valuesMatched == 0) && table2) )
	wds->statsOut(wds, database, "stdout", TRUE, TRUE, TRUE, FALSE);
    regionSize = basesInRegion(regionList,0);
    gapTotal = gapsInRegion(conn, regionList,0);
    }
else
    {	/* this is a bit of a kludge here since these printouts are done in the
	 *	library source wigDataStream.c statsOut() function and
	 *	this is a clean up of that.  That function should be
	 *	pulled out of there and made independent and more
	 *	versatile.
	 */
    long long realSize;
    double variance;
    double stddev;

    /*	Too expensive to lookup the numbers for thousands of regions */
    regionSize = basesInRegion(regionList,MAX_REGION_DISPLAY);
    gapTotal = gapsInRegion(conn, regionList,MAX_REGION_DISPLAY);
    realSize = regionSize - gapTotal;
开发者ID:ucscGenomeBrowser,项目名称:kent,代码行数:66,代码来源:wiggle.c


示例14: freeMem

struct bed *getWiggleAsBed(
    char *db, char *table, 	/* Database and table. */
    struct region *region,	/* Region to get data for. */
    char *filter, 		/* Filter to add to SQL where clause if any. */
    struct hash *idHash, 	/* Restrict to id's in this hash if non-NULL. */
    struct lm *lm,		/* Where to allocate memory. */
    struct sqlConnection *conn)	/* SQL connection to work with */
/* Return a bed list of all items in the given range in table.
 * Cleanup result via lmCleanup(&lm) rather than bedFreeList.  */
/* filter, idHash and lm are currently unused, perhaps future use	*/
{
struct bed *bedList=NULL;
char splitTableOrFileName[HDB_MAX_TABLE_STRING];
struct customTrack *ct = NULL;
boolean isCustom = FALSE;
boolean hasConstraint = FALSE;
struct wiggleDataStream *wds = NULL;
unsigned long long valuesMatched = 0;
int operations = wigFetchBed;
char *dataConstraint;
double ll = 0.0;
double ul = 0.0;
char *table2 = NULL;
struct bed *intersectBedList = NULL;
int maxOut;

WIG_INIT;  /* ct, isCustom, hasConstraint, wds and table2 are set here */

if (hasConstraint)
    freeMem(dataConstraint);	/* been cloned into wds */

maxOut = bigFileMaxOutput();

wds->setMaxOutput(wds, maxOut);

wds->setChromConstraint(wds, region->chrom);
wds->setPositionConstraint(wds, region->start, region->end);

if (table2)
    intersectBedList = bedTable2(conn, region, table2);

if (isCustom)
    {
    if (ct->dbTrack)
	{
	unsigned span = 0;
	struct sqlConnection *trashConn = hAllocConn(CUSTOM_TRASH);
	struct trackDb *tdb = findTdbForTable(database, curTrack, table, ctLookupName);
	valuesMatched = getWigglePossibleIntersection(wds, region,
	    CUSTOM_TRASH, table2, &intersectBedList,
		splitTableOrFileName, operations);
	span = minSpan(trashConn, splitTableOrFileName, region->chrom,
	    region->start, region->end, cart, tdb);
	wds->setSpanConstraint(wds, span);
	hFreeConn(&trashConn);
	}
    else
	valuesMatched = getWigglePossibleIntersection(wds, region, NULL, table2,
	    &intersectBedList, splitTableOrFileName, operations);
    }
else
    {
    if (conn == NULL)
	errAbort( "getWiggleAsBed: NULL conn given for database table");

    if (hFindSplitTable(database, region->chrom, table, splitTableOrFileName, sizeof splitTableOrFileName, NULL))
	{
	struct trackDb *tdb = findTdbForTable(database, curTrack, table, ctLookupName);
	unsigned span = 0;

	/* XXX TBD, watch for a span limit coming in as an SQL filter */
	span = minSpan(conn, splitTableOrFileName, region->chrom,
	    region->start, region->end, cart, tdb);
	wds->setSpanConstraint(wds, span);

	valuesMatched = getWigglePossibleIntersection(wds, region, database,
	    table2, &intersectBedList, splitTableOrFileName, operations);
	}
    }

if (valuesMatched > 0)
    {
    struct bed *bed;

    wds->sortResults(wds);
    for (bed = wds->bed; bed != NULL; bed = bed->next)
	{
	struct bed *copy = lmCloneBed(bed, lm);
	slAddHead(&bedList, copy);
	}
    slReverse(&bedList);
    }

wiggleDataStreamFree(&wds);

return bedList;
}	/*	struct bed *getWiggleAsBed()	*/
开发者ID:ucscGenomeBrowser,项目名称:kent,代码行数:97,代码来源:wiggle.c


示例15: freeMem

// ######################################################################
BitObject::BitObject()
{
  freeMem();
}
开发者ID:binary42,项目名称:avedac,代码行数:5,代码来源:BitObject.C


示例16: liftChain

void liftChain(char *destFile, struct hash *liftHash, 
        int sourceCount, char *sources[], boolean querySide)
/* Lift up coordinates in .chain file. */
{
FILE *f = mustOpen(destFile, "w");
int sourceIx;
int dotMod = dots;

for (sourceIx = 0; sourceIx < sourceCount; ++sourceIx)
    {
    char *source = sources[sourceIx];
    struct lineFile *lf = lineFileOpen(source, TRUE);
    struct chain *chain;
    lineFileSetMetaDataOutput(lf, f);
    verbose(1, "Lifting %s\n", source);
    while ((chain = chainRead(lf)) != NULL)
	{
	struct liftSpec *spec;
	char *seqName = querySide ? chain->qName : chain->tName;
	spec = findLift(liftHash, seqName, lf);
	if (spec == NULL)
	    {
	    if (how != carryMissing)
		{
		chainFree(&chain);
		continue;
		}
	    }
	else
	    {
	    struct cBlock *b = NULL;
	    int offset = spec->offset;
	    if (spec->strand == '-')
		{
		if (querySide)
		    {
		    int qSpan = chain->qEnd - chain->qStart;
		    if (chain->qStrand == '-')
		        chain->qStart += spec->offset;
		    else
		        {
			chain->qStart = spec->newSize - spec->offset 
				- (chain->qSize - chain->qStart);
			}
		    chain->qEnd = chain->qStart + qSpan;
		    chain->qStrand = flipStrand(chain->qStrand);
		    freeMem(chain->qName);
		    chain->qName = cloneString(spec->newName);
		    chain->qSize = spec->newSize;
		    /* We don't need to mess with the blocks here
		     * since they are all relative to the start. */
	            }
		else
		    {
		    /* We try and keep the target strand positive, so we end up
		     * flipping in both target and query and flipping the target
		     * strand. */
		    reverseIntRange(&chain->qStart, &chain->qEnd, chain->qSize);
		    reverseIntRange(&chain->tStart, &chain->tEnd, chain->tSize);
		    chain->qStrand = flipStrand(chain->qStrand);

		    /* Flip around blocks and add offset. */
		    for (b=chain->blockList;  b != NULL;  b=b->next)
			{
			reverseIntRange(&b->qStart, &b->qEnd, chain->qSize);
			reverseIntRange(&b->tStart, &b->tEnd, chain->tSize);
			b->tStart += offset;
			b->tEnd   += offset;
			}
		    slReverse(&chain->blockList);

		    /* On target side add offset as well and update name and size. */
		    chain->tStart += offset;
		    chain->tEnd   += offset;
		    freeMem(chain->tName);
		    chain->tName = cloneString(spec->newName);
		    chain->tSize = spec->newSize;
		    }
		}
	    else
		{
		if (querySide)
		    {
		    if (chain->qStrand == '-')
			offset = spec->newSize - (spec->offset + spec->oldSize);
		    freeMem(chain->qName);
		    chain->qName = cloneString(spec->newName);
		    chain->qSize = spec->newSize;
		    chain->qStart += offset;
		    chain->qEnd   += offset;
		    for (b=chain->blockList;  b != NULL;  b=b->next)
			{
			b->qStart += offset;
			b->qEnd   += offset;
			}
		    }
		else
		    {
		    freeMem(chain->tName);
		    chain->tName = cloneString(spec->newName);
//.........这里部分代码省略.........
开发者ID:CEpBrowser,项目名称:CEpBrowser--from-UCSC-CGI-BIN,代码行数:101,代码来源:liftUp.c


示例17: firstPass

void firstPass(char *aList, char *bList, char *outName)
/* Do first pass - find areas of homology between a and b,
 * save to outName. */
{
char *aNameBuf, **aNames;
char *bNameBuf, **bNames;
int aCount, bCount;
struct nt4Seq **bNts, *bNt, *bNtList = NULL;
int bNtCount;
int i;
FILE *out = mustOpen(outName, "w");

/* Read in fa file lists . */
readAllWordsOrFa(aList, &aNames, &aCount, &aNameBuf);
readAllWordsOrFa(bList, &bNames, &bCount, &bNameBuf);

/* Convert second list to nt4 (packed) format in memory. */
printf("Loading and packing dna in %s\n", bList);
for (i=0; i<bCount; ++i)
    {
    char *bName = bNames[i];
    struct dnaSeq *seqList, *seq;

    seqList = faReadAllDna(bName);
    for (seq = seqList; seq != NULL; seq = seq->next)
	{
	char uniqName[512];
	sprintf(uniqName, "%[email protected]%s", seq->name, bName);
	bNt = newNt4(seq->dna, seq->size, uniqName);
	slAddHead(&bNtList, bNt);
	}
    freeDnaSeqList(&seqList);
    }
slReverse(&bNtList);
bNtCount = slCount(bNtList);
AllocArray(bNts, bNtCount);
for (i=0, bNt=bNtList; i<bNtCount; ++i, bNt=bNt->next)
    bNts[i] = bNt;
printf("Loaded %d contigs from %d files\n", bNtCount, bCount);

/* Align elements of A list one at a time against B list. */
for (i=0; i<aCount; ++i)
    {
    char *aName = aNames[i];
    struct dnaSeq *seqList, *seq;

    printf("Aligning %s against %s\n", aName, bList);
    seqList = faReadAllDna(aName);
    for (seq = seqList; seq != NULL; seq = seq->next)
	{
	doCrude(aName, seq, bNts, bNtCount, out);
	}
    printf("\n");
    freeDnaSeqList(&seqList);
    }


/* Cleanup time. */
for (i=0; i<bNtCount; ++i)
    freeNt4(&bNts[i]);
freeMem(bNts);
freeMem(aNames);
freeMem(bNames);
freeMem(aNameBuf);
freeMem(bNameBuf);
fclose(out);
}
开发者ID:davidhoover,项目名称:kent,代码行数:67,代码来源:waba.c


示例18: freeMem

AcadoIntegratorInternal::~AcadoIntegratorInternal(){
  freeMem();
}
开发者ID:Snkrnryn,项目名称:casadi,代码行数:3,代码来源:acado_integrator_internal.cpp


示例19: blatSeq

void blatSeq(char *userSeq, char *organism)
/* Blat sequence user pasted in. */
{
FILE *f;
struct dnaSeq *seqList = NULL, *seq;
struct tempName pslTn, faTn;
int maxSingleSize, maxTotalSize, maxSeqCount;
int minSingleSize = minMatchShown;
char *genome, *db;
char *type = cgiString("type");
char *seqLetters = cloneString(userSeq);
struct serverTable *serve;
int conn;
int oneSize, totalSize = 0, seqCount = 0;
boolean isTx = FALSE;
boolean isTxTx = FALSE;
boolean txTxBoth = FALSE;
struct gfOutput *gvo;
boolean qIsProt = FALSE;
enum gfType qType, tType;
struct hash *tFileCache = gfFileCacheNew();
boolean feelingLucky = cgiBoolean("Lucky");

getDbAndGenome(cart, &db, &genome, oldVars);
if(!feelingLucky)
    cartWebStart(cart, db, "%s BLAT Results",  trackHubSkipHubName(organism));
/* Load user sequence and figure out if it is DNA or protein. */
if (sameWord(type, "DNA"))
    {
    seqList = faSe 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ freeMemory函数代码示例发布时间:2022-05-30
下一篇:
C++ freeMatrix函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap