<p>You can just add <code>/?format=json</code> to any page to get the JSON output.</p>

<p>ENCODE REST API documentation: <a href="https://www.encodeproject.org/help/rest-api/" rel="noreferrer">https://www.encodeproject.org/help/rest-api/</a></p>

<p>Example scripts: <a href="https://github.com/ENCODE-DCC/submission_sample_scripts" rel="noreferrer">https://github.com/ENCODE-DCC/submission_sample_scripts</a></p>

CC BY-SA 4.0
2019-02-04T07:31:16.053Z
So let's say I want to get the bed file of this experiment using `curl` https://www.encodeproject.org/experiments/ENCSR000CKC/
0x90
CC BY-SA 4.0
2019-02-04T16:40:38.297Z
If you look at the JSON for that experiment, there are multiple BED files listed there: https://www.encodeproject.org/experiments/ENCSR000CKC/?format=json
burger
CC BY-SA 4.0
2019-01-22T00:08:18.590Z
2019-01-22T00:08:18.590Z
burger
<p>I don't know whether there is an API, but <a href="https://www.encodeproject.org/" rel="noreferrer">ENCODE's website</a> does provide an interactive data matrix where you can filter data based on assay and sample type, place data sets in a "shopping cart", and then proceed to "checkout" to download the files of interest.</p>

<p><a href="https://i.sstatic.net/mws6W.png" rel="noreferrer"><img src="https://i.sstatic.net/mws6W.png" alt="Splash page"></a></p>

<p><a href="https://i.sstatic.net/1yJCj.png" rel="noreferrer"><img src="https://i.sstatic.net/1yJCj.png" alt="Data matrix"></a></p>

<p><a href="https://i.sstatic.net/yMUxb.png" rel="noreferrer"><img src="https://i.sstatic.net/yMUxb.png" alt="Checkout"></a></p>

CC BY-SA 4.0
2019-01-18T20:03:19.923Z
I'll add the fact that I've never used this website before today, so the fact that I was able to navigate it so easily is a credit to the group(s) that created and maintain the website!
Daniel Standage
CC BY-SA 4.0
2019-01-18T15:13:20.970Z
2019-01-18T15:13:20.970Z
Daniel Standage
<p><code>So let's say I want to get the bed file of this experiment using curl encodeproject.org/experiments/ENCSR000CKC</code></p>

<p>You can also search for files that belong to a given experiment, e.g. <a href="https://www.encodeproject.org/search/?type=File&amp;dataset=/experiments/ENCSR000CKC/" rel="nofollow noreferrer">https://www.encodeproject.org/search/?type=File&amp;dataset=/experiments/ENCSR000CKC/</a> </p>

<p><a href="https://i.sstatic.net/N9Nuj.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/N9Nuj.png" alt="enter image description here"></a>
Then further select file properties (status, format, etc.) using the facets on the left.</p>

<p>This basically builds up a search URL for you, which is also possible to do manually. For example all BED files in ENCSR000CKC with GRCh38 assembly, returned as JSON: <a href="https://www.encodeproject.org/search/?type=File&amp;dataset=/experiments/ENCSR000CKC/&amp;file_format=bed&amp;assembly=GRCh38&amp;format=json" rel="nofollow noreferrer">https://www.encodeproject.org/search/?type=File&amp;dataset=/experiments/ENCSR000CKC/&amp;file_format=bed&amp;assembly=GRCh38&amp;format=json</a> (See properties tab here <a href="https://www.encodeproject.org/profiles/file.json" rel="nofollow noreferrer">https://www.encodeproject.org/profiles/file.json</a> for all of the file fields you can use.)</p>

<p>You can also specify a <code>field</code> parameter to return only fields you are interested in. For example <a href="https://www.encodeproject.org/search/?type=File&amp;dataset=/experiments/ENCSR000CKC/&amp;file_format=bed&amp;assembly=GRCh38&amp;field=s3_uri&amp;field=cloud_metadata.url&amp;field=dataset&amp;field=file_format&amp;format=json" rel="nofollow noreferrer">https://www.encodeproject.org/search/?type=File&amp;dataset=/experiments/ENCSR000CKC/&amp;file_format=bed&amp;assembly=GRCh38&amp;field=s3_uri&amp;field=cloud_metadata.url&amp;field=dataset&amp;field=file_format&amp;format=json</a> only returns the <em>s3_uri</em>, <em>cloud_metadata.url</em>, <em>dataset</em>, and <em>file_format</em> fields. These objects are returned in the <code>@graph</code> list:</p>

<p><a href="https://i.sstatic.net/Znnoi.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Znnoi.png" alt="enter image description here"></a></p>

