struct altGraphX *agFromAlignments(char *db, struct ggMrnaAli *maList, struct dnaSeq *seq, struct sqlConnection *conn, int chromStart, int chromEnd, FILE *out ) /** Custer overlaps from maList into altGraphX structure. */ { struct altGraphX *ag = NULL, *agList = NULL; struct ggMrnaCluster *mcList=NULL, *mc=NULL; struct ggMrnaInput *ci = NULL; struct geneGraph *gg = NULL; static int count = 0; ci = ggMrnaInputFromAlignments(maList, seq); mcList = ggClusterMrna(ci); if(mcList == NULL) { freeGgMrnaInput(&ci); return NULL; } clusterCount++; for(mc = mcList; mc != NULL; mc = mc->next) { if(optionExists("consensus")) { gg = ggGraphConsensusCluster(db, mc, ci, tissLibHash, !optionExists("skipTissues")); } else gg = ggGraphCluster(db, mc,ci); assert(checkEvidenceMatrix(gg)); ag = ggToAltGraphX(gg); if(ag != NULL) { char name[256]; freez(&ag->name); safef(name, sizeof(name), "%s.%d", ag->tName, count++); ag->name = cloneString(name); /* Convert back to genomic coordinates. */ altGraphXoffset(ag, chromStart); /* Sort vertices so that they are chromosomal order */ altGraphXVertPosSort(ag); /* write to file */ binKeeperAdd(agxSeenBin, ag->tStart, ag->tEnd, ag); slAddHead(&agList, ag); } } /* Sometimes get nested, partial transcripts. Want to filter those out. */ for(ag = agList; ag != NULL; ag = ag->next) { if(!agxIsRedundant(ag)) altGraphXTabOut(ag, out); } /* genoSeq and maList are freed with ci and gg */ ggFreeMrnaClusterList(&mcList); freeGgMrnaInput(&ci); freeGeneGraph(&gg); return agList; }
void smallTest() /* Test out stuff. */ { struct ggMrnaCluster *mc = makeTestInput(); struct geneGraph *gg; static struct ggMrnaInput dummyCi; uglyf("Initial input\n"); dumpMc(mc); uglyf("\n"); gg = ggGraphCluster(mc, &dummyCi); traverseGeneGraph(gg, mc->tStart, mc->tEnd, dumpGgAliInfo); errAbort("Done testing"); }
void constraintsForBac(char *bacAcc, char *outDir) /* Generate a set of constraint files for bac. */ { struct ggMrnaInput *ci = ggGetMrnaForBac(bacAcc); struct ggMrnaCluster *mc, *mcList = ggClusterMrna(ci); struct geneGraph *gg; uglyf("Got %d clusters\n", slCount(mcList)); for (mc = mcList; mc != NULL; mc = mc->next) { uglyf("Initial input\n"); dumpMc(mc); uglyf("\n"); gg = ggGraphCluster(mc, ci); uglyf("Constraints\n"); traverseGeneGraph(gg, mc->tStart, mc->tEnd, dumpGgAliInfo); uglyf("\n\n"); } }