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

C++ AllocArray函数代码示例

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

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



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

示例1: AllocVar

struct sample *groupByPosition(int grouping , struct sample *sampList)
{
struct sample *groupedList = NULL, *samp = NULL, *currSamp = NULL, *sampNext=NULL;
int count = 0;
for(samp = sampList; samp != NULL; samp = sampNext)
    {
    sampNext = samp->next;
    AllocVar(currSamp);
    currSamp->chrom = cloneString(samp->chrom);
    currSamp->chromStart = samp->chromStart;
    currSamp->name = cloneString(samp->name);
    snprintf(currSamp->strand, sizeof(currSamp->strand), "%s", samp->strand);
    AllocArray(currSamp->samplePosition, grouping);
    AllocArray(currSamp->sampleHeight, grouping);
    count = 0;
    while(samp != NULL && count < grouping && sameString(samp->chrom,currSamp->chrom))
	{
	addSampleToCurrent(currSamp, samp, grouping);
	count += samp->sampleCount;
	samp = sampNext = samp->next;
	}
    if(count != 0)
	currSamp->score = currSamp->score / count;
    currSamp->chromEnd = currSamp->chromStart + currSamp->samplePosition[count -1];
    slAddHead(&groupedList, currSamp);
    }
slReverse(&groupedList);
return groupedList;
}
开发者ID:bowhan,项目名称:kent,代码行数:29,代码来源:affyPairsToSample.c


示例2: AllocVar

struct cdsEvidence *createCds(struct dnaSeq *seq, int start, int end,
	int *upAtgCount, int *upKozakCount, int lastIntronPos,
	struct orthoCdsArray *orthoList, double orthoWeightPer)
/* Return new cdsEvidence on given sequence at given position. */
{
struct cdsEvidence *orf;
AllocVar(orf);
int size = end - start;
size -= size % 3;
end = start + size;
orf->name = cloneString(seq->name);
orf->start = start;
orf->end = end;
orf->source = cloneString("txCdsPredict");
orf->accession = cloneString(".");
orf->score = orfScore(orf, seq, upAtgCount, upKozakCount, lastIntronPos,
	orthoList, orthoWeightPer);
orf->startComplete = startsWith("atg", seq->dna + start);
orf->endComplete = isStopCodon(seq->dna + end - 3);
orf->cdsCount = 1;
AllocArray(orf->cdsStarts, 1);
orf->cdsStarts[0] = start;
AllocArray(orf->cdsSizes, 1);
orf->cdsSizes[0] = size;
return orf;
}
开发者ID:elmargb,项目名称:kentUtils,代码行数:26,代码来源:txCdsPredict.c


示例3: initTitleHelper

void initTitleHelper(struct titleHelper *th, char *track, int startIx, int centerIx, int endIx,
		     int nRecords, struct vcfFile *vcff)
/* Set up info including arrays of ref & alt alleles for cluster mouseover. */
{
th->track = track;
th->startIx = startIx;
th->centerIx = centerIx;
th->endIx = endIx;
th->nRecords = nRecords;
int len = endIx - startIx;
AllocArray(th->refs, len);
AllocArray(th->alts, len);
struct vcfRecord *rec;
int i;
for (rec = vcff->records, i = 0;  rec != NULL && i < endIx;  rec = rec->next, i++)
    {
    if (i < startIx)
	continue;
    char refAl[16];
    abbrevAndHandleRC(refAl, sizeof(refAl), rec->alleles[0]);
    th->refs[i-startIx] = vcfFilePooledStr(vcff, refAl);
    char altAl1[16];
    abbrevAndHandleRC(altAl1, sizeof(altAl1), rec->alleles[1]);
    tolowers(altAl1);
    th->alts[i-startIx] = vcfFilePooledStr(vcff, altAl1);
    }
}
开发者ID:maximilianh,项目名称:kent,代码行数:27,代码来源:vcfTrack.c


示例4: contigFromAffyPairName

struct sample *sampFromAffyPair(struct affyPairs *ap, struct hash *liftHash)
/* Use the data in the affy pair and the offset info in the hash to make a
   sample data type. */
{
struct sample *samp = NULL;
struct liftSpec *lf = NULL;
char *name = contigFromAffyPairName(ap->probeSet);
float score = 0;
if(name != NULL)
    {
    lf = hashFindVal(liftHash, name);
    freez(&name);
    }
if(lf != NULL)
    {
    AllocVar(samp);
    samp->chrom = cloneString(lf->newName);
    samp->chromStart = samp->chromEnd = ap->pos + lf->offset;
    samp->name = cloneString("a");
    score = (ap->pm) - (ap->mm);
    if(score < 1)
	score = 1;
    samp->score = (int)score;
    sprintf(samp->strand, "+");
    samp->sampleCount = 1;
    AllocArray(samp->samplePosition, samp->sampleCount);
    samp->samplePosition[0] = 0;
    AllocArray(samp->sampleHeight, samp->sampleCount);
    samp->sampleHeight[0] = samp->score;
    }
return samp;
}
开发者ID:bowhan,项目名称:kent,代码行数:32,代码来源:affyPairsToSample.c


