33990deeb6214328424d9acf9bfaf667ae8f3f4f angie Wed Mar 28 15:34:14 2012 -0700 Feature #6152 (Variant Annotation Tool): Added annoStreamWig and annoGrateWig,which led to some significant changes: annoRow is now polymorphic (words[] vs. wig float[]), annoFilter has a new function to apply filter(s) to a single number, and annoFormatTab can print out per-base wiggle values or average wiggle values (hardcoded to do per-base until a real config option is added). One puny test case was verified against mysql & table browser output. diff --git src/inc/annoRow.h src/inc/annoRow.h index cd3ff16..5d17590 100644 --- src/inc/annoRow.h +++ src/inc/annoRow.h @@ -1,36 +1,45 @@ /* annoRow -- basic data interchange unit of annoGratorQuery framework. */ #ifndef ANNOROW_H #define ANNOROW_H #include "common.h" +enum annoRowType { arWords, arWig }; + struct annoRow /* Representation of a row from a database table or file. The chrom, start and end - * facilitate intersection by position. The words correspond to columns in the autoSql - * definition provided by the source of the annoRow. rightJoinFail is true if this row - * failed a filter marked as rightJoin, meaning it can knock out the primary row (see - * annoFilter.h). */ + * facilitate intersection by position. If type is arWords, then data is an array + * of strings corresponding to columns in the autoSql definition provided by the + * source of the annoRow. If type is arWig, then data is an array of floats. + * rightJoinFail is true if this row failed a filter marked as rightJoin, meaning it + * can knock out the primary row (see annoFilter.h). */ { struct annoRow *next; char *chrom; uint start; uint end; - char **words; + void *data; + enum annoRowType type; boolean rightJoinFail; }; struct annoRow *annoRowFromStringArray(char *chrom, uint start, uint end, boolean rightJoinFail, char **wordsIn, int numCols); -/* Allocate & return an annoRow with words cloned from wordsIn. */ +/* Allocate & return an annoRow with data cloned from wordsIn. */ + +struct annoRow *annoRowWigNew(char *chrom, uint start, uint end, boolean rightJoinFail, + float *values); +/* Allocate & return an annoRowWig, with clone of values; length of values is (end-start). */ struct annoRow *annoRowClone(struct annoRow *rowIn, int numCols); -/* Allocate & return a single annoRow cloned from rowIn. */ +/* Allocate & return a single annoRow cloned from rowIn. + * numCols is used only if rowIn->type is arWords. */ void annoRowFree(struct annoRow **pRow, int numCols); /* Free a single annoRow. */ void annoRowFreeList(struct annoRow **pList, int numCols); /* Free a list of annoRows. */ #endif//ndef ANNOROW_H