9cc4ce16befd7694963bdb46b6e9b4d28a6930cc hiram Thu Apr 6 14:29:04 2023 -0700 adding endpoint /list/files function to list hgdownload files refs #23589 diff --git src/hg/hubApi/dataApi.h src/hg/hubApi/dataApi.h index 2df6d40..f187252 100644 --- src/hg/hubApi/dataApi.h +++ src/hg/hubApi/dataApi.h @@ -21,35 +21,39 @@ #include "hPrint.h" #include "bigWig.h" #include "hubConnect.h" #include "obscure.h" #include "errCatch.h" #include "vcf.h" #include "bedTabix.h" #include "bamFile.h" #include "jsonParse.h" #include "jsonWrite.h" #include "chromInfo.h" #include "wiggle.h" #include "hubPublic.h" #include "cartTrackDb.h" #include "chromAlias.h" +#include "pipeline.h" #ifdef USE_HAL #include "halBlockViz.h" #endif +/* test name for matching a GenArk hub genome name */ +#define isGenArk(name) (startsWith("GCA_", name) || startsWith("GCF_", name)) + /* reference for these error codes: * https://www.restapitutorial.com/httpstatuscodes.html */ /* error return codes */ #define err206 206 #define err206Msg "Partial Content" #define err301 301 #define err301Msg "Moved Permanently" #define err400 400 #define err400Msg "Bad Request" #define err403 403 #define err403Msg "Forbidden" #define err404 404 #define err404Msg "Not Found" #define err415 415 @@ -69,30 +73,31 @@ #define argEnd "end" #define argMaxItemsOutput "maxItemsOutput" #define argJsonOutputArrays "jsonOutputArrays" #define argCategories "categories" #define argSearchTerm "search" /* valid argument listings to verify extraneous arguments * initialized in hubApi.c */ extern char *argListPublicHubs[]; extern char *argListUcscGenomes[]; extern char *argListHubGenomes[]; extern char *argListTracks[]; extern char *argListChromosomes[]; extern char *argListSchema[]; +extern char *argListFiles[]; extern char *argGetDataTrack[]; extern char *argGetDataSequence[]; extern char *argSearch[]; /* maximum number of words expected in PATH_INFO parsing * so far only using 2 */ #define MAX_PATH_INFO 32 /* maximum amount of DNA allowed in a get sequence request */ #define MAX_DNA_LENGTH 499999999 /* this size is directly related to the max limit in needMem used in * jsonWriteString */ @@ -225,30 +230,39 @@ #define trackHasNoData(tdb) (!trackHasData(tdb)) boolean protectedTrack(char *db, struct trackDb *tdb, char *trackName); /* determine if track is off-limits protected data */ boolean isWiggleDataTable(char *type); /* is this a wiggle data track table */ char *chrOrAlias(char *db, char *hubUrl); /* get incoming chr name, may be an alias, return the native chr name */ void hubAliasSetup(struct trackHubGenome *hubGenome); /* see if this hub has an alias file and run chromAliasSetupBb() for it */ +char *genArkPath(char *genome); +/* given a GenArk hub genome name, e.g. GCA_021951015.1 return the path: + * GCA/021/951/015/GCA_021951015.1 + * prefix that with desired server URL: https://hgdownload.soe.ucsc.edu/hubs/ + * if desired. Or suffix add /hub.txt to get the hub.txt URL + * + * already been proven that genome is a GCx_ name prefix before calling + */ + /* ######################################################################### */ /* functions in getData.c */ void apiGetData(char *words[MAX_PATH_INFO]); /* 'getData' function, words[1] is the subCommand */ /* ######################################################################### */ /* functions in list.c */ void apiList(char *words[MAX_PATH_INFO]); /* 'list' function words[1] is the subCommand */ /* ######################################################################### */ /* functions in search.c */