示例5: AllocVar

struct sample *avgSamples(struct sample *s1,
			  struct sample *s2,
			  struct sample *s3,
			  int expIndex, int index)
{
struct sample *ret = NULL; //, *s1, *s2, *s3;
int i;
/* s1 = (struct sample *)slElementFromIx(sList1, index); */
/* s2 = (struct sample *)slElementFromIx(sList2, index); */
/* s3 = (struct sample *)slElementFromIx(sList3, index); */
AllocVar(ret);
ret->chrom = cloneString(s1->chrom);
ret->chromStart = s1->chromStart;
ret->chromEnd = s1->chromEnd;
ret->name = getNameForExp(expIndex);
snprintf(ret->strand, sizeof(ret->strand), "%s", s1->strand);
ret->sampleCount = s1->sampleCount;
AllocArray(ret->samplePosition, ret->sampleCount);
AllocArray(ret->sampleHeight, ret->sampleCount);
ret->score = (s1->score + s2->score + s3->score)/3;
for(i=0;i<ret->sampleCount; i++)
    {
    ret->samplePosition[i] = s1->samplePosition[i];
    if(!((s1->samplePosition[i] == s2->samplePosition[i]) && (s2->samplePosition[i] == s3->samplePosition[i])))
	errAbort("avgTranscriptomeExps::avgSamples() - for probe %s:%d-%d positions at index %i don't agree. %d, %d, %d", 
		 ret->chrom, ret->chromStart, ret->chromEnd, i, s1->samplePosition[i], s2->samplePosition[i], s3->samplePosition[i]);
    ret->sampleHeight[i] = (s1->sampleHeight[i] + s2->sampleHeight[i] + s3->sampleHeight[i])/3;
    }
return ret;
}
开发者ID:bowhan,项目名称:kent,代码行数:30,代码来源:avgTranscriptomeExps.c


示例6: AllocVar

struct snp125CodingCoordless *snp125CodingCoordlessCommaIn(char **pS, struct snp125CodingCoordless *ret)
/* Create a snp125CodingCoordless out of a comma separated string. 
 * This will fill in ret if non-null, otherwise will
 * return a new snp125CodingCoordless */
{
char *s = *pS;

if (ret == NULL)
    AllocVar(ret);
ret->name = sqlStringComma(&s);
ret->transcript = sqlStringComma(&s);
ret->frame = sqlEnumComma(&s, values_frame, &valhash_frame);
ret->alleleCount = sqlSignedComma(&s);
{
int i;
s = sqlEatChar(s, '{');
AllocArray(ret->funcCodes, ret->alleleCount);
for (i=0; i<ret->alleleCount; ++i)
    {
    ret->funcCodes[i] = sqlUnsignedComma(&s);
    }
s = sqlEatChar(s, '}');
s = sqlEatChar(s, ',');
}
{
int i;
s = sqlEatChar(s, '{');
AllocArray(ret->alleles, ret->alleleCount);
for (i=0; i<ret->alleleCount; ++i)
    {
    ret->alleles[i] = sqlStringComma(&s);
    }
s = sqlEatChar(s, '}');
s = sqlEatChar(s, ',');
}
{
int i;
s = sqlEatChar(s, '{');
AllocArray(ret->codons, ret->alleleCount);
for (i=0; i<ret->alleleCount; ++i)
    {
    ret->codons[i] = sqlStringComma(&s);
    }
s = sqlEatChar(s, '}');
s = sqlEatChar(s, ',');
}
{
int i;
s = sqlEatChar(s, '{');
AllocArray(ret->peptides, ret->alleleCount);
for (i=0; i<ret->alleleCount; ++i)
    {
    ret->peptides[i] = sqlStringComma(&s);
    }
s = sqlEatChar(s, '}');
s = sqlEatChar(s, ',');
}
*pS = s;
return ret;
}
开发者ID:CEpBrowser,项目名称:CEpBrowser--from-UCSC-CGI-BIN,代码行数:60,代码来源:snp125CodingCoordless.c


示例7: AllocVar

