0b52ad3ec2c6113bfdd692a58fee812b7dd0a7b2 kent Fri Feb 4 20:47:27 2011 -0800 Getting Table Browser to handle BAM files. This is ready for testing by folks other than me now. Should work for both built-in BAM files and BAM files from track data hubs. I've tested it more though via the hubs. Works mostly by converting bam->sam->array-of-strings and then slotting into the same code bigBed processing uses. diff --git src/hg/hgTables/hgTables.h src/hg/hgTables/hgTables.h index ae18b6a..73d56de 100644 --- src/hg/hgTables/hgTables.h +++ src/hg/hgTables/hgTables.h @@ -154,30 +154,36 @@ /* Find selected track - from CGI variable if possible, else * via various defaults. */ struct trackDb *findTrack(char *name, struct trackDb *trackList); /* Find track, or return NULL if can't find it. */ struct trackDb *mustFindTrack(char *name, struct trackDb *trackList); /* Find track or squawk and die. */ struct asObject *asForTable(struct sqlConnection *conn, char *table); /* Get autoSQL description if any associated with table. */ struct asColumn *asColumnFind(struct asObject *asObj, char *name); /* Return named column. */ +struct slName *asColNames(struct asObject *as); +/* Get list of column names. */ + +struct sqlFieldType *sqlFieldTypesFromAs(struct asObject *as); +/* Convert asObject to list of sqlFieldTypes */ + char *connectingTableForTrack(char *rawTable); /* Return table name to use with all.joiner for track. * You can freeMem this when done. */ char *chromTable(struct sqlConnection *conn, char *table); /* Get chr1_table if it exists, otherwise table. * You can freeMem this when done. */ char *chrnTable(struct sqlConnection *conn, char *table); /* Return chrN_table if table is split, otherwise table. * You can freeMem this when done. */ char *getDbTable(char *db, char *table); /* If table already contains its real database as a dot-prefix, then * return a clone of table; otherwise alloc and return db.table . */ @@ -766,39 +772,70 @@ struct sqlFieldType *bigBedListFieldsAndTypes(char *table, struct sqlConnection *conn); /* Get fields of bigBed as list of sqlFieldType. */ struct bed *bigBedGetFilteredBedsOnRegions(struct sqlConnection *conn, char *db, char *table, struct region *regionList, struct lm *lm, int *retFieldCount); /* Get list of beds from bigBed, in all regions, that pass filtering. */ void bigBedTabOut(char *db, char *table, struct sqlConnection *conn, char *fields, FILE *f); /* Print out selected fields from Big Bed. If fields is NULL, then print out all fields. */ void showSchemaBigBed(char *table); /* Show schema on bigBed. */ +/* More stuff in bigBed.c that makes use of autoSql files. */ + +struct slName *asColNames(struct asObject *as); +/* Get list of column names. */ + +struct sqlFieldType *sqlFieldTypesFromAs(struct asObject *as); +/* Convert asObject to list of sqlFieldTypes */ + /* BAM stuff from bam.c */ +struct asObject *bamAsObj(); +/* Return asObject describing fields of BAM */ + boolean isBamTable(char *table); /* Return TRUE if table corresponds to a BAM file. */ char *bamFileName(char *table, struct sqlConnection *conn); /* Return file name associated with BAM. This handles differences whether it's * a custom or built-in track. Do a freeMem on returned string when done. */ +struct slName *bamGetFields(char *table); +/* Get fields of bam as simple name list. */ + +struct sqlFieldType *bamListFieldsAndTypes(); +/* Get fields of bigBed as list of sqlFieldType. */ + +struct hTableInfo *bamToHti(char *table); +/* Get standard fields of BAM into hti structure. */ + +void showSchemaBam(char *table); +/* Show schema on bam. */ + +void bamTabOut(char *db, char *table, struct sqlConnection *conn, char *fields, FILE *f); +/* Print out selected fields from BAM. If fields is NULL, then print out all fields. */ + +struct bed *bamGetFilteredBedsOnRegions(struct sqlConnection *conn, + char *db, char *table, struct region *regionList, struct lm *lm, + int *retFieldCount); +/* Get list of beds from BAM, in all regions, that pass filtering. */ + /* ----------- Custom track stuff. -------------- */ struct customTrack *getCustomTracks(); /* Get custom track list. */ struct customTrack *ctLookupName(char *name); /* Lookup name in custom track list */ void removeNamedCustom(struct customTrack **pList, char *name); /* Remove named custom track from list if it's on there. */ void flushCustomTracks(); /* Flush custom track list. */ struct slName *getBedFields(int fieldCount); /* Get list of fields for bed of given size. */