Wiki

Clone wiki

enterobase-web / api_straindata

Top level links:

#Searching strain data - the straindata query method See also the interactive documentation at http://enterobase.warwick.ac.uk/api/v2.0/swagger-ui#!/Straindata

The straindata query method combines data from strains, assemblies and STs to give a single access for most data. (If only one of these types of data is desired, then it may be better to use a different query method in the API - for possible alternatives see the diagram on the page about the API structure.)

An example to try in the Swagger UI for straindata is to enter "Agona" for serotype, "Assembled" for assembly_status and "senterica" for database (and otherwise leave the defaults in the Swagger UI). This corresponds to an HTTP GET request (using an API key) with the URL

http://enterobase.warwick.ac.uk/api/v2.0/senterica/straindata?serotype=Agona&sortorder=asc&assembly_status=Assembled&limit=50

The results are a bit long to show in full in this documentation - a similar query with limit set to the smaller value 3 gives the result:

{
  "links": {
    "paging": {
      "next": "http://enterobase.warwick.ac.uk/api/v2.0/senterica/straindata?limit=3&sortorder=asc&offset=3&serotype=Agona&assembly_status=Assembled"
    },
    "records": 1,
    "total_records": 2974
  },
  "straindata": {
    "SAL_EA9564AA": {
      "assembly_barcode": "SAL_KA3160AA_AS",
      "assembly_status": "Assembled",
      "city": null,
      "collection_date": null,
      "collection_month": null,
      "collection_time": null,
      "collection_year": 2015,
      "comment": null,
      "continent": "North America",
      "country": "United States",
      "county": null,
      "created": "2016-02-06T19:55:02.784586+00:00",
      "download_fasta_link": "http://enterobase.warwick.ac.uk/upload/download?assembly_barcode=SAL_KA3160AA_AS&database=senterica",
      "email": null,
      "lab_contact": "United States Department of Agriculture, Food Safety and Inspection Service",
      "lastmodified": "2016-09-07T16:20:58.720874+00:00",
      "latitude": null,
      "longitude": null,
      "n50": 234392,
      "orderby": "barcode",
      "postcode": null,
      "region": "Iowa",
      "secondary_sample_accession": "SRS1278094",
      "serotype": "Agona",
      "source_details": "Animal-Swine-Sow",
      "source_niche": "Livestock",
      "source_type": "Air",
      "strain_barcode": "SAL_EA9564AA",
      "strain_name": "FSIS1605678",
      "sts": [
        {
          "scheme_name": "cgMLST",
          "st_barcode": "SAL_AB4818AA_ST",
          "st_id": 71634,
          "timestamp": "2016-10-13 18:49:32.791374",
          "version": "3.1"
        },
        {
          "predicted_serotype": "Agona",
          "scheme_name": "rMLST",
          "species": "Salmonella enterica",
          "st_barcode": "SAL_RA4278AA_ST",
          "st_complex": "54",
          "st_id": 33136,
          "timestamp": "2017-03-16 22:50:26.193849",
          "version": "3.0"
        },
        {
          "predicted_serotype": "Agona",
          "scheme_name": "MLST_Achtman",
          "st_barcode": "SAL_AA0013AA_ST",
          "st_complex": "54",
          "st_id": 13,
          "timestamp": "2017-04-26 03:08:13.847632",
          "version": "3.0"
        }
      ],
      "top_species": "Salmonella enterica;96.48%",
      "uberstrain": "SAL_EA9564AA",
      "version": 1
    }
  }
}

In order to reduce the amount of content downloaded and speed up the query, "only_fields" may be used, for example, setting "only_fields" to "strain_name,download_fasta_link" (and adding this to the above example). This corresponds to an HTTP request with the URL

http://enterobase.warwick.ac.uk/api/v2.0/senterica/straindata?serotype=Agona&only_fields=strain_name%2Cdownload_fasta_link&sortorder=asc&assembly_status=Assembled&limit=50

The result with limit set to 3 is:

{
  "links": {
    "paging": {
      "next": "http://enterobase.warwick.ac.uk/api/v2.0/senterica/straindata?only_fields=strain_name%2Cdownload_fasta_link&limit=3&sortorder=asc&offset=3&serotype=Agona&assembly_status=Assembled"
    },
    "records": 1,
    "total_records": 2974
  },
  "straindata": {
    "SAL_EA9564AA": {
      "assembly_barcode": "SAL_KA3160AA_AS",
      "download_fasta_link": "http://enterobase.warwick.ac.uk/upload/download?assembly_barcode=SAL_KA3160AA_AS&database=senterica",
      "strain_barcode": "SAL_EA9564AA",
      "strain_name": "FSIS1605678",
      "sts": [
        {
          "scheme_name": "cgMLST",
          "st_barcode": "SAL_AB4818AA_ST",
          "st_id": 71634,
          "timestamp": "2016-10-13 18:49:32.791374",
          "version": "3.1"
        },
        {
          "predicted_serotype": "Agona",
          "scheme_name": "rMLST",
          "species": "Salmonella enterica",
          "st_barcode": "SAL_RA4278AA_ST",
          "st_complex": "54",
          "st_id": 33136,
          "timestamp": "2017-03-16 22:50:26.193849",
          "version": "3.0"
        },
        {
          "predicted_serotype": "Agona",
          "scheme_name": "MLST_Achtman",
          "st_barcode": "SAL_AA0013AA_ST",
          "st_complex": "54",
          "st_id": 13,
          "timestamp": "2017-04-26 03:08:13.847632",
          "version": "3.0"
        }
      ]
    }
  }
}

Updated