Esempio n. 1
0
void liftAcross(char *liftAcross, char *srcFile, char *dstOut)
/* liftAcross - convert one coordinate system to another, no overlapping items. */
{
struct hash *lftHash = readLift(liftAcross);
struct genePred *gpList = genePredExtLoadAll(srcFile);
struct genePred *gp = NULL;
FILE *out = mustOpen(dstOut, "w");

if (bedOut)
    bedRegionOutput(lftHash);

int genePredItemCount = 0;
for (gp = gpList; gp != NULL; gp = gp->next)
    {
    struct liftSpec *lsFound = hashFindVal(lftHash, gp->chrom);
    if (lsFound)
	{
	struct genePred *gpLifted = liftGenePred(gp, lsFound);
	struct genePred *gpl;
	for (gpl = gpLifted; gpl != NULL; gpl = gpl->next)
	    genePredTabOut(gpl, out);
	genePredFreeList(&gpLifted);
	}
    else
	{
	genePredTabOut(gp, out);
	}
    ++genePredItemCount;
    }
/* lftHash and gpList are left allocated to disappear at exit */
verbose(2,"#\tgene pred item count: %d\n", genePredItemCount);
}
int main(int argc, char *argv[])
/* Process command line. */
{
struct hash *liftHash = NULL;
cgiSpoof(&argc, argv);
if (argc != 6)
    usage();
if (cgiVarExists("spacing"))
    chromInsertsSetDefaultGapSize(cgiInt("spacing"));
if (cgiVarExists("lift"))
    liftHash = readLift(cgiString("lift"));
ctgToChromFa(argv[1], argv[2], argv[3], argv[4], argv[5], liftHash);
return 0;
}