struct bed *bedForIv(struct intronEv *iv)
/** Make a bed to represent a intronEv structure. */
{
struct bed *bed = NULL;
AllocVar(bed);
bed->chrom = cloneString(iv->chrom);
bed->chromStart = bed->thickStart = iv->e1S;
bed->chromEnd = bed->thickEnd = iv->e2E;
bed->name = cloneString(iv->ev->orthoBed->name);
if(iv->orientation == 1)
    safef(bed->strand, sizeof(bed->strand), "+");
else if(iv->orientation == -1)
    safef(bed->strand, sizeof(bed->strand), "-");
else 
    safef(bed->strand, sizeof(bed->strand), "%s", iv->ev->orthoBed->strand);
bed->blockCount = 2;
AllocArray(bed->chromStarts, 2);
bed->chromStarts[0] = iv->e1S - bed->chromStart;
bed->chromStarts[1] = iv->e2S - bed->chromStart;
AllocArray(bed->blockSizes, 2);
bed->blockSizes[0] = iv->e1E - iv->e1S;
bed->blockSizes[1] = iv->e2E - iv->e2S;
bed->score = scoreForIntronEv(iv);
return bed;
}
开发者ID:CEpBrowser,项目名称:CEpBrowser--from-UCSC-CGI-BIN,代码行数:25,代码来源:orthoPickIntron.c


示例8: bitmapToMaskArray

void bitmapToMaskArray(struct hash *bitmapHash, struct hash *tbHash)
/* Translate each bitmap in bitmapHash into an array of mask coordinates
 * in the corresponding twoBit in tbHash.  Assume tbHash's mask array is
 * empty at the start -- we allocate it here.  Free bitmap when done. */
{
    struct hashCookie cookie = hashFirst(tbHash);
    struct hashEl *hel = NULL;

    while ((hel = hashNext(&cookie)) != NULL)
    {
        char *seqName = hel->name;
        struct twoBit *tb = (struct twoBit *)(hel->val);
        struct hashEl *bHel = hashLookup(bitmapHash, seqName);
        Bits *bits;
        unsigned start=0, end=0;

        assert(tb != NULL);
        assert(tb->maskBlockCount == 0);
        if (bHel == NULL)
            errAbort("Missing bitmap for seq \"%s\"", seqName);
        bits = (Bits *)bHel->val;
        if (bits != NULL)
        {
            struct lm *lm = lmInit(0);
            struct unsignedRange *rangeList = NULL, *range = NULL;
            int i;
            for (;;)
            {
                start = bitFindSet(bits, end, tb->size);
                if (start >= tb->size)
                    break;
                end = bitFindClear(bits, start, tb->size);
                if (end > start)
                {
                    lmAllocVar(lm, range);
                    range->start = start;
                    range->size = (end - start);
                    slAddHead(&rangeList, range);
                }
            }
            slReverse(&rangeList);
            tb->maskBlockCount = slCount(rangeList);
            if (tb->maskBlockCount > 0)
            {
                AllocArray(tb->maskStarts, tb->maskBlockCount);
                AllocArray(tb->maskSizes, tb->maskBlockCount);
                for (i = 0, range = rangeList;  range != NULL;
                        i++, range = range->next)
                {
                    tb->maskStarts[i] = range->start;
                    tb->maskSizes[i] = range->size;
                }
            }
            lmCleanup(&lm);
            bitFree(&bits);
            bHel->val = NULL;
        }
    }
}
开发者ID:ucsc-mus-strain-cactus,项目名称:kent,代码行数:59,代码来源:twoBitMask.c


示例9: dbFindFieldsWith

void dbFindFieldsWith(char *database, char *regExp, char *output)
/* dbFindFieldsWith - Look through database and find fields that have elements matching a certain pattern in the first N rows.. */
{
regex_t re;
int err = regcomp(&re, regExp, REG_NOSUB|REG_EXTENDED);
if (err < 0)
   errAbort("regcomp failed code %d", err);
struct sqlConnection *conn = sqlConnect(database);
struct slName *table, *tableList = sqlQuickList(conn, "NOSQLINJ show tables");
FILE *f = mustOpen(output, "w");
for (table = tableList; table != NULL; table = table->next)
    {
    char query[256];
    sqlSafef(query, sizeof(query), "select * from %s limit %d", table->name, maxRows);
    verbose(2, "%s.%s\n", database, table->name);
    struct sqlResult *sr = sqlGetResult(conn, query);
    if (sr != NULL)
	{
	int colCount = sqlCountColumns(sr);

	/* Get labels for columns */
	char **labels;
	AllocArray(labels, colCount);
	int i;
	for (i=0; i<colCount; ++i)
	    labels[i] = sqlFieldName(sr);

	/* Get flags that say which fields we've reported. */
	bool *flags;
	AllocArray(flags, colCount);
	char **row;
	while ((row = sqlNextRow(sr)) != NULL)
	    {
	    int i;
	    for (i=0; i<colCount; ++i)
	         {
		 char *field = row[i];
		 if (field != NULL && field[0] != 0)
		     {
		     if (regexec(&re, row[i], 0, NULL, 0) == 0)
			 {
			 if (!flags[i])
			     {
			     flags[i] = TRUE;
			     fprintf(f, "%s\t%s\t%s\n", table->name, labels[i], row[i]);
			     }
			 }
		     }
		 }
	    }
	sqlFreeResult(&sr);
	freez(&flags);
	freez(&labels);
	}
    }
carefulClose(&f);
}
开发者ID:blumroy,项目名称:kentUtils,代码行数:57,代码来源:dbFindFieldsWith.c


