-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcelllines.js
117 lines (106 loc) · 2.73 KB
/
celllines.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
var colors = {
"1": "#7570b3",
"2": "#1b9e77",
"3": "#d95f02",
"4": "#e7298a",
"5": "#66a61e",
"6": "#e6ab02",
"7": "#a6761d",
"8": "#666666",
"9": "#1b9e77",
"10": "#d95f02",
"11": "#7570b3",
"12": "#e7298a",
"13": "#66a61e",
"14": "#e6ab02",
"15": "#a6761d",
"16": "#666666",
"17": "#1b9e77",
"18": "#d95f02",
"19": "#7570b3",
"20": "#e7298a",
"21": "#66a61e",
"22": "#e6ab02",
"X": "#a6761d",
"Y": "#666666",
"MT": "#555555"
}
// function colormap(val) {
// return colors[val]
// }
function chartRNA() {
$('#loader').show()
$.ajax({
type: "POST",
data: {
cell_id: CELL,
type: 'hist'
},
dataType: "json",
url: ROOTPATH + "/php/cellline_rna.php",
success: function (response) {
// change content:
console.log(response);
var trace = {
x: response,
type: 'histogram'
};
var data = [trace];
var layout = {
title: 'Histogram of normalized data',
xaxis: {
title: "Normalized gene expression"
},
}
Plotly.newPlot('project-rna-hist', data, layout);
$('#loader').hide()
},
error: function (response) {
console.log(response.responseText)
$('#loader').hide()
}
})
}
function barchartRNA() {
$('#loader').show()
$.ajax({
type: "POST",
data: {
cell_id: CELL,
type: 'bar'
},
dataType: "json",
url: ROOTPATH + "/php/cellline_rna.php",
success: function (data) {
// change content:
console.log(data)
// response.type = 'bar'
// response.marker = {
// color: response.x[0].map(x => colors[x])
// }
// var data = [response];
var layout = {
title: 'Normalized expression of all genes',
legend: {
title: {
text: 'Chromosome'
}
},
xaxis: {
// tickmode: 'array',
title: "Genes",
// dtick: 1,
// nticks: 25
// type: 'multicategory',
// automargin: true
},
}
Plotly.newPlot('project-rna-bar', data, layout)
$('#loader').hide()
},
error: function (response) {
console.log(response.responseText)
$('#loader').hide()
}
})
}