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

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