示例10: AllocVar

struct cutter *cutterCommaIn(char **pS, struct cutter *ret)
/* Create a cutter out of a comma separated string. 
 * This will fill in ret if non-null, otherwise will
 * return a new cutter */
{
char *s = *pS;

if (ret == NULL)
    AllocVar(ret);
ret->name = sqlStringComma(&s);
ret->size = sqlUnsignedComma(&s);
ret->matchSize = sqlUnsignedComma(&s);
ret->seq = sqlStringComma(&s);
ret->cut = sqlUnsignedComma(&s);
ret->overhang = sqlSignedComma(&s);
ret->palindromic = sqlUnsignedComma(&s);
ret->semicolon = sqlUnsignedComma(&s);
ret->numSciz = sqlUnsignedComma(&s);
{
int i;
s = sqlEatChar(s, '{');
AllocArray(ret->scizs, ret->numSciz);
for (i=0; i<ret->numSciz; ++i)
    {
    ret->scizs[i] = sqlStringComma(&s);
    }
s = sqlEatChar(s, '}');
s = sqlEatChar(s, ',');
}
ret->numCompanies = sqlUnsignedComma(&s);
{
int i;
s = sqlEatChar(s, '{');
AllocArray(ret->companies, ret->numCompanies);
for (i=0; i<ret->numCompanies; ++i)
    {
    ret->companies[i] = sqlCharComma(&s);
    }
s = sqlEatChar(s, '}');
s = sqlEatChar(s, ',');
}
ret->numRefs = sqlUnsignedComma(&s);
{
int i;
s = sqlEatChar(s, '{');
AllocArray(ret->refs, ret->numRefs);
for (i=0; i<ret->numRefs; ++i)
    {
    ret->refs[i] = sqlUnsignedComma(&s);
    }
s = sqlEatChar(s, '}');
s = sqlEatChar(s, ',');
}
*pS = s;
return ret;
}
开发者ID:CEpBrowser,项目名称:CEpBrowser--from-UCSC-CGI-BIN,代码行数:56,代码来源:cutter.c


示例11: avgTranscriptomeExps

void avgTranscriptomeExps()
{
struct sample *s = NULL;
struct sample *s1,*s2,*s3;
struct sample *sList1, *sList2, *sList3 = NULL;
struct sample **sArray1, **sArray2, **sArray3 = NULL;
int i,j,k;
FILE *out = NULL;
for(i=1; i<12; i++)
    {
    for(j='a'; j<'d'; j++)
	{
	char buff[2048];
	int count;
	struct sample *avgList = NULL, *avg;
	if((i != 6 || j != 'a') || doAll)
	    {
	    snprintf(buff, sizeof(buff), "%d.%c.1.%s", i,j,suffix);
	    printf("Averaging %s\n", buff);
	    sList1 = sampleLoadAll(buff);
	    snprintf(buff, sizeof(buff), "%d.%c.2.%s", i,j,suffix);
	    sList2 = sampleLoadAll(buff);
	    snprintf(buff, sizeof(buff), "%d.%c.3.%s", i,j,suffix);
	    sList3 = sampleLoadAll(buff);
	    count = slCount(sList1);
	    AllocArray(sArray1,count);
	    AllocArray(sArray2,count);
	    AllocArray(sArray3,count);
	    for(k=0, s1=sList1, s2=sList2, s3=sList3; k<count; s1=s1->next,s2=s2->next,s3=s3->next, k++)
		{
		sArray1[k] = s1;
		sArray2[k] = s2;
		sArray3[k] = s3;
		}
	    for(k=0;k<count; k++)
		{
		avg = avgSamples(sArray1[k], sArray2[k], sArray3[k], i, k);
		slAddHead(&avgList, avg);
		}
	    slReverse(&avgList);
	    snprintf(buff, sizeof(buff), "%d.%c.1.%s.avg", i,j,suffix);
	    out = mustOpen(buff, "w");
	    for(s = avgList; s != NULL; s = s->next)
		sampleTabOut(s, out);
	    carefulClose(&out);
	    freez(&sArray1);
	    freez(&sArray2);
	    freez(&sArray3);
	    sampleFreeList(&avgList);
	    sampleFreeList(&sList1);
	    sampleFreeList(&sList2);
	    sampleFreeList(&sList3);
	    }
	}
    }
}
开发者ID:bowhan,项目名称:kent,代码行数:56,代码来源:avgTranscriptomeExps.c


示例12: AllocVar

