Published
Edited
Sep 20, 2019
Insert cell
Insert cell
Insert cell
md`Below is code from last semester that I want to move over to Javascript.`
Insert cell
PAAD_expression_x = {
let queryJSON = {
format: 'json',
gene: xgene,
cohort: 'PAAD',
page: 1,
page_size: 183,
sort_by: 'tcga_participant_barcode'
}
let hosturl = 'https://firebrowse.herokuapp.com'
let endpointurl = 'http://firebrowse.org/api/v1/Samples/mRNASeq'
return (await fetch(hosturl + '?' + endpointurl + '?' +
jq.param(queryJSON))).json()
}
Insert cell
PAAD_expression_y = {
let queryJSON = {
format: 'json',
gene: ygene,
cohort: 'PAAD',
page: 1,
page_size: 183,
sort_by: 'tcga_participant_barcode'
}
let hosturl = 'https://firebrowse.herokuapp.com'
let endpointurl='http://firebrowse.org/api/v1/Samples/mRNASeq'
return (await fetch(hosturl +'?'+endpointurl +'?' + jq.param(queryJSON))).json()
}
Insert cell
jq = require("https://code.jquery.com/jquery-3.4.1.js")
Insert cell
viewof xgene = select({
options: ['GATA6','KRAS','TFF1'],
value: 'KRAS'
})
Insert cell
viewof ygene = select({
options: ['GATA6','KRAS','TFF1'],
value: 'GATA6'
})
Insert cell
import {select} from "@jashkenas/inputs"
Insert cell
{
let plotData = {
x: [],
y: [],
text: [],
mode: 'markers',
type: 'scatter'
};
PAAD_expression_x.mRNASeq.forEach(
function(ob) {
plotData.x.push(ob.expression_log2)
plotData.text.push(ob.tcga_participant_barcode)
}
);
PAAD_expression_y.mRNASeq.forEach(
function(ob) {
plotData.y.push(ob.expression_log2)
}
);
const div = DOM.element('div')
Plotly.newPlot(div, [plotData]);
return div
}
Insert cell
Plotly = require("https://cdn.plot.ly/plotly-latest.min.js")
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