f33e484c4ccf75d8c34fde7c52d84d0299026a0d lrnassar Thu May 16 15:47:51 2019 -0700 Adding additional example to api #18869 diff --git src/hg/htdocs/goldenPath/help/api.html src/hg/htdocs/goldenPath/help/api.html index 10eddad..bfa2a48 100755 --- src/hg/htdocs/goldenPath/help/api.html +++ src/hg/htdocs/goldenPath/help/api.html @@ -254,33 +254,30 @@
api.genome.ucsc.edu/getData/track?genome=galGal6;track=gc5BaseBw;maxItemsOutput=100
  • 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://hgdownload.soe.ucsc.edu/hubs/mouseStrains/hub.txt;genome=CAST_EiJ;track=assembly;chrom=chrI;start=43521;end=54321
    2. -
    3. Request track data with over 1M items, return first 1M and flag maxItemsLimit:true - -
      api.genome.ucsc.edu/getData/track?genome=hg19;track=knownGene
    4. Request track data from a restricted track. See FAQ -
      api.genome.ucsc.edu/getData/track?genome=hg19;track=decipherSnvs

    Practical examples

    Looking up the schema of a specific track

    @@ -307,16 +304,62 @@ output can be compared to the second link to see the difference. This can be observed in the conservation track. In the first link, the multiz20way track is nested within the cons20way track. In the second link, however, the multiz20way subtrack is seen at an equivelant level with all other tracks, and the container, cons20way, is not present in the list.

    Request available tracks in the rn6 genome -
    api.genome.ucsc.edu/list/tracks?genome=rn6

    Request available tracks in the rn6 genome, hiding container information -
    api.genome.ucsc.edu/list/tracks?genome=rn6;trackLeavesOnly=1

    +

    Requesting track data with over one million (1M) items in output

    + +

    +Certain tracks may contain over 1M items. When these tracks are queried using the +/getData/track function, only the first million items are returned. The API assumes +this default value of 1M unless a different value (less than 1M) is specified in the +parameter maxItemsOutput.

    + +

    +One of these tracks is the knownGene track for hg19. Removing the maxItemsOutput +parameter from the following link will lead to a 384Mb download, and may cause certain +web browsers to time out.

    + +

    +Request items in knownGene track of hg19, remove maxItemsOutput parameter for 1M max return - +
    api.genome.ucsc.edu/getData/track?genome=hg19;track=knownGene;maxItemsOutput=5

    + +

    +There are different ways around this item limit, depending on how many items are in the track. For +the knownGene track, breaking it down to component chromosome queries using the chrom +parameter will suffice. In order to get a listing of the chrom names, and what chroms have data +for that track, the /list/chromosomes function can be used.

    + +

    +Request listing of chroms that have data for the knownGene track in hg19 - +
    api.genome.ucsc.edu/list/chromosomes?genome=hg19;track=knownGene

    + +

    +With the list of chrom names that have data, the /getData/track function can be used +again while specifying the chrom parameter. In the following example chr1 is queried +and the itemsReturned field shows a total of 7967 items in the output. Well below the +1M limit, meaning all data for chr1 has been extracted. This can then be repeated for all +chroms of interest.

    + +

    +Request iems in knownGene track of hg19, only for chr1 - +
    api.genome.ucsc.edu/getData/track?genome=hg19;track=knownGene;chrom=chr1

    + +

    +For tracks that have additional items, such as SNP tracks, the query can be further broken +down using the additional start and end parameters.

    + +