您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ AllocArray函数代码示例

51自学网 2021-06-01 19:46:26
  C++
这篇教程C++ AllocArray函数代码示例写得很实用,希望能帮到您。

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

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


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例21: hgGenericMicroarray

void hgGenericMicroarray(char *file)/* Load the simple file into two tables.*/{struct expRecord *exps = NULL;struct expData *data = NULL;struct lineFile *lf = lineFileOpen(file,TRUE);char *strings[1000];int ncols, i, n;/* First line has experiment info */ncols = lineFileChopTab(lf,strings);for (i = 1; i < ncols; i++)    {    struct expRecord *oneRec = NULL;    AllocVar(oneRec);    oneRec->id = i - 1;    oneRec->name = cloneString(strings[i]);    oneRec->description = cloneString(strings[i]);    oneRec->url = CSNA;    oneRec->ref = CSNA;    oneRec->credit = CSNA;    oneRec->numExtras = 3;    AllocArray(oneRec->extras, oneRec->numExtras);    oneRec->extras[0] = cloneString("n/a");    oneRec->extras[1] = cloneString("n/a");    oneRec->extras[2] = cloneString(strings[i]);    slAddHead(&exps, oneRec);    }slReverse(&exps);/* Other lines have the data. */while ((n = lineFileChopTab(lf,strings)) > 0)    {    struct expData *oneGene = NULL;    AllocVar(oneGene);    oneGene->name = cloneString(strings[0]);    oneGene->expCount = ncols - 1;    AllocArray(oneGene->expScores, oneGene->expCount);    for (i = 1; i < ncols; i++)	oneGene->expScores[i-1] = sqlFloat(strings[i]);    slAddHead(&data, oneGene);    }if ((n != ncols) && (n > 0))    errAbort("Wrong number of columns in line %d of %s. Got %d, want %d", lf->lineIx, file, n, ncols);slReverse(&data);saveExpsTable(exps);saveDataTable(data);expRecordFreeList(&exps);expDataFreeList(&data);lineFileClose(&lf);}
开发者ID:blumroy,项目名称:kentUtils,代码行数:49,


示例22: CloneVar

struct psl *clonePsl(struct psl *psl)/* Copy a psl to separate memory. */{struct psl *c = CloneVar(psl);c->next = NULL;c->qName = cloneString(psl->qName);c->tName = cloneString(psl->tName);AllocArray(c->blockSizes, c->blockCount);CopyArray(psl->blockSizes, c->blockSizes, c->blockCount);AllocArray(c->qStarts, c->blockCount);CopyArray(psl->qStarts, c->qStarts, c->blockCount);AllocArray(c->tStarts, c->blockCount);CopyArray(psl->tStarts, c->tStarts, c->blockCount);return c;}
开发者ID:apmagalhaes,项目名称:kentUtils,代码行数:15,


示例23: maxTranscriptomeExps

void maxTranscriptomeExps(char *files[], int numFiles, char *outputFile, char *trackName){struct sample **pSampList = NULL;struct sample *s1;struct sample *maxListSamp  = NULL;struct sample *maxSamp = NULL;int i;int count =0;FILE *out = NULL;AllocArray(pSampList, numFiles);for(i=0;i<numFiles; i++) { warn("Reading %s.", files[i]); pSampList[i] = sampleLoadAll(files[i]); }warn("Calculating Maxes.");count = slCount(pSampList[0]);for(i=0;i<count;i++)    {    AllocVar(maxSamp);    s1 = slElementFromIx(pSampList[0], i);    maxSamp->chrom = cloneString(s1->chrom);    maxSamp->chromStart = s1->chromStart;    maxSamp->chromEnd = s1->chromEnd;    maxSamp->name = cloneString(trackName);    snprintf(maxSamp->strand, sizeof(maxSamp->strand), "%s", s1->strand);    maxSamp->sampleCount = s1->sampleCount;    maxSamp->samplePosition = CloneArray(s1->samplePosition, maxSamp->sampleCount);    AllocArray(maxSamp->sampleHeight, maxSamp->sampleCount);    fillInMaxVals(maxSamp, pSampList, numFiles, i);    slAddHead(&maxListSamp, maxSamp);    }slReverse(&maxListSamp);warn("Saving Maxes");out = mustOpen(outputFile, "w");for(maxSamp = maxListSamp; maxSamp != NULL; maxSamp = maxSamp->next)    {    sampleTabOut(maxSamp, out);    }carefulClose(&out);warn("Cleaning up");sampleFreeList(&maxListSamp);for(i=0;i<numFiles; i++)    sampleFreeList(&pSampList[i]);freez(&pSampList);warn("Done.");}
开发者ID:CEpBrowser,项目名称:CEpBrowser--from-UCSC-CGI-BIN,代码行数:48,