struct hgTranscript *hgTranscriptCommaIn(char **pS)
/* Create a hgTranscript out of a comma separated string. */
{
struct hgTranscript *ret;
char *s = *pS;
int i;

AllocVar(ret);
ret->id = sqlUnsignedComma(&s);
ret->name = sqlStringComma(&s);
ret->hgGene = sqlUnsignedComma(&s);
ret->startBac = sqlUnsignedComma(&s);
ret->startPos = sqlUnsignedComma(&s);
ret->endBac = sqlUnsignedComma(&s);
ret->endPos = sqlUnsignedComma(&s);
ret->cdsStartBac = sqlUnsignedComma(&s);
ret->cdsStartPos = sqlUnsignedComma(&s);
ret->cdsEndBac = sqlUnsignedComma(&s);
ret->cdsEndPos = sqlUnsignedComma(&s);
ret->orientation = sqlSignedComma(&s);
ret->exonCount = sqlUnsignedComma(&s);
s = sqlEatChar(s, '{');
AllocArray(ret->exonStartBacs, ret->exonCount);
for (i=0; i<ret->exonCount; ++i)
    {
    ret->exonStartBacs[i] = sqlUnsignedComma(&s);
    }
s = sqlEatChar(s, '}');
s = sqlEatChar(s, ',');
s = sqlEatChar(s, '{');
AllocArray(ret->exonStartPos, ret->exonCount);
for (i=0; i<ret->exonCount; ++i)
    {
    ret->exonStartPos[i] = sqlUnsignedComma(&s);
    }
s = sqlEatChar(s, '}');
s = sqlEatChar(s, ',');
s = sqlEatChar(s, '{');
AllocArray(ret->exonEndBacs, ret->exonCount);
for (i=0; i<ret->exonCount; ++i)
    {
    ret->exonEndBacs[i] = sqlUnsignedComma(&s);
    }
s = sqlEatChar(s, '}');
s = sqlEatChar(s, ',');
s = sqlEatChar(s, '{');
AllocArray(ret->exonEndPos, ret->exonCount);
for (i=0; i<ret->exonCount; ++i)
    {
    ret->exonEndPos[i] = sqlUnsignedComma(&s);
    }
s = sqlEatChar(s, '}');
s = sqlEatChar(s, ',');
*pS = s;
return ret;
}
开发者ID:CEpBrowser,项目名称:CEpBrowser--from-UCSC-CGI-BIN,代码行数:56,代码来源:hgGene.c


示例13: AllocVar

struct pslWQueryID *pslWQueryIDCommaIn(char **pS, struct pslWQueryID *ret)
/* Create a pslWQueryID out of a comma separated string. 
 * This will fill in ret if non-null, otherwise will
 * return a new pslWQueryID */
{
char *s = *pS;
int i;

if (ret == NULL)
    AllocVar(ret);
ret->matches = sqlUnsignedComma(&s);
ret->misMatches = sqlUnsignedComma(&s);
ret->repMatches = sqlUnsignedComma(&s);
ret->nCount = sqlUnsignedComma(&s);
ret->qNumInsert = sqlUnsignedComma(&s);
ret->qBaseInsert = sqlUnsignedComma(&s);
ret->tNumInsert = sqlUnsignedComma(&s);
ret->tBaseInsert = sqlUnsignedComma(&s);
sqlFixedStringComma(&s, ret->strand, sizeof(ret->strand));
ret->qName = sqlStringComma(&s);
ret->qSize = sqlUnsignedComma(&s);
ret->qStart = sqlUnsignedComma(&s);
ret->qEnd = sqlUnsignedComma(&s);
ret->tName = sqlStringComma(&s);
ret->tSize = sqlUnsignedComma(&s);
ret->tStart = sqlUnsignedComma(&s);
ret->tEnd = sqlUnsignedComma(&s);
ret->blockCount = sqlUnsignedComma(&s);
s = sqlEatChar(s, '{');
AllocArray(ret->blockSizes, ret->blockCount);
for (i=0; i<ret->blockCount; ++i)
    {
    ret->blockSizes[i] = sqlUnsignedComma(&s);
    }
s = sqlEatChar(s, '}');
s = sqlEatChar(s, ',');
s = sqlEatChar(s, '{');
AllocArray(ret->qStarts, ret->blockCount);
for (i=0; i<ret->blockCount; ++i)
    {
    ret->qStarts[i] = sqlUnsignedComma(&s);
    }
s = sqlEatChar(s, '}');
s = sqlEatChar(s, ',');
s = sqlEatChar(s, '{');
AllocArray(ret->tStarts, ret->blockCount);
for (i=0; i<ret->blockCount; ++i)
    {
    ret->tStarts[i] = sqlUnsignedComma(&s);
    }
s = sqlEatChar(s, '}');
s = sqlEatChar(s, ',');
ret->queryID = sqlStringComma(&s);
*pS = s;
return ret;
}
开发者ID:elmargb,项目名称:kentUtils,代码行数:56,代码来源:pslWQueryID.c


示例14: AllocVar

