1e04d78b65b35678e80d9f5929e6fec0f7b2fbbb hiram Tue Mar 24 13:32:54 2026 -0700 refactor the GC on fly calculation to move into a library function rfefs #35958 diff --git src/hg/inc/wiggle.h src/hg/inc/wiggle.h index d90ceb7ceeb..8e53035848f 100644 --- src/hg/inc/wiggle.h +++ src/hg/inc/wiggle.h @@ -526,16 +526,33 @@ " string chrom; \"Reference sequence chromosome or scaffold\"\n" \ " uint chromStart; \"Start position in chromosome\"\n" \ " uint chromEnd; \"End position in chromosome\"\n" \ " string name; \"Name of item\"\n" \ " uint span; \"each value spans this many bases\"\n" \ " uint count; \"number of values in this block\"\n" \ " uint offset; \"offset in File to fetch data\"\n" \ " string file; \"path name to data file, one byte per value\"\n" \ " double lowerLimit; \"lowest data value in this block\"\n" \ " double dataRange; \"lowerLimit + dataRange = upperLimit\"\n" \ " uint validCount; \"number of valid data values in this block\"\n" \ " double sumData; \"sum of the data points, for average and stddev calc\"\n" \ " double sumSquares; \"sum of data points squared, for stddev calc\"\n" \ " )\n" +/* in lib/wigDataStream.c - GC percent computed on the fly from sequence */ + +struct gcOnTheFlyWindow +/* One window of GC percent computed directly from genome sequence */ + { + int chromStart; /* chromosome start position of this window */ + double gcPct; /* GC percent 0-100 for this window */ + }; + +int gcOnTheFlyCompute(char *db, char *chrom, int start, int end, int winSize, + struct gcOnTheFlyWindow **retWindows); +/* Compute GC percent in non-overlapping windows of winSize bases from genome + * sequence. Windows are aligned to chromosome boundaries (multiples of + * winSize). N bases are excluded from both numerator and denominator. + * Values are 0-100 (percent). Returns count of windows computed and fills + * retWindows with an allocated array. Caller must freeMem(*retWindows). */ + #endif /* WIGGLE_H */