Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

lab06_graphes.html 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548
  1. <!DOCTYPE html>
  2. <html xmlns="http://www.w3.org/1999/xhtml" lang="" xml:lang="">
  3. <head>
  4. <title>Graphes</title>
  5. <meta charset="utf-8" />
  6. <meta name="author" content="Maxime Wack" />
  7. <link href="libs/remark-css-0.0.1/default.css" rel="stylesheet" />
  8. <script src="libs/htmlwidgets-1.5.1/htmlwidgets.js"></script>
  9. <script src="libs/jquery-1.12.4/jquery.min.js"></script>
  10. <link href="libs/datatables-css-0.0.0/datatables-crosstalk.css" rel="stylesheet" />
  11. <script src="libs/datatables-binding-0.10/datatables.js"></script>
  12. <link href="libs/dt-core-1.10.19/css/jquery.dataTables.min.css" rel="stylesheet" />
  13. <link href="libs/dt-core-1.10.19/css/jquery.dataTables.extra.css" rel="stylesheet" />
  14. <script src="libs/dt-core-1.10.19/js/jquery.dataTables.min.js"></script>
  15. <link href="libs/crosstalk-1.0.0/css/crosstalk.css" rel="stylesheet" />
  16. <script src="libs/crosstalk-1.0.0/js/crosstalk.min.js"></script>
  17. <link rel="stylesheet" href="css/my_style.css" type="text/css" />
  18. </head>
  19. <body>
  20. <textarea id="source">
  21. class: center, middle, title
  22. # UE Visualisation
  23. ### 2019-2020
  24. ## Dr. Maxime Wack
  25. ### AHU Informatique médicale
  26. #### Hôpital Européen Georges Pompidou, &lt;/br&gt; Université de Paris
  27. ---
  28. # Graphe bipartite
  29. .pull-left[
  30. ### Graphe contenant deux sets de sommets **complèment déconnectés**
  31. ### Dit aussi 2-coloriable
  32. ]
  33. .pull-right[
  34. ![](06_img/bipartite.png)
  35. ]
  36. ---
  37. # Projection
  38. .pull-left[
  39. ### Méthode permettant de créer **deux** graphes
  40. ### Les sommets d'une partie sont connectés s'ils partagent un sommet d'une autre partie
  41. ]
  42. .pull-right[
  43. ![](06_img/71.png)
  44. ]
  45. ---
  46. # Projection
  47. .pull-left[
  48. ### Méthode permettant de créer **deux** graphes
  49. ### Les sommets d'une partie sont connectés s'ils partagent un sommet d'une autre partie
  50. ]
  51. .pull-right[
  52. ![](06_img/72.png)
  53. ]
  54. ---
  55. # Projection
  56. .pull-left[
  57. ### Méthode permettant de créer **deux** graphes
  58. ### Les sommets d'une partie sont connectés s'ils partagent un sommet d'une autre partie
  59. ]
  60. .pull-right[
  61. ![](06_img/73.png)
  62. ]
  63. ---
  64. # Projection
  65. .pull-left[
  66. ### Méthode permettant de créer **deux** graphes
  67. ### Les sommets d'une partie sont connectés s'ils partagent un sommet d'une autre partie
  68. ]
  69. .pull-right[
  70. ![](06_img/74.png)
  71. ]
  72. ---
  73. # Projection
  74. .pull-left[
  75. ### Méthode permettant de créer **deux** graphes
  76. ### Les sommets d'une partie sont connectés s'ils partagent un sommet d'une autre partie
  77. ]
  78. .pull-right[
  79. ![](06_img/75.png)
  80. ]
  81. ---
  82. # Projection
  83. .pull-left[
  84. ### Méthode permettant de créer **deux** graphes
  85. ### Les sommets d'une partie sont connectés s'ils partagent un sommet d'une autre partie
  86. ]
  87. .pull-right[
  88. ![](06_img/76.png)
  89. ]
  90. ---
  91. # Projection
  92. .pull-left[
  93. ### Méthode permettant de créer **deux** graphes
  94. ### Les sommets d'une partie sont connectés s'ils partagent un sommet d'une autre partie
  95. ]
  96. .pull-right[
  97. ![](06_img/77.png)
  98. ]
  99. ---
  100. class:center
  101. # Projection
  102. .pull-right[
  103. ![](06_img/bipartite.png)
  104. ]
  105. ---
  106. class:center
  107. # Projection
  108. .pull-left[
  109. ![](06_img/numbered_.png)
  110. ]
  111. .pull-right[
  112. ![](06_img/bipartite.png)
  113. ]
  114. ---
  115. class:center
  116. # Projection
  117. .pull-c1[
  118. ![](06_img/numbered_.png)
  119. ]
  120. .pull-c2[
  121. ![:scale 75%](06_img/bipartite.png)
  122. ]
  123. --
  124. .pull-c3[
  125. ![:scale 65%](06_img/projection.png)
  126. ]
  127. ---
  128. # OMIM
  129. *Online Mendelian Inheritance in Men*
  130. Base de données d'associations connues gène ↔ phénotype
  131. https://omim.org
  132. https://maximewack.com/files/OMIM.csv
  133. ---
  134. class: center
  135. # The Human Disease Network
  136. https://www.ncbi.nlm.nih.gov/pubmed/17502601
  137. ![:scale 90%](06_img/HDN_principe.png)
  138. ---
  139. class: center
  140. # The Human Disease Network
  141. https://www.ncbi.nlm.nih.gov/pubmed/17502601
  142. ![:scale 90%](06_img/HDN.png)
  143. ---
  144. # Librairies
  145. ```r
  146. library(igraph)
  147. library(ggraph)
  148. library(tidyverse)
  149. ```
  150. ---
  151. class:center,middle
  152. # igraph
  153. ---
  154. # Créer des graphes
  155. ```r
  156. # Graphe sans arête
  157. graph.empty(n = 10, directed = T)
  158. # Graphe complètement connecté
  159. graph.full(n = 10, directed = F, loops = F)
  160. # Graphe en étoile
  161. graph.star(n = 10, mode = "out")
  162. ```
  163. ---
  164. # Chargement du graphe
  165. ```r
  166. read_csv("lab06_data/OMIM.csv") -&gt; OMIM
  167. ```
  168. <div id="htmlwidget-e2536eee24b80cd7b4a4" style="width:100%;height:auto;" class="datatables html-widget"></div>
  169. <script type="application/json" data-for="htmlwidget-e2536eee24b80cd7b4a4">{"x":{"filter":"none","data":[["ACYL-CoA DEHYDROGENASE, SHORT-CHAIN, DEFICIENCY OF","ADAMS-OLIVER SYNDROME 1","ADAMS-OLIVER SYNDROME 2","ADAMS-OLIVER SYNDROME 3","ADENINE PHOSPHORIBOSYLTRANSFERASE DEFICIENCY","LUNG CANCER","LUNG CANCER","LUNG CANCER","LUNG CANCER","LUNG CANCER","LUNG CANCER"],["ACADS","ARHGAP31","DOCK6","RBPJ","APRT","CYP2A6","EGFR","TNFSF6","IRF1","BRAF","ERBB2"]],"container":"<table class=\"display\">\n <thead>\n <tr>\n <th>Disease<\/th>\n <th>Gene<\/th>\n <\/tr>\n <\/thead>\n<\/table>","options":{"paging":false,"search":false,"info":false,"order":[],"autoWidth":false,"orderClasses":false}},"evals":[],"jsHooks":[]}</script>
  170. ---
  171. # Chargement du graphe
  172. ```r
  173. graph.data.frame(OMIM, directed = F) -&gt; graphe
  174. ```
  175. ```
  176. ## IGRAPH d3876e8 UN-- 6288 4234 --
  177. ## + attr: name (v/c)
  178. ## + edges from d3876e8 (vertex names):
  179. ## [1] ADRENAL HYPERPLASIA, CONGENITAL, DUE TO 17-ALPHA-HYDROXYLASE DEFICIENCY--CYP17A1
  180. ## [2] 17-BETA-HYDROXYSTEROID DEHYDROGENASE X DEFICIENCY --HSD17B10
  181. ## [3] 2-METHYLBUTYRYL-CoA DEHYDROGENASE DEFICIENCY --ACADSB
  182. ## [4] THREE M SYNDROME 1 --CUL7
  183. ## [5] THREE M SYNDROME 2 --OBSL1
  184. ## [6] 3-METHYLCROTONYL-CoA CARBOXYLASE 1 DEFICIENCY --MCCC1
  185. ## [7] 3-METHYLCROTONYL-CoA CARBOXYLASE 2 DEFICIENCY --MCCC2
  186. ## + ... omitted several edges
  187. ```
  188. ---
  189. # Informations sur le graphe
  190. ### Sommets
  191. ```r
  192. vcount(graphe)
  193. ```
  194. ```
  195. ## [1] 6288
  196. ```
  197. ### Arêtes
  198. ```r
  199. ecount(graphe)
  200. ```
  201. ```
  202. ## [1] 4234
  203. ```
  204. ---
  205. # Informations sur le graphe
  206. ### Dirigé ?
  207. ```r
  208. is.directed(graphe)
  209. ```
  210. ```
  211. ## [1] FALSE
  212. ```
  213. ### Voisins d'un sommet
  214. ```r
  215. neighbors(graphe, V(graphe)[2019])
  216. ```
  217. ```
  218. ## + 1/6288 vertex, named, from d3876e8:
  219. ## [1] SLC25A3
  220. ```
  221. ---
  222. # Projection
  223. ```r
  224. # Établir les types (gène, phénotype)
  225. V(graphe)$type &lt;- bipartite.mapping(graphe)$type
  226. # Créer les projections
  227. projs &lt;- bipartite.projection(graphe)
  228. # Séparer les projections en deux graphes
  229. HDN &lt;- projs$proj1
  230. HGN &lt;- projs$proj2
  231. ```
  232. ---
  233. # HDN
  234. ```r
  235. HDN
  236. ```
  237. ```
  238. ## IGRAPH 58fb0bd UNW- 3512 2839 --
  239. ## + attr: name (v/c), weight (e/n)
  240. ## + edges from 58fb0bd (vertex names):
  241. ## [1] 17-BETA-HYDROXYSTEROID DEHYDROGENASE X DEFICIENCY--MENTAL RETARDATION, X-LINKED 17
  242. ## [2] 17-BETA-HYDROXYSTEROID DEHYDROGENASE X DEFICIENCY--MENTAL RETARDATION, X-LINKED, SYNDROMIC 10
  243. ## [3] 3-HYDROXYACYL-CoA DEHYDROGENASE DEFICIENCY --HYPERINSULINEMIC HYPOGLYCEMIA, FAMILIAL, 4
  244. ## [4] 3-METHYLGLUTACONIC ACIDURIA, TYPE III --OPTIC ATROPHY 3, AUTOSOMAL DOMINANT
  245. ## [5] 46,XX SEX REVERSAL 1 --46,XY SEX REVERSAL 1
  246. ## + ... omitted several edges
  247. ```
  248. ---
  249. # HGN
  250. ```r
  251. HGN
  252. ```
  253. ```
  254. ## IGRAPH f5f35d8 UNW- 2776 2810 --
  255. ## + attr: name (v/c), weight (e/n)
  256. ## + edges from f5f35d8 (vertex names):
  257. ## [1] AKR1C2--AKR1C4 LMNA --MYBPC3 LMNA --ZMPSTE24 GNAS --SSTR5
  258. ## [5] GNAS --AIP GNAS --STX16 GNAS --GNASAS1 COL2A1--COL11A2
  259. ## [9] FGFR3 --KRAS FGFR3 --HRAS FGFR3 --RB1 FGFR3 --PIK3CA
  260. ## [13] FGFR3 --AKT1 FGFR3 --APC FGFR3 --TP53 FGFR3 --NRAS
  261. ## [17] FGFR3 --FLCN FGFR3 --MLH3 FGFR3 --ODC1 FGFR3 --CCND1
  262. ## [21] FGFR3 --PLA2G2A FGFR3 --PTPRJ FGFR3 --EP300 FGFR3 --BUB1B
  263. ## [25] FGFR3 --TLR2 FGFR3 --TLR4 FGFR3 --AURKA FGFR3 --BCL10
  264. ## [29] FGFR3 --AXIN2 FGFR3 --PDGFRL FGFR3 --KIT FGFR3 --STK11
  265. ## + ... omitted several edges
  266. ```
  267. ---
  268. # Décomposition en sous-graphes
  269. ```r
  270. HDN %&gt;%
  271. decompose -&gt; diseases
  272. ```
  273. ---
  274. # ggraph
  275. ```r
  276. graph_one &lt;- function(graph)
  277. {
  278. ggraph(graph) +
  279. geom_edge_diagonal() +
  280. geom_node_label(aes(label = name))
  281. }
  282. ```
  283. ---
  284. # Filtrer sous-graphes &lt; 10 sommets
  285. ```r
  286. diseases %&gt;%
  287. keep(map_dbl(diseases, vcount) &gt;= 10) %&gt;%
  288. map(graph_one) -&gt; plots
  289. ```
  290. ---
  291. # Malformations cardiaques
  292. ```r
  293. plots[[5]]
  294. ```
  295. ![](lab06_graphes_files/figure-html/cardiaques-1.png)&lt;!-- --&gt;
  296. ---
  297. # Surdités
  298. ```r
  299. plots[[9]]
  300. ```
  301. ![](lab06_graphes_files/figure-html/surdités-1.png)&lt;!-- --&gt;
  302. ---
  303. # Ostéogénèses imparfaites
  304. ```r
  305. plots[[12]]
  306. ```
  307. ![](lab06_graphes_files/figure-html/Ostéogénèses-1.png)&lt;!-- --&gt;
  308. ---
  309. # Export
  310. ```r
  311. write.graph(HDN, file = "diseases.graphml", format = "graphml")
  312. write.graph(HGN, file = "genes.graphml", format = "graphml")
  313. ```
  314. </textarea>
  315. <style data-target="print-only">@media screen {.remark-slide-container{display:block;}.remark-slide-scaler{box-shadow:none;}}</style>
  316. <script src="https://remarkjs.com/downloads/remark-latest.min.js"></script>
  317. <script src="addons/macros.js"></script>
  318. <script>var slideshow = remark.create({
  319. "ratio": "4:3",
  320. "countIncrementalSlides": false,
  321. "self-contained": true,
  322. "highlightLines": true
  323. });
  324. if (window.HTMLWidgets) slideshow.on('afterShowSlide', function (slide) {
  325. window.dispatchEvent(new Event('resize'));
  326. });
  327. (function(d) {
  328. var s = d.createElement("style"), r = d.querySelector(".remark-slide-scaler");
  329. if (!r) return;
  330. s.type = "text/css"; s.innerHTML = "@page {size: " + r.style.width + " " + r.style.height +"; }";
  331. d.head.appendChild(s);
  332. })(document);
  333. (function(d) {
  334. var el = d.getElementsByClassName("remark-slides-area");
  335. if (!el) return;
  336. var slide, slides = slideshow.getSlides(), els = el[0].children;
  337. for (var i = 1; i < slides.length; i++) {
  338. slide = slides[i];
  339. if (slide.properties.continued === "true" || slide.properties.count === "false") {
  340. els[i - 1].className += ' has-continuation';
  341. }
  342. }
  343. var s = d.createElement("style");
  344. s.type = "text/css"; s.innerHTML = "@media print { .has-continuation { display: none; } }";
  345. d.head.appendChild(s);
  346. })(document);
  347. // delete the temporary CSS (for displaying all slides initially) when the user
  348. // starts to view slides
  349. (function() {
  350. var deleted = false;
  351. slideshow.on('beforeShowSlide', function(slide) {
  352. if (deleted) return;
  353. var sheets = document.styleSheets, node;
  354. for (var i = 0; i < sheets.length; i++) {
  355. node = sheets[i].ownerNode;
  356. if (node.dataset["target"] !== "print-only") continue;
  357. node.parentNode.removeChild(node);
  358. }
  359. deleted = true;
  360. });
  361. })();
  362. // adds .remark-code-has-line-highlighted class to <pre> parent elements
  363. // of code chunks containing highlighted lines with class .remark-code-line-highlighted
  364. (function(d) {
  365. const hlines = d.querySelectorAll('.remark-code-line-highlighted');
  366. const preParents = [];
  367. const findPreParent = function(line, p = 0) {
  368. if (p > 1) return null; // traverse up no further than grandparent
  369. const el = line.parentElement;
  370. return el.tagName === "PRE" ? el : findPreParent(el, ++p);
  371. };
  372. for (let line of hlines) {
  373. let pre = findPreParent(line);
  374. if (pre && !preParents.includes(pre)) preParents.push(pre);
  375. }
  376. preParents.forEach(p => p.classList.add("remark-code-has-line-highlighted"));
  377. })(document);</script>
  378. <script>
  379. (function() {
  380. var links = document.getElementsByTagName('a');
  381. for (var i = 0; i < links.length; i++) {
  382. if (/^(https?:)?\/\//.test(links[i].getAttribute('href'))) {
  383. links[i].target = '_blank';
  384. }
  385. }
  386. })();
  387. </script>
  388. <script>
  389. slideshow._releaseMath = function(el) {
  390. var i, text, code, codes = el.getElementsByTagName('code');
  391. for (i = 0; i < codes.length;) {
  392. code = codes[i];
  393. if (code.parentNode.tagName !== 'PRE' && code.childElementCount === 0) {
  394. text = code.textContent;
  395. if (/^\\\((.|\s)+\\\)$/.test(text) || /^\\\[(.|\s)+\\\]$/.test(text) ||
  396. /^\$\$(.|\s)+\$\$$/.test(text) ||
  397. /^\\begin\{([^}]+)\}(.|\s)+\\end\{[^}]+\}$/.test(text)) {
  398. code.outerHTML = code.innerHTML; // remove <code></code>
  399. continue;
  400. }
  401. }
  402. i++;
  403. }
  404. };
  405. slideshow._releaseMath(document);
  406. </script>
  407. <!-- dynamically load mathjax for compatibility with self-contained -->
  408. <script>
  409. (function () {
  410. var script = document.createElement('script');
  411. script.type = 'text/javascript';
  412. script.src = 'https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-MML-AM_CHTML';
  413. if (location.protocol !== 'file:' && /^https?:/.test(script.src))
  414. script.src = script.src.replace(/^https?:/, '');
  415. document.getElementsByTagName('head')[0].appendChild(script);
  416. })();
  417. </script>
  418. </body>
  419. </html>