struct altProbe *altProbeCommaIn(char **pS, struct altProbe *ret)
/* Create a altProbe out of a comma separated string. 
 * This will fill in ret if non-null, otherwise will
 * return a new altProbe */
{
char *s = *pS;
int i;

if (ret == NULL)
    AllocVar(ret);
ret->chrom = sqlStringComma(&s);
ret->chromStart = sqlSignedComma(&s);
ret->chromEnd = sqlSignedComma(&s);
ret->type = sqlSignedComma(&s);
sqlFixedStringComma(&s, ret->strand, sizeof(ret->strand));
ret->name = sqlStringComma(&s);
ret->maxCounts = sqlSignedComma(&s);
ret->contProbeCount = sqlSignedComma(&s);
s = sqlEatChar(s, '{');
AllocArray(ret->contProbeSets, ret->contProbeCount);
for (i=0; i<ret->contProbeCount; ++i)
    {
    ret->contProbeSets[i] = sqlStringComma(&s);
    }
s = sqlEatChar(s, '}');
s = sqlEatChar(s, ',');
ret->alt1ProbeCount = sqlSignedComma(&s);
s = sqlEatChar(s, '{');
AllocArray(ret->alt1ProbeSets, ret->alt1ProbeCount);
for (i=0; i<ret->alt1ProbeCount; ++i)
    {
    ret->alt1ProbeSets[i] = sqlStringComma(&s);
    }
s = sqlEatChar(s, '}');
s = sqlEatChar(s, ',');
ret->alt2ProbeCount = sqlSignedComma(&s);
s = sqlEatChar(s, '{');
AllocArray(ret->alt2ProbeSets, ret->alt2ProbeCount);
for (i=0; i<ret->alt2ProbeCount; ++i)
    {
    ret->alt2ProbeSets[i] = sqlStringComma(&s);
    }
s = sqlEatChar(s, '}');
s = sqlEatChar(s, ',');
ret->transcriptCount = sqlSignedComma(&s);
s = sqlEatChar(s, '{');
AllocArray(ret->transcriptNames, ret->transcriptCount);
for (i=0; i<ret->transcriptCount; ++i)
    {
    ret->transcriptNames[i] = sqlStringComma(&s);
    }
s = sqlEatChar(s, '}');
s = sqlEatChar(s, ',');
*pS = s;
return ret;
}
开发者ID:apmagalhaes,项目名称:kentUtils,代码行数:56,代码来源:altProbe.c


示例15: fillInGene

void fillInGene(struct chain *chain, struct genePred *gene, struct genePred **pGene)
/** Fill in syntenic gene structure with initial information for gene. */
{
FILE *cdsErrorFp;
struct genePred *synGene = NULL;
int qs, qe;
struct chain *subChain=NULL, *toFree=NULL;
AllocVar(synGene);
chainSubSetForRegion(chain, gene->txStart, gene->txEnd , &subChain, &toFree);    
if(subChain == NULL)
    {
    *pGene= NULL;
    return;
    }
qChainRangePlusStrand(subChain, &qs, &qe);
synGene->chrom = cloneString(subChain->qName);
synGene->name = cloneString(gene->name);
synGene->txStart = qs;
synGene->txEnd = qe;
AllocArray(synGene->exonStarts, gene->exonCount);
AllocArray(synGene->exonEnds, gene->exonCount);
if(chain->qStrand == '+')
    strncpy(synGene->strand,  gene->strand, sizeof(synGene->strand));
else
    {
    if(gene->strand[0] == '+')
	strncpy(synGene->strand,  "-", sizeof(synGene->strand));
    else if(gene->strand[0] == '-')
	strncpy(synGene->strand,  "+", sizeof(synGene->strand));
    else
	errAbort("Don't recognize strand %s from gene %s", gene->strand, gene->name);
    }
chainFree(&toFree);
chainSubSetForRegion(chain, gene->cdsStart, gene->cdsEnd , &subChain, &toFree);    
if(subChain == NULL )
    {
    if(optionExists("cdsErrorFile"))
        {
        cdsErrorFp = fopen( optionVal("cdsErrorFile",NULL), "a" );
        fprintf( cdsErrorFp, "%s\t%s\t%u\t%u\t%u\t%u\t%s\t%d\n", gene->name, gene->chrom, gene->txStart, 
		 gene->txEnd, gene->cdsStart, gene->cdsEnd, gene->strand, gene->exonCount );
        fclose(cdsErrorFp);
        }
    *pGene = NULL;
    genePredFree(&synGene); 
    return;
    }
qChainRangePlusStrand(subChain, &qs, &qe);
synGene->cdsStart = qs;
synGene->cdsEnd = qe;
chainFree(&toFree);
*pGene = synGene;
}
开发者ID:ucscGenomeBrowser,项目名称:kent,代码行数:53,代码来源:orthoMap.c


示例16: cloneString

