POST ga4gh/callsets/search

Return a list of sets of genotype calls for specific samples in GA4GH format

Parameters

Required

NameTypeDescriptionDefaultExample Values
variantSetId String Return callSets for a specific variant set - 1

Optional

NameTypeDescriptionDefaultExample Values
callback String Name of the callback subroutine to be returned by the requested JSONP response. Required ONLY when using JSONP as the serialisation method. Please see the user guide. - randomlygeneratedname
name String Return callSets by name - NA19777
pageSize Int Number of callSets to return per request 10 -
pageToken Int Identifier showing which page of data to retrieve next null -

Message

Content-typeFormatExample
application/json{ "variantSetId": string, "name":string, "pageToken": string, "pageSize": long }{ "variantSetId": 1, "pageSize": 3, "name": "HG00099" }

Example Requests

/ga4gh/callsets/search


 {
  "callSets": [
    {
      "created": 1432745640000,
      "updated": 1432745640000,
      "name": "HG00096",
      "variantSetIds": [
        "1"
      ],
      "sampleId": "HG00096",
      "info": {
        "assembly_version": [
          "GRCh38"
        ],
        "variantSetName": [
          "1000 Genomes phase3"
        ]
      },
      "id": "1:HG00096"
    },
    {
      "updated": 1432745640000,
      "created": 1432745640000,
      "id": "1:HG00097",
      "info": {
        "variantSetName": [
          "1000 Genomes phase3"
        ],
        "assembly_version": [
          "GRCh38"
        ]
      },
      "sampleId": "HG00097",
      "variantSetIds": [
        "1"
      ],
      "name": "HG00097"
    }
  ],
  "nextPageToken": 2
}
{ "variantSetId": 1, "pageSize": 2  }
        
  1. use strict;
  2. use warnings;
  3.  
  4. use HTTP::Tiny;
  5.  
  6. my $http = HTTP::Tiny->new();
  7.  
  8. my $server = 'https://jan2020.rest.ensembl.org';
  9. my $ext = '/ga4gh/callsets/search';
  10. my $response = $http->request('POST', $server.$ext, {
  11. headers => {
  12. 'Content-type' => 'application/json',
  13. 'Accept' => 'application/json'
  14. },
  15. content => '{ "variantSetId": 1, "pageSize": 2 }'
  16. });
  17.  
  18. die "Failed!\n" unless $response->{success};
  19.  
  20.  
  21. use JSON;
  22. use Data::Dumper;
  23. if(length $response->{content}) {
  24. my $hash = decode_json($response->{content});
  25. local $Data::Dumper::Terse = 1;
  26. local $Data::Dumper::Indent = 1;
  27. print Dumper $hash;
  28. print "\n";
  29. }
  30.  
  1. import requests, sys
  2.  
  3. server = "https://jan2020.rest.ensembl.org"
  4. ext = "/ga4gh/callsets/search"
  5. headers={ "Content-Type" : "application/json", "Accept" : "application/json"}
  6. r = requests.post(server+ext, headers=headers, data='{ "variantSetId": 1, "pageSize": 2 }')
  7.  
  8. if not r.ok:
  9. r.raise_for_status()
  10. sys.exit()
  11.  
  12. decoded = r.json()
  13. print repr(decoded)
  14.  
  1. import requests, sys
  2.  
  3. server = "https://jan2020.rest.ensembl.org"
  4. ext = "/ga4gh/callsets/search"
  5. headers={ "Content-Type" : "application/json", "Accept" : "application/json"}
  6. r = requests.post(server+ext, headers=headers, data='{ "variantSetId": 1, "pageSize": 2 }')
  7.  
  8. if not r.ok:
  9. r.raise_for_status()
  10. sys.exit()
  11.  
  12. decoded = r.json()
  13. print(repr(decoded))
  14.  
  1. require 'net/http'
  2. require 'uri'
  3.  
  4. server='https://jan2020.rest.ensembl.org'
  5. path = '/ga4gh/callsets/search'
  6.  
  7. url = URI.parse(server)
  8. http = Net::HTTP.new(url.host, url.port)
  9.  
  10. request = Net::HTTP::Post.new(path, {'Content-Type' => 'application/json', 'Accept' => 'application/json'})
  11. request.body = '{ "variantSetId": 1, "pageSize": 2 }'
  12.  
  13. response = http.request(request)
  14.  
  15. if response.code != "200"
  16. puts "Invalid response: #{response.code}"
  17. puts response.body
  18. exit
  19. end
  20.  
  21.  
  22. require 'rubygems'
  23. require 'json'
  24. require 'yaml'
  25.  
  26. result = JSON.parse(response.body)
  27. puts YAML::dump(result)
  28.  
  1. import java.net.URL;
  2. import java.net.URLConnection;
  3. import java.net.HttpURLConnection;
  4. import java.io.BufferedReader;
  5. import java.io.InputStream;
  6. import java.io.InputStreamReader;
  7. import java.io.IOException;
  8. import java.io.Reader;
  9. import java.io.DataOutputStream;
  10.  
  11.  
  12. public class EnsemblRest {
  13.  
  14. public static void main(String[] args) throws Exception {
  15. String server = "https://jan2020.rest.ensembl.org";
  16. String ext = "/ga4gh/callsets/search";
  17. URL url = new URL(server + ext);
  18.  
  19. URLConnection connection = url.openConnection();
  20. HttpURLConnection httpConnection = (HttpURLConnection)connection;
  21. String postBody = "{ \"variantSetId\": 1, \"pageSize\": 2 }";
  22. httpConnection.setRequestMethod("POST");
  23. httpConnection.setRequestProperty("Content-Type", "application/json");
  24. httpConnection.setRequestProperty("Accept", "application/json");
  25. httpConnection.setRequestProperty("Content-Length", Integer.toString(postBody.getBytes().length));
  26. httpConnection.setUseCaches(false);
  27. httpConnection.setDoInput(true);
  28. httpConnection.setDoOutput(true);
  29.  
  30. DataOutputStream wr = new DataOutputStream(httpConnection.getOutputStream());
  31. wr.writeBytes(postBody);
  32. wr.flush();
  33. wr.close();
  34.  
  35. InputStream response = connection.getInputStream();
  36. int responseCode = httpConnection.getResponseCode();
  37.  
  38. if(responseCode != 200) {
  39. throw new RuntimeException("Response code was not 200. Detected response was "+responseCode);
  40. }
  41.  
  42. String output;
  43. Reader reader = null;
  44. try {
  45. reader = new BufferedReader(new InputStreamReader(response, "UTF-8"));
  46. StringBuilder builder = new StringBuilder();
  47. char[] buffer = new char[8192];
  48. int read;
  49. while ((read = reader.read(buffer, 0, buffer.length)) > 0) {
  50. builder.append(buffer, 0, read);
  51. }
  52. output = builder.toString();
  53. }
  54. finally {
  55. if (reader != null) try {
  56. reader.close();
  57. } catch (IOException logOrIgnore) {
  58. logOrIgnore.printStackTrace();
  59. }
  60. }
  61.  
  62. System.out.println(output);
  63. }
  64. }
  65.  
  1. library(httr)
  2. library(jsonlite)
  3. library(xml2)
  4.  
  5. server <- "https://jan2020.rest.ensembl.org"
  6. ext <- "/ga4gh/callsets/search"
  7. r <- POST(paste(server, ext, sep = ""), content_type("application/json"), accept("application/json"), body = '{ "variantSetId": 1, "pageSize": 2 }')
  8.  
  9. stop_for_status(r)
  10.  
  11. # use this if you get a simple nested list back, otherwise inspect its structure
  12. # head(data.frame(t(sapply(content(r),c))))
  13. head(fromJSON(toJSON(content(r))))
  14.  
  1. curl 'https://jan2020.rest.ensembl.org/ga4gh/callsets/search' -H 'Content-type:application/json' \
  2. -H 'Accept:application/json' -X POST -d '{ "variantSetId": 1, "pageSize": 2 }'
  3.  
  1. wget -q --header='Content-type:application/json' --header='Accept:application/json' \
  2. --post-data='{ "variantSetId": 1, "pageSize": 2 }' \
  3. 'https://jan2020.rest.ensembl.org/ga4gh/callsets/search' -O -
  4.  

