int main(int argc, char *argv[]) /* main routine, calls optionInt and sets database */ { char *outFile = NULL; boolean memTest=FALSE; char *db = NULL; if(argc == 1) usage(); optionInit(&argc, argv, optionSpecs); if(optionExists("help")) usage(); db = optionVal("db", NULL); if(db == NULL) errAbort("Must set -db flag. Try -help for usage."); if(optionExists("killList")) initKillList(); outFile = optionVal("agxOut", NULL); singleExonOk = optionExists("singleExonOk"); if(outFile == NULL) errAbort("Must specify output file with -agxOut flag. Try -help for usage."); if(optionVal("chromNib", NULL) != NULL) initializeChromNib(optionVal("chromNib", NULL)); minAli = optionFloat("minAli", 0.0); minCover = optionFloat("minCover", 0.0); memTest = optionExists("memTest"); weightMrna = optionExists("weightMrna"); if(memTest == TRUE) warn("Testing for memory leaks, use top to monitor and CTRL-C to stop."); uniqPos = newHash(10); createAltSplices(db, outFile, memTest ); return 0; }
int main(int argc, char *argv[]) /* Process command line. */ { optionInit(&argc, argv, options); maxGap = optionInt("maxGap", maxGap); maxChain = optionInt("maxChain", maxChain); minIdRatio = optionFloat("minId", 0.0)/100.0; minScore = optionFloat("minScore", minScore); bedOut = optionExists("bed"); if (argc != 5) usage(); doIt(argv[1], argv[2], argv[3], argv[4]); return 0; }
int main(int argc, char *argv[]) /* Process command line. */ { optionInit(&argc, argv, options); markovTable = optionVal("markovTable", NULL); originalCoordinates = optionExists("originalCoordinates"); minScoreCutoff = optionFloat("minScoreCutoff", 0); prior = optionFloat("prior", prior); priorBackoff = optionFloat("priorBackoff", priorBackoff); topOnly = optionExists("topOnly"); uniformBackground = optionExists("uniformBackground"); if (argc < 4) usage(); motifFinder(argv[1], argv[2], argc-3, argv+3); return 0; }
int main(int argc, char *argv[]) /* Process command line. */ { int minSizeT = 0; int minSizeQ = 0; int minChainT = 0; int minChainQ = 0; double minMatch = LIFTOVER_MINMATCH; double minBlocks = LIFTOVER_MINBLOCKS; optionInit(&argc, argv, optionSpecs); minMatch = optionFloat("minMatch", minMatch); minBlocks = optionFloat("minBlocks", minBlocks); fudgeThick = optionExists("fudgeThick"); multiple = optionExists("multiple"); noSerial = optionExists("noSerial"); if ((!multiple) && (optionExists("minSizeT") || optionExists("minSizeQ") || optionExists("minChainT") || optionExists("minChainQ") || optionExists("chainTable") || optionExists("noSerial"))) errAbort("minSizeT/Q, minChainT/Q, noSerial and chainTable can only be used with -multiple."); if (optionExists("minSizeT") && optionExists("minChainT")) errAbort("minSizeT is currently a deprecated synonym for minChainT. Can't set both."); minSizeT = optionInt("minSizeT", minChainT); /* note: we're setting minChainT */ minSizeQ = optionInt("minSizeQ", minSizeQ); minChainT = optionInt("minChainT", minChainT); minChainQ = optionInt("minChainQ", minChainQ); if (optionExists("bedPlus")) { bedPlus = optionInt("bedPlus", bedPlus); if (bedPlus < 3 || bedPlus > 15) errAbort("-bedPlus=%d is out of range -- BED has between 3 and 15 fields.", bedPlus); } ends = optionInt("ends", ends); hasBin = optionExists("hasBin"); tabSep = optionExists("tab") || optionExists("tabSep"); if ((hasBin || tabSep) && !bedPlus) usage(); chainTable = optionVal("chainTable", chainTable); if (optionExists("errorHelp")) errAbort("%s", liftOverErrHelp()); if (argc != 5) usage(); liftOver(argv[1], argv[2], minMatch, minBlocks, minSizeT, minSizeQ, minChainT, minChainQ, multiple, noSerial, chainTable, argv[3], argv[4]); return 0; }
static float optionFrac(char *name, float def) /* get an option that must be in the range 0.0 and 1.0, or -1.0 to disable. */ { float val = optionFloat(name, def); if (((val < 0.0) || (val > 1.0)) && (val != -1.0)) errAbort("-%s must be in the range 0.0..1.0 (or -1.0 to disable)", name); return val; }
int main(int argc, char *argv[]) /* Process command line. */ { struct tm *tm; if (argc < 2) usage(); optionInit(&argc, argv, options); if (!optionExists("age")) { verbose(1,"ERROR: must specify an age argument, e.g.: -age=8\n"); usage(); } if (time(&timeNow) < 1) errAbort("can not obtain current time via time() function\n"); tm = localtime(&timeNow); ageHours = optionFloat("age", 0.0); time_t ageSeconds = (time_t)(ageHours * 3600); /* age in seconds */ dropTime = timeNow - ageSeconds; if (ageHours > 0.0) { verbose(2,"# specified age = %f hours = %ld seconds\n", ageHours, (unsigned long)ageSeconds); verbose(2,"# current time: %d-%02d-%02d %02d:%02d:%02d %ld\n", 1900+tm->tm_year, 1+tm->tm_mon, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, (unsigned long)timeNow); tm = localtime(&dropTime); verbose(2,"# drop time: %d-%02d-%02d %02d:%02d:%02d %ld\n", 1900+tm->tm_year, 1+tm->tm_mon, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, (unsigned long)dropTime); } else { verbose(1,"ERROR: specified age %.f must be greater than 0.0\n", ageHours); usage(); } drop = optionExists("drop"); historyToo = optionExists("historyToo"); db = optionVal("db",db); extFileCheck = optionExists("extFile"); extDel = optionExists("extDel"); tableStatus = optionExists("tableStatus"); topDir = optionVal("topDir", topDir); verbose(2,"# drop requested: %s\n", drop ? "TRUE" : "FALSE"); verbose(2,"# historyToo: %s\n", historyToo ? "TRUE" : "FALSE"); verbose(2,"# extFile: %s\n", extFileCheck ? "TRUE" : "FALSE"); verbose(2,"# extDel: %s\n", extDel ? "TRUE" : "FALSE"); verbose(2,"# tableStatus: %s\n", tableStatus ? "TRUE" : "FALSE"); verbose(2,"# topDir: %s\n", topDir); verbose(2,"# database: %s\n", db); dbTrash(db); if (verboseLevel() > 1) printVmPeak(); return 0; }
void twinOrfStats(char *axtFile, char *raFile, char *outFile) /* twinOrfStats - Collect stats on refSeq cDNAs aligned to another species via axtForEst. */ { struct hash *rsiHash = readRefRa(raFile); struct lineFile *lf = lineFileOpen(axtFile, TRUE); FILE *f = mustOpen(outFile, "w"); struct axt *axt; static struct countMatrix kozak[10], all, utr5, utr3, cds; static struct c2Counts c2All, c2Utr5, c2Utr3, c2Cds; char label[64]; char *predictFile = optionVal("predict", NULL); int i; struct codonCounts codons; initCounts(&codons, 1); threshold = optionFloat("threshold", threshold); while ((axt = axtRead(lf)) != NULL) { struct refSeqInfo *rsi = hashFindVal(rsiHash, axt->tName); if (rsi != NULL && rsi->cdsStart >= 5) { if (checkAtg(axt, rsi->cdsStart)) { for (i=0; i<10; ++i) addPos(&kozak[i], axt, rsi->cdsStart - 5 + i); addRange(&all, &c2All, axt, 0, rsi->size); addRange(&utr5, &c2Utr5, axt, 0, rsi->cdsStart); addRange(&cds, &c2Cds, axt, rsi->cdsStart, rsi->cdsEnd); addRange(&utr3, &c2Utr3, axt, rsi->cdsEnd, rsi->size); addCodons(&codons, axt, rsi->cdsStart, rsi->cdsEnd-3); } } axtFree(&axt); } lineFileClose(&lf); dumpCounts(f, &all, "all"); dumpCounts(f, &utr5, "utr5"); dumpCounts(f, &cds, "cds"); dumpCounts(f, &utr3, "utr3"); dumpM1(f, &c2All, "c2_all"); dumpM1(f, &c2Utr5, "c2_utr5"); dumpM1(f, &c2Cds, "c2_cds"); dumpM1(f, &c2Utr3, "c2_utr3"); for (i=0; i<10; ++i) { sprintf(label, "kozak[%d]", i-5); dumpCounts(f, &kozak[i], label); } dumpCodon(f, &codons, "codon"); if (predictFile) { predict(kozak, &all, axtFile, predictFile, rsiHash); } }
int main( int argc, char *argv[] ) { optionInit(&argc, argv, optionSpecs); obsolete = optionExists("obsolete"); if (! obsolete) { verbose(1,"ERROR: This loader is obsolete. Please use: 'wigEncode'\n"); verbose(1,"\t(use -obsolete flag to run this encoder despite it being obsolete)\n"); errAbort("ERROR: wigAsciiToBinary is obsolete, use 'wigEncode' instead"); } if (argc < 2) usage(); add_offset = optionLongLong("offset", 0); binsize = optionLongLong("binsize", 1024); dataSpan = optionLongLong("dataSpan", 1); chrom = optionVal("chrom", NULL); wibFile = optionVal("wibFile", NULL); name = optionVal("name", NULL); minVal = optionFloat("minVal", -1 * INFINITY); maxVal = optionFloat("maxVal", INFINITY); trimVals = optionExists("minVal") || optionExists("maxVal"); verbose(2, "options: -verbose, offset= %llu, binsize= %llu, dataSpan= %llu\n", add_offset, binsize, dataSpan); if (chrom) { verbose(2, "-chrom=%s\n", chrom); } if (wibFile) { verbose(2, "-wibFile=%s\n", wibFile); } if (name) { verbose(2, "-name=%s\n", name); } wigAsciiToBinary(argc, argv); exit(0); }
int main(int argc, char *argv[]) /* Process command line. */ { optionInit(&argc, argv, optionSpecs); gExonOverlap = optionFloat("exonOverlap", 0.0); gCdsOnly = optionExists("cds"); if (argc != 4) usage(); geneOverlap(argv[1], argv[2], argv[3]); return 0; }
int main(int argc, char *argv[]) /* Process command line. */ { optionInit(&argc, argv, optionSpecs); if (argc != 4) usage(); minAli = optionFloat("minAli", minAli); nearTop = optionFloat("nearTop", nearTop); minCover = optionFloat("minCover", minCover); minNearTopSize = optionInt("minNearTopSize", minNearTopSize); ignoreSize = optionExists("ignoreSize"); if (optionExists("sizeMatters")) warn("warning: -sizeMatters is deprecated and is now the default"); noIntrons = optionExists("noIntrons"); singleHit = optionExists("singleHit"); noHead = optionExists("nohead"); ignoreNs = optionExists("ignoreNs"); coverQSizeFile = optionVal("coverQSizes", NULL); pslReps(argv[1], argv[2], argv[3]); return 0; }
int main(int argc, char *argv[]) /* Process command line. */ { optionHash(&argc, argv); scale = optionFloat("scale", scale); maxGap = optionInt("maxGap", maxGap); near = optionInt("near", near); sampleList = optionVal("samples", cloneString(sampleList)); if (argc != 2) usage(); calcGap(argv[1]); return 0; }
int main(int argc, char *argv[]) /* Process command line. */ { optionInit(&argc, argv, optionSpecs); aHitAny = optionExists("aHitAny"); bScore = optionExists("bScore"); minCoverage = optionFloat("minCoverage", minCoverage); strictTab = optionExists("tab"); allowStartEqualEnd = optionExists("allowStartEqualEnd"); if (argc != 4) usage(); bedIntersect(argv[1], argv[2], argv[3]); return 0; }
int main(int argc, char *argv[]) /* Process command line. */ { userName = cloneString(getUser()); optionHashSome(&argc, argv, TRUE); if (argc < 2) usage(); paraHubHost = optionVal("host", paraHubHost); cpuUsage = optionFloat("cpu", cpuUsage); if (cpuUsage < 0) usage(); ramUsage = paraParseRam(optionVal("ram","0")); if (ramUsage == -1) usage(); parasol(argv[1], argc-2, argv+2); return 0; }
int main(int argc, char *argv[]) /* Process command line. */ { optionHash(&argc, argv); clRegion = optionVal("region", clRegion); bigWinSize = optionInt("bigWinSize", bigWinSize); bigStepSize = optionInt("bigStepSize", bigStepSize); smallWinSize = optionInt("smallWinSize", smallWinSize); threshold = optionFloat("threshold", threshold); picksPer = optionInt("picksPer", picksPer); htmlOutput = optionVal("html", htmlOutput); avoidFile = optionVal("avoid", avoidFile); randSeed = optionInt("randSeed", randSeed); printWin = optionExists("printWin"); dnaUtilOpen(); if (argc != 4) usage(); regionPicker(argv[1], argv[2], argv[3]); return 0; }
int main(int argc, char *argv[]) /* Process command line. */ { optionInit(&argc, argv, optionSpecs); if (argc != 6) usage(); if (optionExists("prot")) qType = tType = "prot"; qType = optionVal("q", qType); tType = optionVal("t", tType); if (sameWord(tType, "prot") || sameWord(tType, "dnax") || sameWord(tType, "rnax")) minIdentity = 25; minIdentity = optionFloat("minIdentity", minIdentity); minScore = optionInt("minScore", minScore); dots = optionInt("dots", 0); outputFormat = optionVal("out", outputFormat); /* set global for fuzzy find functions */ setFfIntronMax(optionInt("maxIntron", ffIntronMaxDefault)); gfClient(argv[1], argv[2], argv[3], argv[4], argv[5], tType, qType); return 0; }
int main(int argc, char *argv[]) /* Process command line. */ { optionInit(&argc, argv, options); if (argc < 2) usage(); minCover = optionFloat("minCover", 80.0); maxGap = optionInt("maxGap", 1000); agp = optionExists("agp"); allowDuplicates = optionExists("allowDuplicates"); verbose(2,"#\tminCover: %% %g\n", minCover); verbose(2,"#\tmaxGap: %u\n", maxGap); verbose(2,"#\toutput type: %s\n", agp ? "AGP" : "BED"); clusterClone(argc, argv); return(0); }
int main(int argc, char *argv[]) /* Process command line. */ { optionHash(&argc, argv); if (argc != 2) usage(); xBins = optionInt("xBins", xBins); yBins = optionInt("yBins", yBins); xBinSize = optionInt("xBinSize", xBinSize); yBinSize = optionInt("yBinSize", yBinSize); xMin = optionInt("xMin", xMin); yMin = optionInt("yMin", yMin); psFile = optionVal("ps", NULL); psSize = optionInt("psSize", psSize); margin = optionInt("margin", margin); doLog = optionExists("log"); labelStep = optionInt("labelStep", labelStep); postScale = optionFloat("postScale", postScale); textHist2(argv[1]); return 0; }
void borfMatcher(char *bedIn, char *borfIn, char *bedOutFile, char *genePredOutFile) /* Top level function to open files and call other functions. */ { struct borf *borf = NULL, *borfList = NULL; struct bed *bed = NULL, *bedList = NULL; struct genePred *gp = NULL; float threshold = optionFloat("minScore", 50); FILE *bedOut = mustOpen(bedOutFile, "w"); FILE *genePredOut = mustOpen(genePredOutFile, "w"); boolean keepSmall = optionExists("keepSmall"); boolean keepNmd = optionExists("keepNmd"); borfList = borfLoadAll(borfIn); bedList = bedLoadAll(bedIn); dotForUserInit(slCount(bedList)/10); for(bed = bedList, borf = borfList; bed != NULL && borf != NULL; bed = bed->next, borf = borf->next) { dotForUser(); if(!stringIn(bed->name, borf->name)) errAbort("Trying to match up %s bed with %s borf - bad idea!", bed->name, borf->name); /* Have to adjust cds end. Borf puts stop codon outside of cds, we put it inside. */ borf->cdsEnd = min(borf->cdsEnd+3, borf->size); if((borf->score > threshold || (keepSmall && borf->cdsSize > 0)) && sameString(borf->strand, "+")) { setThickStartStop(bed, borf); if(keepNmd || !nmdTarget(bed)) { gp = bedToGenePred(bed); bedTabOutN(bed, 12, bedOut); genePredTabOut(gp, genePredOut); genePredFree(&gp); } } } warn("Done."); carefulClose(&bedOut); carefulClose(&genePredOut); }
int main(int argc, char *argv[]) /* Process command line. */ { optionInit(&argc, argv, options); if (argc != 3) usage(); database = optionVal("database", database); doAverage = optionExists("average"); transpose = optionExists("transpose"); minAbsVal = optionFloat("minAbsVal", minAbsVal); minMaxVal = optionInt("minMaxVal", minMaxVal); c = optionDouble("addConst", c); clump = optionVal("clump", clump); doLoad = !optionExists("noLoad"); if (optionExists("tab")) { tabDir = optionVal("tab", tabDir); makeDir(tabDir); } limit = optionInt("limit", limit); hgRatioMicroarray(argv[1], argv[2]); return 0; }
int main(int argc, char *argv[]) { struct lineFile *pf, *prf; char filename[64], *pslTable; optionInit(&argc, argv, optionSpecs); if (argc < 4) usage(); VERBOSE = optionExists("verbose"); SLOP = optionExists("slop"); SHORT = optionExists("short"); LONG = optionExists("long"); MISMATCH = optionExists("mismatch"); ORPHAN = optionExists("orphan"); NORANDOM = optionExists("noRandom"); NOBIN = optionExists("noBin"); MIN = optionInt("min",MIN); MAX = optionInt("max",MAX); TINSERT = optionInt("tInsert",TINSERT); HARDMAX = optionInt("hardMax",HARDMAX); if (SLOP) SLOPVAL = optionInt("slopval",SLOPVAL); else SLOPVAL = 0; NEARTOP = optionFloat("nearTop",NEARTOP); NEARTOP = 1 - NEARTOP; MIN_ID = optionFloat("minId",MIN_ID); MIN_ORPHAN_ID = optionFloat("minOrphanId",MIN_ORPHAN_ID); pf = pslFileOpen(argv[1]); prf = lineFileOpen(argv[2],TRUE); pslTable = cloneString(argv[3]); sprintf(filename, "%s.pairs", argv[4]); of = mustOpen(filename, "w"); if (SLOP) { sprintf(filename, "%s.slop", argv[4]); sf = mustOpen(filename, "w"); } if (ORPHAN) { sprintf(filename, "%s.orphan", argv[4]); orf = mustOpen(filename, "w"); } if (MISMATCH) { sprintf(filename, "%s.mismatch", argv[4]); mf = mustOpen(filename, "w"); } if (SHORT) { sprintf(filename, "%s.short", argv[4]); esf = mustOpen(filename, "w"); } if (LONG) { sprintf(filename, "%s.long", argv[4]); elf = mustOpen(filename, "w"); } if (VERBOSE) printf("Reading pair file\n"); clones = newHash(23); leftNames = newHash(23); rightNames = newHash(23); readPairFile(prf); if (VERBOSE) printf("Reading psl file\n"); readPslFile(pf); if (VERBOSE) printf("Creating Pairs\n"); pslPairs(); if (VERBOSE) printf("Writing to files\n"); printOut(pslTable); lineFileClose(&pf); lineFileClose(&prf); fclose(of); if (ORPHAN) fclose(orf); if (SLOP) fclose(sf); if (MISMATCH) fclose(mf); if (SHORT) fclose(esf); if (LONG) fclose(elf); return 0; }
void twinOrfStats(char *axtFile, char *raFile, char *outFile) /* twinOrfStats - Collect stats on refSeq cDNAs aligned to another species via axtForEst. */ { struct hash *rsiHash = readRefRa(raFile); struct lineFile *lf = lineFileOpen(axtFile, TRUE); FILE *f = mustOpen(outFile, "w"); struct axt *axt; static struct c1Counts c1Kozak[10], c1all, c1utr5, c1utr3, c1cds; static struct c2Counts c2Kozak[10], c2All, c2Utr5, c2Utr3, c2Cds; static struct c3Counts c3All, c3Utr5, c3Utr3, c3Cds; char label[64]; char *predictFile = optionVal("predict", NULL); int i; static struct c3Counts cod1, cod2, cod3, stop, earlyCod1, earlyCod2, earlyCod3; int earlySize; initC3Counts(&cod1, 0); initC3Counts(&cod2, 0); initC3Counts(&cod3, 0); initC3Counts(&earlyCod1, 0); initC3Counts(&earlyCod2, 0); initC3Counts(&earlyCod3, 0); initC3Counts(&c3Utr3, 0); initC3Counts(&c3Utr5, 0); initC3Counts(&stop, 0); threshold = optionFloat("threshold", threshold); earlyAaSize = optionInt("earlyAaSize", earlyAaSize); earlySize = 3*earlyAaSize; while ((axt = axtRead(lf)) != NULL) { struct refSeqInfo *rsi = hashFindVal(rsiHash, axt->tName); if (rsi != NULL && rsi->cdsStart >= 6) { if (checkAtg(axt, rsi->cdsStart)) { for (i=0; i<10; ++i) addPos(&c1Kozak[i], &c2Kozak[i], axt, rsi->cdsStart - 5 + i); addRange(&c1all, &c2All, &c3All, axt, 0, rsi->size); addRange(&c1utr5, &c2Utr5, &c3Utr5, axt, 0, rsi->cdsStart); addRange(&c1cds, &c2Cds, &c3Cds, axt, rsi->cdsStart, rsi->cdsEnd); addRange(&c1utr3, &c2Utr3, &c3Utr3, axt, rsi->cdsEnd, rsi->size); /* The +3+1 in the expression below breaks down as so: the * +3 is to move past the first 'ATG' codon, which is part of * the Kozak consensus model, not the coding model. The +1 * is so that we look at the 2nd and 3rd bases of the previous * codon, and the first base of the current codon. */ addCodons(&earlyCod1, axt, rsi->cdsStart+3+1, rsi->cdsStart+1+earlySize); addCodons(&earlyCod2, axt, rsi->cdsStart+3+2, rsi->cdsStart+2+earlySize); addCodons(&earlyCod3, axt, rsi->cdsStart+3+3, rsi->cdsStart+3+earlySize); addCodons(&cod1, axt, rsi->cdsStart+3+1+earlySize, rsi->cdsEnd-5); addCodons(&cod2, axt, rsi->cdsStart+3+2+earlySize, rsi->cdsEnd-4); addCodons(&cod3, axt, rsi->cdsStart+3+3+earlySize, rsi->cdsEnd-3); addCodons(&stop, axt, rsi->cdsEnd-3, rsi->cdsEnd); } } axtFree(&axt); } lineFileClose(&lf); dumpC1(f, &c1all, "c1_all"); dumpC2(f, &c2All, "c2_all"); dumpC3(f, &c3All, "c3_all"); dumpC1(f, &c1utr5, "c1_utr5"); dumpC2(f, &c2Utr5, "c2_utr5"); dumpC3(f, &c3Utr5, "c3_utr5"); dumpC1(f, &c1cds, "c1_cds"); dumpC2(f, &c2Cds, "c2_cds"); dumpC3(f, &c3Cds, "c3_cds"); dumpC1(f, &c1utr3, "c1_utr3"); dumpC2(f, &c2Utr3, "c2_utr3"); dumpC3(f, &c3Utr3, "c3_utr3"); for (i=0; i<10; ++i) { sprintf(label, "c1_kozak[%d]", i-5); dumpC1(f, &c1Kozak[i], label); sprintf(label, "c2_kozak[%d]", i-5); dumpC2(f, &c2Kozak[i], label); } dumpC3(f, &earlyCod1, "earlyCod1"); dumpC3(f, &earlyCod2, "earlyCod2"); dumpC3(f, &earlyCod3, "earlyCod3"); dumpC3(f, &cod1, "cod1"); dumpC3(f, &cod2, "cod2"); dumpC3(f, &cod3, "cod3"); dumpC3(f, &stop, "stop"); if (predictFile) { predict(c1Kozak, &c1all, axtFile, predictFile, rsiHash); } }
/* entry */ int main(int argc, char** argv) { char *selectFile, *inFile, *outFile, *dropFile; optionInit(&argc, argv, optionSpecs); if (argc != 4) usage("wrong # args"); selectFile = argv[1]; inFile = argv[2]; outFile = argv[3]; /* select file options */ if (optionExists("selectFmt") && optionExists("selectCoordCols")) errAbort("can't specify both -selectFmt and -selectCoordCols"); if (optionExists("selectFmt")) selectFmt = parseFormatSpec(optionVal("selectFmt", NULL)); else if (optionExists("selectCoordCols")) { selectCoordCols = coordColsParseSpec("selectCoordCols", optionVal("selectCoordCols", NULL)); selectFmt = COORD_COLS_FMT; } else selectFmt = getFileFormat(selectFile); if (optionExists("selectCds")) selectCaOpts |= chromAnnCds; if (optionExists("selectRange")) selectCaOpts |= chromAnnRange; if ((selectFmt == PSLQ_FMT) || (selectFmt == CHAINQ_FMT)) selectCaOpts |= chromAnnUseQSide; /* in file options */ if (optionExists("inFmt") && optionExists("inCoordCols")) errAbort("can't specify both -inFmt and -inCoordCols"); if (optionExists("inFmt")) inFmt = parseFormatSpec(optionVal("inFmt", NULL)); else if (optionExists("inCoordCols")) { inCoordCols = coordColsParseSpec("inCoordCols", optionVal("inCoordCols", NULL)); inFmt = COORD_COLS_FMT; } else inFmt = getFileFormat(inFile); inCaOpts = chromAnnSaveLines; // need lines for output if (optionExists("inCds")) inCaOpts |= chromAnnCds; if (optionExists("inRange")) inCaOpts |= chromAnnRange; if ((inFmt == PSLQ_FMT) || (inFmt == CHAINQ_FMT)) inCaOpts |= chromAnnUseQSide; /* select options */ useAggregate = optionExists("aggregate"); nonOverlapping = optionExists("nonOverlapping"); if (optionExists("strand") && optionExists("oppositeStrand")) errAbort("can only specify one of -strand and -oppositeStrand"); if (optionExists("strand")) selectOpts |= selStrand; if (optionExists("oppositeStrand")) selectOpts |= selOppositeStrand; if (optionExists("excludeSelf") && (optionExists("idMatch"))) errAbort("can't specify both -excludeSelf and -idMatch"); if (optionExists("excludeSelf")) selectOpts |= selExcludeSelf; if (optionExists("idMatch")) selectOpts |= selIdMatch; criteria.threshold = optionFloat("overlapThreshold", 0.0); criteria.thresholdCeil = optionFloat("overlapThresholdCeil", 1.1); criteria.similarity = optionFloat("overlapSimilarity", 0.0); criteria.similarityCeil = optionFloat("overlapSimilarityCeil", 1.1); criteria.bases = optionInt("overlapBases", -1); /* output options */ mergeOutput = optionExists("mergeOutput"); idOutput = optionExists("idOutput"); statsOutput = optionExists("statsOutput") || optionExists("statsOutputAll") || optionExists("statsOutputBoth"); if ((mergeOutput + idOutput + statsOutput) > 1) errAbort("can only specify one of -mergeOutput, -idOutput, -statsOutput, -statsOutputAll, or -statsOutputBoth"); outputAll = optionExists("statsOutputAll"); outputBoth = optionExists("statsOutputBoth"); if (outputBoth) outputAll = TRUE; if (mergeOutput) { if (nonOverlapping) errAbort("can't use -mergeOutput with -nonOverlapping"); if (useAggregate) errAbort("can't use -mergeOutput with -aggregate"); if ((selectFmt == CHAIN_FMT) || (selectFmt == CHAINQ_FMT) || (inFmt == CHAIN_FMT) || (inFmt == CHAINQ_FMT)) if (useAggregate) errAbort("can't use -mergeOutput with chains"); selectCaOpts |= chromAnnSaveLines; } dropFile = optionVal("dropped", NULL); /* check for options incompatible with aggregate mode */ if (useAggregate) { int i; for (i = 0; aggIncompatible[i] != NULL; i++) { if (optionExists(aggIncompatible[i])) errAbort("-%s is not allowed -aggregate", aggIncompatible[i]); } } overlapSelect(selectFile, inFile, outFile, dropFile); return 0; }
int main(int argc, char *argv[]) /* Process command line. */ { boolean drop, move, copy; struct sigaction sigSpec; setlinebuf(stdout); setlinebuf(stderr); ZeroVar(&sigSpec); sigSpec.sa_handler = sigStopSignaled; sigSpec.sa_flags = SA_RESTART; if (sigaction(SIGUSR1, &sigSpec, NULL) < 0) errnoAbort("can't set SIGUSR1 handler"); optionInit(&argc, argv, optionSpecs); drop = optionExists("drop"); move = optionExists("move"); copy = optionExists("copy"); gReload = optionExists("reload"); if (move || copy) { if (argc != 3) usage(); } else if (argc != 2) usage(); if ((drop+move+copy) > 1) errAbort("can only specify one of -drop, -move, or -copy"); gbVerbInit(optionInt("verbose", 0)); if (gbVerbose >= 6) sqlMonitorEnable(JKSQL_TRACE); if (drop) dropAll(argv[1]); else if (move) moveAll(argv[1], argv[2]); else if (copy) copyAll(argv[1], argv[2]); else { char *reloadList = optionVal("reloadList", NULL); gDatabase = argv[1]; gOptions = dbLoadOptionsParse(gDatabase); gForceIgnoreDelete = optionExists("forceIgnoreDelete"); if (optionExists("rebuildDerived")) gOptions.flags |= DBLOAD_BYPASS_GBLOADED|DBLOAD_REBUILD_DERIVED; gMaxShrinkage = optionFloat("maxShrinkage", 0.1); gGbdbGenBank = optionVal("gbdbGenBank", NULL); if (gGbdbGenBank == NULL) gGbdbGenBank = gbConfGet(gOptions.conf, "gbdb.genbank"); if (gGbdbGenBank == NULL) gGbdbGenBank = "/gbdb/genbank"; gWorkDir = optionVal("workdir", "work/load"); if (gOptions.flags & DBLOAD_DRY_RUN) printf("*** using dry run mode ***\n"); gbLoadRna(reloadList); } return 0; }
void netFilter(int inCount, char *inFiles[]) /* netFilter - Filter out parts of net.. */ { FILE *f = stdout; int i; boolean doLine = optionExists("line"); tHash = hashCommaOption("t"); notTHash = hashCommaOption("notT"); qHash = hashCommaOption("q"); notQHash = hashCommaOption("notQ"); minScore = optionInt("minScore", -BIGNUM); maxScore = optionFloat("maxScore", 9e99); qStartMin = optionInt("qStartMin", -BIGNUM); qStartMax = optionInt("qStartMax", BIGNUM); qEndMin = optionInt("qEndMin", -BIGNUM); qEndMax = optionInt("qEndMax", BIGNUM); tStartMin = optionInt("tStartMin", -BIGNUM); tStartMax = optionInt("tStartMax", BIGNUM); tEndMin = optionInt("tEndMin", -BIGNUM); tEndMax = optionInt("tEndMax", BIGNUM); qOverlapStart = optionInt("qOverlapStart", -BIGNUM); qOverlapEnd = optionInt("qOverlapEnd", BIGNUM); tOverlapStart = optionInt("tOverlapStart", -BIGNUM); tOverlapEnd = optionInt("tOverlapEnd", BIGNUM); doSyn = optionExists("syn"); minTopScore = optionFloat("minTopScore", minTopScore); minSynScore = optionFloat("minSynScore", minSynScore); minSynSize = optionFloat("minSynSize", minSynSize); minSynAli = optionFloat("minSynAli", minSynAli); maxFar = optionFloat("maxFar", maxFar); doChimpSyn = optionExists("chimpSyn"); doNonSyn = optionExists("nonsyn"); minGap = optionInt("minGap", minGap); minAli = optionInt("minAli", minAli); minSizeT = optionInt("minSizeT", minSizeT); minSizeQ = optionInt("minSizeQ", minSizeQ); fillOnly = optionExists("fill"); gapOnly = optionExists("gap"); types = optionMultiVal("type", types); noRandom = optionExists("noRandom"); noHap = optionExists("noHap"); for (i=0; i<inCount; ++i) { struct lineFile *lf = lineFileOpen(inFiles[i], TRUE); if (doLine) { netLineFilter(lf, f); } else { struct chainNet *net; while ((net = chainNetRead(lf)) != NULL) { boolean writeIt = TRUE; if (tHash != NULL && !hashLookup(tHash, net->name)) writeIt = FALSE; if (notTHash != NULL && hashLookup(notTHash, net->name)) writeIt = FALSE; if (noRandom && (endsWith(net->name, "_random") || startsWith("chrUn", net->name) || sameWord("chrNA", net->name) /* danRer */ || sameWord("chrU", net->name))) /* dm */ writeIt = FALSE; if (noHap && stringIn("_hap",net->name)) writeIt = FALSE; if (writeIt) { writeFiltered(net, f); } chainNetFree(&net); } } lineFileClose(&lf); } }
int main(int argc, char *argv[]) /* Process command line into global variables and call blat. */ { boolean tIsProtLike, qIsProtLike; #ifdef DEBUG { char *cmd = "blat hCrea.geno hCrea.mrna foo.psl -t=dnax -q=rnax"; char *words[16]; printf("Debugging parameters\n"); cmd = cloneString(cmd); argc = chopLine(cmd, words); argv = words; } #endif /* DEBUG */ optionInit(&argc, argv, options); if (argc != 4) usage(); /* Get database and query sequence types and make sure they are * legal and compatable. */ if (optionExists("prot")) qType = tType = gftProt; if (optionExists("t")) tType = gfTypeFromName(optionVal("t", NULL)); trimA = optionExists("trimA") || optionExists("trima"); trimT = optionExists("trimT") || optionExists("trimt"); trimHardA = optionExists("trimHardA"); switch (tType) { case gftProt: case gftDnaX: tIsProtLike = TRUE; break; case gftDna: tIsProtLike = FALSE; break; default: tIsProtLike = FALSE; errAbort("Illegal value for 't' parameter"); break; } if (optionExists("q")) qType = gfTypeFromName(optionVal("q", NULL)); if (qType == gftRnaX || qType == gftRna) trimA = TRUE; if (optionExists("noTrimA")) trimA = FALSE; switch (qType) { case gftProt: case gftDnaX: case gftRnaX: minIdentity = 25; qIsProtLike = TRUE; break; default: qIsProtLike = FALSE; break; } if ((tIsProtLike ^ qIsProtLike) != 0) errAbort("t and q must both be either protein or dna"); /* Set default tile size for protein-based comparisons. */ if (tIsProtLike) { tileSize = 5; minMatch = 1; oneOff = FALSE; maxGap = 0; } /* Get tile size and related parameters from user and make sure * they are within range. */ tileSize = optionInt("tileSize", tileSize); stepSize = optionInt("stepSize", tileSize); minMatch = optionInt("minMatch", minMatch); oneOff = optionExists("oneOff"); fastMap = optionExists("fastMap"); minScore = optionInt("minScore", minScore); maxGap = optionInt("maxGap", maxGap); minRepDivergence = optionFloat("minRepDivergence", minRepDivergence); minIdentity = optionFloat("minIdentity", minIdentity); gfCheckTileSize(tileSize, tIsProtLike); if (minMatch < 0) errAbort("minMatch must be at least 1"); if (maxGap > 100) errAbort("maxGap must be less than 100"); /* Set repMatch parameter from command line, or * to reasonable value that depends on tile size. */ if (optionExists("repMatch")) repMatch = optionInt("repMatch", repMatch); else repMatch = gfDefaultRepMatch(tileSize, stepSize, tIsProtLike); /* Gather last few command line options. */ noHead = optionExists("noHead"); ooc = optionVal("ooc", NULL); makeOoc = optionVal("makeOoc", NULL); mask = optionVal("mask", NULL); qMask = optionVal("qMask", NULL); repeats = optionVal("repeats", NULL); if (repeats != NULL && mask != NULL && differentString(repeats, mask)) errAbort("The -mask and -repeat settings disagree. " "You can just omit -repeat if -mask is on"); if (mask != NULL) /* Mask setting will also set repeats. */ repeats = mask; outputFormat = optionVal("out", outputFormat); dotEvery = optionInt("dots", 0); /* set global for fuzzy find functions */ setFfIntronMax(optionInt("maxIntron", ffIntronMaxDefault)); setFfExtendThroughN(optionExists("extendThroughN")); /* Call routine that does the work. */ blat(argv[1], argv[2], argv[3]); return 0; }