c8ca88c9c4552b413376e7cf2a5b84100793b88b hiram Fri Sep 30 15:26:43 2022 -0700 allow chromInfo to read from URL refs #29819 diff --git src/hg/lib/chromInfo.c src/hg/lib/chromInfo.c index e02fe89..5c307f4 100644 --- src/hg/lib/chromInfo.c +++ src/hg/lib/chromInfo.c @@ -1,29 +1,29 @@ /* chromInfo.c was originally generated by the autoSql program, which also * generated chromInfo.h and chromInfo.sql. This module links the database and * the RAM representation of objects. */ /* Copyright (C) 2014 The Regents of the University of California * See kent/LICENSE or http://genome.ucsc.edu/license/ for licensing information. */ #include "common.h" #include "linefile.h" #include "dystring.h" #include "jksql.h" #include "hdb.h" #include "chromInfo.h" - +#include "net.h" void chromInfoStaticLoad(char **row, struct chromInfo *ret) /* Load a row from chromInfo table into ret. The contents of ret will * be replaced at the next call to this function. */ { ret->chrom = row[0]; ret->size = sqlUnsigned(row[1]); ret->fileName = row[2]; } struct chromInfo *chromInfoLoad(char **row) /* Load a chromInfo from row fetched with select * from chromInfo * from database. Dispose of this with chromInfoFree(). */ { @@ -241,31 +241,35 @@ * Dispose of this with chromInfoFree(). */ { struct chromInfo *ret; AllocVar(ret); ret->chrom = cloneString(row[0]); ret->size = sqlUnsigned(row[1]); ret->fileName = NULL; // note only name and size supported return ret; } struct chromInfo *chromInfoListFromFile(char *fileName) /* read chrom info from file and return list of name and size */ { struct chromInfo *list = NULL, *el; -struct lineFile *lf = lineFileOpen(fileName, TRUE); +struct lineFile *lf = NULL; +if (udcIsLocal(fileName)) + lf = lineFileOpen(fileName, TRUE); +else + lf = netLineFileOpen(fileName); char *row[2]; while (lineFileRow(lf, row)) { el = chromInfoAddOneFromFile(row); slAddHead(&list, el); } lineFileClose(&lf); slReverse(&list); return list; } struct hash *chromHashFromFile(char *fileName) /* read chrom info from file and return hash of name and size */