73f88b8e6b6378e44487b6eee99e4e80fdf85f4a kent Fri Jun 24 06:28:27 2011 -0700 Responding to Mark's feedback. diff --git src/hg/checkCoverageGaps/checkCoverageGaps.c src/hg/checkCoverageGaps/checkCoverageGaps.c index e8bcd5a..b3a884f 100644 --- src/hg/checkCoverageGaps/checkCoverageGaps.c +++ src/hg/checkCoverageGaps/checkCoverageGaps.c @@ -4,48 +4,53 @@ #include "linefile.h" #include "hash.h" #include "options.h" #include "jksql.h" #include "trackDb.h" #include "hdb.h" #include "obscure.h" #include "rangeTree.h" #include "bigWig.h" #include "bigBed.h" static char const rcsid[] = "$Id: newProg.c,v 1.30 2010/03/24 21:18:33 hiram Exp $"; boolean allParts = FALSE; boolean female = FALSE; +boolean noComma = FALSE; void usage() /* Explain usage and exit. */ { errAbort( "checkCoverageGaps - Check for biggest gap in coverage for a list of tracks.\n" + "For most tracks coverage of 10,000,000 or more will indicate that there was\n" + "a mistake in generating the track.\n" "usage:\n" " checkCoverageGaps database track1 ... trackN\n" "Note: for bigWig and bigBeds, the biggest gap is rounded to the nearest 10,000 or so\n" "options:\n" " -allParts If set then include _hap and _random and other wierd chroms\n" " -female If set then don't check chrY\n" + " -noComma - Don't put commas in biggest gap output\n" ); } static struct optionSpec options[] = { {"allParts", OPTION_BOOLEAN}, {"female", OPTION_BOOLEAN}, + {"noComma", OPTION_BOOLEAN}, {NULL, 0}, }; void bigCoverageIntoTree(struct trackDb *tdb, struct bbiFile *bbi, char *chrom, int chromSize, struct rbTree *rt, boolean isBigBed) /* Find biggest gap in given chromosome in bigWig or bigBed */ { int sampleSize = 10000; int sampleCount = chromSize/sampleSize; if (sampleCount > 1) { int evenEnd = sampleCount * sampleSize; double *summaryVals; AllocArray(summaryVals, sampleCount); @@ -179,47 +184,52 @@ else tableCoverageIntoTree(hti, tdb, conn, chrom->name, chromSize, rt); if (rt->n > 0) // Want to keep completely uncovered chromosome uncovered addGaps(conn, chrom->name, rt); biggestGapFromRangeTree(rt, chromSize, &start, &end, &size); if (size > biggestSize) { biggestSize = size; biggestStart = start; biggestEnd = end; biggestChrom = chrom->name; } rangeTreeFree(&rt); } printf("%s\t%s:%d-%d\t", track, biggestChrom, biggestStart+1, biggestEnd); +if (noComma) + printf("%d", biggestSize); +else printLongWithCommas(stdout, biggestSize); putchar('\n'); freez(&typeWord); bbiFileClose(&bbi); } void checkCoverageGaps(char *database, int trackCount, char *tracks[]) /* checkCoverageGaps - Check for biggest gap in coverage for a list of tracks.. */ { struct slName *chromList = hChromList(database); struct hash *chromHash = hChromSizeHash(database); struct sqlConnection *conn = sqlConnect(database); int i; +printf("#table\tbiggest gap position \tbiggest gap size\n"); for (i=0; i