struct linkedFeatures *lfFromRetroGene(struct ucscRetroInfo *pg) /* Return a linked feature from a retroGene. */ { struct linkedFeatures *lf; struct simpleFeature *sf, *sfList = NULL; int grayIx = grayInRange(pg->score, 0, 1000); int *starts = pg->chromStarts, start; int *sizes = pg->blockSizes; int blockCount = pg->blockCount, i; assert(starts != NULL && sizes != NULL && blockCount > 0); AllocVar(lf); lf->grayIx = grayIx; lf->name = cloneString(pg->name); lf->orientation = orientFromChar(pg->strand[0]); for (i=0; i<blockCount; ++i) { AllocVar(sf); start = starts[i] + pg->chromStart; sf->start = start; sf->end = start + sizes[i]; sf->grayIx = grayIx; slAddHead(&sfList, sf); } slReverse(&sfList); lf->components = sfList; linkedFeaturesBoundsAndGrays(lf); lf->tallStart = pg->thickStart; lf->tallEnd = pg->thickEnd; lf->extra = pg; return lf; }
static struct linkedFeatures *skeletonLf(struct cgapSage *tag) /* Fill in everything except the name and score. */ { struct linkedFeatures *lf; struct simpleFeature *sf; AllocVar(lf); AllocVar(sf); lf->start = sf->start = tag->chromStart; lf->end = sf->end = tag->chromEnd; lf->tallStart = tag->thickStart; lf->tallEnd = tag->thickEnd; lf->orientation = orientFromChar(tag->strand[0]); lf->components = sf; return lf; }
static struct linkedFeatures *lfFromEncodePeak(struct slList *item, struct trackDb *tdb, int scoreMin, int scoreMax) /* Translate an {encode,narrow,broad,gapped}Peak item into a linkedFeatures. */ { struct encodePeak *peak = (struct encodePeak *)item; struct linkedFeatures *lf; struct simpleFeature *sfList = NULL; if (!peak) return NULL; AllocVar(lf); lf->start = peak->chromStart; lf->end = peak->chromEnd; if (peak->peak > -1) { lf->tallStart = peak->chromStart + peak->peak; lf->tallEnd = lf->tallStart + 1; } lf->filterColor = -1; lf->orientation = orientFromChar(peak->strand[0]); adjustBedScoreGrayLevel(tdb, (struct bed *)peak, scoreMin, scoreMax); lf->grayIx = grayInRange((int)peak->score, scoreMin, scoreMax); lf->name = cloneString(peak->name); if (peak->blockCount > 0) { int i; for (i = 0; i < peak->blockCount; i++) { struct simpleFeature *sf; AllocVar(sf); sf->start = lf->start + peak->blockStarts[i]; sf->end = lf->start + peak->blockStarts[i] + peak->blockSizes[i]; sf->grayIx = lf->grayIx; slAddHead(&sfList, sf); } slReverse(&sfList); } else { AllocVar(sfList); sfList->start = lf->start; sfList->end = lf->end; sfList->grayIx = lf->grayIx; } lf->components = sfList; return lf; }
struct linkedFeatures *lfFromBed6(struct codeBlast *bed, int scoreMin, int scoreMax) /* Return a linked feature from a (full) bed. */ { struct linkedFeatures *lf; struct simpleFeature *sf; int grayIx = grayInRange(bed->score, scoreMin, scoreMax); AllocVar(lf); lf->grayIx = grayIx; lf->name = cloneString(bed->name); lf->orientation = orientFromChar(bed->strand[0]); AllocVar(sf); sf->start = bed->chromStart; sf->end = bed->chromEnd; sf->grayIx = grayIx; lf->components = sf; linkedFeaturesBoundsAndGrays(lf); lf->tallStart = bed->chromStart; lf->tallEnd = bed->chromEnd; return lf; }
struct linkedFeatures *lfFromSample(struct sample *sample) /* Return a linked feature from a full sample (wiggle) track. */ { struct linkedFeatures *lf; struct simpleFeature *sf, *sfList = NULL; int grayIx = grayInRange(sample->score, 0, 1000); int start, i; unsigned *X = sample->samplePosition; int *Y = sample->sampleHeight; unsigned sampleCount = sample->sampleCount; assert(X != NULL && Y != NULL && sampleCount > 0); AllocVar(lf); lf->grayIx = grayIx; lf->name = cloneString(sample->name); lf->orientation = orientFromChar(sample->strand[0]); for (i=0; i<sampleCount; ++i) { AllocVar(sf); start = X[i] + sample->chromStart; sf->start = start; if( Y[i] < 0 ) /*hack for negative values not loading correctly*/ sf->end = start; else if( Y[i] == 0 ) sf->end = start + 1; else sf->end = start + Y[i]; sf->grayIx = grayIx; slAddHead(&sfList, sf); } slReverse(&sfList); lf->components = sfList; linkedFeaturesBoundsAndGrays(lf); lf->start = sample->chromStart; lf->end = sample->chromEnd; return lf; }