Published
Edited
Mar 10, 2021
Insert cell
md`# OpenTox: Toxicology Websites`
Insert cell
md`Select from the categories below. Press Ctrl to select multiple choices.`
Insert cell
viewof selected_data_types = Select(unique_data_types, {label: "Select Species type", multiple: true, value: default_data_types})
Insert cell
viewof selected_Citations = Select(unique_Citations, {label: "Select Citations", multiple: true, value: default_Citations})
Insert cell
viewof selected_assay_type = Select(unique_assay_type, {label: "Select assay type", multiple: true, value: default_assay_type})
Insert cell
viewof selected_Prediction_type = Select(unique_Prediction_type, {label: "Select Prediction type", multiple: true, value: default_Prediction_type})
Insert cell
Table(filtered_datasets)
Insert cell
pie_chart_data = unique_assay_type.map(assay_type => {return {
"label": assay_type,
"count": filtered_datasets.filter(item => item["assay type"] == assay_type).length
}})
Insert cell
genPieChart(pie_chart_data, "count", "label", "Pie chart representation of assay types")
Insert cell
vl.markBar()
.data(filtered_datasets)
.encode(
vl.y().count(),
vl.x().fieldN("assay type"),
)
.width(600).height(400).render()
Insert cell
filtered_datasets = dataset
.filter(item => selected_Prediction_type.includes(item["Prediction type"]))
.filter(item => selected_assay_type.includes(item["assay type"]))
.filter(item => selected_Citations.includes(item["Citations"]))
.filter(item => selected_data_types.includes(item["Species type"]))
Insert cell
default_Citations = unique_Citations
Insert cell
unique_Citations = get_unique_elements(dataset, "Citations")
Insert cell
default_Prediction_type = unique_Prediction_type
Insert cell
unique_Prediction_type = get_unique_elements(dataset, "Prediction type")
Insert cell
default_assay_type = unique_assay_type
Insert cell
unique_assay_type = get_unique_elements(dataset, "assay type")
Insert cell
default_data_types = unique_data_types
Insert cell
unique_data_types = get_unique_elements(dataset, "Species type")
Insert cell
function get_unique_elements(array, property_name) {
var set = new Set(array.map(x => x[property_name]));
return Array.from(set).filter(function(item) {return item != null;}).sort()
}
Insert cell
dataset = fetch_dataset_to_array(dataset_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 = base_url_edelweiss + dataset_id + "/versions/latest/data"
Insert cell
base_url_edelweiss = 'https://api.edelweissdata.com/datasets/'
Insert cell
dataset_id = "cc2c1516-57ff-4eb6-9cd9-c285722a1be6"
Insert cell
import {Select, Range, Toggle, Table} from "@observablehq/inputs"
Insert cell
import {genPieChart} from "@floran-hachez/vega-lite-pie-chart"
Insert cell
import { vl } from "@vega/vega-lite-api"
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more