f3a4a303938f64a47233dc52a6bb766442466b4c hiram Mon Mar 30 13:15:16 2026 -0700 correctly calculate to end of sequence and sequences smaller than the window size refs #35958 diff --git src/hg/makeDb/hgGcPercent/hgGcPercent.c src/hg/makeDb/hgGcPercent/hgGcPercent.c index c7977202d07..bb903a43872 100644 --- src/hg/makeDb/hgGcPercent/hgGcPercent.c +++ src/hg/makeDb/hgGcPercent/hgGcPercent.c @@ -80,40 +80,42 @@ char *createTable = "#Displays GC percentage in 20Kb blocks for genome\n" "CREATE TABLE gcPercent (\n" "chrom varchar(255) not null, # Human chromosome number\n" "chromStart int unsigned not null, # Start position in genoSeq\n" "chromEnd int unsigned not null, # End position in genoSeq\n" "name varchar(255) not null, # Constant string GCpct\n" "gcPpt int unsigned not null, # GC percentage for 20Kb block\n" "#Indices\n" "UNIQUE(chrom(%d),chromStart)\n" ");\n"; static void wigOutLine(FILE *f, char *chrom, int start, int end, int ppt) { -/* only full winSize spans are valid */ -if ((end - start) < winSize) - return; +int span = end - start; -/* see if we are starting on a new chrom */ +/* see if we are starting on a new chrom or span has changed */ if (! (previousChrom && (sameWord(previousChrom, chrom)))) { freeMem(previousChrom); previousChrom = cloneString(chrom); - fprintf(f, "variableStep chrom=%s span=%d\n", chrom, winSize-overlap); + fprintf(f, "variableStep chrom=%s span=%d\n", chrom, span); + } +else if (span != winSize - overlap) + { + fprintf(f, "variableStep chrom=%s span=%d\n", chrom, span); } fprintf(f, "%d\t%g\n", start+1, ppt/10.0); } void makeGcLineFromSeq(DNA *dna, char *chrom, int start, int end, FILE *f) /* Given a sequence and window within the sequence, print out a line of * BED 5 with the GC parts per thousand (not percent) in the window (or * ascii-wiggle if -wigOut). */ { static int dotMod = 0; int minCount = winSize/4; int i, count, gcCount, val, ppt, gapCount; if ((++dotMod&127) == 0) {