549dcd456f5d557e15426176e487f91246363548 kate Mon Apr 10 17:21:22 2017 -0700 Better integration with bigBed cod. Fixes loading problem and allows labelFields code to operate (not yet tested). refs #18736 diff --git src/hg/inc/barChartBed.h src/hg/inc/barChartBed.h index ffde0f5..24a8a6d 100644 --- src/hg/inc/barChartBed.h +++ src/hg/inc/barChartBed.h @@ -1,92 +1,95 @@ /* barChartBed.h was originally generated by the autoSql program, which also * generated barChartBed.c and barChartBed.sql. This header links the database and * the RAM representation of objects. */ #ifndef BARCHARTBED_H #define BARCHARTBED_H #include "jksql.h" #define BARCHARTBED_NUM_COLS 8 extern char *barChartBedCommaSepFieldNames; -// TODO: add fields for description and unique identifier/name - struct barChartBed /* BED6+ with additional fields for category count and values */ { struct barChartBed *next; /* Next in singly linked list. */ char *chrom; /* Reference sequence chromosome or scaffold */ unsigned chromStart; /* Start position in chromosome */ unsigned chromEnd; /* End position in chromosome */ char *name; /* Item identifier */ unsigned score; /* Score from 0-1000; derived from total median all categories (log-transformed and scaled) */ char strand[2]; /* + or - for strand */ unsigned expCount; /* Number of categories */ float *expScores; /* Comma separated list of category values */ }; struct barChartBed *barChartBedLoadByQuery(struct sqlConnection *conn, char *query); /* Load all barChartBed from table that satisfy the query given. * Where query is of the form 'select * from example where something=something' * or 'select example.* from example, anotherTable where example.something = * anotherTable.something'. * Dispose of this with barChartBedFreeList(). */ void barChartBedSaveToDb(struct sqlConnection *conn, struct barChartBed *el, char *tableName, int updateSize); /* Save barChartBed as a row to the table specified by tableName. * As blob fields may be arbitrary size updateSize specifies the approx size * of a string that would contain the entire query. Arrays of native types are * converted to comma separated strings and loaded as such, User defined types are * inserted as NULL. This function automatically escapes quoted strings for mysql. */ struct barChartBed *barChartBedLoad(char **row); /* Load a barChartBed from row fetched with select * from barChartBed * from database. Dispose of this with barChartBedFree(). */ struct barChartBed *barChartBedLoadAll(char *fileName); /* Load all barChartBed from whitespace-separated file. * Dispose of this with barChartBedFreeList(). */ struct barChartBed *barChartBedLoadAllByChar(char *fileName, char chopper); /* Load all barChartBed from chopper separated file. * Dispose of this with barChartBedFreeList(). */ #define barChartBedLoadAllByTab(a) barChartBedLoadAllByChar(a, '\t'); /* Load all barChartBed from tab separated file. * Dispose of this with barChartBedFreeList(). */ struct barChartBed *barChartBedCommaIn(char **pS, struct barChartBed *ret); /* Create a barChartBed out of a comma separated string. * This will fill in ret if non-null, otherwise will * return a new barChartBed */ void barChartBedFree(struct barChartBed **pEl); /* Free a single dynamically allocated barChartBed such as created * with barChartBedLoad(). */ void barChartBedFreeList(struct barChartBed **pList); /* Free a list of dynamically allocated barChartBed's */ void barChartBedOutput(struct barChartBed *el, FILE *f, char sep, char lastSep); /* Print out barChartBed. Separate fields with sep. Follow last field with lastSep. */ #define barChartBedTabOut(el,f) barChartBedOutput(el,f,'\t','\n'); /* Print out barChartBed as a line in a tab-separated file. */ #define barChartBedCommaOut(el,f) barChartBedOutput(el,f,',',','); /* Print out barChartBed as a comma separated list including final comma. */ /* -------------------------------- End autoSql Generated Code -------------------------------- */ void barChartBedCreateTable(struct sqlConnection *conn, char *table); /* Create barChart format table of given name. */ -float barChartTotalValue(struct barChartBed *bed); +struct bed *barChartSimpleBedLoad(char **row); +/* Load a bed from row containing barChart bed fields. + * This is reuses autoSql barChartBedLoad, but with a full-size bed. + Dispose of this with bedFree() */ + +float barChartTotalValue(struct bed *bed); /* Return total of all category values */ -float barChartHighestValue(struct barChartBed *bed, int *categIdRet); +float barChartMaxValue(struct bed *bed, int *categIdRet); /* Return value and id of category with highest value for this item */ #endif /* BARCHARTBED_H */