Public
Edited
Jul 23, 2024
Fork of Untitled
Insert cell
Insert cell
sdk = await import ('https://episphere.github.io/diseasome/sdk.js');
Insert cell
Insert cell
Insert cell
viewof type = Inputs.select(Object.keys(traitFiles[0]).slice(4), { width: 620, value: "trait_categories", label: "Select by type"})
Insert cell
Insert cell
Insert cell
pgsVariantsNumber = 40
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
viewof disease_ontology_term = Inputs.select(
//efoIds from pgs catalog scoring files only
scoringFilesEfoIds, {value: "EFO:0000712", width: 620, label: "Select by EFO term"})
Insert cell
Insert cell
Insert cell
pgsIds2 = pgs2.map(x => x.id)
Insert cell
Insert cell
Insert cell
//in first selection, fixed trait drop down, but synonym breaks sometimes (old version below with map, not flatMap)
// viewof trait = Inputs.select(
// Array.from(new Set( traitFiles.map(x => x[type]).sort().filter(e => e.length).map(JSON.stringify)), JSON.parse)
// , {width: 620, value: "Cancer", label: "Select trait"})
Insert cell
Insert cell
includesBlanckOntologyTerms = ontologyTerms._embedded.terms.map(x => x.obo_id).sort() // only 1,000 terms out of 4,000
Insert cell
pgsWithtwoOrMoreEfos = scoringFiles.filter(file=> file.trait_efo.length > 1)
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
ontologyTerms = await (await(fetch('https://corsproxy.io/?https://www.ebi.ac.uk/ols/api/ontologies/efo/terms?page=1&size=200'))).json()//await (await(fetchp('https://www.ebi.ac.uk/ols/api/ontologies/efo'))).json()
Insert cell
scoringFilesEfoIds = [...new Set(scoringFiles.flatMap(x => x.trait_efo.map(y=> {return y.id.replace(/_/g,':')})).sort())]
// ontologyTermsEfoIds = ontologyTerms["_embedded"]["terms"].map(x => x.obo_id).sort()
Insert cell
Insert cell
tableDataEfo = {
let ids = []
scoringFiles.flatMap((x,i) => x.trait_efo.map(pgs=>{
if(pgs.id===disease_ontology_term.replace(/:/g,'_')){ids.push(x)
}}))
let data = ids.map( o =>
preferredOrder(o,["id","variants_number","trait_reported","name","ftp_scoring_file","ftp_harmonized_scoring_files","publication","matches_publication","samples_variants","samples_training","trait_additional","trait_efo","method_name","method_params", "variants_interactions","variants_genomebuild","weight_type","acestry_distribution",
"date_release","license"])).filter(function (el) {
return el.variants_number <= pgsVariantsNumber
})
if (data.length == 0){
data.push({"id":`no pgs files with less than ${pgsVariantsNumber} SNPs`})
return data
}
return data
}
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