void txgAnalyze(char *inTxg, char *dnaPath, char *outFile) /* txgAnalyze - Analyse transcription graph for alt exons, alt 3', alt 5', * retained introns, alternative promoters, etc.. */ { struct lineFile *lf = lineFileOpen(inTxg, TRUE); FILE *f = mustOpen(outFile, "w"); char *row[TXGRAPH_NUM_COLS]; struct nibTwoCache *ntc = nibTwoCacheNew(dnaPath); struct dnaSeq *chrom = NULL; while (lineFileRow(lf, row)) { struct txGraph *txg = txGraphLoad(row); if (chrom == NULL || !sameString(chrom->name, txg->tName)) { dnaSeqFree(&chrom); chrom = nibTwoCacheSeq(ntc, txg->tName); verbose(2, "Loaded %s into %s\n", txg->tName, chrom->name); } struct range *exonsWithIntrons = retainedIntrons(txg, f); cassetteExons(txg, f); altThreePrime(txg, exonsWithIntrons, f); altFivePrime(txg, exonsWithIntrons, f); altPromoter(txg, f); strangeSplices(txg, chrom, f); bleedsIntoIntrons(txg, f); refSeparateButJoined(txg, f); if (fConst != NULL) constExons(txg, fConst); slFreeList(&exonsWithIntrons); txGraphFree(&txg); } carefulClose(&f); }
void txgToAgx(char *inTxg, char *outAgx) /* txgToAgx - Convert from txg (txGraph) format to agx (altGraphX). */ { struct lineFile *lf = lineFileOpen(inTxg, TRUE); char *row[TXGRAPH_NUM_COLS]; FILE *f = mustOpen(outAgx, "w"); while (lineFileRow(lf, row)) { struct txGraph *txg = txGraphLoad(row); verbose(2, "loaded txGraph %s\n", txg->name); struct altGraphX *agx = txGraphToAltGraphX(txg); altGraphXTabOut(agx, f); altGraphXFree(&agx); txGraphFree(&txg); } carefulClose(&f); }