d0054a39067a773d5342af78a80d964835d47a60 markd Thu Oct 16 13:28:21 2025 -0700 add bedToBigBed -fixScores to correct scores that are out-of-range or invalid diff --git src/inc/basicBed.h src/inc/basicBed.h index 7ca8d8f470b..be96c665f57 100644 --- src/inc/basicBed.h +++ src/inc/basicBed.h @@ -41,30 +41,38 @@ }; #define bedKnownFields 15 /* Maximum known fields in bed */ #define BB_MAX_CHROM_STRING 255 /* Maximum string length for chromosome length */ struct bed3 /* Browser extensible data - first three fields */ { struct bed3 *next; /* Next in singly linked list. */ char *chrom; /* Human chromosome or FPC contig */ unsigned chromStart; /* Start position in chromosome */ unsigned chromEnd; /* End position in chromosome */ }; +enum bedParseOpts +/* boolean options to control parsing of BEDs */ +{ + BED_IS_CUSTOM_TRACK = 0x01, // less error checking for custom tracks + BED_ALLOW_1BP_OVERLAP = 0x02, // allow exons to overlap by at most one base pair + BED_FIX_SCORE = 0x04, // correct out-of-range or floating scores +}; + struct bed3 *bed3New(char *chrom, int start, int end); /* Make new bed3. */ void bed3Free(struct bed3 **pBed); /* Free up bed3 */ void bed3FreeList(struct bed3 **pList); /* Free a list of dynamically allocated bed3's */ struct bed3 *bed3LoadAll(char *fileName); /* Load three columns from file as bed3. */ long long bed3TotalSize(struct bed3 *bedList); /* Return sum of chromEnd-chromStart. */ @@ -326,21 +334,25 @@ /* Return an autoSql definition for a bed of given number of fields. * Normally totalFieldCount is equal to bedFieldCount. If there are extra * fields they are just given the names field16, field17, etc and type string. */ boolean asCompareObjAgainstStandardBed(struct asObject *asYours, int numColumnsToCheck, boolean abortOnDifference); /* Compare user's .as object asYours to the standard BED. * abortOnDifference specifies whether to warn or abort if they differ within the first numColumnsToCheck columns. * Returns TRUE if they match. */ void loadAndValidateBed(char *row[], int wordCount, int fieldCount, struct lineFile *lf, struct bed * bed, struct asObject *as, boolean isCt); /* Convert a row of strings to a bed and validate the contents. Abort with message if invalid data. Optionally validate bedPlus via asObject. */ void loadAndValidateBedExt(char *row[], int bedFieldCount, int fieldCount, struct lineFile *lf, struct bed * bed, struct asObject *as, boolean isCt, boolean allow1bpOverlap); /* Convert a row of strings to a bed and validate the contents. Abort with message if invalid data. Optionally validate bedPlus via asObject. Possibly allow one base overlap in exons */ +void loadAndValidateBedOpts(char *row[], int bedFieldCount, int fieldCount, struct lineFile *lf, struct bed * bed, struct asObject *as, unsigned opts); +/* Convert a row of strings to a bed and validate the contents. Abort with message if invalid data. Optionally validate bedPlus via asObject. + * If a customTrack, then some errors are tolerated. Possibly allow exons to overlap by one base. */ + int itemRgbColumn(char *column9); /* Convert color specification to internal format. */ #define BAD_BLOCKS "BED blocks must span chromStart to chromEnd. (chromStart + blockStarts[last] + blockSizes[last]) must equal chromEnd." #endif /* BASICBED_H */