void doMiddle() { char *preIntron, *startIntron, *endIntron, *postIntron; int count = 0; int matchCount = 0; int maxCount; struct nameOff *matchList; boolean invert = cgiVarExists("Invert"); preIntron = cgiString("preIntron"); startIntron = cgiString("startIntron"); endIntron = cgiString("endIntron"); postIntron = cgiString("postIntron"); /* Just for debugging cut search short if matches special magic */ maxCount = atoi(preIntron); if (maxCount <= 0) maxCount = 0x7ffffff; eraseWhiteSpace(preIntron); eraseWhiteSpace(startIntron); eraseWhiteSpace(endIntron); eraseWhiteSpace(postIntron); tolowers(preIntron); tolowers(startIntron); tolowers(endIntron); tolowers(postIntron); matchList = scanIntronFile(preIntron, startIntron, endIntron, postIntron, invert); if (matchList == NULL) errAbort("Sorry, no matches to %s%s %s %s %s", (invert ? "inverted " : ""), preIntron, startIntron, endIntron, postIntron); printf("<P>%d introns matching %s%s(%s %s)%s. ", slCount(matchList), (invert ? "inverted " : ""), preIntron, startIntron, endIntron, postIntron); printf("Shortcut to <A HREF=\"#1\">frequency counts.</A></P>"); htmlHorizontalLine(); showMatches(matchList); htmlHorizontalLine(); printf("<TT><PRE>"); printf("<A NAME=\"1\"></A>"); printAllHistograms(); printf("</TT></PRE>"); }
int main(int argc, char *argv[]) { FILE *xaFile; struct xaAli *xa; struct gapInfo *gapList = NULL, *gaps; int count = 0; long startTime = clock1000(); char *xaName, *newName; char *first; boolean cbFirst; if (argc != 4) usage(); first = argv[1]; xaName = argv[2]; newName = argv[3]; if (sameWord("elegans", first)) cbFirst = FALSE; else if (sameWord("briggsae", first)) cbFirst = TRUE; else usage(); dnaUtilOpen(); intronHash = newHash(0); out = mustOpen(newName, "w"); xaFile = mustOpen(xaName, "r"); while ((xa = xaReadNext(xaFile, FALSE)) != NULL) { char *s; if (!cbFirst) { char *swaps; int swapi; char swapc; uglyf("Swapping....\n"); swaps = xa->query; xa->query = xa->target; xa->target = swaps; swapi = xa->qStart; xa->qStart = xa->tStart; xa->tStart = swapi; swapi = xa->qEnd; xa->qEnd = xa->tEnd; xa->tEnd = swapi; swapc = xa->qStrand; xa->qStrand = xa->tStrand; xa->tStrand = swapc; swaps = xa->qSym; xa->qSym = xa->tSym; xa->tSym = swaps; swapSym(xa->hSym, xa->symCount); } uglyf("%d query %s target %s\n", count, xa->query, xa->target); s = chromFromPath(xa->target); freeMem(xa->target); xa->target = s; if (++count % 500 == 0) printf("Processing %d\n", count); gaps = findLargeGaps(xa, gapList); gapList = slCat(gaps, gapList); xaAliFree(xa); } slReverse(&gapList); report(out, "Processing took %f seconds\n", (clock1000()-startTime)*0.001); reportGaps(gapList, out); printAllHistograms(out); calcCeHomoCount(); printHomologousEndStats(out); printSameIntronStats(out); return 0; }