438e3f1d32b858255405c7bb3fccb7190d06fca1 hiram Sun Apr 28 13:12:25 2019 -0700 eliminating the db= argument everywhere, only need genome= refs #18869 diff --git src/hg/htdocs/goldenPath/help/api.html src/hg/htdocs/goldenPath/help/api.html index 413bf32..b52332a 100755 --- src/hg/htdocs/goldenPath/help/api.html +++ src/hg/htdocs/goldenPath/help/api.html @@ -1,207 +1,203 @@

JSON API data interface

Contents

What is JSON data ?
What is the access URL ?
What type of data can be accessed ?
Endpoint functions
Parameters to endpoint functions
Required and optional parameters
Supported track types
Example data access, list functions
Example data access, getData functions
Error return examples

What is JSON data ?

JSON data is a data transfer syntax from a data provider to a data consumer. See also: JSON Introduction

What is the access URL ?

This access url: https://api-test.gi.ucsc.edu/ is used to access the endpoint functions. For example:

     wget -O- 'https://api-test.gi.ucsc.edu/list/publicHubs'
 

What type of data can be accessed ?

The following data sets can be accessed at this time:

Endpoint functions to return data

Use the url: https://api-test.gi.ucsc.edu/ is access the endpoint functions. For example:

     wget -O- 'https://api-test.gi.ucsc.edu/list/publicHubs'
 

Parameters to endpoint functions

The parameters are added to the endpoint URL beginning with a question mark ?, and multiple parameters are separated with the semi-colon ;. For example:

-https://api-test.gi.ucsc.edu/getData/sequence?db=ce11;chrom=chrM
+https://api-test.gi.ucsc.edu/getData/sequence?genome=ce11;chrom=chrM
 

Required and optional parameters

- - - - + + + +
Endpoint functionRequiredOptional
/list/publicHubs(none)(none)
/list/ucscGenomes(none)(none)
/list/hubGenomeshubUrl(none)
/list/tracks(hubUrl and genome) or dbtrackLeavesOnly=1
/list/chromosomes((hubUrl and genome) or db) and track(none)
/getData/sequence((hubUrl and genome) or db) and chromstart and end
/getData/track((hubUrl and genome) or db) and trackchrom, (start and end), maxItemsOutput, jsonOutputArrays
/list/tracksgenome or (hubUrl and genome)trackLeavesOnly=1
/list/chromosomesgenome or (hubUrl and genome)track
/getData/sequence(genome or (hubUrl and genome)) and chromstart and end
/getData/track(genome or (hubUrl and genome)) and trackchrom, (start and end), maxItemsOutput, jsonOutputArrays

The hubUrl and genome parameters are required together to specify a unique genome in an assembly or track hub. The genome for a track hub will usually be a UCSC database genome. Assembly hubs will -have their own unique genome sequences. -

-

-When not an assembly or track hub, to access UCSC database assemblies, -the parameter db=<name> is required. +have their own unique genome sequences. Specify genome without +a hubUrl to refer to a UCSC genome browser assembly.

Using the chrom=<name> parameter will limit the request to the single specified chromosome. To limit the request to a specific position, both start=4321 and end=5678 must be given together.

Supported track types, at this time (April 2019), for getData functions

Example data access

Listing functions

  1. list public hubs - api.genome.ucsc.edu/list/publicHubs
  2. list UCSC database genomes - api.genome.ucsc.edu/list/ucscGenomes
  3. list genomes from specified hub - api.genome.ucsc.edu/list/hubGenomes?hubUrl=http://genome-test.gi.ucsc.edu/~hiram/hubs/Plants/hub.txt
  4. list tracks from specified hub and genome - api.genome.ucsc.edu/list/tracks?hubUrl=http://genome-test.gi.ucsc.edu/~hiram/hubs/Plants/hub.txt;genome=_araTha1
  5. -
  6. list tracks from UCSC database genome - api.genome.ucsc.edu/list/tracks?db=ce11
  7. -
  8. list chromosomes from UCSC database genome - api.genome.ucsc.edu/list/chromosomes?db=ce11
  9. -
  10. list chromosomes from specified track in UCSC database genome - api.genome.ucsc.edu/list/chromosomes?db=ce11;track=gold
  11. +
  12. list tracks from UCSC database genome - api.genome.ucsc.edu/list/tracks?genome=ce11
  13. +
  14. list chromosomes from UCSC database genome - api.genome.ucsc.edu/list/chromosomes?genome=ce11
  15. +
  16. list chromosomes from specified track in UCSC database genome - api.genome.ucsc.edu/list/chromosomes?genome=ce11;track=gold
  17. list chromosomes from assembly hub genome -
    api.genome.ucsc.edu/list/chromosomes?hubUrl=http://genome-test.gi.ucsc.edu/~hiram/hubs/Plants/hub.txt;genome=_araTha1
  18. list chromosomes from specified track in assembly hub genome -
    api.genome.ucsc.edu/list/chromosomes?hubUrl=http://genome-test.gi.ucsc.edu/~hiram/hubs/Plants/hub.txt;genome=_araTha1;track=assembly_

