Enter the string "bone chip" in the search box at the top right of the page at. The ENCODE web app is a good place to start to see an example. You can also search for objects programmatically and get the search result back in JSON format. In the GET example above, we use the ENCODE REST API to retrieve an individual object using its ENCODE accession number.
MCF-7 Cell Culture and 4-hydroxytamoxifen treatment
For example, documents is an array of document identifiers and so you can loop over that array.Īdding the following code to the example script above loops through the documents array, GET's each document object, and prints its description: for doc_uri in biosample:ĭoc_response = requests.get('' + doc_uri, headers=headers) The important point is that the response object has been cast into a native Python dict datastructure. "summary": "Homo sapiens MCF-7 cell line", "health_status": "breast cancer (adenocarcinoma)", "description": "mammary gland, adenocarcinoma", The dictionary is then dumped back to a string and pretty-printed with useful indentation. The ENCODE server's JSON response is extracted as a Python dictionary using the response.json() method. This script GET's the JSON representation of ENCODE biosample ENCBS000AAA. # Extract the JSON response as a Python dictionary Response = requests.get(url, headers=headers) # This URL locates the ENCODE biosample with accession number ENCBS000AAA # Force return from the server in JSON format Sending a GET request is accomplished here by using the requests.get() method.
GET will work without a username and password to fetch publicly-released ENCODE objects. The HTTP GET request is used to retrieve objects from the ENCODE server. A library or module for parsing JSON-structured text and building native data structures.
The requests library here for Python is good, and will be used for examples in this documentation.
The curl command, which ships with Mac OSX and all major LINUX/UNIX implementations.A JSON pretty-printer plugin for your web browser, such as JSONView (for Chrome or Firefox) or json-lite (for Safari).While getting objects from the database can often be done in just a few lines of code, here are some quick ways of testing your connection and exploring the ENCODE data objects without writing any code. We have written example scripts you can look at here. You will almost certainly use libraries for your language of choice to handle the network connection and parse the objects returned ( requests and json for Python, for example). If you’re familiar with JavaScript’s object literal notation or Python’s dictionary datatype, then JSON-formatted text will look familiar. JSON is a defined data interchange format that is used web-wide. Data objects exchanged with the server conform to the standard JavaScript Object Notation (JSON) format. Your scripts interact with the database through an industry-standard, Hypertext-Transfer-Protocol-(HTTP)-based, Representational-state-transfer (RESTful) application programming interface (API).
Direct interaction with the ENCODE DCC metadata database is typically done through scripts you write and execute on your own Mac, PC or server.