-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
179 lines (160 loc) · 10.3 KB
/
index.html
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
<!DOCTYPE html>
<meta charset="utf-8">
<head>
<link href="css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="css/style.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.2/css/all.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<!-- Load the javascript libraries -->
<script src="dependencies/jquery.min.js"></script>
<script src="dependencies/d3.v4.min.js"></script>
<script src="dependencies/d3-selection-multi.v1.js"></script>
<script src="dependencies/tinycolor.js"></script>
<script src="dependencies/numeric.js"></script>
<script src="dependencies/svd.js"></script>
<script src="dependencies/jquery.lazyload-any.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.5.3/jspdf.min.js"></script>
<script type="text/javascript" src="https://html2canvas.hertzen.com/dist/html2canvas.js"></script>
<script src="oncotreevis.js"></script>
<script src="display_tree.js"></script>
<script src="display_tree_matching.js"></script>
<script src="dgidb_query_response.js"></script>
<!-- Load tree datasets -->
<script src="data/aml_morita/trees_aml_morita.json"></script>
<script src="data/aml_compass/trees_aml_compass.json"></script>
<script src="data/brca_razavi/trees_brca_razavi.json"></script>
<script src="data/tracerx/tracerx_lung/trees_tracerx_lung.json"></script>
<script src="data/tracerx/tracerx421/trees_tracerx421.json"></script>
<script src="data/noble2022/trees_noble2022.json"></script>
<script src="data/aml_tupro/trees_aml_tupro.json"></script>
<script src="data/gene_chr_map.json"></script>
</head>
<body style="margin-top: 5px; margin-left: 5px; margin-right: 5px;">
<div style="display: flex">
<div style="background-color: #b4a7d6; flex-grow: 1; height: 60px"></div>
<div style="width: 300px; height: 60px; background: radial-gradient(#ffffff 0%, #b4a7d6); text-align: center; ">
<p id="logo" style="font-family:Calibri, sans-serif; font-size:40px; letter-spacing: 0.5px;"><b> oncotreeVIS </b></p>
</div>
<div style="background-color: #b4a7d6; height: 60px; padding-top:5px;">
<a style="text-decoration: none" href="https://github.com/cbg-ethz/oncotreeVIS" target="new">
<i class="fa fa-github" style="font-size:48px; color:#353935"></i> </a>
</div>
<div style="background-color: #b4a7d6; height: 60px; padding-top:9px;">
<a style="text-decoration: none" href="https://www.biorxiv.org/content/10.1101/2024.11.15.623847v1" target="paper">
<i class="fa fa-file-text-o" style="font-size:40px; color:#353935"></i> </a>
</div>
</div><br/>
<div style="margin-left: 10px;">
<div width="100%" style="font-size: 13px;">
Select predefined or custom mutation tree cohort: <select id="drop-down-cohort"></select><br/>
</div><br/>
<div width=100% id="container"> </div>
</div>
<script>
function load() {
// Get selected file.
let file = document.getElementById("picker").files[0];
// Read selected file.
let reader = new FileReader();
reader.addEventListener("loadstart", (event) => {
$("body").addClass("wait");
})
reader.onload = () => {
let data = JSON.parse(reader.result);
oncotreeVIS(data, "container")
};
reader.readAsText(file);
e = document.getElementById("drop-down-cohort")
var option = document.createElement("option")
option.text = file.name
option.selected = true
e.add(option)
}
</script>
<script>
datasets = {
"[CLUSTERED] 123 AML point mutation trees (Morita et al. 2020)": {"data": data_aml_morita},
"[CLUSTERED] 43 tumor evolution trees (Noble et al. 2022)": {"data": data_noble2022},
"[CLUSTERED] 99 non-small cell lung cancer point mutation trees (TRACERx, Jamal-Hanjani et al. 2017)": {"data": data_tracerx_lung},
"[CLUSTERED] 21 TumorProfiler AML CN trees": {"data": data_tupro_aml},
"145 AML joint CN-point mutation trees (COMPASS, Sollier et al. 2022)": {"data": data_aml_compass},
"4,843 alternative mutation trees for 126 non-small cell lung metastatic cancer point patients (TRACERx421, Al Bakir et al. 2023)": {"data": data_tracerx421},
"1,214 Breast cancer mutation trees (Razavi et al. 2018)": {"data": data_brca_razavi},
"--> Load custom mutation tree cohort file": {}
}
var drop_down_cohorts = document.getElementById("drop-down-cohort")
Object.keys(datasets).forEach(function (dataset, idx) {
drop_down_cohorts.options[drop_down_cohorts.options.length] = new Option(dataset, idx);
})
$('#drop-down-cohort').change(function(){
custom_file_option_text = "custom mutation tree cohort"
e = document.getElementById("drop-down-cohort")
var last_option = e.options[e.options.length - 1].text
if (!last_option.includes(custom_file_option_text)) {
e.remove(e.options.length - 1)
}
var cohort_name = e.options[e.selectedIndex].text
if (cohort_name.includes(custom_file_option_text)) {
container = document.getElementById("container")
container.innerHTML = "<div style='display: block; margin-left: auto; margin-right: auto; padding-left:10%; padding-right:10%;" +
"font-size:13px; min-width:80%; height:50%; overflow:scroll;'>" +
"<table><tr><td colspan=2>" +
"The JSON files used for the predefined datasets are available on " +
"<a href='https://github.com/cbg-ethz/oncotreeVIS/tree/main/data' target=git>github</a>.<br/></td></tr><tr><td>" +
"The expected input is a JSON file with the following key values:<p style='margin:6px;'></p>" +
"<table style='min-width:560px'>" +
"<tr style='border-bottom: 2px solid darkgray; border-top: 2px solid darkgray'>" +
"<td ><b>Key</b></td><td style='padding-left:20px'><b>Data structure</b></td></tr>" +
"<tr style='border-bottom: 1px solid darkgray;'><td style='vertical-align:top'><b>trees</b></td>" +
"<td style='padding-left:20px; text-align:justify; vertical-align:top'>" +
"Dictionary where the key is the sample id and the value is another dictionary containing the tree structure (required) " +
"and the sample metadata (optional). <p style='margin:6px;'></p>" +
"The tree structure is an hierarchical data structure in JSON format, as used in D3.js and anytree (python) libraries. " +
"Each node has one or more child nodes (<i>node.children</i>), except for the leaves. In addition, each node " +
"has the following attributes: <i>node_id</i> (string/int, required), </i>matching_label</i> (required), " +
"<i>size_percent</i> (float, optional), <i>gene_events</i> (dictionary, optional), " +
"<i>is_neutral</i> (boolean, optional). The gene_events attribute has two predefined keys (\"mutation\" and \"CNA\"), " +
"but any other key names can be used. The values for the \"CNA\" event key are specifically interpreted as amplification " +
"or deletion amounts w.r.t. the neutral states. The first three letters of the event key are used " +
"in the visualization for displaying a summary for the gene events.<p style='margin:6px;'></p>"+
"<font style='font-weight: 500;'>Example</font>: \"AML-03-001\": {\"tree\": {\"node_id\": 0, \"matching_label\": 0, \"children\": " +
"[{\"node_id\": 407, \"matching_label\": 14, \"size_percent\": 0.228, \"gene_events\": {\"FLT3-ITD\": {\"mutation\": \"\"}}, " +
"\"children\": [{\"node_id\": 408, \"matching_label\": 5, \"size_percent\": 0.772, \"gene_events\": {\"NPM1\": {\"mutation\": " +
"\"p.L287fs\"}}}]}]}, \"metadata\": {\"Chemo\": \"No\", \"Gender\": \"Female\", \"VitalStatus\": \"Dead NOS\", \"age\": 59, "+
"\"Diagnosis\": \"AML\", \"Response\": \"CR\"}} <p style='margin:6px;'></p>"+
"Examples for gene_events dictionary: \"gene_events\": {\"NPM1\": {\"mutation\": \"p.L287fs\"}, " +
"\"AKT3\": {\"CNA\": 2}, \"JAK2\": {\"CNA\": -1}, \"TP53\": {\"CNA\”: \"-\", \"expression\": \"0.34\"}}" +
"<p style='margin:6px;'></p>" +
"</td></tr>" +
"<tr style='border-bottom: 1px solid darkgray;'><td style='vertical-align:top'><b>clusters</b></td>" +
"<td style='padding-left:20px'>List of lists of tree ids (strings).<p style='margin:6px;'></p>" +
"<font style='font-weight: 500;'>Example:</font> [['AML-55-001', 'AML-33-001', 'AML-57-001', 'AML-11-001'], " +
"['AML-77-001'], ['AML-50-001', 'AML-102-001'], … ]" +
"<p style='margin:6px;'></p>" +
"</td></tr>" +
"<tr style='border-bottom: 1px solid darkgray;'><td style='vertical-align:top'><b>pairwise_tree_distances</b></td><td style='padding-left:20px'>" +
"List of dictionaries where the keys are the tree ids of the pair of trees (strings) and the values are the distance scores (float). " +
"<p style='margin:6px;'></p>" +
"<font style='font-weight: 500;'>Example:</font> [{'sample_1': 'AML-73-001', 'sample_2': 'AML-22-001', 'distance': 0.6072}, … ]" +
"<p style='margin:6px;'></p>" +
"</td></tr>" +
"<tr style='border-bottom: 2px solid darkgray;'><td style='vertical-align:top'><b>highlighted_genes</b></td><td style='padding-left:20px'>" +
"Styles used: color code or keywords 'bold', 'italic', 'underline'.<p style='margin:6px;'></p>" +
"<font style='font-weight: 500;'>Example:</font> {\"JAK2\": \"bold\", \"PTEN\": \"italic\", \"TP53\": " +
"\"#b4a7d6\", \"FLT3-ITD\": \"lightsteelblue\"}" +
"<p style='margin:6px;'></p>" +
"</td></tr>" +
"</table>" +
"</td><td style='padding-left:50px; min-width:300px'><b>Load JSON file:</b><p style='margin:6px;'></p><input type=file id='picker' onchange='load()'<br/><br/><br/>" +
"<i> <font color=gray>The data is processed on the fly on the client's side and remains confidential.</font></i></td></tr></table><br/><br/>" +
"</div>"
} else {
data = datasets[cohort_name]["data"]
data["matching_trees"] = datasets[cohort_name]["matching_trees"]
oncotreeVIS(data, "container")
}
});
data = data_aml_morita
oncotreeVIS(data, "container")
</script>
</body>