/*	Return is an array of integers, last one of value zero to indicate the
 *	end of the array.  In case of nothing found in trackDb, return
 *	a NULL pointer indicating no results. 
 *
 *      If the value is 'first' then use the first span value from the table.
 *      Assumes that all values in the table are the same. */
int *wiggleSpanList(struct sqlConnection *conn, struct trackDb *tdb)
{
char *tdbDefault = cloneString(trackDbSettingOrDefault(tdb, SPANLIST, "NONE"));
int *ret = (int *)NULL;


if (sameWord("NONE",tdbDefault))
    {
    struct hashEl *hel;
    /*	if not found in trackDb, maybe it is in tdb->settings
     *	(custom tracks keep settings here)
     */
    if ((tdb->settings != (char *)NULL) &&
	(tdb->settingsHash != (struct hash *)NULL))
	{
	if ((hel = hashLookup(tdb->settingsHash, SPANLIST)) != NULL)
	    {
	    freeMem(tdbDefault);
	    tdbDefault = cloneString((char *)hel->val);
	    }
	}
    }
/* if we still don't have a spanList, or we got "first" for spanList,
 * make up spanList by choosing the first span we find in the table */
//if (sameWord("NONE",tdbDefault) || sameWord("first",tdbDefault))
else if( sameWord("first",tdbDefault))
    {
    char query[1024];
    snprintf(query, sizeof(query), "SELECT span FROM %s limit 1", tdb->table );
    char *tmpSpan = sqlQuickString(conn, query);
    AllocArray(ret,2);
    ret[0] = sqlUnsigned(tmpSpan);
    ret[1] = 0;
    freeMem(tmpSpan);
    }
else 
    {
    /*	If something found, let's parse it	*/
    int i;
    char *words[MAX_SPAN_COUNT];
    int wc;
    wc = chopCommas(tdbDefault,words);
    AllocArray(ret,wc+1);	/*	+ 1 for the extra zero	*/
    for ( i = 0; i < wc; ++i )
	ret[i] = sqlUnsigned(words[i]);
    intSort(wc,ret);
    ret[wc] = 0;	/*	end of list	*/
    }

freeMem(tdbDefault);
return(ret);
}	/*	int *wiggleSpanList(struct trackDb *tdb)	*/
开发者ID:CEpBrowser,项目名称:CEpBrowser--from-UCSC-CGI-BIN,代码行数:58,代码来源:wiggleUtils.c


示例17: output_cluster_matrix_long

void output_cluster_matrix_long(struct cluster_bed_matrix *cbm, struct slName *labels, boolean keep_bed, char *outputfile, boolean header)
/* For handling long-form cluster output */
{
    FILE *out = mustOpen(outputfile, "w");
    int i, j, l;
    char **labels_array;
    int *subpos_array;
    int *cluster_row_array;
    int num_labels = slCount(labels);
    int num_subpos = cbm->pbm->ncol / num_labels;
    struct slName *label;
    AllocArray(labels_array, cbm->pbm->ncol);
    AllocArray(subpos_array, cbm->pbm->ncol);
    i = 0;
    for (label = labels; label != NULL; label = label->next)
	for (j = 0; j < num_subpos; j++)
	{
	    labels_array[i] = label->name;
	    subpos_array[i] = j+1;
	    i++;
	}
    AllocArray(cluster_row_array, cbm->pbm->nrow - cbm->num_na);
    i = 0;
    for (j = 0; j < cbm->k; j++)
	for (l = 0; l < cbm->cluster_sizes[j]; l++)
	    cluster_row_array[i++] = l+1;
    if (header)
    {
	if (keep_bed)
	    fprintf(out, "chrom\tchromStart\tchromEnd\tname\tscore\tstrand\t");
	fprintf(out, "Row\tCluster_Name\tCluster_Row\tCentroid_Distance\tLabel_Subpos\tLabel\tSubpos\tColumn\tData\n");
    }
    for (i = cbm->num_na; i < cbm->pbm->nrow; i++)
    {
	struct perBaseWig *pbw = cbm->pbm->array[i];
	for (j = 0; j < cbm->pbm->ncol; j++)
	{
	    if (keep_bed)
		fprintf(out, "%s\t%d\t%d\t%s\t%d\t%c\t", pbw->chrom, pbw->chromStart, pbw->chromEnd, pbw->name, pbw->score, pbw->strand[0]);
	    fprintf(out, "%d\t", i - cbm->num_na + 1);
	    fprintf(out, "Cluster_%d\t", pbw->label + 1);
	    fprintf(out, "%d\t", cluster_row_array[i-cbm->num_na]);
	    fprintf(out, "%f\t", pbw->cent_distance);
	    fprintf(out, "%s_%d\t%s\t%d\t", labels_array[j], subpos_array[j], labels_array[j], subpos_array[j]);
	    fprintf(out, "%d\t", j+1);
	    fprintf(out, "%f\n", cbm->pbm->matrix[i][j]);
	}
    }
    freeMem(labels_array);
    freeMem(subpos_array);
    carefulClose(&out);
}
开发者ID:CRG-Barcelona,项目名称:bwtool,代码行数:52,代码来源:matrix.c


