forked from CCGE-BOADICEA/pedigreejs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex_es.html
479 lines (444 loc) · 17.9 KB
/
index_es.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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,maximum-scale=2">
<link href="https://code.jquery.com/ui/1.12.1/themes/cupertino/jquery-ui.min.css" rel="stylesheet" type="text/css" media="all" />
<link href="https://cdn.jsdelivr.net/npm/@fortawesome/[email protected]/css/all.min.css" rel="stylesheet" type="text/css" media="all" />
<link rel="stylesheet" href="build/pedigreejs.v3.0.0-rc3.css" />
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/d3.min.js" integrity="sha256-yUdn/lyl/rHBn4bD4HkKmnR7S6Fj+tXIO0ozSay1Bik=" crossorigin="anonymous"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js"></script>
<script type="module" src="es/pedigree.js"></script>
<style>
a[href^="http://"][target=_blank]:after,
a[href^="https://"][target=_blank]:after,
a[href^="ftp://"][target=_blank]:after {
content: "\f08e";
font-family: FontAwesome;
font-weight: normal;
font-style: normal;
display: inline-block;
text-decoration: none;
padding: 0px 2px;
display:inline;
}
.fa-rotate-45 {
-webkit-transform:rotate(45deg);
-moz-transform:rotate(45deg);
-ms-transform:rotate(45deg);
-o-transform:rotate(45deg);
transform:rotate(45deg);
}
.header {
background-color:#DDD1C1;
margin-right: auto;
margin-left: auto;
margin-bottom: 20px;
}
.btn.btn-primary {
color: #fff;
background-color: #337ab7;
border-color: #2e6da4;
padding: 10px 16px;
font-size: 18px;
line-height: 1.3333333;
border-radius: 6px;
text-decoration: none;
}
.row {
display: flex;
}
.row > div {
margin-right: 10px;
}
.left {
width:140px;
font-weight: bold;
text-align: right;
flex-shrink: 0;
}
/* Clear floats after the columns */
.row:after {
content: "";
display: table;
clear: both;
}
@media screen and (min-width: 768px) {
.header {
padding-top: 20px;
padding-bottom: 20px;
}
.header h1 {
font-size: 63px;
font-weight: 500;
line-height: 1.1;
margin: 10px 0;
}
.header h2 {
font-size: 30px;
margin-top: 20px;
margin-bottom: 10px;
font-weight: 500;
}
}
body {
margin: 0;
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
font-size: 14px;
line-height: 1.42857143;
color: #333;
background-color: #fff;
}
.container {
width: 90%;
max-width: 1140px;
margin-right: auto;
margin-left: auto;
}
#ped {text-align:center;}
.btn {
color: #333;
background-color: #fff;
border: 1px solid #ccc;
display: inline-block;
padding: 6px 12px;
cursor: pointer;
margin-left: 5px;
border-radius: 4px;
}
.options {
background-color: #F5F5F5;
padding: 10px;
border: 1px solid #ccc;
font-size: 13px;
line-height: 1.42857143;
overflow: auto;word-wrap: normal;
border-radius: 4px;
}
#pedigree_history {
padding: 10px;
}
.text-center {
text-align: center;
padding: 0 20px;
}
</style>
<script type="module">
import * as pedigree from '/es/pedigree.js';
import * as pedcache from '/es/pedcache.js';
import {urlParam, isIE} from '/es/utils.js';
if(isIE()) {
document.write('<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/browser/canvg.min.js"><\/script>');
}
$( document ).ready(function() {
////////////////////
var dataset = [
{"name": "m11", "sex": "M", "top_level": true},
{"name": "f11", "display_name": "Jane", "sex": "F", "status": 1, "top_level": true, "breast_cancer_diagnosis_age":67, "ovarian_cancer_diagnosis_age":63},
{"name": "m12", "sex": "M", "top_level": true},
{"name": "f12", "sex": "F", "top_level": true, "breast_cancer_diagnosis_age":55},
{"name": "m21", "sex": "M", "mother": "f11", "father": "m11", "age": 56},
{"name": "f21", "sex": "F", "mother": "f12", "father": "m12", "breast_cancer_diagnosis_age":55, "breast_cancer2_diagnosis_age": 60, "ovarian_cancer_diagnosis_age":58, "age": 63},
{"name": "ch1", "display_name": "Ana", "sex": "F", "mother": "f21", "father": "m21", "proband": true, "age": 25}
];
$( "#pedigrees" ).append( $( "<div id='pedigree_history'></div>" ) );
$( "#pedigrees" ).append( $( "<div id='pedigree'></div>" ) );
var opts = {
'targetDiv': 'pedigree',
'btn_target': 'pedigree_history',
// 'nodeclick': pedigree_form.nodeclick,
'width': ($(window).width() > 450 ? 690 : $(window).width()- 30),
'height': 480,
'symbol_size': 30,
'edit': true,
'zoomSrc': ['button'],
'zoomIn': .05,
'zoomOut': 1.5,
'optionalLabels': [
['brca1_gene_test', 'brca2_gene_test', 'palb2_gene_test', 'chek2_gene_test', 'atm_gene_test'],
['rad51d_gene_test', 'rad51c_gene_test', 'brip1_gene_test'],
['er_bc_pathology', 'pr_bc_pathology', 'her2_bc_pathology', 'ck14_bc_pathology', 'ck56_bc_pathology']],
'labels': [['age', 'yob'],
['brca1_gene_test', 'brca2_gene_test', 'palb2_gene_test', 'chek2_gene_test', 'atm_gene_test'],
['rad51d_gene_test', 'rad51c_gene_test', 'brip1_gene_test'],
['er_bc_pathology', 'pr_bc_pathology', 'her2_bc_pathology', 'ck14_bc_pathology', 'ck56_bc_pathology']],
'diseases': [{'type': 'breast_cancer', 'colour': '#F68F35'},
{'type': 'breast_cancer2', 'colour': 'pink'},
{'type': 'ovarian_cancer', 'colour': '#4DAA4D'},
{'type': 'pancreatic_cancer', 'colour': '#4289BA'},
{'type': 'prostate_cancer', 'colour': '#D5494A'}],
'DEBUG': (urlParam('debug') === null ? false : true)};
var local_dataset = pedcache.current(opts);
if (local_dataset !== undefined && local_dataset !== null) {
opts.dataset = local_dataset;
} else {
opts.dataset = dataset;
}
opts = pedigree.build(opts);
});
</script>
</head>
<body>
<!-- HEADER -->
<div class="header">
<div class="container">
<a class="btn btn-primary pull-right" role="button" href="https://github.com/CCGE-BOADICEA/pedigreejs">View on GitHub</a>
<h1>pedigreejs</h1>
<h2>A web tool for building and displaying pedigrees.</h2>
</div>
</div>
<div class="container">
<div>
<!-- EXAMPLE -->
<div style="margin-left:20px;" class="pull-right">
<div class="text-center">
<label class="btn">
<input id="load" type="file" style="display: none;"/>Load
</label>
<label class="btn">
<input id="save" type="button" style="display: none;"/>Save
</label>
<label class="btn">
<input id="print" type="button" style="display: none;"/>Print
</label>
<label class="btn">
<input id="svg_download" type="button" style="display: none;"/>SVG
</label>
<label class="btn">
<input id="png_download" type="button" style="display: none;"/>PNG
</label>
<div id="pedigrees"></div>
<div id="node_properties"></div>
</div>
</div>
<div>
<h2>Overview</h2>
<p>
<strong>pedigreejs</strong> is a JavaScript library used to draw family trees using
<a href="https://www.ncbi.nlm.nih.gov/pubmed/7887430" target="_blank">standard pedigree nomenclature</a>.
It uses the JavaScript <a href="https://d3js.org/" target="_blank">d3</a> library
to layout the hierarchical structure and draw the individual nodes as a SVG image.
The size of the SVG can be configured as well as the colour codes used to denote disease.
It can be used to build the pedigree structure or load in an existing data set.
To assist visualisation and building of larger pedigrees a full screen mode is provided.
</p>
<p>
Browser local storage is used to maintain a history of the steps in building a pedigree
structure. So that at each step of the pedigree building process it can be undone to return
to previous versions.
</p>
<p>See the <a href="docs/developer.html">developer documentation</a> for more details about setting up
pedigreejs.</p>
<p>A demonstration page is available <a href="docs/demo.html">here</a>.
Other example pages and configurations are given below:</p>
<ul>
<li>Example 1: <a href="docs/example1.html">diabetes example</a></li>
<li>Example 2: <a href="docs/example2.html">change background, node colours and using local storage</a></li>
<li>Example 3: <a href="docs/example3.html">change text and node size</a></li>
<li>Example 4: <a href="docs/example4.html">PED file example with genotype data</a></li>
<li>Example 5: <a href="docs/example5.html">consanguineous partners and first and last name labels</a></li>
<li>Example 6: <a href="docs/example6.html">example pedigree validation</a></li>
<li>Example 7: <a href="docs/example7.html">twins, divorced, miscarriage, termination, stillbirth and adoption</a></li>
<li>Example 8: <a href="docs/example8.html">search pedigree data</a></li>
<li>Example 9: <a href="docs/example9.html">consanguineous partners at different levels</a></li>
</ul>
</div>
</div>
<!-- EXAMPLE END -->
<h2>Building Pedigrees</h2>
<p>
Individuals can be added to the pedigree by placing the mouse over an individual to reveal
the widgets used for editing and adding a
partner <i class="fa fa-link" aria-hidden="true"></i> (two people with at least one child),
parents <i class="fa fa-arrow-up" aria-hidden="true"></i>,
a sibling <i class="fa fa-user-plus" aria-hidden="true"></i>,
or a child <i class="fa fa-arrow-down" aria-hidden="true"></i>.
Options are given to add
male <i class="fa fa-square-o" aria-hidden="true"></i>,
female <i class="fa fa-circle-o" aria-hidden="true"></i>,
unknown <i class="fa fa-square-o fa-rotate-45" aria-hidden="true"></i>,
dizygotic (fraternal) twin <i class="fa fa-angle-up" style="font-size:1.5em" aria-hidden="true"></i>
or monozygotic (identical) twin <i class="fa fa-caret-up" style="font-size:1.5em" aria-hidden="true"></i>.
</p>
<p>
If the 'edit' parameter is set in the configuration of pedigreejs then the <i class="fa fa-cog" aria-hidden="true"></i> widget
is also displayed. When this widget is clicked it opens an editor dialog of the attributes associated for the individual. A default
editor is provided that can be overridden and customised.
</p>
<p>Half siblings can be added by creating a new partner (with <i class="fa fa-link" aria-hidden="true"></i>)
for the parent in common to the siblings.
Consanguineous partners can be created between individual's at the same or different levels in the pedigree
tree, <i>e.g.</i> cousins.
This is done by placing the mouse over one of the partners and clicking and dragging the
triple dashed line widget <img alt="handle" src="docs/img/handle.png"> in the direction of their new partner.
</p>
<p>
There are 'undo' <i class="fa fa-undo" aria-hidden="true"></i>,
'redo' <i class="fa fa-redo" aria-hidden="true"></i> and 'reset' <i class="fa fa-refresh" aria-hidden="true"></i>
buttons at the top and a button to enable full screen editing <i class="fa fa-arrows-alt" aria-hidden="true"></i>.
</p>
<h2>Loading and Saving Pedigree Data</h2>
<p>The pedigree can be saved out and loaded back in. Preliminary support is given to loading basic
BOADICEA file format v4 (see the BOADICEA documentation
<a href="https://pluto.srl.cam.ac.uk/bd4/v4/docs/BWA_v4_Appendix_A.pdf" target="_blank">Appendix</a>).</p>
<p>Support for <a href="https://www.cog-genomics.org/plink/1.9/formats#ped">PED file format</a>
has been added, see <a href="docs/example4.html">example 4</a>.<p>
<h2>Future Development</h2>
<p>The following will be looked at:</p>
<ul>
<li>currently the maximum number of partners an individual can be represented to have is 2.</li>
<li><del>the ability to represent consanguineous partners between different levels in the tree.</del></li>
</ul>
<h2 id="config">Configuration and Integration Notes</h2>
<p>The following parameters can be used to configure pedigreejs.
Please also see the <a href="docs/developer.html">developer notes</a> for more details about
programmatically interacting with pedigreejs.
The important parameter to configure is 'targetDiv' which defines the HTML div used for
drawing the pedigree. Default parameters are provided which are documented below.
There is a configuration parameter 'edit' which can take a function, so that a
customised editor can be written to view and edit an individual's attributes (e.g. name, sex).
Alternatively is 'edit' is set to true a default dialog will be displayed showing the
individual's attributes.
</p>
<pre class="options">
var opts = {
'targetDiv': 'pedigree',
'btn_target': 'pedigree_history',
'width': 450,
'height': 320,
'symbol_size': 35,
'store_type': 'array',
'diseases': [
{'type': 'breast_cancer', 'colour': '#F68F35'},
{'type': 'ovarian_cancer', 'colour': '#4DAA4D'},
{'type': 'pancreatic_cancer', 'colour': '#4289BA'},
{'type': 'prostate_cancer', 'colour': '#D5494A'}],
labels: ['age', 'yob'],
font_size: '.75em',
font_family: 'Helvetica',
font_weight: 700,
'DEBUG': (pedigree_util.urlParam('debug') === null ? false : true)
};
var local_dataset = pedcache.current(opts);
if (local_dataset !== undefined && local_dataset !== null) {
opts.dataset = local_dataset;
} else {
opts.dataset = dataset;
}
opts= ptree.build(opts);
</pre>
<h2>Options</h2>
<div class="row" id="targetDiv">
<div class="left">targetDiv</div>
<div>This is the id of the HTML div used for drawing the pedigree, <i>e.g.</i> 'pedigree_edit'.</div>
</div>
<div class="row" id="btn_target">
<div class="left">btn_target</div>
<div>This is the id of the HTML div used for the buttons, <i>e.g.</i> 'pedigree_history'.</div>
</div>
<div class="row" id="dataset">
<div class="left">dataset</div>
<div>The pedigree data to be displayed, <i>e.g.</i>
<pre class="options">
[ {"name": "m21", "sex": "M", "top_level": true},
{"name": "f21", "sex": "F", "top_level": true},
{"name": "ch1", "sex": "F", "mother": "f21", "father": "m21", "breast_cancer": true, "proband": true}]</pre>
</div>
</div>
<div class="row" id="labels">
<div class="left">labels</div>
<div>Array of attributes to display under the individual's symbol, <i>e.g.</i> labels: ['age', 'yob', 'alleles'].</div>
</div>
<div class="row" id="font_size">
<div class="left">font_size</div>
<div>Define the font-size of the labels, <i>e.g.</i> '0.75em' or '10px'.</div>
</div>
<div class="row" id="font_family">
<div class="left">font_family</div>
<div>Define the font-family of the labels, <i>e.g.</i> 'times'.</div>
</div>
<div class="row" id="font_weight">
<div class="left">font_weight</div>
<div>Define the font-weight of the labels, <i>e.g.</i> 400, 700.</div>
</div>
<div class="row" id="width">
<div class="left">width</div>
<div>Width of the SVG element, <i>e.g.</i> 600.</div>
</div>
<div class="row" id="height">
<div class="left">height</div>
<div>Height of the SVG element, <i>e.g.</i> 400.</div>
</div>
<div class="row" id="symbol_size">
<div class="left">symbol_size</div>
<div>Size of the nodes, <i>e.g.</i> 35.</div>
</div>
<div class="row" id="store_type">
<div class="left">store_type</div>
<div>Pedigree storage (for undo, redo functions) set to 'session', 'local' or 'array'.
Default is '<a href="https://www.w3schools.com/html/html5_webstorage.asp">session</a>' browser storage.
Using 'session' will store the data for one session (data is lost when the browser tab is closed).
Using 'local' will store the data with no expiration date.
If session/local storage is not supported then it switches automatically to 'array' (JavaScript array store).</div>
</div>
<div class="row" id="zoomIn">
<div class="left">zoomIn</div>
<div>The factor by which the svg size can be scaled down to, default 1 (no zoom in).</div>
</div>
<div class="row" id="zoomOut">
<div class="left">zoomOut</div>
<div>The factor by which the svg size can be scaled up to, default 1 (no zoom out).</div>
</div>
<div class="row" id="edit">
<div class="left">edit</div>
<div>Set to true for a button to display an individual's details (<i>e.g.</i> age, sex) in a dialog or provide a funtion to handle editing.</div>
</div>
<div class="row" id="diseases">
<div class="left">diseases</div>
<div>Diseases and their colour representation, <i>e.g.</i>
<pre class="options">
[{'type': 'breast_cancer', 'colour': '#F68F35'},
{'type': 'breast_cancer2', 'colour': 'pink'},
{'type': 'ovarian_cancer', 'colour': '#4DAA4D'},
{'type': 'pancreatic_cancer', 'colour': '#4289BA'},
{'type': 'prostate_cancer', 'colour': '#D5494A'}]</pre>
</div>
</div>
<div class="row" id="background">
<div class="left">background</div>
<div>SVG background colour, <i>e.g.</i> #d3d3d3.</div>
</div>
<div class="row" id="node_background">
<div class="left">node_background</div>
<div>Individual's background colour, <i>e.g.</i> #fff.</div>
</div>
<div class="row" id="validate">
<div class="left">validate</div>
<div>Pedigree data validation (default true). This can also take a validation
function to override the in-built validation. The in-built validation throws an error if any
of the following are not true:
<ul>
<li>parents, when defined, exist in the pedigree</li>
<li>mother is female</li>
<li>father is male</li>
</ul>
A warning message it sent to the console if there are any individuals that are not connected
(i.e. a break in the pedigree). See the <a href="docs/developer.html">developer notes</a> for
more details.
</div>
</div>
<div class="row" id="DEBUG">
<div class="left">DEBUG</div>
<div>Debug mode, <i>e.g.</i> false.</div>
</div>
<h2>Publication</h2>
<p><strong>pedigreejs: a web-based graphical pedigree editor</strong><br>
Carver T, Cunningham AP, Babb de Villiers C, Lee A, Hartley S, Tischkowitz M, et al.
<i>Bioinformatics <a href="http://dx.doi.org/10.1093/bioinformatics/btx705" target="_blank">
doi:10.1093/bioinformatics/btx705</a></i></p>
</div>
<p></p>
</body>
</html>