13b584581e6d7b1860e0cab97adc3594b1899308 braney Mon Aug 7 12:05:10 2023 -0700 add instaPort to bigBed support diff --git src/hg/lib/bed.c src/hg/lib/bed.c index ef2394d..09b27e9 100644 --- src/hg/lib/bed.c +++ src/hg/lib/bed.c @@ -1,33 +1,33 @@ /* bed.c was originally generated by the autoSql program, which also * generated bed.h and bed.sql. This module links the database and the RAM * representation of objects. */ /* Copyright (C) 2014 The Regents of the University of California * See kent/LICENSE or http://genome.ucsc.edu/license/ for licensing information. */ #include "common.h" #include "bed.h" #include "minChromSize.h" #include "hdb.h" -struct genePred *bedToGenePred(struct bed *bed) +struct genePredExt *bedToGenePredExt(struct bed *bed) /* Convert a single bed to a genePred structure. */ { -struct genePred *gp = NULL; +struct genePredExt *gp = NULL; int i; assert(bed); AllocVar(gp); gp->name = cloneString(bed->name); gp->chrom = cloneString(bed->chrom); //fails if strlen(bed->strand) == 2 as genepred has no space for zero terminator //safef(gp->strand, sizeof(gp->strand), "%s", bed->strand); gp->strand[0] = bed->strand[0]; gp->strand[1] = '\0'; assert(gp->strand[1] != '-'); gp->txStart = bed->chromStart; gp->txEnd = bed->chromEnd; gp->cdsStart = bed->thickStart; gp->cdsEnd = bed->thickEnd; gp->exonCount = bed->blockCount; @@ -40,30 +40,36 @@ gp->exonStarts[i] = bed->chromStarts[i] + bed->chromStart; gp->exonEnds[i] = gp->exonStarts[i] + bed->blockSizes[i]; } } else { gp->exonCount = 1; AllocArray(gp->exonStarts, gp->exonCount); AllocArray(gp->exonEnds, gp->exonCount); gp->exonStarts[0] = bed->chromStart; gp->exonEnds[0] = bed->chromEnd; } return gp; } +struct genePred *bedToGenePred(struct bed *bed) +/* Convert a single bed to a genePred structure. */ +{ +return (struct genePred *)bedToGenePredExt(bed); +} + struct bed *bedFromGenePred(struct genePred *genePred) /* Convert a single genePred to a bed structure */ { struct bed *bed; int i, blockCount, *chromStarts, *blockSizes, chromStart; /* A tiny bit of error checking on the genePred. */ if (genePred->txStart >= genePred->txEnd || genePred->cdsStart > genePred->cdsEnd) { errAbort("mangled genePred format for %s", genePred->name); } /* Allocate bed and fill in from psl. */ AllocVar(bed); bed->chrom = cloneString(genePred->chrom);