struct genePred *loadGenes(int numGenePreds, char **genePredFiles) /* load and sort genes */ { int i; struct genePred *genes = NULL; for (i = 0; i < numGenePreds; i++) genes = slCat(genes, genePredReaderLoadFile(genePredFiles[i], NULL)); slSort(&genes, genePredCmp); return genes; }
void genePredToGtf(char *database, char *table, char *gtfOut) /* genePredToGtf - Convert genePredName table or file to gtf.. */ { FILE *f = mustOpen(gtfOut, "w"); struct hash *dupeHash = newHash(16); struct genePred *gpList = NULL, *gp = NULL; if (sameString(database, "file")) { gpList = genePredReaderLoadFile(table, NULL); } else { struct sqlConnection *conn = sqlConnect(database); gpList = genePredReaderLoadQuery(conn, table, NULL); sqlDisconnect(&conn); } for (gp = gpList; gp != NULL; gp = gp->next) genePredWriteToGtf(gp, source, dupeHash, f); carefulClose(&f); }
void mafGene(char *dbName, char *mafTable, char *geneTable, char *speciesList, char *outName) /* mafGene - output protein alignments using maf and genePred. */ { struct slName *speciesNames = readList(speciesList); FILE *f = mustOpen(outName, "w"); struct genePred *list = NULL; if (geneList != NULL) { struct slName *geneNames = readList(geneList); for(; geneNames; geneNames = geneNames->next) { struct genePred *pred = getPredsForName(geneNames->name, geneTable, dbName); if (pred != NULL) slCat(&list, pred); } } else if (useFile) /* Read genePreds from a file passed instead of a table */ list = genePredReaderLoadFile(geneTable, NULL); else if (geneName != NULL) list = getPredsForName(geneName, geneTable, dbName); else if (geneBeds != NULL) list = getPredsFromBeds(geneBeds, geneTable, dbName); else list = queryPreds(dbName, geneTable); for(; list; list = list->next) { verbose(2, "outting gene %s \n",list->name); outGenePred(f, list, dbName, mafTable, geneTable, speciesNames); if (delay) { verbose(2, "delaying %d seconds\n",delay); sleep(delay); } } }