getData functions

    -
  1. Get DNA sequence from specified chromosome in UCSC database genome -
    api.genome.ucsc.edu/getData/sequence?db=ce11;chrom=chrM
  2. -
  3. Get DNA sequence from specified chromosome and start,end coordinates in UCSC database genome -
    api.genome.ucsc.edu/getData/sequence?db=ce11;chrom=chrM;start=4321;end=5678
  4. +
  5. Get DNA sequence from specified chromosome in UCSC database genome -
    api.genome.ucsc.edu/getData/sequence?genome=ce11;chrom=chrM
  6. +
  7. Get DNA sequence from specified chromosome and start,end coordinates in UCSC database genome -
    api.genome.ucsc.edu/getData/sequence?genome=ce11;chrom=chrM;start=4321;end=5678
  8. Get DNA sequence from a track hub where 'genome' is a UCSC database -
    api.genome.ucsc.edu/getData/sequence?hubUrl=http://genome-test.gi.ucsc.edu/~hiram/hubs/GillBejerano/hub.txt;genome=hg19;chrom=chrM;start=4321;end=5678
  9. Get DNA sequence from specified chromosome and start,end coordinates in an assembly hub genome -
    api.genome.ucsc.edu/getData/sequence?hubUrl=http://genome-test.gi.ucsc.edu/~hiram/hubs/Plants/hub.txt;genome=_araTha1;chrom=chrCp;start=4321;end=5678
  10. -
  11. Get track data for specified track in UCSC database genome -
    api.genome.ucsc.edu/getData/track?db=ce11;track=gold;maxItemsOutput=100
  12. -
  13. Get track data for specified track and chromosome in UCSC database genome -
    api.genome.ucsc.edu/getData/track?db=ce11;track=gold;chrom=chrM
  14. -
  15. Get track data for specified track, chromosome and start,end coordinates in UCSC database genome -
    api.genome.ucsc.edu/getData/track?db=ce11;track=gold;chrom=chrI;start=47000;end=48000
  16. +
  17. Get track data for specified track in UCSC database genome -
    api.genome.ucsc.edu/getData/track?genome=ce11;track=gold;maxItemsOutput=100
  18. +
  19. Get track data for specified track and chromosome in UCSC database genome -
    api.genome.ucsc.edu/getData/track?genome=ce11;track=gold;chrom=chrM
  20. +
  21. Get track data for specified track, chromosome and start,end coordinates in UCSC database genome -
    api.genome.ucsc.edu/getData/track?genome=ce11;track=gold;chrom=chrI;start=47000;end=48000
  22. Get track data for specified track in an assembly hub genome -
    api.genome.ucsc.edu/getData/track?hubUrl=http://genome-test.gi.ucsc.edu/~hiram/hubs/Plants/hub.txt;genome=_araTha1;track=assembly_
  23. Get track data for specified track and chromosome in an assembly hub genome -
    api.genome.ucsc.edu/getData/track?hubUrl=http://genome-test.gi.ucsc.edu/~hiram/hubs/Plants/hub.txt;genome=_araTha1;track=assembly_;chrom=chrCp
  24. Get track data for specified track in a track hub -
    api.genome.ucsc.edu/getData/track?hubUrl=http://genome-test.gi.ucsc.edu/~hiram/hubs/GillBejerano/hub.txt;genome=hg19;track=ultraConserved
  25. Get track data for specified track and chromosome in a track hub -
    api.genome.ucsc.edu/getData/track?hubUrl=http://genome-test.gi.ucsc.edu/~hiram/hubs/GillBejerano/hub.txt;genome=hg19;track=ultraConserved;chrom=chr8
  26. Wiggle track data for specified track, chromosome with start and end limits in an assembly hub genome -
    api.genome.ucsc.edu/getData/track?hubUrl=http://genome-test.gi.ucsc.edu/~hiram/hubs/Plants/hub.txt;genome=_araTha1;track=assembly_;chrom=chrCp;start=4321;end=5678
  27. -
  28. Wiggle track data for specified track in a UCSC database genome -
    api.genome.ucsc.edu/getData/track?genome=galGal6;track=gc5BaseBw;maxItemsOutput=100
  29. -
  30. bigBed data from a UCSC database, chrom and start,end limits -
    api.genome.ucsc.edu/getData/track?genome=galGal6;track=ncbiRefSeqOther;chrom=chr1;start=750000;end=55700000
  31. +
  32. Wiggle track data for specified track in a UCSC database genome -
    api.genome.ucsc.edu/getData/track?genome=galGal6;track=gc5BaseBw;maxItemsOutput=100
  33. +
  34. bigBed data from a UCSC database, chrom and start,end limits -
    api.genome.ucsc.edu/getData/track?genome=galGal6;track=ncbiRefSeqOther;chrom=chr1;start=750000;end=55700000

Error return examples

  1. Request track data for non-existent chromosome in an assembly hub genome -
    api.genome.ucsc.edu/getData/track?hubUrl=http://genome-test.gi.ucsc.edu/~hiram/hubs/Plants/hub.txt;genome=_araTha1;track=assembly_;chrom=chrI;start=43521;end=54321