示例24: AllocVar

struct starTableInfo *starTableInfoNew(struct sqlConnection *conn, char *name)/* Create new starTable,  reading information about it from database. */{struct starTableInfo *sti;AllocVar(sti);char buf[256];safef(buf, sizeof(buf), "%s%s", tablePrefix, name);sti->tableName = cloneString(buf);sti->fieldName = cloneString(name);char query[256];sqlSafef(query, sizeof(query), "select max(id) from %s", sti->tableName);sti->maxId = sqlQuickNum(conn, query);verbose(2, "%s maxId %d/n", sti->tableName, sti->maxId);AllocArray(sti->termsForIds, sti->maxId+1);sqlSafef(query, sizeof(query), "select id,term from %s", sti->tableName);struct sqlResult *sr = sqlGetResult(conn, query);char **row;while ((row = sqlNextRow(sr)) != NULL)    {    unsigned id = sqlUnsigned(row[0]);    char *term = row[1];    sti->termsForIds[id] = cloneString(term);    }sqlFreeResult(&sr);return sti;}
开发者ID:apmagalhaes,项目名称:kentUtils,代码行数:26,


示例25: sqlStringDynamicArray

void sqlStringDynamicArray(char *s, char ***retArray, int *retSize)/* Convert comma separated list of strings to an dynamically allocated * array, which should be freeMem()'d when done. As a speed option all * of the elements in the array are needMem()'d at the same time. This  * means that all the entries are free()'d by calling freeMem() on the * first element. For example: * sqlStringDynamicArray(s, &retArray, &retSize); * DoSomeFunction(retArray, retSize); * freeMem(retArray[0]); * freeMem(retArray); */{char **sArray, **dArray = NULL;int size;if (s == NULL)    {    *retArray = NULL;    *retSize = 0;    return;    }s = cloneString(s);sqlStringStaticArray(s, &sArray, &size);if (size > 0)    {    AllocArray(dArray,size);    CopyArray(sArray, dArray, size);    }*retArray = dArray;*retSize = size;}
开发者ID:Puneet-Shivanand,项目名称:zinba,代码行数:31,


示例26: sortAndWriteOffsets

void sortAndWriteOffsets(bits32 firstIx, bits32 *offsetArray, bits32 *listArray, 	DNA *allDna, FILE *f)/* Set up and do a qsort on list that starts at firstIx.  Write result to file. */{/* Count up length of list. */int listSize = 0;bits32 listIx;for (listIx = firstIx; listIx != 0; listIx = listArray[listIx])    ++listSize;/* Get an array to hold all offsets in list, hopefully a small one on stack, * but if need be a big one on heap */bits32 smallArray[32], *bigArray = NULL, *sortArray;if (listSize <= ArraySize(smallArray))    sortArray = smallArray;else    AllocArray(sortArray, listSize);/* Copy list to array for sorting. */int sortIx;for (sortIx=0, listIx=firstIx; listIx != 0; ++sortIx, listIx=listArray[listIx])    sortArray[sortIx] = offsetArray[listIx];/* Do the qsort.  I hope I got the cmp function right! */qsort(sortArray, listSize, sizeof(sortArray[0]), cmpAfter16);/* Write out sorted result. */mustWrite(f, sortArray, listSize * sizeof(bits32));/* Clean up. */if (bigArray)    freeMem(bigArray);}
开发者ID:CEpBrowser,项目名称:CEpBrowser--from-UCSC-CGI-BIN,代码行数:33,