示例18: hAllocConn

struct dMatrix *dataFromTable(char *tableName, char *query)
/* Read data from table name with rowname. */
{
struct sqlConnection *conn = hAllocConn();
struct slName *colNames = sqlListFields(conn, tableName);
struct slName *name = NULL;
int count = 0;
struct dMatrix *dM = NULL;
struct sqlResult *sr = NULL;
char **row = NULL;
int colIx = 0;


/* Allocate some initial memory. */
AllocVar(dM);
dM->colCount = slCount(colNames) -1;
dM->rowCount = 1;
AllocArray(dM->matrix, dM->rowCount);
AllocArray(dM->rowNames, dM->rowCount);
AllocArray(dM->matrix[0], dM->colCount);
AllocArray(dM->colNames, dM->colCount);
for(name = colNames->next; name != NULL; name = name->next)
    dM->colNames[count++] = cloneString(name->name);

/* Execute our query. */
sr = sqlGetResult(conn, query);
count = 0;

/* Read out the data. */
while((row = sqlNextRow(sr)) != NULL)
    {
    /* Expand matrix data as necessary. */
    if(count > 0)
	{
	ExpandArray(dM->matrix, dM->rowCount, dM->rowCount+1);
	AllocArray(dM->matrix[dM->rowCount], dM->colCount);
	ExpandArray(dM->rowNames, dM->rowCount, dM->rowCount+1);
	dM->rowCount++;
	}
    dM->rowNames[count] = cloneString(row[0]);
    for(colIx = 0; colIx < dM->colCount; colIx++) 
	dM->matrix[count][colIx] = atof(row[colIx+1]);
    count++;
    }
if(count == 0)
    errAbort("Didn't find any results for query:\n%s", query);
sqlFreeResult(&sr);
hFreeConn(&conn);
return dM;
}
开发者ID:apmagalhaes,项目名称:kentUtils,代码行数:50,代码来源:spliceProbeVis.c


示例19: initPcm

void initPcm(struct ggcInfo *g, struct pcm *pcm, char *name, int pixels, bool detailed)
/* Allocate and initialize pcm */
{
ZeroVar(pcm);
pcm->name = cloneString(name);
pcm->pixels = pixels;
pcm->detailed = detailed;
AllocArray(pcm->match, pixels);
AllocArray(pcm->cover, pixels);
AllocArray(pcm->coverNondash, pixels);
AllocArray(pcm->count, pixels);
if (g != NULL)
    slAddTail(&g->pcmList, pcm);
}
开发者ID:blumroy,项目名称:kentUtils,代码行数:14,代码来源:ggcPic.c


示例20: AllocVar

struct splice *spliceCommaIn(char **pS, struct splice *ret)
/* Create a splice out of a comma separated string. 
 * This will fill in ret if non-null, otherwise will
 * return a new splice */
{
char *s = *pS;
int i;

if (ret == NULL)
    AllocVar(ret);
ret->tName = sqlStringComma(&s);
ret->tStart = sqlSignedComma(&s);
ret->tEnd = sqlSignedComma(&s);
ret->name = sqlStringComma(&s);
ret->type = sqlSignedComma(&s);
sqlFixedStringComma(&s, ret->strand, sizeof(ret->strand));
ret->agxId = sqlSignedComma(&s);
ret->vCount = sqlSignedComma(&s);
s = sqlEatChar(s, '{');
AllocArray(ret->vPositions, ret->vCount);
for (i=0; i<ret->vCount; ++i)
    {
    ret->vPositions[i] = sqlSignedComma(&s);
    }
s = sqlEatChar(s, '}');
s = sqlEatChar(s, ',');
s = sqlEatChar(s, '{');
AllocArray(ret->vTypes, ret->vCount);
for (i=0; i<ret->vCount; ++i)
    {
    ret->vTypes[i] = sqlUnsignedComma(&s);
    }
s = sqlEatChar(s, '}');
s = sqlEatChar(s, ',');
ret->pathCount = sqlSignedComma(&s);
s = sqlEatChar(s, '{');
for (i=0; i<ret->pathCount; ++i)
    {
    s = sqlEatChar(s, '{');
    if(s[0] != '}')        slSafeAddHead(&ret->paths, pathCommaIn(&s,NULL));
    s = sqlEatChar(s, '}');
    s = sqlEatChar(s, ',');
    }
slReverse(&ret->paths);
s = sqlEatChar(s, '}');
s = sqlEatChar(s, ',');
*pS = s;
return ret;
}
开发者ID:apmagalhaes,项目名称:kentUtils,代码行数:49,代码来源:splice.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ AllocExclusive函数代码示例发布时间:2022-05-30
下一篇:
C++ Alloc函数代码示例发布时间: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