Public
Edited
Nov 26, 2024
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
vl_neg = vl.markRect().data(data_neg_filter).title("Non-steatotic")
.encode(
vl.y().fieldN("Protein"),
vl.x().fieldN("CAS (Group ID)"),
vl.color().fieldQ("log2FoldChange").scale({scheme: "redblue", reverse: false, zero: false, domainMin: -4, domainMax: 4}),
vl.tooltip([
{
"field": "log2FoldChange",
"type": "quantitative",
"format": ",.2f"
},
vl.fieldN("GENE"),
vl.fieldN("Organism"),
vl.fieldN("Organ"),
vl.fieldN("Cell type"),
vl.fieldN("Cell name"),
vl.fieldN("Treatment modality"),
vl.fieldN("Exposure time"),
vl.fieldN("Compound"),
vl.fieldQ("Concentration"),
vl.fieldN("accession"),
]),
)
Insert cell
vl_pos = vl.markRect().data(data_pos_filter).title("Steatotic")
.encode(
vl.y().fieldN("Protein"),
vl.x().fieldN("CAS (Group ID)"),
vl.color().fieldQ("log2FoldChange").scale({scheme: "redblue", reverse: false, zero: false, domainMin: -4, domainMax: 4}),
vl.tooltip([
{
"field": "log2FoldChange",
"type": "quantitative",
"format": ",.2f"
},
vl.fieldN("GENE"),
vl.fieldN("Organism"),
vl.fieldN("Organ"),
vl.fieldN("Cell type"),
vl.fieldN("Cell name"),
vl.fieldN("Treatment modality"),
vl.fieldN("Exposure time"),
vl.fieldN("Compound"),
vl.fieldQ("Concentration"),
vl.fieldN("accession"),
]),
)
Insert cell
data_avg_filter = avg_data.filter(data =>
checkboxes_treatment.includes(data['Treatment modality']) &&
checkboxes_exposure.includes(data['Exposure time']) &&
checkboxes_organ.includes(data['Organ']) &&
checkboxes_cell_name.includes(data['Cell name']) &&
checkboxes_cell_type.includes(data['Cell type'])

)
Insert cell
data_neg_filter = data_neg.filter(data =>
checkboxes_treatment.includes(data['Treatment modality']) &&
checkboxes_exposure.includes(data['Exposure time']) &&
checkboxes_organ.includes(data['Organ']) &&
checkboxes_cell_name.includes(data['Cell name']) &&
checkboxes_cell_type.includes(data['Cell type']) &&
data['padj'] < threshold_padj

)
Insert cell
data_pos_filter = data_pos.filter(data =>
checkboxes_treatment.includes(data['Treatment modality']) &&
checkboxes_exposure.includes(data['Exposure time']) &&
checkboxes_organ.includes(data['Organ']) &&
checkboxes_cell_name.includes(data['Cell name']) &&
checkboxes_cell_type.includes(data['Cell type']) &&
data['padj'] < threshold_padj
)
Insert cell
data_neg = newData.filter(data => data.Steatotic === false)
Insert cell
data_pos = newData.filter(data => data.Steatotic === true)
Insert cell
cell_type = get_unique_elements(data, "Cell type")
Insert cell
cell_name = get_unique_elements(data, "Cell name")
Insert cell
organisms = get_unique_elements(data, "Organism")
Insert cell
organs = get_unique_elements(data, "Organ")
Insert cell
treatment_modalities = get_unique_elements(data, "Treatment modality")
Insert cell
exposure_times = get_unique_elements(data, "Exposure time")
Insert cell
get_unique_elements(data, "Steatotic")
Insert cell
get_unique_elements = function(array, parameter) {
return Array.from(new Set(array.map(item => item[parameter])))
}
Insert cell
newData = data.map(item => ({
...item,
"CAS (Group ID)": `${item["CAS number"]} (${item["BMD condition"]})`
}));
Insert cell
data = fetch_dataset_to_array(dataset_url, {})
Insert cell
avg_data = fetch_dataset_to_array(dataset_avg_url, {})
Insert cell
function fetch_dataset_to_array(dataset_url, query_options) {
return fetch(dataset_url, query_options).then(response_dataset => {
if (!response_dataset.ok) throw new Error(response_dataset.status);
return response_dataset.json();}).then(json => json.results.map(x => x.data));
}
Insert cell
dataset_url = api_url + dataset_id + "/versions/latest/data"
Insert cell
api_url = "https://api.edelweissdata.com/datasets/"
Insert cell
dataset_id = "4e5e9cc9-2934-43fd-a17f-f106fd1d1708"
Insert cell
dataset_avg_url = api_url + dataset_avg_id + "/versions/latest/data"
Insert cell
dataset_avg_id = "6a97d1ae-1f12-48c5-9aab-15eb51be1b5b"
Insert cell
import {vl} from "@vega/vega-lite-api"
Insert cell
import {ForceGraph} from "@d3/force-directed-graph"
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