patlas
  • Introduction
  • Usage
    • Sidebar
      • Browse
      • Import
      • Statistics
      • Projects
    • Top navigation bar
      • Table
      • Heatmap
    • Graph interaction
      • Plasmid popup
  • API
    • Relationships and distances estimations
    • Antibiotic and plasmid family detection
    • Downloads
    • Import files
    • Import results through requests
    • Database creation
    • Local installation
Powered by GitBook
On this page
  • Download metadata
  • From a browser
  • From a terminal
  • Download sequences
  1. API

Downloads

PreviousAntibiotic and plasmid family detectionNextImport files

Last updated 6 years ago

pATLAS database requests can be done through URLs, similar to what is done in .

Download metadata

From a browser

If you have a list of accession numbers present in pATLAS database, you can download all metadata through:

http://www.patlas.site/api/sendmetadata/?accession=<accession_list>

or

http://www.patlas.site/api/sendmetadata?accession=<accession_list>

It will fetch an array of json objects in which each contains all metadata available for that accession number.

E.g.:

http://www.patlas.site/api/sendmetadata?accession=NC_017393_1,NZ_CP009835_1

From a terminal

TL;DR

import requests

r = requests.post("http://www.patlas.site/api/sendmetadata/",
json=["NC_017393_1", "NZ_CP009835_1"])

r.content
# your results

Explanation

  • Send the post to http://www.patlas.site/results/.

  • Send a json with the request. This json must contain a list of

    accession numbers

Download sequences

The sequences of plasmids from pATLAS database can be downloaded through the following API when providing a list of the accession numbers:

http://www.patlas.site/api/senddownload/?accession=<accession_list>

It will generate a fasta file with the accession numbers requested and the sequences associated with each accession number.

Limitation: This type of request to pATLAS database cannot have thousands of accessions therefore for requests with thousands of accessions, use the following request type:

Python:

import requests

# Note that form data should be sent as a string and using 'data' instead of 'json'
r = requests.post("http://www.patlas.site/api/senddownload/",
data={"accessions": '["NC_017393_1", "NZ_CP009835_1"]'})

r.content
# result: http://patlas.site/results?query=15675682358507007771

Javascript / JQuery:

// Note that form data should be sent as a string
$.post("www.patlas.site/api/senddownload/", {"accessions": JSON.stringify(["NC_017393_1", "NZ_CP009835_1"])}, (data, status) => {
      if (status === "success") {
        console.log(data)
        // result: http://patlas.site/results?query=15675682358507007771
      }
    }
  )

Note - The download button in the top bar downloads the accession numbers associated with the current selection using this last API, so it is possible to download the full pATLAS data set. See for more information. also uses this API.

eutils
Top navigation bar
Download button in table