/ga4gh/callsets/search


{ "variantSetId": 1, "pageSize": 3, "name": "HG00099" }
        
  1. use strict;
  2. use warnings;
  3.  
  4. use HTTP::Tiny;
  5.  
  6. my $http = HTTP::Tiny->new();
  7.  
  8. my $server = 'https://jan2020.rest.ensembl.org';
  9. my $ext = '/ga4gh/callsets/search';
  10. my $response = $http->request('POST', $server.$ext, {
  11. headers => {
  12. 'Content-type' => 'application/json',
  13. 'Accept' => 'application/json'
  14. },
  15. content => '{ "variantSetId": 1, "pageSize": 3, "name": "HG00099" }'
  16. });
  17.  
  18. die "Failed!\n" unless $response->{success};
  19.  
  20.  
  21. use JSON;
  22. use Data::Dumper;
  23. if(length $response->{content}) {
  24. my $hash = decode_json($response->{content});
  25. local $Data::Dumper::Terse = 1;
  26. local $Data::Dumper::Indent = 1;
  27. print Dumper $hash;
  28. print "\n";
  29. }
  30.  
  1. import requests, sys
  2.  
  3. server = "https://jan2020.rest.ensembl.org"
  4. ext = "/ga4gh/callsets/search"
  5. headers={ "Content-Type" : "application/json", "Accept" : "application/json"}
  6. r = requests.post(server+ext, headers=headers, data='{ "variantSetId": 1, "pageSize": 3, "name": "HG00099" }')
  7.  
  8. if not r.ok:
  9. r.raise_for_status()
  10. sys.exit()
  11.  
  12. decoded = r.json()
  13. print repr(decoded)
  14.  
  1. import requests, sys
  2.  
  3. server = "https://jan2020.rest.ensembl.org"
  4. ext = "/ga4gh/callsets/search"
  5. headers={ "Content-Type" : "application/json", "Accept" : "application/json"}
  6. r = requests.post(server+ext, headers=headers, data='{ "variantSetId": 1, "pageSize": 3, "name": "HG00099" }')
  7.  
  8. if not r.ok:
  9. r.raise_for_status()
  10. sys.exit()
  11.  
  12. decoded = r.json()
  13. print(repr(decoded))
  14.  
  1. require 'net/http'
  2. require 'uri'
  3.  
  4. server='https://jan2020.rest.ensembl.org'
  5. path = '/ga4gh/callsets/search'
  6.  
  7. url = URI.parse(server)
  8. http = Net::HTTP.new(url.host, url.port)
  9.  
  10. request = Net::HTTP::Post.new(path, {'Content-Type' => 'application/json', 'Accept' => 'application/json'})
  11. request.body = '{ "variantSetId": 1, "pageSize": 3, "name": "HG00099" }'
  12.  
  13. response = http.request(request)
  14.  
  15. if response.code != "200"
  16. puts "Invalid response: #{response.code}"
  17. puts response.body
  18. exit
  19. end
  20.  
  21.  
  22. require 'rubygems'
  23. require 'json'
  24. require 'yaml'
  25.  
  26. result = JSON.parse(response.body)
  27. puts YAML::dump(result)
  28.  
  1. import java.net.URL;
  2. import java.net.URLConnection;
  3. import java.net.HttpURLConnection;
  4. import java.io.BufferedReader;
  5. import java.io.InputStream;
  6. import java.io.InputStreamReader;
  7. import java.io.IOException;
  8. import java.io.Reader;
  9. import java.io.DataOutputStream;
  10.  
  11.  
  12. public class EnsemblRest {
  13.  
  14. public static void main(String[] args) throws Exception {
  15. String server = "https://jan2020.rest.ensembl.org";
  16. String ext = "/ga4gh/callsets/search";
  17. URL url = new URL(server + ext);
  18.  
  19. URLConnection connection = url.openConnection();
  20. HttpURLConnection httpConnection = (HttpURLConnection)connection;
  21. String postBody = "{ \"variantSetId\": 1, \"pageSize\": 3, \"name\": \"HG00099\" }";
  22. httpConnection.setRequestMethod("POST");
  23. httpConnection.setRequestProperty("Content-Type", "application/json");
  24. httpConnection.setRequestProperty("Accept", "application/json");
  25. httpConnection.setRequestProperty("Content-Length", Integer.toString(postBody.getBytes().length));
  26. httpConnection.setUseCaches(false);
  27. httpConnection.setDoInput(true);
  28. httpConnection.setDoOutput(true);
  29.  
  30. DataOutputStream wr = new DataOutputStream(httpConnection.getOutputStream());
  31. wr.writeBytes(postBody);
  32. wr.flush();
  33. wr.close();
  34.  
  35. InputStream response = connection.getInputStream();
  36. int responseCode = httpConnection.getResponseCode();
  37.  
  38. if(responseCode != 200) {
  39. throw new RuntimeException("Response code was not 200. Detected response was "+responseCode);
  40. }
  41.  
  42. String output;
  43. Reader reader = null;
  44. try {
  45. reader = new BufferedReader(new InputStreamReader(response, "UTF-8"));
  46. StringBuilder builder = new StringBuilder();
  47. char[] buffer = new char[8192];
  48. int read;
  49. while ((read = reader.read(buffer, 0, buffer.length)) > 0) {
  50. builder.append(buffer, 0, read);
  51. }
  52. output = builder.toString();
  53. }
  54. finally {
  55. if (reader != null) try {
  56. reader.close();
  57. } catch (IOException logOrIgnore) {
  58. logOrIgnore.printStackTrace();
  59. }
  60. }
  61.  
  62. System.out.println(output);
  63. }
  64. }
  65.  
  1. library(httr)
  2. library(jsonlite)
  3. library(xml2)
  4.  
  5. server <- "https://jan2020.rest.ensembl.org"
  6. ext <- "/ga4gh/callsets/search"
  7. r <- POST(paste(server, ext, sep = ""), content_type("application/json"), accept("application/json"), body = '{ "variantSetId": 1, "pageSize": 3, "name": "HG00099" }')
  8.  
  9. stop_for_status(r)
  10.  
  11. # use this if you get a simple nested list back, otherwise inspect its structure
  12. # head(data.frame(t(sapply(content(r),c))))
  13. head(fromJSON(toJSON(content(r))))
  14.  
  1. curl 'https://jan2020.rest.ensembl.org/ga4gh/callsets/search' -H 'Content-type:application/json' \
  2. -H 'Accept:application/json' -X POST -d '{ "variantSetId": 1, "pageSize": 3, "name": "HG00099" }'
  3.  
  1. wget -q --header='Content-type:application/json' --header='Accept:application/json' \
  2. --post-data='{ "variantSetId": 1, "pageSize": 3, "name": "HG00099" }' \
  3. 'https://jan2020.rest.ensembl.org/ga4gh/callsets/search' -O -
  4.  

Resource Information

MethodsPOST
Response formatsjson
jsonp