<p>Putting this all together to parse in Python:</p>

<pre><code>&gt;&gt;&gt; import requests
&gt;&gt;&gt; import pandas as pd
&gt;&gt;&gt; url = (
...     'https://www.encodeproject.org'
...     '/search/?type=File'
...     '&amp;dataset=/experiments/ENCSR000CKC/'
...     '&amp;file_format=bed'
...     '&amp;assembly=GRCh38'
...     '&amp;field=file_format'
...     '&amp;field=assembly'
...     '&amp;field=s3_uri'
...     '&amp;field=cloud_metadata.url'
...     '&amp;format=json'
... )
&gt;&gt;&gt; r = requests.get(url)
&gt;&gt;&gt; files = r.json()['@graph']
&gt;&gt;&gt; df = pd.DataFrame(files)
&gt;&gt;&gt; df['cloud_metadata'] = df['cloud_metadata'].apply(lambda x: x.get('url'))
&gt;&gt;&gt; df[['@id', 'assembly', 'file_format', 's3_uri', 'cloud_metadata']]
                   @id assembly file_format                                                                                 s3_uri                                                                                             cloud_metadata
0  /files/ENCFF368QQU/   GRCh38         bed  s3://encode-public/2016/08/04/10493464-917f-4290-bb13-c5fec8319887/ENCFF368QQU.bed.gz  https://encode-public.s3.amazonaws.com/2016/08/04/10493464-917f-4290-bb13-c5fec8319887/ENCFF368QQU.bed.gz
1  /files/ENCFF554NVI/   GRCh38         bed  s3://encode-public/2016/08/04/865f220e-7a47-427a-a7c1-9bdc049d4658/ENCFF554NVI.bed.gz  https://encode-public.s3.amazonaws.com/2016/08/04/865f220e-7a47-427a-a7c1-9bdc049d4658/ENCFF554NVI.bed.gz
2  /files/ENCFF217CRP/   GRCh38         bed  s3://encode-public/2016/08/04/43aa693e-1581-4886-8ace-7e1609f45790/ENCFF217CRP.bed.gz  https://encode-public.s3.amazonaws.com/2016/08/04/43aa693e-1581-4886-8ace-7e1609f45790/ENCFF217CRP.bed.gz
</code></pre>

<p>The s3_uri and cloud_metadata.url both point to the same thing. You can use the s3_uri to download using awscli or boto3. You can pass the https link to cURL.</p>

CC BY-SA 4.0
2019-04-04T00:27:08.333Z
2019-04-04T00:27:08.333Z
ksgraham
<p>There are two places:</p>
<blockquote>
<ol>
<li><a href="https://www.encodeproject.org/matrix/?type=Experiment&amp;status=released&amp;perturbed=false" rel="nofollow noreferrer">encodeproject.org</a></li>
<li><a href="https://screen.encodeproject.org/" rel="nofollow noreferrer">screen.encodeproject.org</a></li>
</ol>
</blockquote>
<p>Details can be found in the <a href="https://www.nature.com/immersive/d42859-020-00027-2/index.html" rel="nofollow noreferrer">ENCODE3 papers</a> published in July 2020</p>

CC BY-SA 4.0
2020-09-04T11:03:59.413Z
2020-09-04T11:03:59.413Z
Code42
<p>I am looking for a modular way to query data from <a href="https://genome.ucsc.edu/cgi-bin/hgTracks" rel="nofollow noreferrer">ENCODE</a>. </p>

<p>For example, I would like to get CHiP-seq or similar tracks for a specific cell line. What's the proper way to do it? </p>

<p>Finally, is there an API to do it?  </p>

<public-databases><data-download><api><encode><genetics>
How do you query and explore ENCODE data?
# How do you query and explore ENCODE data?

(Asked by: username_0 on 2019-01-18)

