Published
Edited
Mar 28, 2020
Insert cell
Insert cell
Insert cell
d3.json("http://string-db.org/api/json/resolve?identifier=ADD&species=9606", {
// headers: {"content-type": "application/json"},
method: "GET",
mode: "cors"
})
Insert cell
Insert cell
Insert cell
d3.json(cors_prepend + "http://string-db.org/api/json/resolve?identifier=ADD&species=9606", {
// headers: {"content-type": "application/json"},
method: "GET",
mode: "cors"
})
Insert cell
Insert cell
protein_list = ['CLASP1', 'CDK2', 'ACE2', 'TP53', 'CD8A', 'Meg3', 'Actg1', 'Arsg', 'Exosc4', 'Tor1a'].map(x => x.toUpperCase()) //['CLASP1', 'CDK2', 'TP53', 'MARK2', 'ACE2', 'MAPK']
Insert cell
Insert cell
Insert cell
req_score = 900
Insert cell
interact_limit = 1
Insert cell
Insert cell
interactions = d3.tsv(cors_prepend + 'http://string-db.org/api/tsv/interactions?identifiers='
+ protein_list_string + '&required_score=' + req_score + '&limit=' + interact_limit, {
method: "GET",
mode: "cors"
})
Insert cell
Insert cell
protein_of_interest = 'CLASP1'
Insert cell
interactions.filter(x=>x.preferredName_A == protein_of_interest || x.preferredName_B == protein_of_interest)
Insert cell
interactionsList = d3.tsv(cors_prepend + 'http://string-db.org/api/tsv/interactionsList?identifiers='
+ protein_list_string + '&required_score=' + req_score + '&limit=' + interact_limit, {
method: "GET",
mode: "cors"
})
Insert cell
interactionsList
Insert cell
Insert cell
nodes = interactionsList
.map(x => x.preferredName_A.toUpperCase())
.concat(interactionsList.map(x => x.preferredName_B.toUpperCase()))
.filter((x, i, a) => a.indexOf(x) === i)
.map(x => {
return {'id':x, 'group': 1}
})
Insert cell
Insert cell
Insert cell
data = ({
'nodes':nodes,
'links':links
})
Insert cell
Insert cell
protein_name = 'TP53'
Insert cell
d3.tsv(cors_prepend + 'http://string-db.org/api/tsv/interactorsList?identifiers=' + protein_list_string + '%&required_score=400&limit=10', {
// headers: {"content-type": "application/json"},
method: 'GET',
mode: "cors"
})
Insert cell
Insert cell
d3.tsv(cors_prepend + 'https://string-db.org/api/tsv/get_string_ids?identifiers=' + protein_list + '&required_score=400&limit=3', {
// headers: {"content-type": "application/json"},
method: "GET",
mode: "cors"
})
// identifiers=[your_identifiers]&[optional_parameters]
Insert cell
Insert cell
Insert cell
data
Insert cell
d3.forceSimulation(nodes)
Insert cell
Insert cell
Insert cell
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