Published
Edited
Apr 22, 2020
Insert cell
Insert cell
// genes_str = [
// 'PHF14', 'RBM3', 'MSL1', 'PHF21A', 'ARL10', 'INSR', 'JADE2', 'P2RX7',
// 'LINC00662', 'CCDC101', 'PPM1B', 'KANSL1L', 'CRYZL1', 'ANAPC16', 'TMCC1',
// 'CDH8', 'RBM11', 'CNPY2', 'HSPA1L', 'CUL2', 'PLBD2', 'LARP7', 'TECPR2',
// 'ZNF302', 'CUX1', 'MOB2', 'CYTH2', 'SEC22C', 'EIF4E3', 'ROBO2',
// 'ADAMTS9-AS2', 'CXXC1', 'LINC01314', 'ATF7', 'ATP5F1'].join('\n')

genes_str = 'TP53\nACE2'
Insert cell
description = ''
Insert cell
payload = ({'list':genes_str, 'description':description})
Insert cell
JSON.stringify(payload)
Insert cell
Insert cell
post_url = 'https://amp.pharm.mssm.edu/Enrichr/addList'
Insert cell
d3.json(post_url, {
// body: JSON.stringify(payload),
body: payload,
headers: {"content-type": "application/json"},
method: "POST",
mode: "cors"
})
Insert cell
Insert cell
Insert cell
d3.json(get_url, {
headers: {"content-type": "application/json"},
method: "GET",
mode: "cors"
})
Insert cell
Insert cell
JSON.parse(enrichr_response.body)
Insert cell
enrichr_response = {
const response = await fetch(get_url);
return {
ok: response.ok,
body: await response.text()
};
}
Insert cell
Insert cell
params = {
let params = {'list':genes_str, 'description':''}
return params
}
Insert cell
new_post_response = {
const response = await fetch(
post_url, {
method: 'POST',
body: form_data
}
);
return {
ok: response.ok,
body: await response.text()
};
}
Insert cell
settings_post_response = {
const response = await fetch(
post_url,
{
"async": true,
"crossDomain": true,
"url": "https://amp.pharm.mssm.edu/Enrichr/addList",
"method": "POST",
"processData": false,
"contentType": false,
"mimeType": "multipart/form-data",
"data": JSON.stringify(form)
}
);
return {
ok: response.ok,
body: await response.text()
};
}
Insert cell
form_data = new FormData();
Insert cell
form_data.append('list', genes_str)
Insert cell
// post_response = fetch(post_url, {
// method: 'POST',
// headers: {
// 'Content-Type': 'application/json',
// },
// body: JSON.stringify(params)
// })
// .then((response) => response.json())
// .then((data) => {
// console.log('Success:', data);
// })
// .catch((error) => {
// console.error('Error:', error);
// });
Insert cell
form = new FormData();
Insert cell
form.append("list", genes_str);
Insert cell
form.append("description", "clustergrammer")
Insert cell
settings = ({
"async": true,
"crossDomain": true,
"url": "https://amp.pharm.mssm.edu/Enrichr/addList",
"method": "POST",
"processData": false,
"contentType": false,
"mimeType": "multipart/form-data",
"data": form
})
Insert cell
$.ajax(settings)
.done(function(response){
response = JSON.parse(response);
});
Insert cell
$
Insert cell
import { jQuery as $ } from "@ddspog/useful-libs"
Insert cell
Insert cell
fetch("https://amp.pharm.mssm.edu/Harmonizome/api/1.0/gene/TP53", {
// body: JSON.stringify(`{"ping": ${Date.now()}}`),
headers: {"content-type": "application/json"},
method: "GET",
mode: "cors"
}).then(response => {
return response
// return response.json();
}).catch((error) => {
console.error('Error:', error);
});

Insert cell
d3.json("https://amp.pharm.mssm.edu/Harmonizome/api/1.0/gene/TP53", {
headers: {"content-type": "application/json"},
method: "GET",
mode: "cors"
})
Insert cell
Insert cell
d3.json("https://cors-anywhere.herokuapp.com/http://string-db.org/api/json/resolve?identifier=ADD&species=9606", {
// headers: {"content-type": "application/json"},
method: "GET",
mode: "cors"
})
Insert cell
d3.json("https://cors-anywhere.herokuapp.com/http://string-db.org/api/json/interactorsList?identifiers=4932.YML115C%0D4932.YJR075W%0D4932.YEL036C&required_score=400&limit=20", {
// headers: {"content-type": "application/json"},
method: "GET",
mode: "cors"
})
Insert cell
fetch("https://cors-anywhere.herokuapp.com/http://string-db.org/api/json/resolve?identifier=ADD&species=9606", {
// body: JSON.stringify(`{"ping": ${Date.now()}}`),
// headers: {"content-type": "application/json"},
method: "GET",
mode: "cors"
}).then(response => {
return response
// return response.json();
})
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more