I am looking for a modular way to query data from [ENCODE](https://genome.ucsc.edu/cgi-bin/hgTracks).

For example, I would like to get CHiP-seq or similar tracks for a specific cell line. What's the proper way to do it?

Finally, is there an API to do it?

**Tags:** public-databases, data-download, api, encode, genetics

---

## 4 answers

### Answer by username_2 on 2019-01-18. Score: 7

I don't know whether there is an API, but [ENCODE's website](https://www.encodeproject.org/) does provide an interactive data matrix where you can filter data based on assay and sample type, place data sets in a "shopping cart", and then proceed to "checkout" to download the files of interest.

[![Splash page](https://i.sstatic.net/mws6W.png)](https://i.sstatic.net/mws6W.png)

[![Data matrix](https://i.sstatic.net/1yJCj.png)](https://i.sstatic.net/1yJCj.png)

[![Checkout](https://i.sstatic.net/yMUxb.png)](https://i.sstatic.net/yMUxb.png)

> **Comments:**
> **username_2**: I'll add the fact that I've never used this website before today, so the fact that I was able to navigate it so easily is a credit to the group(s) that created and maintain the website!  

---

### Answer by username_1 on 2019-01-22. Score: 5

You can just add `/?format=json` to any page to get the JSON output.

ENCODE REST API documentation: <https://www.encodeproject.org/help/rest-api/>

Example scripts: <https://github.com/ENCODE-DCC/submission_sample_scripts>

> **Comments:**
> **username_0**: So let's say I want to get the bed file of this experiment using `curl` https://www.encodeproject.org/experiments/ENCSR000CKC/  
> **username_1**: If you look at the JSON for that experiment, there are multiple BED files listed there: https://www.encodeproject.org/experiments/ENCSR000CKC/?format=json  

---

### Answer by username_3 on 2019-04-04. Score: 2

So let's say I want to get the bed file of this experiment using curl encodeproject.org/experiments/ENCSR000CKC
You can also search for files that belong to a given experiment, e.g. https://www.encodeproject.org/search/?type=File&dataset=/experiments/ENCSR000CKC/ 

Then further select file properties (status, format, etc.) using the facets on the left.
This basically builds up a search URL for you, which is also possible to do manually. For example all BED files in ENCSR000CKC with GRCh38 assembly, returned as JSON: https://www.encodeproject.org/search/?type=File&dataset=/experiments/ENCSR000CKC/&file_format=bed&assembly=GRCh38&format=json (See properties tab here https://www.encodeproject.org/profiles/file.json for all of the file fields you can use.)
You can also specify a field parameter to return only fields you are interested in. For example https://www.encodeproject.org/search/?type=File&dataset=/experiments/ENCSR000CKC/&file_format=bed&assembly=GRCh38&field=s3_uri&field=cloud_metadata.url&field=dataset&field=file_format&format=json only returns the s3_uri, cloud_metadata.url, dataset, and file_format fields. These objects are returned in the @graph list:

Putting this all together to parse in Python:
>>> import requests
>>> import pandas as pd
>>> url = (
...     'https://www.encodeproject.org'
...     '/search/?type=File'
...     '&dataset=/experiments/ENCSR000CKC/'
...     '&file_format=bed'
...     '&assembly=GRCh38'
...     '&field=file_format'
...     '&field=assembly'
...     '&field=s3_uri'
...     '&field=cloud_metadata.url'
...     '&format=json'
... )
>>> r = requests.get(url)
>>> files = r.json()['@graph']
>>> df = pd.DataFrame(files)
>>> df['cloud_metadata'] = df['cloud_metadata'].apply(lambda x: x.get('url'))
>>> df[['@id', 'assembly', 'file_format', 's3_uri', 'cloud_metadata']]
                   @id assembly file_format                                                                                 s3_uri                                                                                             cloud_metadata
0  /files/ENCFF368QQU/   GRCh38         bed  s3://encode-public/2016/08/04/10493464-917f-4290-bb13-c5fec8319887/ENCFF368QQU.bed.gz  https://encode-public.s3.amazonaws.com/2016/08/04/10493464-917f-4290-bb13-c5fec8319887/ENCFF368QQU.bed.gz
1  /files/ENCFF554NVI/   GRCh38         bed  s3://encode-public/2016/08/04/865f220e-7a47-427a-a7c1-9bdc049d4658/ENCFF554NVI.bed.gz  https://encode-public.s3.amazonaws.com/2016/08/04/865f220e-7a47-427a-a7c1-9bdc049d4658/ENCFF554NVI.bed.gz
2  /files/ENCFF217CRP/   GRCh38         bed  s3://encode-public/2016/08/04/43aa693e-1581-4886-8ace-7e1609f45790/ENCFF217CRP.bed.gz  https://encode-public.s3.amazonaws.com/2016/08/04/43aa693e-1581-4886-8ace-7e1609f45790/ENCFF217CRP.bed.gz

The s3_uri and cloud_metadata.url both point to the same thing. You can use the s3_uri to download using awscli or boto3. You can pass the https link to cURL.


---

### Answer by username_4 on 2020-09-04. Score: 0

There are two places:

> 1. [encodeproject.org](https://www.encodeproject.org/matrix/?type=Experiment&status=released&perturbed=false)
> 2. [screen.encodeproject.org](https://screen.encodeproject.org/)

Details can be found in the [ENCODE3 papers](https://www.nature.com/immersive/d42859-020-00027-2/index.html) published in July 2020


---

