Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

565 lines
13KB

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