/* wigTestMaker - Create test wig files.. */ #include "common.h" #include "linefile.h" #include "hash.h" #include "options.h" #include "portable.h" void usage() /* Explain usage and exit. */ { errAbort( "wigTestMaker - Create test wig files.\n" "usage:\n" " wigTestMaker outDir\n" "options:\n" " -xxx=XXX\n" ); } static struct optionSpec options[] = { {NULL, 0}, }; void makeEmpty(char *fileName) /* Make an empty file. */ { FILE *f = mustOpen(fileName, "w"); carefulClose(&f); } void makeEmptyFixed(char *fileName) /* Make short fixed step test. */ { FILE *f = mustOpen(fileName, "w"); fprintf(f, "fixedStep chrom=chr1 span=10 start=100 step=10\n"); carefulClose(&f); } void makeShortFixed(char *fileName) /* Make short fixed step test. */ { FILE *f = mustOpen(fileName, "w"); fprintf(f, "fixedStep chrom=chr1 span=10 start=100 step=10\n"); fprintf(f, "1.0\n"); carefulClose(&f); } void makeEmptyVar(char *fileName) /* Make short fixed step test. */ { FILE *f = mustOpen(fileName, "w"); fprintf(f, "variableStep chrom=chr1 span=10\n"); carefulClose(&f); } void makeShortVar(char *fileName) /* Make short fixed step test. */ { FILE *f = mustOpen(fileName, "w"); fprintf(f, "variableStep chrom=chr1 span=10\n"); fprintf(f, "100 1.0\n"); carefulClose(&f); } void makeShortBed(char *fileName) /* Make short fixed step test. */ { FILE *f = mustOpen(fileName, "w"); fprintf(f, "chr1\t100\t110\t1.0\n"); carefulClose(&f); } void makeManyContigs(char *fileName, int contigCount) /* Make a test bedGraph with many contigs. */ { int i; FILE *f = mustOpen(fileName, "w"); for (i=1; i<=contigCount; ++i) { fprintf(f, "contig%d\t%d\t%d\t%g\n", i, 1000000+i, 1000100+i, 1.0/i); fprintf(f, "contig%d\t%d\t%d\t%g\n", i, 1001000+i, 1001100+i, i*1.000001); } carefulClose(&f); } #define TWOPI (3.1415 * 2.0) void makeSineSineFixed(char *fileName, int innerRes, int outerRes, int outerCount, int chromCount) /* Make a test set involving sine modulated sine waves in fixedStep format. */ { FILE *f = mustOpen(fileName, "w"); int totalSteps = innerRes * outerRes * outerCount; double innerStep = TWOPI/innerRes; double outerStep = TWOPI/(innerRes*outerRes); int chromIx; for (chromIx=1; chromIx<=chromCount; ++chromIx) { fprintf(f, "fixedStep chrom=chr%d start=1 step=1 span=1\n", chromIx); double outerAngle = 0, innerAngle = 0; int i; for (i=0; i