示例27: while

//-----------------------------------------------------------------------------EStatus BaseArray::SetLength (INT  iLengthIn)  {  INT    iNewAllocSize = iAllocSize;  // calculate how much to grow the array.  while (iLengthIn > iNewAllocSize)    {    iNewAllocSize += iAllocInc;    };  // if more memory is to be allocated, allocate it, copy over old values, and delete old memory.  if (iNewAllocSize > iAllocSize)    {    VOID *  pNewArray = AllocArray (iNewAllocSize);    // Note:  Ideally you need to detect an allocation failure here and return a failure code.    if (pNewArray == NULL)  return (EStatus::kFailure);    INT     iOldAllocSize = iAllocSize;    VOID *  pOldArray     = pArray;    pArray = pNewArray;    iAllocSize = iNewAllocSize;    if (iOldAllocSize > 0)      {      CopyValues (pOldArray, 0, 0, iOldAllocSize);      DeleteArray (&pOldArray);      };    };  iLength = iLengthIn;  return (EStatus::kSuccess);  };
开发者ID:mduffor,项目名称:tedit,代码行数:34,


示例28: optionVal

float *getWeights(int count)/* Get weights - all 1.0 by default, or read from file otherwise. */{float *weights;float total = 0.0;int observed = 0;int i;char *fileName = optionVal("weights", NULL);/* Initialize all to 1.0. */AllocArray(weights, count);for (i=0; i<count; ++i)    weights[i] = 1.0;/* Read from file if it exists. */if (fileName != NULL)    {    struct lineFile *lf = lineFileOpen(fileName, TRUE);    char *row[2];    while (lineFileRow(lf, row))        {	int ix = atoi(row[1]);	float val = atof(row[0]);	if (ix < 0 || ix > count || val <= 0)	    errAbort("%s does not seem to be a good weight file on line %d", 	    	lf->fileName, lf->lineIx);	weights[ix] = val;	total += val;	++observed;	}    lineFileClose(&lf);    printf("%d genes, %d weights, %f total wieght/n", count, observed, total);    }return weights;}
开发者ID:ucscGenomeBrowser,项目名称:kent,代码行数:35,


示例29: bbiWriteSummaryAndIndexUnc

static bits64 bbiWriteSummaryAndIndexUnc(struct bbiSummary *summaryList, 	int blockSize, int itemsPerSlot, FILE *f)/* Write out summary and index to summary compressed, returning start position of * summary index. */{bits32 i, count = slCount(summaryList);struct bbiSummary **summaryArray;AllocArray(summaryArray, count);writeOne(f, count);struct bbiSummary *summary;for (summary = summaryList, i=0; summary != NULL; summary = summary->next, ++i)    {    summaryArray[i] = summary;    summary->fileOffset = ftell(f);    writeOne(f, summary->chromId);    writeOne(f, summary->start);    writeOne(f, summary->end);    writeOne(f, summary->validCount);    bbiWriteFloat(f, summary->minVal);    bbiWriteFloat(f, summary->maxVal);    bbiWriteFloat(f, summary->sumData);    bbiWriteFloat(f, summary->sumSquares);    }bits64 indexOffset = ftell(f);cirTreeFileBulkIndexToOpenFile(summaryArray, sizeof(summaryArray[0]), count,    blockSize, itemsPerSlot, NULL, bbiSummaryFetchKey, bbiSummaryFetchOffset,     indexOffset, f);freez(&summaryArray);return indexOffset;}
开发者ID:Nicholas-NVS,项目名称:kentUtils,代码行数:30,



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


C++ AllocExclusive函数代码示例
C++ AlignLo函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。