aboutsummaryrefslogtreecommitdiff
path: root/competition_results (1).ipynb
blob: 02e81db73d56037fd808cf7e84d1011ed20cf751 (plain)
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
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Using Connectivity map data and PharmacoGx R package to find drugs against coronaviruses"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Connectivity map or Cmap is resource that uses gene expression data to connect disease transcriptomic signature with those of different types of cells after drug treatment. If the transcriptomic signature of a drug on cell line is opposite from disease signature, it can be expected that this drug could have a positive effect on amelioration of disease.\n",
    "\n",
    "\n",
    "References:\n",
    "Subramanian A, et al. A Next Generation Connectivity Map: L1000 Platform And The First 1,000,000 Profiles. Cell. 2017/12/1. 171(6):1437–1452.\n",
    "\n",
    "Lamb J, et al. The Connectivity Map: using gene-expression signatures to connect small molecules, genes, and disease. Science. 2006/9/29. 313(5795):1929-35, (2006)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Harmonizome is a collection of processed datasets from over 70 major online resources. I downloaded from Harmonizome \"GEO Signatures of Differentially Expressed Genes for Viral Infections\". For this analysis I used transcriptomics data of lungs from mice that were infected with icSARS CoV (GEO accesion number GSE50000;7th day of infection) and Calu-3 2B4 cells that were infected with Human Coronavirus EMC 2012 (GEO accession number GSE45042;24 hours after infection). For this analysis I havent used transcriptomic data of novel human coronavirus 2019 or SARS-2, but according to the literature all of these viruses (MERS,SARS1 and SARS2) are betacoronaviruses that have origin in bats and SARS-2 is shown to be very similar to SARS-01 according to phylogenic analysis. \n",
    "\n",
    "References:\n",
    "Rouillard AD, Gundersen GW, Fernandez NF, Wang Z, Monteiro CD, McDermott MG, Ma'ayan A. The harmonizome: a collection of processed datasets gathered to serve and mine knowledge about genes and proteins. Database (Oxford). 2016 Jul 3;2016. pii: baw100.\n",
    "\t\n",
    "Josset L, Menachery VD, Gralinski LE, Agnihothram S et al. Cell host response to infection with novel human coronavirus EMC predicts potential antivirals and important differences with SARS coronavirus. mBio 2013 Apr 30;4(3):e00165-13. PMID: 23631916\n",
    "\n",
    "Menachery VD, Eisfeld AJ, Schäfer A, Josset L et al. Pathogenic influenza viruses and coronaviruses utilize similar and contrasting approaches to control interferon-stimulated gene responses. mBio 2014 May 20;5(3):e01174-14. PMID: 24846384\n",
    "\n",
    "Yushun Wan, Jian Shang, Rachel Graham, Ralph S. Baric, Fang Li. Receptor recognition by novel coronavirus from Wuhan: An analysis based on decade-long structural studies of SARS. Journal of Virology, 2020; DOI: 10.1128/JVI.00127-20\n",
    "\n",
    "Yadi Zhou, Yuan Hou, Jiayu Shen, Yin Huang, William Martin, Feixiong Cheng.Network-based Drug Repurposing for Human Coronavirus\n",
    "doi: https://doi.org/10.1101/2020.02.03.20020263"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "For the analysis of Connectivity map data I used PharmacoGx R package.\n",
    "\n",
    "P Smirnov, Z Safikhani, N El-Hachem , D Wang, A She , C Olsen, MFreeman, H Selby, D Gendoo , P Grossman , A Beck , H Aerts ,\n",
    "M Lupien, A Goldenberg ,B Haibe-Kains PharmacoGx: an R package for analysis of large pharmacogenomic datasets Bioinformatics (2016)."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 76,
   "metadata": {},
   "outputs": [],
   "source": [
    "library(PharmacoGx)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 77,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<table>\n",
       "<caption>A data.frame: 11 × 5</caption>\n",
       "<thead>\n",
       "\t<tr><th></th><th scope=col>PSet.Name</th><th scope=col>Dataset.Type</th><th scope=col>Available.Molecular.Profiles</th><th scope=col>Date.Updated</th><th scope=col>URL</th></tr>\n",
       "\t<tr><th></th><th scope=col>&lt;fct&gt;</th><th scope=col>&lt;fct&gt;</th><th scope=col>&lt;fct&gt;</th><th scope=col>&lt;fct&gt;</th><th scope=col>&lt;fct&gt;</th></tr>\n",
       "</thead>\n",
       "<tbody>\n",
       "\t<tr><th scope=row>CCLE_2013</th><td>CCLE_2013      </td><td>sensitivity </td><td>rna/mutation                </td><td>Tue Sep 15 18:50:07 2015</td><td>https://www.pmgenomics.ca/bhklab/sites/default/files/downloads/CCLE_Nature2013.RData</td></tr>\n",
       "\t<tr><th scope=row>CCLE</th><td>CCLE           </td><td>sensitivity </td><td>rna/rnaseq/mutation/cnv     </td><td>Thu Dec 10 18:17:14 2015</td><td>https://www.pmgenomics.ca/bhklab/sites/default/files/downloads/CCLE.RData           </td></tr>\n",
       "\t<tr><th scope=row>GDSC_2013</th><td>GDSC_2013      </td><td>sensitivity </td><td>rna/mutation                </td><td>Mon Oct  5 16:07:54 2015</td><td>https://www.pmgenomics.ca/bhklab/sites/default/files/downloads/CGP_Nature2013.RData </td></tr>\n",
       "\t<tr><th scope=row>GDSC</th><td>GDSC           </td><td>sensitivity </td><td>rna/rna2/mutation/fusion/cnv</td><td>Wed Dec 30 10:44:21 2015</td><td>https://www.pmgenomics.ca/bhklab/sites/default/files/downloads/GDSC.RData           </td></tr>\n",
       "\t<tr><th scope=row>GDSC1000</th><td>GDSC1000       </td><td>sensitivity </td><td>rna                         </td><td>Thu Aug 25 11:13:00 2016</td><td>https://www.pmgenomics.ca/bhklab/sites/default/files/downloads/GDSC1000.RData       </td></tr>\n",
       "\t<tr><th scope=row>gCSI</th><td>gCSI           </td><td>sensitivity </td><td>rnaseq/cnv                  </td><td>Mon Jun 13 18:50:12 2016</td><td>https://www.pmgenomics.ca/bhklab/sites/default/files/downloads/gCSI.RData           </td></tr>\n",
       "\t<tr><th scope=row>FIMM</th><td>FIMM           </td><td>sensitivity </td><td>                            </td><td>Mon Oct 3 17:14:00 2016 </td><td>https://www.pmgenomics.ca/bhklab/sites/default/files/downloads/FIMM.RData           </td></tr>\n",
       "\t<tr><th scope=row>CTRPv2</th><td>CTRPv2         </td><td>sensitivity </td><td>                            </td><td>Thu Aug 25 11:15:00 2016</td><td>https://www.pmgenomics.ca/bhklab/sites/default/files/downloads/CTRPv2.RData         </td></tr>\n",
       "\t<tr><th scope=row>CMAP</th><td>CMAP           </td><td>perturbation</td><td>rna                         </td><td>Mon Sep 21 02:38:45 2015</td><td>https://www.pmgenomics.ca/bhklab/sites/default/files/downloads/CMAP.RData           </td></tr>\n",
       "\t<tr><th scope=row>L1000_compounds</th><td>L1000_compounds</td><td>perturbation</td><td>rna                         </td><td>Mon Jan 25 12:51:00 2016</td><td>https://www.pmgenomics.ca/bhklab/sites/default/files/downloads/L1000_compounds.RData</td></tr>\n",
       "\t<tr><th scope=row>L1000_genetic</th><td>L1000_genetic  </td><td>perturbation</td><td>rna                         </td><td>Mon Jan 25 12:51:00 2016</td><td>https://www.pmgenomics.ca/bhklab/sites/default/files/downloads/L1000_genetic.RData  </td></tr>\n",
       "</tbody>\n",
       "</table>\n"
      ],
      "text/latex": [
       "A data.frame: 11 × 5\n",
       "\\begin{tabular}{r|lllll}\n",
       "  & PSet.Name & Dataset.Type & Available.Molecular.Profiles & Date.Updated & URL\\\\\n",
       "  & <fct> & <fct> & <fct> & <fct> & <fct>\\\\\n",
       "\\hline\n",
       "\tCCLE\\_2013 & CCLE\\_2013       & sensitivity  & rna/mutation                 & Tue Sep 15 18:50:07 2015 & https://www.pmgenomics.ca/bhklab/sites/default/files/downloads/CCLE\\_Nature2013.RData\\\\\n",
       "\tCCLE & CCLE            & sensitivity  & rna/rnaseq/mutation/cnv      & Thu Dec 10 18:17:14 2015 & https://www.pmgenomics.ca/bhklab/sites/default/files/downloads/CCLE.RData           \\\\\n",
       "\tGDSC\\_2013 & GDSC\\_2013       & sensitivity  & rna/mutation                 & Mon Oct  5 16:07:54 2015 & https://www.pmgenomics.ca/bhklab/sites/default/files/downloads/CGP\\_Nature2013.RData \\\\\n",
       "\tGDSC & GDSC            & sensitivity  & rna/rna2/mutation/fusion/cnv & Wed Dec 30 10:44:21 2015 & https://www.pmgenomics.ca/bhklab/sites/default/files/downloads/GDSC.RData           \\\\\n",
       "\tGDSC1000 & GDSC1000        & sensitivity  & rna                          & Thu Aug 25 11:13:00 2016 & https://www.pmgenomics.ca/bhklab/sites/default/files/downloads/GDSC1000.RData       \\\\\n",
       "\tgCSI & gCSI            & sensitivity  & rnaseq/cnv                   & Mon Jun 13 18:50:12 2016 & https://www.pmgenomics.ca/bhklab/sites/default/files/downloads/gCSI.RData           \\\\\n",
       "\tFIMM & FIMM            & sensitivity  &                              & Mon Oct 3 17:14:00 2016  & https://www.pmgenomics.ca/bhklab/sites/default/files/downloads/FIMM.RData           \\\\\n",
       "\tCTRPv2 & CTRPv2          & sensitivity  &                              & Thu Aug 25 11:15:00 2016 & https://www.pmgenomics.ca/bhklab/sites/default/files/downloads/CTRPv2.RData         \\\\\n",
       "\tCMAP & CMAP            & perturbation & rna                          & Mon Sep 21 02:38:45 2015 & https://www.pmgenomics.ca/bhklab/sites/default/files/downloads/CMAP.RData           \\\\\n",
       "\tL1000\\_compounds & L1000\\_compounds & perturbation & rna                          & Mon Jan 25 12:51:00 2016 & https://www.pmgenomics.ca/bhklab/sites/default/files/downloads/L1000\\_compounds.RData\\\\\n",
       "\tL1000\\_genetic & L1000\\_genetic   & perturbation & rna                          & Mon Jan 25 12:51:00 2016 & https://www.pmgenomics.ca/bhklab/sites/default/files/downloads/L1000\\_genetic.RData  \\\\\n",
       "\\end{tabular}\n"
      ],
      "text/markdown": [
       "\n",
       "A data.frame: 11 × 5\n",
       "\n",
       "| <!--/--> | PSet.Name &lt;fct&gt; | Dataset.Type &lt;fct&gt; | Available.Molecular.Profiles &lt;fct&gt; | Date.Updated &lt;fct&gt; | URL &lt;fct&gt; |\n",
       "|---|---|---|---|---|---|\n",
       "| CCLE_2013 | CCLE_2013       | sensitivity  | rna/mutation                 | Tue Sep 15 18:50:07 2015 | https://www.pmgenomics.ca/bhklab/sites/default/files/downloads/CCLE_Nature2013.RData |\n",
       "| CCLE | CCLE            | sensitivity  | rna/rnaseq/mutation/cnv      | Thu Dec 10 18:17:14 2015 | https://www.pmgenomics.ca/bhklab/sites/default/files/downloads/CCLE.RData            |\n",
       "| GDSC_2013 | GDSC_2013       | sensitivity  | rna/mutation                 | Mon Oct  5 16:07:54 2015 | https://www.pmgenomics.ca/bhklab/sites/default/files/downloads/CGP_Nature2013.RData  |\n",
       "| GDSC | GDSC            | sensitivity  | rna/rna2/mutation/fusion/cnv | Wed Dec 30 10:44:21 2015 | https://www.pmgenomics.ca/bhklab/sites/default/files/downloads/GDSC.RData            |\n",
       "| GDSC1000 | GDSC1000        | sensitivity  | rna                          | Thu Aug 25 11:13:00 2016 | https://www.pmgenomics.ca/bhklab/sites/default/files/downloads/GDSC1000.RData        |\n",
       "| gCSI | gCSI            | sensitivity  | rnaseq/cnv                   | Mon Jun 13 18:50:12 2016 | https://www.pmgenomics.ca/bhklab/sites/default/files/downloads/gCSI.RData            |\n",
       "| FIMM | FIMM            | sensitivity  | <!----> | Mon Oct 3 17:14:00 2016  | https://www.pmgenomics.ca/bhklab/sites/default/files/downloads/FIMM.RData            |\n",
       "| CTRPv2 | CTRPv2          | sensitivity  | <!----> | Thu Aug 25 11:15:00 2016 | https://www.pmgenomics.ca/bhklab/sites/default/files/downloads/CTRPv2.RData          |\n",
       "| CMAP | CMAP            | perturbation | rna                          | Mon Sep 21 02:38:45 2015 | https://www.pmgenomics.ca/bhklab/sites/default/files/downloads/CMAP.RData            |\n",
       "| L1000_compounds | L1000_compounds | perturbation | rna                          | Mon Jan 25 12:51:00 2016 | https://www.pmgenomics.ca/bhklab/sites/default/files/downloads/L1000_compounds.RData |\n",
       "| L1000_genetic | L1000_genetic   | perturbation | rna                          | Mon Jan 25 12:51:00 2016 | https://www.pmgenomics.ca/bhklab/sites/default/files/downloads/L1000_genetic.RData   |\n",
       "\n"
      ],
      "text/plain": [
       "                PSet.Name       Dataset.Type Available.Molecular.Profiles\n",
       "CCLE_2013       CCLE_2013       sensitivity  rna/mutation                \n",
       "CCLE            CCLE            sensitivity  rna/rnaseq/mutation/cnv     \n",
       "GDSC_2013       GDSC_2013       sensitivity  rna/mutation                \n",
       "GDSC            GDSC            sensitivity  rna/rna2/mutation/fusion/cnv\n",
       "GDSC1000        GDSC1000        sensitivity  rna                         \n",
       "gCSI            gCSI            sensitivity  rnaseq/cnv                  \n",
       "FIMM            FIMM            sensitivity                              \n",
       "CTRPv2          CTRPv2          sensitivity                              \n",
       "CMAP            CMAP            perturbation rna                         \n",
       "L1000_compounds L1000_compounds perturbation rna                         \n",
       "L1000_genetic   L1000_genetic   perturbation rna                         \n",
       "                Date.Updated            \n",
       "CCLE_2013       Tue Sep 15 18:50:07 2015\n",
       "CCLE            Thu Dec 10 18:17:14 2015\n",
       "GDSC_2013       Mon Oct  5 16:07:54 2015\n",
       "GDSC            Wed Dec 30 10:44:21 2015\n",
       "GDSC1000        Thu Aug 25 11:13:00 2016\n",
       "gCSI            Mon Jun 13 18:50:12 2016\n",
       "FIMM            Mon Oct 3 17:14:00 2016 \n",
       "CTRPv2          Thu Aug 25 11:15:00 2016\n",
       "CMAP            Mon Sep 21 02:38:45 2015\n",
       "L1000_compounds Mon Jan 25 12:51:00 2016\n",
       "L1000_genetic   Mon Jan 25 12:51:00 2016\n",
       "                URL                                                                                 \n",
       "CCLE_2013       https://www.pmgenomics.ca/bhklab/sites/default/files/downloads/CCLE_Nature2013.RData\n",
       "CCLE            https://www.pmgenomics.ca/bhklab/sites/default/files/downloads/CCLE.RData           \n",
       "GDSC_2013       https://www.pmgenomics.ca/bhklab/sites/default/files/downloads/CGP_Nature2013.RData \n",
       "GDSC            https://www.pmgenomics.ca/bhklab/sites/default/files/downloads/GDSC.RData           \n",
       "GDSC1000        https://www.pmgenomics.ca/bhklab/sites/default/files/downloads/GDSC1000.RData       \n",
       "gCSI            https://www.pmgenomics.ca/bhklab/sites/default/files/downloads/gCSI.RData           \n",
       "FIMM            https://www.pmgenomics.ca/bhklab/sites/default/files/downloads/FIMM.RData           \n",
       "CTRPv2          https://www.pmgenomics.ca/bhklab/sites/default/files/downloads/CTRPv2.RData         \n",
       "CMAP            https://www.pmgenomics.ca/bhklab/sites/default/files/downloads/CMAP.RData           \n",
       "L1000_compounds https://www.pmgenomics.ca/bhklab/sites/default/files/downloads/L1000_compounds.RData\n",
       "L1000_genetic   https://www.pmgenomics.ca/bhklab/sites/default/files/downloads/L1000_genetic.RData  "
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "availablePSets()\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 78,
   "metadata": {},
   "outputs": [],
   "source": [
    "CMAP.sigs <- downloadPertSig(\"CMAP\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 80,
   "metadata": {},
   "outputs": [],
   "source": [
    " drug.perturbation <- CMAP.sigs"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 82,
   "metadata": {},
   "outputs": [],
   "source": [
    "sars1_up_and_down_genes <-read.csv(\"icSARS_Cov_Day7_None_GSE50000.csv\",stringsAsFactors = F, header = T, sep=\";\")\n",
    "rownames(sars1_up_and_down_genes) <- sars1_up_and_down_genes$Feature\n",
    "sars1<- sars1_up_and_down_genes$Direction\n",
    "names(sars1) <- rownames(sars1_up_and_down_genes)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 83,
   "metadata": {},
   "outputs": [],
   "source": [
    "res_sars1 <- apply(drug.perturbation[,,c(\"tstat\", \"fdr\")], \n",
    "             2,function(x, sars1){\n",
    "         return(connectivityScore(x=x, \n",
    "                                  y=sars1,\n",
    "                               method=\"fgsea\", nperm=100))\n",
    "       },sars1 = sars1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 84,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<style>\n",
       ".list-inline {list-style: none; margin:0; padding: 0}\n",
       ".list-inline>li {display: inline-block}\n",
       ".list-inline>li:not(:last-child)::after {content: \"\\00b7\"; padding: 0 .5ex}\n",
       "</style>\n",
       "<ol class=list-inline><li>'Connectivity'</li><li>'P_value'</li></ol>\n"
      ],
      "text/latex": [
       "\\begin{enumerate*}\n",
       "\\item 'Connectivity'\n",
       "\\item 'P\\_value'\n",
       "\\end{enumerate*}\n"
      ],
      "text/markdown": [
       "1. 'Connectivity'\n",
       "2. 'P_value'\n",
       "\n",
       "\n"
      ],
      "text/plain": [
       "[1] \"Connectivity\" \"P_value\"     "
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "rownames(res_sars1) <- c(\"Connectivity\", \"P_value\")\n",
    "res_sars1 <- t(res_sars1)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 95,
   "metadata": {},
   "outputs": [],
   "source": [
    "con_score_sars <-res_sars1[order((res_sars1[,1]),decreasing = F),]\n",
    "p_value_sars <- res_sars1[order((res_sars1[,2]),decreasing = F),]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 96,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<table>\n",
       "<caption>A matrix: 1288 × 2 of type dbl</caption>\n",
       "<thead>\n",
       "\t<tr><th></th><th scope=col>Connectivity</th><th scope=col>P_value</th></tr>\n",
       "</thead>\n",
       "<tbody>\n",
       "\t<tr><th scope=row>valproic acid</th><td>-0.376625</td><td>0.003243431</td></tr>\n",
       "\t<tr><th scope=row>rifabutin</th><td>-0.340380</td><td>0.003249652</td></tr>\n",
       "\t<tr><th scope=row>levomepromazine</th><td>-0.329905</td><td>0.003363063</td></tr>\n",
       "\t<tr><th scope=row>promazine</th><td>-0.338460</td><td>0.003408985</td></tr>\n",
       "\t<tr><th scope=row>Prestwick-559</th><td>-0.332285</td><td>0.003453743</td></tr>\n",
       "\t<tr><th scope=row>maprotiline</th><td>-0.345995</td><td>0.003483930</td></tr>\n",
       "\t<tr><th scope=row>nicergoline</th><td>-0.297975</td><td>0.003540995</td></tr>\n",
       "\t<tr><th scope=row>GW-8510</th><td>-0.365775</td><td>0.003643482</td></tr>\n",
       "\t<tr><th scope=row>lasalocid</th><td>-0.287965</td><td>0.003653011</td></tr>\n",
       "\t<tr><th scope=row>pyrvinium</th><td>-0.312920</td><td>0.003692544</td></tr>\n",
       "\t<tr><th scope=row>nortriptyline</th><td>-0.346990</td><td>0.003785772</td></tr>\n",
       "\t<tr><th scope=row>prochlorperazine</th><td>-0.360245</td><td>0.003809080</td></tr>\n",
       "\t<tr><th scope=row>norcyclobenzaprine</th><td>-0.319960</td><td>0.003935323</td></tr>\n",
       "\t<tr><th scope=row>fluphenazine</th><td>-0.351740</td><td>0.004089757</td></tr>\n",
       "\t<tr><th scope=row>LY-294002</th><td>-0.358135</td><td>0.004118938</td></tr>\n",
       "\t<tr><th scope=row>raloxifene</th><td>-0.301795</td><td>0.004218595</td></tr>\n",
       "\t<tr><th scope=row>4,5-dianilinophthalimide</th><td>-0.809330</td><td>0.006282675</td></tr>\n",
       "\t<tr><th scope=row>trichostatin A</th><td>-0.330245</td><td>0.006335983</td></tr>\n",
       "\t<tr><th scope=row>eucatropine</th><td>-0.288555</td><td>0.006421429</td></tr>\n",
       "\t<tr><th scope=row>syrosingopine</th><td>-0.318895</td><td>0.006459413</td></tr>\n",
       "\t<tr><th scope=row>mebendazole</th><td>-0.300325</td><td>0.006618701</td></tr>\n",
       "\t<tr><th scope=row>lycorine</th><td> 0.319895</td><td>0.006644780</td></tr>\n",
       "\t<tr><th scope=row>rescinnamine</th><td>-0.323295</td><td>0.006987249</td></tr>\n",
       "\t<tr><th scope=row>reserpine</th><td>-0.285080</td><td>0.007184183</td></tr>\n",
       "\t<tr><th scope=row>sirolimus</th><td>-0.361685</td><td>0.007393165</td></tr>\n",
       "\t<tr><th scope=row>trifluoperazine</th><td>-0.375195</td><td>0.007405285</td></tr>\n",
       "\t<tr><th scope=row>vorinostat</th><td>-0.378310</td><td>0.008683363</td></tr>\n",
       "\t<tr><th scope=row>methotrexate</th><td>-0.336405</td><td>0.008864197</td></tr>\n",
       "\t<tr><th scope=row>fulvestrant</th><td>-0.281245</td><td>0.009065718</td></tr>\n",
       "\t<tr><th scope=row>phenazopyridine</th><td>-0.321425</td><td>0.009136916</td></tr>\n",
       "\t<tr><th scope=row>...</th><td>...</td><td>...</td></tr>\n",
       "\t<tr><th scope=row>PF-00562151-00</th><td>0</td><td>1</td></tr>\n",
       "\t<tr><th scope=row>pioglitazone</th><td>0</td><td>1</td></tr>\n",
       "\t<tr><th scope=row>PF-00539745-00</th><td>0</td><td>1</td></tr>\n",
       "\t<tr><th scope=row>valdecoxib</th><td>0</td><td>1</td></tr>\n",
       "\t<tr><th scope=row>PF-00539758-00</th><td>0</td><td>1</td></tr>\n",
       "\t<tr><th scope=row>orlistat</th><td>0</td><td>1</td></tr>\n",
       "\t<tr><th scope=row>5707885</th><td>0</td><td>1</td></tr>\n",
       "\t<tr><th scope=row>C-75</th><td>0</td><td>1</td></tr>\n",
       "\t<tr><th scope=row>5155877</th><td>0</td><td>1</td></tr>\n",
       "\t<tr><th scope=row>dinoprostone</th><td>0</td><td>1</td></tr>\n",
       "\t<tr><th scope=row>5194442</th><td>0</td><td>1</td></tr>\n",
       "\t<tr><th scope=row>AG-028671</th><td>0</td><td>1</td></tr>\n",
       "\t<tr><th scope=row>6-bromoindirubin-3'-oxime</th><td>0</td><td>1</td></tr>\n",
       "\t<tr><th scope=row>Gly-His-Lys</th><td>0</td><td>1</td></tr>\n",
       "\t<tr><th scope=row>STOCK1N-35696</th><td>0</td><td>1</td></tr>\n",
       "\t<tr><th scope=row>STOCK1N-28457</th><td>0</td><td>1</td></tr>\n",
       "\t<tr><th scope=row>H-89</th><td>0</td><td>1</td></tr>\n",
       "\t<tr><th scope=row>SB-202190</th><td>0</td><td>1</td></tr>\n",
       "\t<tr><th scope=row>NS-398</th><td>0</td><td>1</td></tr>\n",
       "\t<tr><th scope=row>SB-203580</th><td>0</td><td>1</td></tr>\n",
       "\t<tr><th scope=row>AH-6809</th><td>0</td><td>1</td></tr>\n",
       "\t<tr><th scope=row>alsterpaullone</th><td>0</td><td>1</td></tr>\n",
       "\t<tr><th scope=row>SC-19220</th><td>0</td><td>1</td></tr>\n",
       "\t<tr><th scope=row>0198306-0000</th><td>0</td><td>1</td></tr>\n",
       "\t<tr><th scope=row>AR-A014418</th><td>0</td><td>1</td></tr>\n",
       "\t<tr><th scope=row>semustine</th><td>0</td><td>1</td></tr>\n",
       "\t<tr><th scope=row>CP-944629</th><td>0</td><td>1</td></tr>\n",
       "\t<tr><th scope=row>irinotecan</th><td>0</td><td>1</td></tr>\n",
       "\t<tr><th scope=row>BCB000039</th><td>0</td><td>1</td></tr>\n",
       "\t<tr><th scope=row>11-deoxy-16,16-dimethylprostaglandin E2</th><td>0</td><td>1</td></tr>\n",
       "</tbody>\n",
       "</table>\n"
      ],
      "text/latex": [
       "A matrix: 1288 × 2 of type dbl\n",
       "\\begin{tabular}{r|ll}\n",
       "  & Connectivity & P\\_value\\\\\n",
       "\\hline\n",
       "\tvalproic acid & -0.376625 & 0.003243431\\\\\n",
       "\trifabutin & -0.340380 & 0.003249652\\\\\n",
       "\tlevomepromazine & -0.329905 & 0.003363063\\\\\n",
       "\tpromazine & -0.338460 & 0.003408985\\\\\n",
       "\tPrestwick-559 & -0.332285 & 0.003453743\\\\\n",
       "\tmaprotiline & -0.345995 & 0.003483930\\\\\n",
       "\tnicergoline & -0.297975 & 0.003540995\\\\\n",
       "\tGW-8510 & -0.365775 & 0.003643482\\\\\n",
       "\tlasalocid & -0.287965 & 0.003653011\\\\\n",
       "\tpyrvinium & -0.312920 & 0.003692544\\\\\n",
       "\tnortriptyline & -0.346990 & 0.003785772\\\\\n",
       "\tprochlorperazine & -0.360245 & 0.003809080\\\\\n",
       "\tnorcyclobenzaprine & -0.319960 & 0.003935323\\\\\n",
       "\tfluphenazine & -0.351740 & 0.004089757\\\\\n",
       "\tLY-294002 & -0.358135 & 0.004118938\\\\\n",
       "\traloxifene & -0.301795 & 0.004218595\\\\\n",
       "\t4,5-dianilinophthalimide & -0.809330 & 0.006282675\\\\\n",
       "\ttrichostatin A & -0.330245 & 0.006335983\\\\\n",
       "\teucatropine & -0.288555 & 0.006421429\\\\\n",
       "\tsyrosingopine & -0.318895 & 0.006459413\\\\\n",
       "\tmebendazole & -0.300325 & 0.006618701\\\\\n",
       "\tlycorine &  0.319895 & 0.006644780\\\\\n",
       "\trescinnamine & -0.323295 & 0.006987249\\\\\n",
       "\treserpine & -0.285080 & 0.007184183\\\\\n",
       "\tsirolimus & -0.361685 & 0.007393165\\\\\n",
       "\ttrifluoperazine & -0.375195 & 0.007405285\\\\\n",
       "\tvorinostat & -0.378310 & 0.008683363\\\\\n",
       "\tmethotrexate & -0.336405 & 0.008864197\\\\\n",
       "\tfulvestrant & -0.281245 & 0.009065718\\\\\n",
       "\tphenazopyridine & -0.321425 & 0.009136916\\\\\n",
       "\t... & ... & ...\\\\\n",
       "\tPF-00562151-00 & 0 & 1\\\\\n",
       "\tpioglitazone & 0 & 1\\\\\n",
       "\tPF-00539745-00 & 0 & 1\\\\\n",
       "\tvaldecoxib & 0 & 1\\\\\n",
       "\tPF-00539758-00 & 0 & 1\\\\\n",
       "\torlistat & 0 & 1\\\\\n",
       "\t5707885 & 0 & 1\\\\\n",
       "\tC-75 & 0 & 1\\\\\n",
       "\t5155877 & 0 & 1\\\\\n",
       "\tdinoprostone & 0 & 1\\\\\n",
       "\t5194442 & 0 & 1\\\\\n",
       "\tAG-028671 & 0 & 1\\\\\n",
       "\t6-bromoindirubin-3'-oxime & 0 & 1\\\\\n",
       "\tGly-His-Lys & 0 & 1\\\\\n",
       "\tSTOCK1N-35696 & 0 & 1\\\\\n",
       "\tSTOCK1N-28457 & 0 & 1\\\\\n",
       "\tH-89 & 0 & 1\\\\\n",
       "\tSB-202190 & 0 & 1\\\\\n",
       "\tNS-398 & 0 & 1\\\\\n",
       "\tSB-203580 & 0 & 1\\\\\n",
       "\tAH-6809 & 0 & 1\\\\\n",
       "\talsterpaullone & 0 & 1\\\\\n",
       "\tSC-19220 & 0 & 1\\\\\n",
       "\t0198306-0000 & 0 & 1\\\\\n",
       "\tAR-A014418 & 0 & 1\\\\\n",
       "\tsemustine & 0 & 1\\\\\n",
       "\tCP-944629 & 0 & 1\\\\\n",
       "\tirinotecan & 0 & 1\\\\\n",
       "\tBCB000039 & 0 & 1\\\\\n",
       "\t11-deoxy-16,16-dimethylprostaglandin E2 & 0 & 1\\\\\n",
       "\\end{tabular}\n"
      ],
      "text/markdown": [
       "\n",
       "A matrix: 1288 × 2 of type dbl\n",
       "\n",
       "| <!--/--> | Connectivity | P_value |\n",
       "|---|---|---|\n",
       "| valproic acid | -0.376625 | 0.003243431 |\n",
       "| rifabutin | -0.340380 | 0.003249652 |\n",
       "| levomepromazine | -0.329905 | 0.003363063 |\n",
       "| promazine | -0.338460 | 0.003408985 |\n",
       "| Prestwick-559 | -0.332285 | 0.003453743 |\n",
       "| maprotiline | -0.345995 | 0.003483930 |\n",
       "| nicergoline | -0.297975 | 0.003540995 |\n",
       "| GW-8510 | -0.365775 | 0.003643482 |\n",
       "| lasalocid | -0.287965 | 0.003653011 |\n",
       "| pyrvinium | -0.312920 | 0.003692544 |\n",
       "| nortriptyline | -0.346990 | 0.003785772 |\n",
       "| prochlorperazine | -0.360245 | 0.003809080 |\n",
       "| norcyclobenzaprine | -0.319960 | 0.003935323 |\n",
       "| fluphenazine | -0.351740 | 0.004089757 |\n",
       "| LY-294002 | -0.358135 | 0.004118938 |\n",
       "| raloxifene | -0.301795 | 0.004218595 |\n",
       "| 4,5-dianilinophthalimide | -0.809330 | 0.006282675 |\n",
       "| trichostatin A | -0.330245 | 0.006335983 |\n",
       "| eucatropine | -0.288555 | 0.006421429 |\n",
       "| syrosingopine | -0.318895 | 0.006459413 |\n",
       "| mebendazole | -0.300325 | 0.006618701 |\n",
       "| lycorine |  0.319895 | 0.006644780 |\n",
       "| rescinnamine | -0.323295 | 0.006987249 |\n",
       "| reserpine | -0.285080 | 0.007184183 |\n",
       "| sirolimus | -0.361685 | 0.007393165 |\n",
       "| trifluoperazine | -0.375195 | 0.007405285 |\n",
       "| vorinostat | -0.378310 | 0.008683363 |\n",
       "| methotrexate | -0.336405 | 0.008864197 |\n",
       "| fulvestrant | -0.281245 | 0.009065718 |\n",
       "| phenazopyridine | -0.321425 | 0.009136916 |\n",
       "| ... | ... | ... |\n",
       "| PF-00562151-00 | 0 | 1 |\n",
       "| pioglitazone | 0 | 1 |\n",
       "| PF-00539745-00 | 0 | 1 |\n",
       "| valdecoxib | 0 | 1 |\n",
       "| PF-00539758-00 | 0 | 1 |\n",
       "| orlistat | 0 | 1 |\n",
       "| 5707885 | 0 | 1 |\n",
       "| C-75 | 0 | 1 |\n",
       "| 5155877 | 0 | 1 |\n",
       "| dinoprostone | 0 | 1 |\n",
       "| 5194442 | 0 | 1 |\n",
       "| AG-028671 | 0 | 1 |\n",
       "| 6-bromoindirubin-3'-oxime | 0 | 1 |\n",
       "| Gly-His-Lys | 0 | 1 |\n",
       "| STOCK1N-35696 | 0 | 1 |\n",
       "| STOCK1N-28457 | 0 | 1 |\n",
       "| H-89 | 0 | 1 |\n",
       "| SB-202190 | 0 | 1 |\n",
       "| NS-398 | 0 | 1 |\n",
       "| SB-203580 | 0 | 1 |\n",
       "| AH-6809 | 0 | 1 |\n",
       "| alsterpaullone | 0 | 1 |\n",
       "| SC-19220 | 0 | 1 |\n",
       "| 0198306-0000 | 0 | 1 |\n",
       "| AR-A014418 | 0 | 1 |\n",
       "| semustine | 0 | 1 |\n",
       "| CP-944629 | 0 | 1 |\n",
       "| irinotecan | 0 | 1 |\n",
       "| BCB000039 | 0 | 1 |\n",
       "| 11-deoxy-16,16-dimethylprostaglandin E2 | 0 | 1 |\n",
       "\n"
      ],
      "text/plain": [
       "                                        Connectivity P_value    \n",
       "valproic acid                           -0.376625    0.003243431\n",
       "rifabutin                               -0.340380    0.003249652\n",
       "levomepromazine                         -0.329905    0.003363063\n",
       "promazine                               -0.338460    0.003408985\n",
       "Prestwick-559                           -0.332285    0.003453743\n",
       "maprotiline                             -0.345995    0.003483930\n",
       "nicergoline                             -0.297975    0.003540995\n",
       "GW-8510                                 -0.365775    0.003643482\n",
       "lasalocid                               -0.287965    0.003653011\n",
       "pyrvinium                               -0.312920    0.003692544\n",
       "nortriptyline                           -0.346990    0.003785772\n",
       "prochlorperazine                        -0.360245    0.003809080\n",
       "norcyclobenzaprine                      -0.319960    0.003935323\n",
       "fluphenazine                            -0.351740    0.004089757\n",
       "LY-294002                               -0.358135    0.004118938\n",
       "raloxifene                              -0.301795    0.004218595\n",
       "4,5-dianilinophthalimide                -0.809330    0.006282675\n",
       "trichostatin A                          -0.330245    0.006335983\n",
       "eucatropine                             -0.288555    0.006421429\n",
       "syrosingopine                           -0.318895    0.006459413\n",
       "mebendazole                             -0.300325    0.006618701\n",
       "lycorine                                 0.319895    0.006644780\n",
       "rescinnamine                            -0.323295    0.006987249\n",
       "reserpine                               -0.285080    0.007184183\n",
       "sirolimus                               -0.361685    0.007393165\n",
       "trifluoperazine                         -0.375195    0.007405285\n",
       "vorinostat                              -0.378310    0.008683363\n",
       "methotrexate                            -0.336405    0.008864197\n",
       "fulvestrant                             -0.281245    0.009065718\n",
       "phenazopyridine                         -0.321425    0.009136916\n",
       "...                                     ...          ...        \n",
       "PF-00562151-00                          0            1          \n",
       "pioglitazone                            0            1          \n",
       "PF-00539745-00                          0            1          \n",
       "valdecoxib                              0            1          \n",
       "PF-00539758-00                          0            1          \n",
       "orlistat                                0            1          \n",
       "5707885                                 0            1          \n",
       "C-75                                    0            1          \n",
       "5155877                                 0            1          \n",
       "dinoprostone                            0            1          \n",
       "5194442                                 0            1          \n",
       "AG-028671                               0            1          \n",
       "6-bromoindirubin-3'-oxime               0            1          \n",
       "Gly-His-Lys                             0            1          \n",
       "STOCK1N-35696                           0            1          \n",
       "STOCK1N-28457                           0            1          \n",
       "H-89                                    0            1          \n",
       "SB-202190                               0            1          \n",
       "NS-398                                  0            1          \n",
       "SB-203580                               0            1          \n",
       "AH-6809                                 0            1          \n",
       "alsterpaullone                          0            1          \n",
       "SC-19220                                0            1          \n",
       "0198306-0000                            0            1          \n",
       "AR-A014418                              0            1          \n",
       "semustine                               0            1          \n",
       "CP-944629                               0            1          \n",
       "irinotecan                              0            1          \n",
       "BCB000039                               0            1          \n",
       "11-deoxy-16,16-dimethylprostaglandin E2 0            1          "
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "p_value_sars\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 87,
   "metadata": {},
   "outputs": [],
   "source": [
    "mers_up_and_down_genes <-read.csv(\"HCoV_EMC2012_24Hour_23631916_GSE45042.csv\",stringsAsFactors = F, header = T, sep=\";\")\n",
    "rownames(mers_up_and_down_genes) <- mers_up_and_down_genes$Feature\n",
    "mers<- mers_up_and_down_genes$Direction\n",
    "names(mers) <- rownames(mers_up_and_down_genes)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 88,
   "metadata": {},
   "outputs": [],
   "source": [
    "res_mers <- apply(drug.perturbation[,,c(\"tstat\", \"fdr\")], \n",
    "             2,function(x, mers){\n",
    "         return(connectivityScore(x=x, \n",
    "                                  y=mers,\n",
    "                               method=\"fgsea\", nperm=100))\n",
    "       },mers = mers)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 89,
   "metadata": {},
   "outputs": [],
   "source": [
    "rownames(res_mers) <- c(\"Connectivity\", \"P_value\")\n",
    "res_mers <- t(res_mers)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 98,
   "metadata": {},
   "outputs": [],
   "source": [
    "con_score <-res_mers[order((res_mers[,1]),decreasing = F),]\n",
    "p_value <- res_mers[order((res_mers[,2]),decreasing = F),]\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 99,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<table>\n",
       "<caption>A matrix: 1288 × 2 of type dbl</caption>\n",
       "<thead>\n",
       "\t<tr><th></th><th scope=col>Connectivity</th><th scope=col>P_value</th></tr>\n",
       "</thead>\n",
       "<tbody>\n",
       "\t<tr><th scope=row>valproic acid</th><td>-0.376625</td><td>0.003319676</td></tr>\n",
       "\t<tr><th scope=row>flupentixol</th><td>-0.269090</td><td>0.003383565</td></tr>\n",
       "\t<tr><th scope=row>syrosingopine</th><td>-0.318895</td><td>0.003397262</td></tr>\n",
       "\t<tr><th scope=row>levomepromazine</th><td>-0.329905</td><td>0.003426580</td></tr>\n",
       "\t<tr><th scope=row>eucatropine</th><td>-0.288555</td><td>0.003468201</td></tr>\n",
       "\t<tr><th scope=row>vorinostat</th><td>-0.378310</td><td>0.003530871</td></tr>\n",
       "\t<tr><th scope=row>prochlorperazine</th><td>-0.360245</td><td>0.003554838</td></tr>\n",
       "\t<tr><th scope=row>rescinnamine</th><td>-0.323295</td><td>0.003575237</td></tr>\n",
       "\t<tr><th scope=row>maprotiline</th><td>-0.345995</td><td>0.003584323</td></tr>\n",
       "\t<tr><th scope=row>promazine</th><td>-0.338460</td><td>0.003632854</td></tr>\n",
       "\t<tr><th scope=row>phenazopyridine</th><td>-0.321425</td><td>0.003734297</td></tr>\n",
       "\t<tr><th scope=row>nortriptyline</th><td>-0.346990</td><td>0.003890230</td></tr>\n",
       "\t<tr><th scope=row>norcyclobenzaprine</th><td>-0.319960</td><td>0.003968853</td></tr>\n",
       "\t<tr><th scope=row>lasalocid</th><td>-0.287965</td><td>0.004218595</td></tr>\n",
       "\t<tr><th scope=row>trifluoperazine</th><td>-0.375195</td><td>0.004504136</td></tr>\n",
       "\t<tr><th scope=row>fluphenazine</th><td>-0.351740</td><td>0.004867912</td></tr>\n",
       "\t<tr><th scope=row>sirolimus</th><td>-0.361685</td><td>0.005503567</td></tr>\n",
       "\t<tr><th scope=row>methotrexate</th><td>-0.336405</td><td>0.006284774</td></tr>\n",
       "\t<tr><th scope=row>resveratrol</th><td>-0.350465</td><td>0.006437040</td></tr>\n",
       "\t<tr><th scope=row>nicergoline</th><td>-0.297975</td><td>0.006459316</td></tr>\n",
       "\t<tr><th scope=row>GW-8510</th><td>-0.365775</td><td>0.006644780</td></tr>\n",
       "\t<tr><th scope=row>LY-294002</th><td>-0.358135</td><td>0.006971206</td></tr>\n",
       "\t<tr><th scope=row>antimycin A</th><td>-0.282915</td><td>0.006971206</td></tr>\n",
       "\t<tr><th scope=row>chlorpromazine</th><td>-0.312550</td><td>0.006971420</td></tr>\n",
       "\t<tr><th scope=row>ampyrone</th><td>-0.302000</td><td>0.007577828</td></tr>\n",
       "\t<tr><th scope=row>trichostatin A</th><td>-0.330245</td><td>0.008959310</td></tr>\n",
       "\t<tr><th scope=row>bromocriptine</th><td>-0.298380</td><td>0.009140214</td></tr>\n",
       "\t<tr><th scope=row>cefadroxil</th><td>-0.302460</td><td>0.009152568</td></tr>\n",
       "\t<tr><th scope=row>HC toxin</th><td>-0.371125</td><td>0.009495673</td></tr>\n",
       "\t<tr><th scope=row>fluspirilene</th><td>-0.271445</td><td>0.009801250</td></tr>\n",
       "\t<tr><th scope=row>...</th><td>...</td><td>...</td></tr>\n",
       "\t<tr><th scope=row>PF-00562151-00</th><td>0</td><td>1</td></tr>\n",
       "\t<tr><th scope=row>pioglitazone</th><td>0</td><td>1</td></tr>\n",
       "\t<tr><th scope=row>PF-00539745-00</th><td>0</td><td>1</td></tr>\n",
       "\t<tr><th scope=row>valdecoxib</th><td>0</td><td>1</td></tr>\n",
       "\t<tr><th scope=row>PF-00539758-00</th><td>0</td><td>1</td></tr>\n",
       "\t<tr><th scope=row>orlistat</th><td>0</td><td>1</td></tr>\n",
       "\t<tr><th scope=row>5707885</th><td>0</td><td>1</td></tr>\n",
       "\t<tr><th scope=row>C-75</th><td>0</td><td>1</td></tr>\n",
       "\t<tr><th scope=row>5155877</th><td>0</td><td>1</td></tr>\n",
       "\t<tr><th scope=row>dinoprostone</th><td>0</td><td>1</td></tr>\n",
       "\t<tr><th scope=row>5194442</th><td>0</td><td>1</td></tr>\n",
       "\t<tr><th scope=row>AG-028671</th><td>0</td><td>1</td></tr>\n",
       "\t<tr><th scope=row>6-bromoindirubin-3'-oxime</th><td>0</td><td>1</td></tr>\n",
       "\t<tr><th scope=row>Gly-His-Lys</th><td>0</td><td>1</td></tr>\n",
       "\t<tr><th scope=row>STOCK1N-35696</th><td>0</td><td>1</td></tr>\n",
       "\t<tr><th scope=row>STOCK1N-28457</th><td>0</td><td>1</td></tr>\n",
       "\t<tr><th scope=row>H-89</th><td>0</td><td>1</td></tr>\n",
       "\t<tr><th scope=row>SB-202190</th><td>0</td><td>1</td></tr>\n",
       "\t<tr><th scope=row>NS-398</th><td>0</td><td>1</td></tr>\n",
       "\t<tr><th scope=row>SB-203580</th><td>0</td><td>1</td></tr>\n",
       "\t<tr><th scope=row>AH-6809</th><td>0</td><td>1</td></tr>\n",
       "\t<tr><th scope=row>alsterpaullone</th><td>0</td><td>1</td></tr>\n",
       "\t<tr><th scope=row>SC-19220</th><td>0</td><td>1</td></tr>\n",
       "\t<tr><th scope=row>0198306-0000</th><td>0</td><td>1</td></tr>\n",
       "\t<tr><th scope=row>AR-A014418</th><td>0</td><td>1</td></tr>\n",
       "\t<tr><th scope=row>semustine</th><td>0</td><td>1</td></tr>\n",
       "\t<tr><th scope=row>CP-944629</th><td>0</td><td>1</td></tr>\n",
       "\t<tr><th scope=row>irinotecan</th><td>0</td><td>1</td></tr>\n",
       "\t<tr><th scope=row>BCB000039</th><td>0</td><td>1</td></tr>\n",
       "\t<tr><th scope=row>11-deoxy-16,16-dimethylprostaglandin E2</th><td>0</td><td>1</td></tr>\n",
       "</tbody>\n",
       "</table>\n"
      ],
      "text/latex": [
       "A matrix: 1288 × 2 of type dbl\n",
       "\\begin{tabular}{r|ll}\n",
       "  & Connectivity & P\\_value\\\\\n",
       "\\hline\n",
       "\tvalproic acid & -0.376625 & 0.003319676\\\\\n",
       "\tflupentixol & -0.269090 & 0.003383565\\\\\n",
       "\tsyrosingopine & -0.318895 & 0.003397262\\\\\n",
       "\tlevomepromazine & -0.329905 & 0.003426580\\\\\n",
       "\teucatropine & -0.288555 & 0.003468201\\\\\n",
       "\tvorinostat & -0.378310 & 0.003530871\\\\\n",
       "\tprochlorperazine & -0.360245 & 0.003554838\\\\\n",
       "\trescinnamine & -0.323295 & 0.003575237\\\\\n",
       "\tmaprotiline & -0.345995 & 0.003584323\\\\\n",
       "\tpromazine & -0.338460 & 0.003632854\\\\\n",
       "\tphenazopyridine & -0.321425 & 0.003734297\\\\\n",
       "\tnortriptyline & -0.346990 & 0.003890230\\\\\n",
       "\tnorcyclobenzaprine & -0.319960 & 0.003968853\\\\\n",
       "\tlasalocid & -0.287965 & 0.004218595\\\\\n",
       "\ttrifluoperazine & -0.375195 & 0.004504136\\\\\n",
       "\tfluphenazine & -0.351740 & 0.004867912\\\\\n",
       "\tsirolimus & -0.361685 & 0.005503567\\\\\n",
       "\tmethotrexate & -0.336405 & 0.006284774\\\\\n",
       "\tresveratrol & -0.350465 & 0.006437040\\\\\n",
       "\tnicergoline & -0.297975 & 0.006459316\\\\\n",
       "\tGW-8510 & -0.365775 & 0.006644780\\\\\n",
       "\tLY-294002 & -0.358135 & 0.006971206\\\\\n",
       "\tantimycin A & -0.282915 & 0.006971206\\\\\n",
       "\tchlorpromazine & -0.312550 & 0.006971420\\\\\n",
       "\tampyrone & -0.302000 & 0.007577828\\\\\n",
       "\ttrichostatin A & -0.330245 & 0.008959310\\\\\n",
       "\tbromocriptine & -0.298380 & 0.009140214\\\\\n",
       "\tcefadroxil & -0.302460 & 0.009152568\\\\\n",
       "\tHC toxin & -0.371125 & 0.009495673\\\\\n",
       "\tfluspirilene & -0.271445 & 0.009801250\\\\\n",
       "\t... & ... & ...\\\\\n",
       "\tPF-00562151-00 & 0 & 1\\\\\n",
       "\tpioglitazone & 0 & 1\\\\\n",
       "\tPF-00539745-00 & 0 & 1\\\\\n",
       "\tvaldecoxib & 0 & 1\\\\\n",
       "\tPF-00539758-00 & 0 & 1\\\\\n",
       "\torlistat & 0 & 1\\\\\n",
       "\t5707885 & 0 & 1\\\\\n",
       "\tC-75 & 0 & 1\\\\\n",
       "\t5155877 & 0 & 1\\\\\n",
       "\tdinoprostone & 0 & 1\\\\\n",
       "\t5194442 & 0 & 1\\\\\n",
       "\tAG-028671 & 0 & 1\\\\\n",
       "\t6-bromoindirubin-3'-oxime & 0 & 1\\\\\n",
       "\tGly-His-Lys & 0 & 1\\\\\n",
       "\tSTOCK1N-35696 & 0 & 1\\\\\n",
       "\tSTOCK1N-28457 & 0 & 1\\\\\n",
       "\tH-89 & 0 & 1\\\\\n",
       "\tSB-202190 & 0 & 1\\\\\n",
       "\tNS-398 & 0 & 1\\\\\n",
       "\tSB-203580 & 0 & 1\\\\\n",
       "\tAH-6809 & 0 & 1\\\\\n",
       "\talsterpaullone & 0 & 1\\\\\n",
       "\tSC-19220 & 0 & 1\\\\\n",
       "\t0198306-0000 & 0 & 1\\\\\n",
       "\tAR-A014418 & 0 & 1\\\\\n",
       "\tsemustine & 0 & 1\\\\\n",
       "\tCP-944629 & 0 & 1\\\\\n",
       "\tirinotecan & 0 & 1\\\\\n",
       "\tBCB000039 & 0 & 1\\\\\n",
       "\t11-deoxy-16,16-dimethylprostaglandin E2 & 0 & 1\\\\\n",
       "\\end{tabular}\n"
      ],
      "text/markdown": [
       "\n",
       "A matrix: 1288 × 2 of type dbl\n",
       "\n",
       "| <!--/--> | Connectivity | P_value |\n",
       "|---|---|---|\n",
       "| valproic acid | -0.376625 | 0.003319676 |\n",
       "| flupentixol | -0.269090 | 0.003383565 |\n",
       "| syrosingopine | -0.318895 | 0.003397262 |\n",
       "| levomepromazine | -0.329905 | 0.003426580 |\n",
       "| eucatropine | -0.288555 | 0.003468201 |\n",
       "| vorinostat | -0.378310 | 0.003530871 |\n",
       "| prochlorperazine | -0.360245 | 0.003554838 |\n",
       "| rescinnamine | -0.323295 | 0.003575237 |\n",
       "| maprotiline | -0.345995 | 0.003584323 |\n",
       "| promazine | -0.338460 | 0.003632854 |\n",
       "| phenazopyridine | -0.321425 | 0.003734297 |\n",
       "| nortriptyline | -0.346990 | 0.003890230 |\n",
       "| norcyclobenzaprine | -0.319960 | 0.003968853 |\n",
       "| lasalocid | -0.287965 | 0.004218595 |\n",
       "| trifluoperazine | -0.375195 | 0.004504136 |\n",
       "| fluphenazine | -0.351740 | 0.004867912 |\n",
       "| sirolimus | -0.361685 | 0.005503567 |\n",
       "| methotrexate | -0.336405 | 0.006284774 |\n",
       "| resveratrol | -0.350465 | 0.006437040 |\n",
       "| nicergoline | -0.297975 | 0.006459316 |\n",
       "| GW-8510 | -0.365775 | 0.006644780 |\n",
       "| LY-294002 | -0.358135 | 0.006971206 |\n",
       "| antimycin A | -0.282915 | 0.006971206 |\n",
       "| chlorpromazine | -0.312550 | 0.006971420 |\n",
       "| ampyrone | -0.302000 | 0.007577828 |\n",
       "| trichostatin A | -0.330245 | 0.008959310 |\n",
       "| bromocriptine | -0.298380 | 0.009140214 |\n",
       "| cefadroxil | -0.302460 | 0.009152568 |\n",
       "| HC toxin | -0.371125 | 0.009495673 |\n",
       "| fluspirilene | -0.271445 | 0.009801250 |\n",
       "| ... | ... | ... |\n",
       "| PF-00562151-00 | 0 | 1 |\n",
       "| pioglitazone | 0 | 1 |\n",
       "| PF-00539745-00 | 0 | 1 |\n",
       "| valdecoxib | 0 | 1 |\n",
       "| PF-00539758-00 | 0 | 1 |\n",
       "| orlistat | 0 | 1 |\n",
       "| 5707885 | 0 | 1 |\n",
       "| C-75 | 0 | 1 |\n",
       "| 5155877 | 0 | 1 |\n",
       "| dinoprostone | 0 | 1 |\n",
       "| 5194442 | 0 | 1 |\n",
       "| AG-028671 | 0 | 1 |\n",
       "| 6-bromoindirubin-3'-oxime | 0 | 1 |\n",
       "| Gly-His-Lys | 0 | 1 |\n",
       "| STOCK1N-35696 | 0 | 1 |\n",
       "| STOCK1N-28457 | 0 | 1 |\n",
       "| H-89 | 0 | 1 |\n",
       "| SB-202190 | 0 | 1 |\n",
       "| NS-398 | 0 | 1 |\n",
       "| SB-203580 | 0 | 1 |\n",
       "| AH-6809 | 0 | 1 |\n",
       "| alsterpaullone | 0 | 1 |\n",
       "| SC-19220 | 0 | 1 |\n",
       "| 0198306-0000 | 0 | 1 |\n",
       "| AR-A014418 | 0 | 1 |\n",
       "| semustine | 0 | 1 |\n",
       "| CP-944629 | 0 | 1 |\n",
       "| irinotecan | 0 | 1 |\n",
       "| BCB000039 | 0 | 1 |\n",
       "| 11-deoxy-16,16-dimethylprostaglandin E2 | 0 | 1 |\n",
       "\n"
      ],
      "text/plain": [
       "                                        Connectivity P_value    \n",
       "valproic acid                           -0.376625    0.003319676\n",
       "flupentixol                             -0.269090    0.003383565\n",
       "syrosingopine                           -0.318895    0.003397262\n",
       "levomepromazine                         -0.329905    0.003426580\n",
       "eucatropine                             -0.288555    0.003468201\n",
       "vorinostat                              -0.378310    0.003530871\n",
       "prochlorperazine                        -0.360245    0.003554838\n",
       "rescinnamine                            -0.323295    0.003575237\n",
       "maprotiline                             -0.345995    0.003584323\n",
       "promazine                               -0.338460    0.003632854\n",
       "phenazopyridine                         -0.321425    0.003734297\n",
       "nortriptyline                           -0.346990    0.003890230\n",
       "norcyclobenzaprine                      -0.319960    0.003968853\n",
       "lasalocid                               -0.287965    0.004218595\n",
       "trifluoperazine                         -0.375195    0.004504136\n",
       "fluphenazine                            -0.351740    0.004867912\n",
       "sirolimus                               -0.361685    0.005503567\n",
       "methotrexate                            -0.336405    0.006284774\n",
       "resveratrol                             -0.350465    0.006437040\n",
       "nicergoline                             -0.297975    0.006459316\n",
       "GW-8510                                 -0.365775    0.006644780\n",
       "LY-294002                               -0.358135    0.006971206\n",
       "antimycin A                             -0.282915    0.006971206\n",
       "chlorpromazine                          -0.312550    0.006971420\n",
       "ampyrone                                -0.302000    0.007577828\n",
       "trichostatin A                          -0.330245    0.008959310\n",
       "bromocriptine                           -0.298380    0.009140214\n",
       "cefadroxil                              -0.302460    0.009152568\n",
       "HC toxin                                -0.371125    0.009495673\n",
       "fluspirilene                            -0.271445    0.009801250\n",
       "...                                     ...          ...        \n",
       "PF-00562151-00                          0            1          \n",
       "pioglitazone                            0            1          \n",
       "PF-00539745-00                          0            1          \n",
       "valdecoxib                              0            1          \n",
       "PF-00539758-00                          0            1          \n",
       "orlistat                                0            1          \n",
       "5707885                                 0            1          \n",
       "C-75                                    0            1          \n",
       "5155877                                 0            1          \n",
       "dinoprostone                            0            1          \n",
       "5194442                                 0            1          \n",
       "AG-028671                               0            1          \n",
       "6-bromoindirubin-3'-oxime               0            1          \n",
       "Gly-His-Lys                             0            1          \n",
       "STOCK1N-35696                           0            1          \n",
       "STOCK1N-28457                           0            1          \n",
       "H-89                                    0            1          \n",
       "SB-202190                               0            1          \n",
       "NS-398                                  0            1          \n",
       "SB-203580                               0            1          \n",
       "AH-6809                                 0            1          \n",
       "alsterpaullone                          0            1          \n",
       "SC-19220                                0            1          \n",
       "0198306-0000                            0            1          \n",
       "AR-A014418                              0            1          \n",
       "semustine                               0            1          \n",
       "CP-944629                               0            1          \n",
       "irinotecan                              0            1          \n",
       "BCB000039                               0            1          \n",
       "11-deoxy-16,16-dimethylprostaglandin E2 0            1          "
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "p_value"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 92,
   "metadata": {},
   "outputs": [],
   "source": [
    "write.csv(p_value,\"mers_results.csv\", row.names = T)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 93,
   "metadata": {},
   "outputs": [],
   "source": [
    "write.csv(p_value_sars,\"sars_results.csv\", row.names = T)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "Based on p value and connectivity score (negative score means that drug reverses the disease signature) I have decided to do \n",
    "docking on rescinnamine. This drug is FDA-approved angiotensin-converting enzyme inhibitor used as an antihypertensive drug.\n",
    "It is already known that Angiotensin-converting Enzyme is functional receptor for SARS coronavirues.\n",
    "Virtual screening results of small-molecule compounds against Spike structural protein of coronaviruses showed that rescinnamine \n",
    "has a high binding affinity against coronavirus.\n",
    "I also in my results get that sirolimus can be used against coronaviruses, and study by Zhou et al get the similar results.\n",
    "Based on my analysis valproic acid could also be used against coronaviruses, and there are currently clinical trial of valproic\n",
    "acid against HIV-viruses, but I get better binding affinity energy using PyRx with rescinnamine.\n",
    "\n",
    "Kuhn JH, Li W, Choe H, Farzan M. Angiotensin-converting enzyme 2: a functional receptor for SARS coronavirus.\n",
    "Cell Mol Life Sci. 2004;61(21):2738–2743. doi:10.1007/s00018-004-4242-5\n",
    "\n",
    "Yushun Wan, Jian Shang, Rachel Graham, Ralph S. Baric, Fang Li. Receptor recognition by novel coronavirus from Wuhan: \n",
    "An analysis based on decade-long structural studies of SARS. \n",
    "Journal of Virology, 2020; DOI: 10.1128/JVI.00127-20\n",
    "\n",
    "Canrong Wu, Yang Liu, Yueying Yang, Peng Zhang, Wu Zhong, Yali Wang, Qiqi Wang, Yang Xu, Mingxue Li, Xingzhou Li, Mengzhu Zheng, Lixia Chen, Hua Li,\n",
    "Analysis of therapeutic targets for SARS-CoV-2 and discovery of potential drugs by computational methods,\n",
    "Acta Pharmaceutica Sinica B,2020,\n",
    "\n",
    "Yadi Zhou, Yuan Hou, Jiayu Shen, Yin Huang, William Martin, Feixiong Cheng.Network-based Drug Repurposing for Human Coronavirus\n",
    "doi: https://doi.org/10.1101/2020.02.03.20020263\n",
    "\n",
    "                                                              \n",
    "O. Trott, A. J. Olson,AutoDock Vina: improving the speed and accuracy of dockingwith a new scoring function,\n",
    "efficient optimization and multithreading, Journal of Computational Chemistry 31 (2010); 455-461; DOI 10.1002/jcc.21334  \n",
    "\n",
    "Study of Valproic Acid to Treat HIV Infected Adults https://clinicaltrials.gov/ct2/show/NCT00312546"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "R",
   "language": "R",
   "name": "ir"
  },
  "language_info": {
   "codemirror_mode": "r",
   "file_extension": ".r",
   "mimetype": "text/x-r-source",
   "name": "R",
   "pygments_lexer": "r",
   "version": "3.6.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}