Public
Edited
Feb 26, 2022
1 fork
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
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
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
keyValuePairs = [
{"Parameter" : "Organ", "Value": summary_metadata["Assay"]["Organ"]},
{"Parameter" : "Organism", "Value": summary_metadata["Assay"]["Organism"]},
{"Parameter" : "Information domain", "Value": summary_metadata["Information domain"]},
{"Parameter" : "Exposure time", "Value": summary_metadata["Assay"]["Treatment"]["Exposure time"]},
{"Parameter" : "Modality", "Value": summary_metadata["Assay"]["Treatment"]["Treatment modality"]},
{"Parameter" : "Method name", "Value": summary_metadata["Method name"]},
]
Insert cell
compound_info = summary_metadata.Compound.filter(obj => obj["Compound name as used in metadata sheet"] == selected_compound)
Insert cell
compounds_table = {
var tbl = [];
var i = 0;
for (var compound of compound_info) {
tbl.push({
//'Compound': compound['Compound name of actual form used'], // removed, as several entries seem faulty. Which column represents the compound name in the form it has in the real data, form which the triplets have been created??
'Compound': compound['Compound name as used in metadata sheet'],
'Form': compound['Compound form'],
'CAS': compound['CAS number'],
'SMILES': compound['SMILES'],
'Mol': svgs[i],
})
i = i + 1
}
return tbl;
};
Insert cell
svgs = Promise.all(promises)
Insert cell
// Copied from PCR analysis notebook

promises = {
var promises = [];
for (var compound of compound_info) {
const smiles = compound.SMILES;
const safeSmiles = encodeURIComponent(smiles);
const svg_url = "https://chemidconvert.cloud.douglasconnect.com/v1/asSvg?width=200&height=200&smiles=" + safeSmiles;
const svg = fetch(svg_url).then(response => response.text());
promises.push(svg);
}
return promises;
}
Insert cell
endpoint1_data = summary_data.map(obj => {
return {
"Exposure time": obj["Exposure time"],
"BMC10": obj["Endpoint 1 BMC10"].toFixed(2),
"BMC25": obj["Endpoint 1 BMC25"].toFixed(2),
"BMC50": obj["Endpoint 1 BMC50"].toFixed(2),
"slope": obj["Endpoint 1 slope"].toFixed(2),
"hit call": obj["Endpoint 1 hit call"],
"warnings": obj["Endpoint 1 warnings"]
}
})
Insert cell
endpoint2_data = summary_data.map(obj => {
return {
"Exposure time": obj["Exposure time"],
"BMC10": obj["Endpoint 2 BMC10"].toFixed(2),
"BMC25": obj["Endpoint 2 BMC25"].toFixed(2),
"BMC50": obj["Endpoint 2 BMC50"].toFixed(2),
"slope": obj["Endpoint 2 slope"].toFixed(2),
"hit call": obj["Endpoint 2 hit call"],
"warnings": obj["Endpoint 2 warnings"]
}
})
Insert cell
timepoints = summary_data.map(row => row["Exposure time"])
Insert cell
compounds = summary_metadata.Compound.map(obj => obj["Compound name as used in metadata sheet"])
Insert cell
raw_data = fetch_dataset_to_array(base_url_edelweiss, raw_dataset_id, query)
Insert cell
raw_metadata = fetch_dataset_to_array(base_url_edelweiss, raw_dataset_id, {}, "metadata")
Insert cell
processed_data = fetch_dataset_to_array(base_url_edelweiss, processed_dataset_id, query)
Insert cell
processed_metadata = fetch_dataset_to_array(base_url_edelweiss, processed_dataset_id, {}, "metadata")
Insert cell
summary_data = fetch_dataset_to_array(base_url_edelweiss, summary_dataset_id, query)
Insert cell
summary_metadata = fetch_dataset_to_array(base_url_edelweiss, summary_dataset_id, {}, "metadata")
Insert cell
query = {
return {
method: 'POST',
body: JSON.stringify({
condition: {
exactSearch: [{ column: ["Compound"] }, selected_compound],
}
})
}
}
Insert cell
// Create function to fetch data. Query options defined in cell above

// Pass in an optional variable 'meta' to the function to make it request the metadata!
function fetch_dataset_to_array(base_url, dataset_id, query_options, datatype) {
if (datatype == "metadata") {
var dataset_url = base_url + dataset_id + "/versions/latest/metadata"
} else {
var dataset_url = base_url + dataset_id + "/versions/latest/data"
}
return fetch(dataset_url, query_options).then(response_dataset => {
if (!response_dataset.ok) throw new Error(response_dataset.status);
if (datatype == null)
return response_dataset.json().then(json => json.results.map(x => x.data));
else if (datatype == 'metadata' )
return response_dataset.json();
})
}
Insert cell
summary_dataset_id = "284fb3cc-13d5-4284-89c5-e6ede945bff5"
Insert cell
processed_dataset_id = "ef4840ac-d495-4409-8170-05055501848c"
Insert cell
raw_dataset_id = "b37eace9-3181-43a5-8da9-760607e5ba97"
Insert cell
// Set url for data base
base_url_edelweiss = 'https://api.develop.edelweiss.douglasconnect.com/datasets/'
Insert cell
// Import selection, range and toggle tools from inputs notebook
import {Select, Range, Toggle} from "@observablehq/inputs"
Insert cell
// Import vega-lite visualization library
import {vl} from "@vega/vega-lite-api"
Insert cell
// Import libraries for data table rendering
import {render_data_table} from '@info474/utilities'
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