forked from cansyl/DRUIDom
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDRUIDom_Source_Code.m
2030 lines (1785 loc) · 119 KB
/
DRUIDom_Source_Code.m
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
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
% DRUIDom v1.1
%
% DRUIDom (DRUg Interacting Domains): a computational method for
% predicting new drug/compound - target protein interactions for drug
% discovery and repurposing, via mapping ligands to structural domains
% where the binding site resides.
%
% Repository: https://github.com/cansyl/DRUIDom
%
% Contact: [email protected]
%
% ------------------------------------------------------------------------
%
% Article
%
% Protein Domain-Based Prediction of Compound–Target Interactions and
% Experimental Validation on LIM Kinases.
%
% Authors: Tunca Dogan*, Ece Akhan, Marcus Baumann, Altay Koyas, Heval
% Atas, Ian Baxendale, Maria Martin and Rengul Cetin-Atalay*
% * Corresponding authors
%
% Pre-print DOI:10.1101/2021.06.14.448307
%
% ------------------------------------------------------------------------
%
% Copyright (C) 2021 CanSyL
%
% This program is free software: you can redistribute it and/or modify it
% under the terms of the GNU General Public License as published by the
% Free Software Foundation, either version 3 of the License, or (at your
% option) any later version.
%
% This program is distributed in the hope that it will be useful, but
% WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
% Public License for more details.
%
% You should have received a copy of the GNU General Public License along
% with this program. If not, see http://www.gnu.org/licenses/.
%
% ------------------------------------------------------------------------
%
%
%
% ------------------------
% Source Code of the Study
% ------------------------
% ---------------------------
% Dataset preparation process
% ---------------------------
% Extracting active and inactive data points from the ExCAPE dataset and further filtering and organization operations:
% xz -d DRUIDom_Files/pubchem.chembl.dataset4publication_inchi_smiles_v2.tsv.xz
% cut -d$'\t' -f2,4,5,8,9,12 DRUIDom_Files/ExCAPE.pubchem.chembl.dataset4publication_inchi_smiles_v2.tsv > DRUIDom_Files/ExCAPE_all_datapoints.tsv
% cut -d$'\t' -f4,5 DRUIDom_Files/ExCAPE_all_datapoints.tsv > DRUIDom_Files/ExCAPE_all_datapoints_Taxonid_GeneName.tsv
% awk -F'\t' '$2~/N/' DRUIDom_Files/ExCAPE_all_datapoints.tsv > DRUIDom_Files/ExCAPE_inactive_datapoints.tsv
% awk -F'\t' '$2~/A/' DRUIDom_Files/ExCAPE_all_datapoints.tsv > DRUIDom_Files/ExCAPE_active_datapoints.tsv
% cut -d$'\t' -f4,5 DRUIDom_Files/ExCAPE_active_datapoints.tsv > DRUIDom_Files/ExCAPE_active_datapoints_Taxonid_GeneName.tsv
% cut -d$'\t' -f1,6 DRUIDom_Files/ExCAPE_active_datapoints.tsv > DRUIDom_Files/ExCAPE_active_datapoints_Compoundid_SMILES.tsv
% sed 1d DRUIDom_Files/ExCAPE_active_datapoints.tsv > DRUIDom_Files/ExCAPE_active_datapoints2.tsv (rename the file by removing 2)
% awk -F'\t' '{if($3=="" || $3 < 4.7) print $0}' DRUIDom_Files/ExCAPE_inactive_datapoints.tsv > DRUIDom_Files/ExCAPE_inactive_datapoints_filtered.tsv
% awk -F'\t' '{if(!$3) print $0}' DRUIDom_Files/ExCAPE_inactive_datapoints_filtered.tsv > DRUIDom_Files/ExCAPE_inactive_datapoints_filtered_noact.tsv
% awk -F'\t' '{if($3) print $0}' DRUIDom_Files/ExCAPE_inactive_datapoints_filtered.tsv > DRUIDom_Files/ExCAPE_inactive_datapoints_filtered_withact.tsv
% cut -d$'\t' -f4,5 DRUIDom_Files/ExCAPE_inactive_datapoints_filtered_noact.tsv > DRUIDom_Files/ExCAPE_inactive_datapoints_filtered_noact_Taxonid_GeneName.tsv
% cut -d$'\t' -f1,6 DRUIDom_Files/ExCAPE_inactive_datapoints_filtered_noact.tsv > DRUIDom_Files/ExCAPE_inactive_datapoints_filtered_noact_Compoundid_SMILES.tsv
% cut -d$'\t' -f4,5 DRUIDom_Files/ExCAPE_inactive_datapoints_filtered_withact.tsv > DRUIDom_Files/ExCAPE_inactive_datapoints_filtered_withact_Taxonid_GeneName.tsv
% cut -d$'\t' -f1,6 DRUIDom_Files/ExCAPE_inactive_datapoints_filtered_withact.tsv > DRUIDom_Files/ExCAPE_inactive_datapoints_filtered_withact_Compoundid_SMILES.tsv
% cut -d$'\t' -f1 DRUIDom_Files/DEEPScreen_ChEMBLv23_act_inact_filtered_data_original.txt > DRUIDom_Files/DEEPScreen_ChEMBLv23_act_inact_filtered_data_Targetid.txt
% cut -d$'\t' -f2 DRUIDom_Files/DEEPScreen_ChEMBLv23_act_inact_filtered_data_original.txt > DRUIDom_Files/DEEPScreen_ChEMBLv23_act_inact_filtered_data_Compoundid.txt
% (Filename starting with "DEEPScreen" contains drug/compound-target protein interaction/bioactivity data points obtained from the ChEMBL database by rigorous
% filtering operations; detailed information regarding the preparation of this dataset can be obtained from our previous publication at:
% https://pubs.rsc.org/en/content/articlehtml/2020/sc/c9sc03414e)
% Mapping UniProt accessions to targets in ExCAPE dataset:
UniProt_mapping=cell(0,3);
[UniProt_UniProtAcc,UniProt_TaxonID,UniProt_GeneName]=textread('DRUIDom_Files/Mapping_UniProtAcc_TaxonID_GeneName.tab', '%s %s %s', 'delimiter', '\t', 'headerlines', 1);
to=1;
for i=1:length(UniProt_UniProtAcc)
x=strsplit(UniProt_GeneName{i,1},' ')';
UniProt_mapping(to:(to+length(x)-1),1)=repmat(UniProt_UniProtAcc(i,1),length(x),1);
UniProt_mapping(to:(to+length(x)-1),2)=repmat(UniProt_TaxonID(i,1),length(x),1);
UniProt_mapping(to:(to+length(x)-1),3)=x;
to=to+length(x);
end
UniProt_mapping=upper(UniProt_mapping);
save DRUIDom_Files/UniProt_mapping.mat UniProt_mapping
UniProt_mapping_23=strcat(UniProt_mapping(:,2), {' '}, UniProt_mapping(:,3));
save DRUIDom_Files/UniProt_mapping_23.mat UniProt_mapping_23
% (ExCAPE all datapoints)
[ExCAPE_all_datapoints_Taxonid,ExCAPE_all_datapoints_GeneName]=textread('DRUIDom_Files/ExCAPE_all_datapoints_Taxonid_GeneName.tsv', '%s %s', 'delimiter', '\t');
ExCAPE_all_datapoints_Taxonid(1,:)=[];
ExCAPE_all_datapoints_GeneName(1,:)=[];
ExCAPE_all_datapoints_23=strcat(ExCAPE_all_datapoints_Taxonid(:,1), {' '}, ExCAPE_all_datapoints_GeneName(:,1));
clear ExCAPE_all_datapoints_Taxonid ExCAPE_all_datapoints_GeneName
load DRUIDom_Files/UniProt_mapping_23.mat
load DRUIDom_Files/UniProt_mapping.mat
[Lia,Locb]=ismember(ExCAPE_all_datapoints_23,UniProt_mapping_23);
ExCAPE_all_datapoints_UniProtAcc=cell(length(ExCAPE_all_datapoints_23),1);
ExCAPE_all_datapoints_UniProtAcc(Lia==1,1)=UniProt_mapping(Locb(Locb>0),1);
% save DRUIDom_Files/ExCAPE_all_datapoints_UniProtAcc.mat ExCAPE_all_datapoints_UniProtAcc
% (not possible to save as mat file due to extremely large size of the variable)
t=ExCAPE_all_datapoints_UniProtAcc';
fid = fopen('DRUIDom_Files/ExCAPE_all_datapoints_UniProtAcc.txt','w');
fprintf(fid,'%s\n',t{:});
fclose(fid);
% (ExCAPE active datapoints)
[ExCAPE_active_datapoints_Taxonid,ExCAPE_active_datapoints_GeneName]=textread('DRUIDom_Files/ExCAPE_active_datapoints_Taxonid_GeneName.tsv', '%s %s', 'delimiter', '\t');
ExCAPE_active_datapoints_23=strcat(ExCAPE_active_datapoints_Taxonid(:,1), {' '}, ExCAPE_active_datapoints_GeneName(:,1));
[Lia,Locb]=ismember(ExCAPE_active_datapoints_23,UniProt_mapping_23);
ExCAPE_active_datapoints_UniProtAcc=cell(length(ExCAPE_active_datapoints_23),1);
ExCAPE_active_datapoints_UniProtAcc(Lia==1,1)=UniProt_mapping(Locb(Locb>0),1);
save DRUIDom_Files/ExCAPE_active_datapoints_UniProtAcc.mat ExCAPE_active_datapoints_UniProtAcc
t=ExCAPE_active_datapoints_UniProtAcc';
fid = fopen('DRUIDom_Files/ExCAPE_active_datapoints_UniProtAcc.txt','w');
fprintf(fid,'%s\n',t{:});
fclose(fid);
[ExCAPE_active_datapoints_Compoundid,ExCAPE_active_datapoints_SMILES]=textread('DRUIDom_Files/ExCAPE_active_datapoints_Compoundid_SMILES.tsv', '%s %s', 'delimiter', '\t');
del_ind=find(cellfun(@isempty,ExCAPE_active_datapoints_UniProtAcc));
ExCAPE_active_datapoints_UniProtAcc(del_ind,:)=[];
ExCAPE_active_datapoints_Compoundid(del_ind,:)=[];
ExCAPE_active_datapoints_SMILES(del_ind,:)=[];
save DRUIDom_Files/ExCAPE_active_datapoints_Org_Var.mat ExCAPE_active_datapoints_UniProtAcc ExCAPE_active_datapoints_Compoundid ExCAPE_active_datapoints_SMILES
ExCAPE_Org_act=[ExCAPE_active_datapoints_UniProtAcc ExCAPE_active_datapoints_Compoundid];
save DRUIDom_Files/ExCAPE_Org_act.mat ExCAPE_Org_act
% (ExCAPE inactive datapoints with activity measures)
[ExCAPE_inactive_datapoints_filtered_withact_Taxonid,ExCAPE_inactive_datapoints_filtered_withact_GeneName]=textread('DRUIDom_Files/ExCAPE_inactive_datapoints_filtered_withact_Taxonid_GeneName.tsv', '%s %s', 'delimiter', '\t');
ExCAPE_inactive_datapoints_filtered_withact_23=strcat(ExCAPE_inactive_datapoints_filtered_withact_Taxonid(:,1), {' '}, ExCAPE_inactive_datapoints_filtered_withact_GeneName(:,1));
[Lia,Locb]=ismember(ExCAPE_inactive_datapoints_filtered_withact_23,UniProt_mapping_23);
ExCAPE_inactive_datapoints_filtered_withact_UniProtAcc=cell(length(ExCAPE_inactive_datapoints_filtered_withact_23),1);
ExCAPE_inactive_datapoints_filtered_withact_UniProtAcc(Lia==1,1)=UniProt_mapping(Locb(Locb>0),1);
save DRUIDom_Files/ExCAPE_inactive_datapoints_filtered_withact_UniProtAcc.mat ExCAPE_inactive_datapoints_filtered_withact_UniProtAcc
t=ExCAPE_inactive_datapoints_filtered_withact_UniProtAcc';
fid = fopen('DRUIDom_Files/ExCAPE_inactive_datapoints_filtered_withact_UniProtAcc.txt','w');
fprintf(fid,'%s\n',t{:});
fclose(fid);
[ExCAPE_inactive_datapoints_filtered_withact_Compoundid,ExCAPE_inactive_datapoints_filtered_withact_SMILES]=textread('DRUIDom_Files/ExCAPE_inactive_datapoints_filtered_withact_Compoundid_SMILES.tsv', '%s %s', 'delimiter', '\t');
del_ind=find(cellfun(@isempty,ExCAPE_inactive_datapoints_filtered_withact_UniProtAcc));
ExCAPE_inactive_datapoints_filtered_withact_UniProtAcc(del_ind,:)=[];
ExCAPE_inactive_datapoints_filtered_withact_Compoundid(del_ind,:)=[];
ExCAPE_inactive_datapoints_filtered_withact_SMILES(del_ind,:)=[];
save DRUIDom_Files/ExCAPE_inactive_datapoints_filtered_withact_Org_Var.mat ExCAPE_inactive_datapoints_filtered_withact_UniProtAcc ExCAPE_inactive_datapoints_filtered_withact_Compoundid ExCAPE_inactive_datapoints_filtered_withact_SMILES
ExCAPE_Org_inact_withact=[ExCAPE_inactive_datapoints_filtered_withact_UniProtAcc ExCAPE_inactive_datapoints_filtered_withact_Compoundid];
save DRUIDom_Files/ExCAPE_Org_inact_withact.mat ExCAPE_Org_inact_withact
ExCAPE_Org_act_inact=[ExCAPE_Org_act;ExCAPE_Org_inact_withact];
save DRUIDom_Files/ExCAPE_Org_act_inact.mat ExCAPE_Org_act_inact
length(unique(ExCAPE_Org_act_inact(:,1)))
length(unique(ExCAPE_Org_act_inact(:,2)))
% (ExCAPE inactive datapoints without any activity measures at all)
[ExCAPE_inactive_datapoints_filtered_noact_Taxonid,ExCAPE_inactive_datapoints_filtered_noact_GeneName]=textread('DRUIDom_Files/ExCAPE_inactive_datapoints_filtered_noact_Taxonid_GeneName.tsv', '%s %s', 'delimiter', '\t');
ExCAPE_inactive_datapoints_filtered_noact_23=strcat(ExCAPE_inactive_datapoints_filtered_noact_Taxonid(:,1), {' '}, ExCAPE_inactive_datapoints_filtered_noact_GeneName(:,1));
[Lia,Locb]=ismember(ExCAPE_inactive_datapoints_filtered_noact_23,UniProt_mapping_23);
ExCAPE_inactive_datapoints_filtered_noact_UniProtAcc=cell(length(ExCAPE_inactive_datapoints_filtered_noact_23),1);
ExCAPE_inactive_datapoints_filtered_noact_UniProtAcc(Lia==1,1)=UniProt_mapping(Locb(Locb>0),1);
% save DRUIDom_Files/ExCAPE_inactive_datapoints_filtered_noact_UniProtAcc.mat ExCAPE_inactive_datapoints_filtered_noact_UniProtAcc
% (not possible to save as mat file due to extremely large size of the variable)
t=ExCAPE_inactive_datapoints_filtered_noact_UniProtAcc';
fid = fopen('DRUIDom_Files/ExCAPE_inactive_datapoints_filtered_noact_UniProtAcc.txt','w');
fprintf(fid,'%s\n',t{:});
fclose(fid);
% (Generating the ExCAPE_PubChem dataset)
[ExCAPE_Org_act_PubChem,idx]=sort(ExCAPE_Org_act(:,2));
ExCAPE_Org_act_PubChem=ExCAPE_Org_act_PubChem(1:201013,1);
ExCAPE_Org_act_PubChem_prot=ExCAPE_Org_act(idx,1);
ExCAPE_Org_act_PubChem_prot=ExCAPE_Org_act_PubChem_prot(1:201013,1);
ExCAPE_Org_act_PubChem=[ExCAPE_Org_act_PubChem_prot ExCAPE_Org_act_PubChem];
save DRUIDom_Files/ExCAPE_Org_act_PubChem.mat ExCAPE_Org_act_PubChem
[ExCAPE_Org_inact_withact_PubChem,idx]=sort(ExCAPE_Org_inact_withact(:,2));
ExCAPE_Org_inact_withact_PubChem=ExCAPE_Org_inact_withact_PubChem(1:99946,1);
ExCAPE_Org_inact_withact_PubChem_prot=ExCAPE_Org_inact_withact(idx,1);
ExCAPE_Org_inact_withact_PubChem_prot=ExCAPE_Org_inact_withact_PubChem_prot(1:99946,1);
ExCAPE_Org_inact_withact_PubChem=[ExCAPE_Org_inact_withact_PubChem_prot ExCAPE_Org_inact_withact_PubChem];
save DRUIDom_Files/ExCAPE_Org_inact_withact_PubChem.mat ExCAPE_Org_inact_withact_PubChem
ExCAPE_Org_act_inact_PubChem=[ExCAPE_Org_act_PubChem;ExCAPE_Org_inact_withact_PubChem];
save DRUIDom_Files/ExCAPE_Org_act_inact_PubChem.mat ExCAPE_Org_act_inact_PubChem
length(unique(ExCAPE_Org_act_inact_PubChem(:,1)))
length(unique(ExCAPE_Org_act_inact_PubChem(:,2)))
% Mapping UniProt accessions to targets in DEEPScreen ChEMBLv23 training dataset:
[DEEPScreen_ChEMBLv23_act_inact_Target_ChEMBLid]=textread('DRUIDom_Files/DEEPScreen_ChEMBLv23_act_inact_filtered_data_Targetid.txt', '%s');
DEEPScreen_ChEMBLv23_act_inact_Target_ChEMBLid=strrep(DEEPScreen_ChEMBLv23_act_inact_Target_ChEMBLid,'_inact','');
DEEPScreen_ChEMBLv23_act_inact_Target_ChEMBLid=strrep(DEEPScreen_ChEMBLv23_act_inact_Target_ChEMBLid,'_act','');
[DEEPScreen_ChEMBLv23_act_inact_Compound_ChEMBLid]=textread('DRUIDom_Files/DEEPScreen_ChEMBLv23_act_inact_filtered_data_Compoundid.txt', '%s', 'delimiter', '\n', 'bufsize', 500000);
[Mapping_UniProtAcc,Mapping_ChEMBLid]=textread('DRUIDom_Files/Mapping_UniProtAcc_ChEMBLid.tab', '%s %s', 'delimiter', '\t', 'headerlines', 1);
[Lia,~]=ismember(DEEPScreen_ChEMBLv23_act_inact_Target_ChEMBLid,Mapping_ChEMBLid);
del_ind=find(Lia==0);
DEEPScreen_ChEMBLv23_act_inact_Target_ChEMBLid(del_ind,:)=[];
DEEPScreen_ChEMBLv23_act_inact_Compound_ChEMBLid(del_ind,:)=[];
[~,Locb]=ismember(DEEPScreen_ChEMBLv23_act_inact_Target_ChEMBLid,Mapping_ChEMBLid);
DEEPScreen_ChEMBLv23_act_inact_Target_UniProtAcc=Mapping_UniProtAcc(Locb);
to=1;
for i=1:2:length(DEEPScreen_ChEMBLv23_act_inact_Compound_ChEMBLid)
if isempty(DEEPScreen_ChEMBLv23_act_inact_Compound_ChEMBLid{i,1})==0
x=strsplit(DEEPScreen_ChEMBLv23_act_inact_Compound_ChEMBLid{i,1},',')';
DEEPScreen_ChEMBLv23_Org_act(to:(to+length(x)-1),1)=repmat(DEEPScreen_ChEMBLv23_act_inact_Target_UniProtAcc(i,1),length(x),1);
DEEPScreen_ChEMBLv23_Org_act(to:(to+length(x)-1),2)=x;
to=to+length(x);
end
end
to=1;
for i=2:2:length(DEEPScreen_ChEMBLv23_act_inact_Compound_ChEMBLid)
if isempty(DEEPScreen_ChEMBLv23_act_inact_Compound_ChEMBLid{i,1})==0
x=strsplit(DEEPScreen_ChEMBLv23_act_inact_Compound_ChEMBLid{i,1},',')';
DEEPScreen_ChEMBLv23_Org_inact(to:(to+length(x)-1),1)=repmat(DEEPScreen_ChEMBLv23_act_inact_Target_UniProtAcc(i,1),length(x),1);
DEEPScreen_ChEMBLv23_Org_inact(to:(to+length(x)-1),2)=x;
to=to+length(x);
end
end
save DRUIDom_Files/DEEPScreen_ChEMBLv23_Org_act_raw.mat DEEPScreen_ChEMBLv23_Org_act
save DRUIDom_Files/DEEPScreen_ChEMBLv23_Org_inact_raw.mat DEEPScreen_ChEMBLv23_Org_inact
[ChEMBLv23_Compoundid,ChEMBLv23_SMILES]=textread('DRUIDom_Files/ChEMBLv23_compound_SMILES.txt', '%s %s', 'delimiter', '\t', 'headerlines', 1);
[Lia,Locb]=ismember(DEEPScreen_ChEMBLv23_Org_act(:,2),ChEMBLv23_Compoundid);
DEEPScreen_ChEMBLv23_Org_act_SMILES=cell(length(DEEPScreen_ChEMBLv23_Org_act),1);
DEEPScreen_ChEMBLv23_Org_act_SMILES(Lia==1,1)=ChEMBLv23_SMILES(Locb(Locb>0),1);
del_ind=find(Lia==0);
DEEPScreen_ChEMBLv23_Org_act(del_ind,:)=[];
DEEPScreen_ChEMBLv23_Org_act_SMILES(del_ind,:)=[];
save DRUIDom_Files/DEEPScreen_ChEMBLv23_Org_act_var.mat DEEPScreen_ChEMBLv23_Org_act DEEPScreen_ChEMBLv23_Org_act_SMILES
[Lia,Locb]=ismember(DEEPScreen_ChEMBLv23_Org_inact(:,2),ChEMBLv23_Compoundid);
DEEPScreen_ChEMBLv23_Org_inact_SMILES=cell(length(DEEPScreen_ChEMBLv23_Org_inact),1);
DEEPScreen_ChEMBLv23_Org_inact_SMILES(Lia==1,1)=ChEMBLv23_SMILES(Locb(Locb>0),1);
del_ind=find(Lia==0);
DEEPScreen_ChEMBLv23_Org_inact(del_ind,:)=[];
DEEPScreen_ChEMBLv23_Org_inact_SMILES(del_ind,:)=[];
save DRUIDom_Files/DEEPScreen_ChEMBLv23_Org_inact_var.mat DEEPScreen_ChEMBLv23_Org_inact DEEPScreen_ChEMBLv23_Org_inact_SMILES
DEEPScreen_ChEMBLv23_Org_act_inact=[DEEPScreen_ChEMBLv23_Org_act;DEEPScreen_ChEMBLv23_Org_inact];
save DRUIDom_Files/DEEPScreen_ChEMBLv23_Org_act_inact.mat DEEPScreen_ChEMBLv23_Org_act_inact
length(unique(DEEPScreen_ChEMBLv23_Org_act_inact(:,1)))
length(unique(DEEPScreen_ChEMBLv23_Org_act_inact(:,2)))
% Comparison and the merge between ExCAPE and DEEPScreen training datasets:
% (actives dataset)
DEEPScreen_Org_act_51=strcat(DEEPScreen_ChEMBLv23_Org_act(:,1), {' '}, DEEPScreen_ChEMBLv23_Org_act(:,2));
ExCAPE_Org_act_51=strcat(ExCAPE_Org_act(:,1), {' '}, ExCAPE_Org_act(:,2));
[Lia,~]=ismember(ExCAPE_Org_act_51,DEEPScreen_Org_act_51);
ExCAPE_Org_act_onlyExCAPE=ExCAPE_Org_act(Lia==0,:);
ExCAPE_Org_act_onlyExCAPE_SMILES=ExCAPE_active_datapoints_SMILES(Lia==0,:);
save DRUIDom_Files/ExCAPE_Org_act_onlyExCAPE_var.mat ExCAPE_Org_act_onlyExCAPE ExCAPE_Org_act_onlyExCAPE_SMILES
Combined_Org_act=[DEEPScreen_ChEMBLv23_Org_act;ExCAPE_Org_act_onlyExCAPE];
Combined_Org_act_SMILES=[DEEPScreen_ChEMBLv23_Org_act_SMILES;ExCAPE_Org_act_onlyExCAPE_SMILES];
save DRUIDom_Files/Combined_Org_act_var.mat Combined_Org_act Combined_Org_act_SMILES
t=Combined_Org_act_SMILES';
fid = fopen('DRUIDom_Files/Combined_Org_act_SMILES.txt','w');
fprintf(fid,'%s\n',t{:});
fclose(fid);
Combined_Org_act_SMILES_id=[Combined_Org_act_SMILES Combined_Org_act(:,2)];
t=Combined_Org_act_SMILES_id';
fid = fopen('DRUIDom_Files/Combined_Org_act_SMILES_id.smi','w');
fprintf(fid,'%s\t%s\n',t{:});
fclose(fid);
% (inactives dataset)
DEEPScreen_Org_inact_51=strcat(DEEPScreen_ChEMBLv23_Org_inact(:,1), {' '}, DEEPScreen_ChEMBLv23_Org_inact(:,2));
ExCAPE_Org_inact_withact_51=strcat(ExCAPE_Org_inact_withact(:,1), {' '}, ExCAPE_Org_inact_withact(:,2));
[Lia,~]=ismember(ExCAPE_Org_inact_withact_51,DEEPScreen_Org_inact_51);
ExCAPE_Org_inact_withact_onlyExCAPE=ExCAPE_Org_inact_withact(Lia==0,:);
ExCAPE_Org_inact_withact_onlyExCAPE_SMILES=ExCAPE_inactive_datapoints_filtered_withact_SMILES(Lia==0,:);
save DRUIDom_Files/ExCAPE_Org_inact_withact_onlyExCAPE_var.mat ExCAPE_Org_inact_withact_onlyExCAPE ExCAPE_Org_inact_withact_onlyExCAPE_SMILES
Combined_Org_inact_withact=[DEEPScreen_ChEMBLv23_Org_inact;ExCAPE_Org_inact_withact_onlyExCAPE];
Combined_Org_inact_withact_SMILES=[DEEPScreen_ChEMBLv23_Org_inact_SMILES;ExCAPE_Org_inact_withact_onlyExCAPE_SMILES];
save DRUIDom_Files/Combined_Org_inact_withact_var.mat Combined_Org_inact_withact Combined_Org_inact_withact_SMILES
t=Combined_Org_inact_withact_SMILES';
fid = fopen('DRUIDom_Files/Combined_Org_inact_withact_SMILES.txt','w');
fprintf(fid,'%s\n',t{:});
fclose(fid);
Combined_Org_inact_withact_SMILES_id=[Combined_Org_inact_withact_SMILES Combined_Org_inact_withact(:,2)];
t=Combined_Org_inact_withact_SMILES_id';
fid = fopen('DRUIDom_Files/Combined_Org_inact_withact_SMILES_id.smi','w');
fprintf(fid,'%s\t%s\n',t{:});
fclose(fid);
Combined_Org_All_id=[Combined_Org_act(:,2);Combined_Org_inact_withact(:,2)];
[Combined_Org_All_id_unique,I,J] = unique(Combined_Org_All_id);
Combined_Org_All_SMILES=[Combined_Org_act_SMILES;Combined_Org_inact_withact_SMILES];
Combined_Org_All_SMILES_unique=Combined_Org_All_SMILES(I);
Combined_Org_All_SMILES_id_unique=[Combined_Org_All_SMILES_unique Combined_Org_All_id_unique];
t=Combined_Org_All_SMILES_id_unique';
fid = fopen('DRUIDom_Files/Combined_Org_All_SMILES_id_unique.smi','w');
fprintf(fid,'%s\t%s\n',t{:});
fclose(fid);
Combined_Org_act_51=strcat(Combined_Org_act(:,1), {' '}, Combined_Org_act(:,2));
Combined_Org_inact_withact_51=strcat(Combined_Org_inact_withact(:,1), {' '}, Combined_Org_inact_withact(:,2));
[Lia,~]=ismember(Combined_Org_act_51,Combined_Org_inact_withact_51);
sum(Lia)
% (there are very few corresponding data points between actives and inactives: 1574)
Combined_Org_act_inact=[Combined_Org_act;Combined_Org_inact_withact];
save DRUIDom_Files/Combined_Org_act_inact.mat Combined_Org_act_inact
length(unique(Combined_Org_act_inact(:,1)))
length(unique(Combined_Org_act_inact(:,2)))
Target_UniProtacc_Combined_Org_act_inact=unique(Combined_Org_act_inact(:,1));
save DRUIDom_Files/Target_UniProtacc_Combined_Org_act_inact.mat Target_UniProtacc_Combined_Org_act_inact
% (finalized bioactivity dataset stats: 2,869,943 interaction data points between 3,644 target proteins and 1,033,581 compounds)
t=Combined_Org_act_inact;
t(1:1637599,3)=cellstr('A');
t(1637600:end,3)=cellstr('I');
t=t';
fid = fopen('DRUIDom_source_bioactivity_dataset_filtered.txt','w');
fprintf(fid,'%s\t%s\t%s\n',t{:});
fclose(fid);
% Histogram of data point distributions for all targets:
length(unique(Combined_Org_act(:,1)))
length(unique(Combined_Org_act(:,2)))
[~,Locb]=ismember(Combined_Org_act(:,1),unique(Combined_Org_act(:,1)));
Hist_combined_act=hist(Locb,0.5:1:(max(Locb)+0.5));
figure;bar(log10(sort(Hist_combined_act,'descend')))
[~,Locb]=ismember(Combined_Org_act(:,2),unique(Combined_Org_act(:,2)));
Hist_combined_act_comp=sort(hist(Locb,0.5:1:(max(Locb)+0.5)),'descend')';
length(find(Hist_combined_act_comp>=5))
length(unique(Combined_Org_inact_withact(:,1)))
length(unique(Combined_Org_inact_withact(:,2)))
[~,Locb]=ismember(Combined_Org_inact_withact(:,1),unique(Combined_Org_inact_withact(:,1)));
Hist_combined_inact_withact=hist(Locb,0.5:1:(max(Locb)+0.5));
figure;bar(log10(sort(Hist_combined_inact_withact,'descend')))
[~,Locb]=ismember(Combined_Org_inact_withact(:,2),unique(Combined_Org_inact_withact(:,2)));
Hist_combined_inact_withact_comp=sort(hist(Locb,0.5:1:(max(Locb)+0.5)),'descend')';
length(find(Hist_combined_inact_withact_comp>=5))
% Generation of the Morgan Fingerprints for all compounds and pairwise tanimoto similarity search using Chemfp:
% conda create -n py2condaenv python=2
% conda activate py2-rdkit-env
% python .../chemfp-1.5/setup.py install --without-openmp
% cd .../DRUIDom
% rdkit2fps --morgan DRUIDom_Files/Combined_Org_All_SMILES_id_unique.smi -o DRUIDom_Files/Combined_Org_All_ECFP4_id_unique.fps
% split -l 206705 DRUIDom_Files/Combined_Org_All_ECFP4_id_unique.fps
% simsearch --times --threshold 0.5 -q xaa xaa -o DRUIDom_Files/xaa_xaa_Simsearch.txt
% simsearch --times --threshold 0.5 -q xaa xab -o DRUIDom_Files/xaa_xab_Simsearch.txt
% simsearch --times --threshold 0.5 -q xaa xac -o DRUIDom_Files/xaa_xac_Simsearch.txt
% simsearch --times --threshold 0.5 -q xaa xad -o DRUIDom_Files/xaa_xad_Simsearch.txt
% simsearch --times --threshold 0.5 -q xaa xae -o DRUIDom_Files/xaa_xae_Simsearch.txt
% simsearch --times --threshold 0.5 -q xab xab -o DRUIDom_Files/xab_xab_Simsearch.txt
% simsearch --times --threshold 0.5 -q xab xac -o DRUIDom_Files/xab_xac_Simsearch.txt
% simsearch --times --threshold 0.5 -q xab xad -o DRUIDom_Files/xab_xad_Simsearch.txt
% simsearch --times --threshold 0.5 -q xab xae -o DRUIDom_Files/xab_xae_Simsearch.txt
% simsearch --times --threshold 0.5 -q xac xac -o DRUIDom_Files/xac_xac_Simsearch.txt
% simsearch --times --threshold 0.5 -q xac xad -o DRUIDom_Files/xac_xad_Simsearch.txt
% simsearch --times --threshold 0.5 -q xac xae -o DRUIDom_Files/xac_xae_Simsearch.txt
% simsearch --times --threshold 0.5 -q xad xad -o DRUIDom_Files/xad_xad_Simsearch.txt
% simsearch --times --threshold 0.5 -q xad xae -o DRUIDom_Files/xad_xae_Simsearch.txt
% simsearch --times --threshold 0.5 -q xae xae -o DRUIDom_Files/xae_xae_Simsearch.txt
% simsearch --times --threshold 0.5 --NxN DRUIDom_Files/Combined_Org_All_ECFP4_id_unique.fps -o DRUIDom_Files/Combined_Org_All_Simsearch.txt
% Organizing the compound similarity files (repeat below code for all 15 parts from xaa to xae):
[Part_Simsearch]=textread('DRUIDom_Files/xaa_xaa_Simsearch.txt', '%s', 'delimiter', '\n', 'bufsize', 500000);
Part_SimS_Org=cell(10000000,3);
to=1;
for i=1:length(Part_Simsearch)
disp(['Line number: ' num2str(i), ' / ' num2str(length(Part_Simsearch))])
x=strsplit(Part_Simsearch{i,1},'\t')';
if str2num(x{1,1})~=0
Part_SimS_Org(to:(to+((length(x)-2)/2)-1),1)=repmat(x(2,1),(length(x)-2)/2,1);
Part_SimS_Org(to:(to+((length(x)-2)/2)-1),2)=x(3:2:(end-1),1);
Part_SimS_Org(to:(to+((length(x)-2)/2)-1),3)=x(4:2:(end),1);
to=to+((length(x)-2)/2);
end
end
del_ind=cellfun(@isempty,Part_SimS_Org(:,1));
Part_SimS_Org(del_ind,:)=[];
self_ind=cellfun(@isequal,Part_SimS_Org(:,1),Part_SimS_Org(:,2));
Part_SimS_Org(self_ind==1,:)=[];
t=Part_SimS_Org';
fid=fopen('DRUIDom_Files/xaa_xaa_SimS_Org.txt','w');
fprintf(fid,'%s\t%s\t%s\n',t{:});
fclose(fid);
% cat DRUIDom_Files/xaa_xaa_SimS_Org.txt DRUIDom_Files/xaa_xab_SimS_Org.txt DRUIDom_Files/xaa_xac_SimS_Org.txt DRUIDom_Files/xaa_xad_SimS_Org.txt DRUIDom_Files/xaa_xae_SimS_Org.txt DRUIDom_Files/xab_xab_SimS_Org.txt DRUIDom_Files/xab_xac_SimS_Org.txt DRUIDom_Files/xab_xad_SimS_Org.txt DRUIDom_Files/xab_xae_SimS_Org.txt DRUIDom_Files/xac_xac_SimS_Org.txt DRUIDom_Files/xac_xad_SimS_Org.txt DRUIDom_Files/xac_xae_SimS_Org.txt DRUIDom_Files/xad_xad_SimS_Org.txt DRUIDom_Files/xad_xae_SimS_Org.txt DRUIDom_Files/xae_xae_SimS_Org.txt > DRUIDom_Files/Combined_SimS_Org.txt
% Generating the combined protein groups for each ligand cluster using the selected ligand similarity threshold:
[Combined_Org_Comp1,Combined_Org_Comp2,Combined_Org_Sim]=textread('DRUIDom_Files/Combined_SimS_Org.txt', '%s %s %d', 'delimiter', '\t');
load DRUIDom_Files/Combined_Org_act_var.mat
load DRUIDom_Files/Combined_Org_inact_withact_var.mat
Combined_Org_id_unique=unique([Combined_Org_act(:,2);Combined_Org_inact_withact(:,2)]);
save DRUIDom_Files/Combined_Org_id_unique.mat Combined_Org_id_unique
thr=0.7;
ind_thr=find(Combined_Org_Sim>=thr);
Combined_Org_Sim=Combined_Org_Sim(ind_thr);
Combined_Org_Comp1=Combined_Org_Comp1(ind_thr);
Combined_Org_Comp2=Combined_Org_Comp2(ind_thr);
save DRUIDom_Files/Combined_Org_Comp1_07.mat Combined_Org_Comp1
save DRUIDom_Files/Combined_Org_Comp2_07.mat Combined_Org_Comp2
save DRUIDom_Files/Combined_Org_Sim_07.mat Combined_Org_Sim
[Lia1,Locb1]=ismember(Combined_Org_Comp1,Combined_Org_id_unique);
[~,Locb2]=ismember(Combined_Org_Comp2,Combined_Org_id_unique);
save DRUIDom_Files/Locations_07.mat Locb1 Locb2
[Lia_act,Locb_act]=ismember(Combined_Org_act(:,2),Combined_Org_id_unique);
[Lia_inact,Locb_inact]=ismember(Combined_Org_inact_withact(:,2),Combined_Org_id_unique);
save DRUIDom_Files/Locations_act_inact.mat Locb_act Locb_inact
Combined_Org_id_unique_ind=(1:length(Combined_Org_id_unique))';
parpool(4)
Combined_Org_unique_act_Prot=cell(length(Combined_Org_id_unique),1);
Combined_Org_unique_inact_withact_Prot=cell(length(Combined_Org_id_unique),1);
parfor i=1:length(Combined_Org_id_unique)
disp(['Compound number: ' num2str(i), ' / ' num2str(length(Combined_Org_id_unique))])
Combined_Org_thrSim_temp_ind=unique([i;Locb2(Locb1==i);Locb1(Locb2==i)]);
Combined_Org_unique_act_Prot{i,1}=unique(Combined_Org_act(ismember(Locb_act,Combined_Org_thrSim_temp_ind)==1,1));
Combined_Org_unique_inact_withact_Prot{i,1}=unique(Combined_Org_inact_withact(ismember(Locb_inact,Combined_Org_thrSim_temp_ind)==1,1));
end
save DRUIDom_Files/Combined_Org_unique_act_Prot_07.mat Combined_Org_unique_act_Prot
save DRUIDom_Files/Combined_Org_unique_inact_withact_Prot_07.mat Combined_Org_unique_inact_withact_Prot
% Analyzing and thresholding the protein arrays:
Combined_Org_unique_Samplenum_act_inact_sup=zeros(length(Combined_Org_id_unique),3);
for i=1:length(Combined_Org_id_unique)
disp(['Compound number: ' num2str(i), ' / ' num2str(length(Combined_Org_id_unique))])
Combined_Org_unique_Samplenum_act_inact_sup(i,1)=length(Combined_Org_unique_act_Prot{i,1});
Combined_Org_unique_Samplenum_act_inact_sup(i,2)=length(Combined_Org_unique_inact_withact_Prot{i,1});
Combined_Org_unique_Samplenum_act_inact_sup(i,3)=(Combined_Org_unique_Samplenum_act_inact_sup(i,1)+Combined_Org_unique_Samplenum_act_inact_sup(i,2))/2;
end
save DRUIDom_Files/Combined_Org_unique_Samplenum_act_inact_sup.mat Combined_Org_unique_Samplenum_act_inact_sup
length(find(Combined_Org_unique_Samplenum_act_inact_sup(:,1)>=3))
length(find(Combined_Org_unique_Samplenum_act_inact_sup(:,2)>=3))
length(find(Combined_Org_unique_Samplenum_act_inact_sup(:,1)>=3 & Combined_Org_unique_Samplenum_act_inact_sup(:,2)>=3))
length(find(Combined_Org_unique_Samplenum_act_inact_sup(:,1)>=5))
length(find(Combined_Org_unique_Samplenum_act_inact_sup(:,2)>=5))
length(find(Combined_Org_unique_Samplenum_act_inact_sup(:,1)>=5 & Combined_Org_unique_Samplenum_act_inact_sup(:,2)>=5))
length(find(Combined_Org_unique_Samplenum_act_inact_sup(:,1)>=10))
length(find(Combined_Org_unique_Samplenum_act_inact_sup(:,2)>=10))
length(find(Combined_Org_unique_Samplenum_act_inact_sup(:,1)>=10 & Combined_Org_unique_Samplenum_act_inact_sup(:,2)>=10))
% (histograms of active and inactive distribution in the Prot5 dataset)
figure;
histogram(sort(2*Combined_Org_unique_Samplenum_act_inact_sup(:,3),'descend'),-0.5:1:(max(2*Combined_Org_unique_Samplenum_act_inact_sup(:,3))+0.5),'FaceAlpha',1)
set(gca,'YScale','log')
axis([0.5 350 0 1000000])
figure;
histogram(sort(Combined_Org_unique_Samplenum_act_inact_sup(:,1),'descend'),-0.5:1:(max(Combined_Org_unique_Samplenum_act_inact_sup(:,1))+0.5),'FaceColor',[0 0.7 0],'FaceAlpha',1)
set(gca,'YScale','log')
axis([0.5 350 0 1000000])
figure;
histogram(sort(Combined_Org_unique_Samplenum_act_inact_sup(:,2),'descend'),-0.5:1:(max(Combined_Org_unique_Samplenum_act_inact_sup(:,2))+0.5),'FaceColor',[0.8 0 0],'FaceAlpha',1)
set(gca,'YScale','log')
axis([0.5 350 0 1000000])
thr_act_samp=5;
thr_inact_samp=5;
Combined_Org_unique_Samplenum_act_inact_sup_5=Combined_Org_unique_Samplenum_act_inact_sup(Combined_Org_unique_Samplenum_act_inact_sup(:,1)>=thr_act_samp & Combined_Org_unique_Samplenum_act_inact_sup(:,2)>=thr_inact_samp,:);
Combined_Org_unique_act_Prot_5=Combined_Org_unique_act_Prot(Combined_Org_unique_Samplenum_act_inact_sup(:,1)>=thr_act_samp & Combined_Org_unique_Samplenum_act_inact_sup(:,2)>=thr_inact_samp,:);
Combined_Org_unique_inact_withact_Prot_5=Combined_Org_unique_inact_withact_Prot(Combined_Org_unique_Samplenum_act_inact_sup(:,1)>=thr_act_samp & Combined_Org_unique_Samplenum_act_inact_sup(:,2)>=thr_inact_samp,:);
Combined_Org_id_unique_Prot_5=Combined_Org_id_unique(Combined_Org_unique_Samplenum_act_inact_sup(:,1)>=thr_act_samp & Combined_Org_unique_Samplenum_act_inact_sup(:,2)>=thr_inact_samp,:);
save DRUIDom_Files/Combined_Org_unique_act_inact_Prot_5_var.mat Combined_Org_unique_Samplenum_act_inact_sup_5 Combined_Org_unique_act_Prot_5 Combined_Org_unique_inact_withact_Prot_5 Combined_Org_id_unique_Prot_5
% InterPro domain array generation for active and inactive sets:
% (saving a unique list of target protein accessions from the combined activity set)
Combined_Org_act_inact_Prot_unique=unique([Combined_Org_act(:,1);Combined_Org_inact_withact(:,1)]);
save DRUIDom_Files/Combined_Org_act_inact_Prot_unique.mat Combined_Org_act_inact_Prot_unique
% (UniProt id retrieval is used to obtain InterPro hits for these 3644 target proteins)
% (Organizing InterPro hits of our target proteins)
[InterPro_entriesmatched_onlytarget_UniProtAcc,InterPro_entriesmatched_onlytarget_IPRid]=textread('DRUIDom_Files/InterPro_UniProtAcc_IPRid_entriesmatched_onlytargets.tab', '%s %s', 'delimiter', '\t', 'headerlines', 1);
InterPro_entriesmatched_onlytarget_Org=cell(0,2);
to=1;
for i=1:length(InterPro_entriesmatched_onlytarget_UniProtAcc)
disp(['Line number: ' num2str(i), ' / ' num2str(length(InterPro_entriesmatched_onlytarget_UniProtAcc))])
if isempty(InterPro_entriesmatched_onlytarget_IPRid{i,1})==0
x=strsplit(InterPro_entriesmatched_onlytarget_IPRid{i,1},';')';
x(end,:)=[];
InterPro_entriesmatched_onlytarget_Org(to:(to+(length(x))-1),1)=repmat(InterPro_entriesmatched_onlytarget_UniProtAcc(i,1),length(x),1);
InterPro_entriesmatched_onlytarget_Org(to:(to+(length(x))-1),2)=x;
to=to+(length(x));
end
end
save DRUIDom_Files/InterPro_entriesmatched_onlytarget_Org.mat InterPro_entriesmatched_onlytarget_Org
% (Organizing InterPro hits of all ChEMBL targets)
[InterPro_entriesmatched_onlyChEMBL_UniProtAcc,InterPro_entriesmatched_onlyChEMBL_IPRid]=textread('DRUIDom_Files/InterPro_UniProtAcc_IPRid_entriesmatched_onlyChEMBL.tab', '%s %s', 'delimiter', '\t', 'headerlines', 1);
InterPro_entriesmatched_onlyChEMBL_Org=cell(0,2);
to=1;
for i=1:length(InterPro_entriesmatched_onlyChEMBL_UniProtAcc)
disp(['Line number: ' num2str(i), ' / ' num2str(length(InterPro_entriesmatched_onlyChEMBL_UniProtAcc))])
if isempty(InterPro_entriesmatched_onlyChEMBL_IPRid{i,1})==0
x=strsplit(InterPro_entriesmatched_onlyChEMBL_IPRid{i,1},';')';
x(end,:)=[];
InterPro_entriesmatched_onlyChEMBL_Org(to:(to+(length(x))-1),1)=repmat(InterPro_entriesmatched_onlyChEMBL_UniProtAcc(i,1),length(x),1);
InterPro_entriesmatched_onlyChEMBL_Org(to:(to+(length(x))-1),2)=x;
to=to+(length(x));
end
end
save DRUIDom_Files/InterPro_entriesmatched_onlyChEMBL_Org.mat InterPro_entriesmatched_onlyChEMBL_Org
% (Organizing InterPro hits of all human proteins)
[InterPro_entriesmatched_allhuman_UniProtAcc,InterPro_entriesmatched_allhuman_IPRid]=textread('DRUIDom_Files/InterPro_UniProtAcc_IPRid_entriesmatched_allhuman.tab', '%s %s', 'delimiter', '\t', 'headerlines', 1);
InterPro_entriesmatched_allhuman_Org=cell(0,2);
to=1;
for i=1:length(InterPro_entriesmatched_allhuman_UniProtAcc)
disp(['Line number: ' num2str(i), ' / ' num2str(length(InterPro_entriesmatched_allhuman_UniProtAcc))])
if isempty(InterPro_entriesmatched_allhuman_IPRid{i,1})==0
x=strsplit(InterPro_entriesmatched_allhuman_IPRid{i,1},';')';
x(end,:)=[];
InterPro_entriesmatched_allhuman_Org(to:(to+(length(x))-1),1)=repmat(InterPro_entriesmatched_allhuman_UniProtAcc(i,1),length(x),1);
InterPro_entriesmatched_allhuman_Org(to:(to+(length(x))-1),2)=x;
to=to+(length(x));
end
end
save DRUIDom_Files/InterPro_entriesmatched_allhuman_Org.mat InterPro_entriesmatched_allhuman_Org
% (Selecting only domain type hits from the organized protein InterPro hit files)
[InterPro_v72_Domain_id,~,~]=textread('DRUIDom_Files/InterPro_v72_Domain_entrylist.txt', '%s %s %s', 'delimiter', '\t');
InterPro_v72_Domain_id=unique(InterPro_v72_Domain_id);
[Lia,~]=ismember(InterPro_entriesmatched_onlytarget_Org(:,2),InterPro_v72_Domain_id);
InterPro_entriesmatched_onlytarget_Org_onlydom=InterPro_entriesmatched_onlytarget_Org(Lia==1,:);
save DRUIDom_Files/InterPro_entriesmatched_onlytarget_Org_onlydom.mat InterPro_entriesmatched_onlytarget_Org_onlydom
[Lia,~]=ismember(InterPro_entriesmatched_onlyChEMBL_Org(:,2),InterPro_v72_Domain_id);
InterPro_entriesmatched_onlyChEMBL_Org_onlydom=InterPro_entriesmatched_onlyChEMBL_Org(Lia==1,:);
save DRUIDom_Files/InterPro_entriesmatched_onlyChEMBL_Org_onlydom.mat InterPro_entriesmatched_onlyChEMBL_Org_onlydom
[Lia,~]=ismember(InterPro_entriesmatched_allhuman_Org(:,2),InterPro_v72_Domain_id);
InterPro_entriesmatched_allhuman_Org_onlydom=InterPro_entriesmatched_allhuman_Org(Lia==1,:);
save DRUIDom_Files/InterPro_entriesmatched_allhuman_Org_onlydom.mat InterPro_entriesmatched_allhuman_Org_onlydom
% (organizing InterPro term relation file to determine domain relations)
[InterPro_v72_ParentChildTree,~]=textread('DRUIDom_Files/InterPro_v72_ParentChildTreeFile.txt', '%s %s', 'delimiter', '::');
InterPro_v72_ParentChildTree=InterPro_v72_ParentChildTree(1:2:end,1);
% (removal of non-domain IRP entries from the hierarchy file)
for i=1:length(InterPro_v72_ParentChildTree)
InterPro_v72_terms_from_ParentChildTree(i,1)=erase(InterPro_v72_ParentChildTree(i,1),"-");
end
[Lia,~]=ismember(InterPro_v72_terms_from_ParentChildTree,InterPro_v72_Domain_id);
InterPro_v72_ParentChildTree_Dom=InterPro_v72_ParentChildTree(Lia==1,:);
% (addition of domain entries to the table that have no hierarchical relationship with other entries)
InterPro_v72_terms_without_hierarc=setdiff(InterPro_v72_Domain_id,InterPro_v72_terms_from_ParentChildTree);
InterPro_v72_ParentChildTree_Dom=[InterPro_v72_ParentChildTree_Dom;InterPro_v72_terms_without_hierarc];
save DRUIDom_Files/InterPro_v72_ParentChildTree_var.mat InterPro_v72_ParentChildTree InterPro_v72_ParentChildTree_Dom
InterPro_v72_Dom_groups=cell(length(InterPro_v72_ParentChildTree_Dom),5);
for i=1:length(InterPro_v72_ParentChildTree_Dom)
if isequal(InterPro_v72_ParentChildTree_Dom{i,1}(1,1),'-')==0
Level1=erase(InterPro_v72_ParentChildTree_Dom(i,1),"-");
InterPro_v72_Dom_groups(i,1)=erase(InterPro_v72_ParentChildTree_Dom(i,1),"-");
elseif isequal(InterPro_v72_ParentChildTree_Dom{i,1}(1,1:3),'--I')==1
Level2=erase(InterPro_v72_ParentChildTree_Dom(i,1),"-");
InterPro_v72_Dom_groups(i,1)=Level1;
InterPro_v72_Dom_groups(i,2)=Level2;
elseif isequal(InterPro_v72_ParentChildTree_Dom{i,1}(1,1:5),'----I')==1
Level3=erase(InterPro_v72_ParentChildTree_Dom(i,1),"-");
InterPro_v72_Dom_groups(i,1)=Level1;
InterPro_v72_Dom_groups(i,2)=Level2;
InterPro_v72_Dom_groups(i,3)=Level3;
elseif isequal(InterPro_v72_ParentChildTree_Dom{i,1}(1,1:7),'------I')==1
Level4=erase(InterPro_v72_ParentChildTree_Dom(i,1),"-");
InterPro_v72_Dom_groups(i,1)=Level1;
InterPro_v72_Dom_groups(i,2)=Level2;
InterPro_v72_Dom_groups(i,3)=Level3;
InterPro_v72_Dom_groups(i,4)=Level4;
elseif isequal(InterPro_v72_ParentChildTree_Dom{i,1}(1,1:9),'--------I')==1
Level5=erase(InterPro_v72_ParentChildTree_Dom(i,1),"-");
InterPro_v72_Dom_groups(i,1)=Level1;
InterPro_v72_Dom_groups(i,2)=Level2;
InterPro_v72_Dom_groups(i,3)=Level3;
InterPro_v72_Dom_groups(i,4)=Level4;
InterPro_v72_Dom_groups(i,5)=Level5;
end
end
spc_ind=cellfun(@isempty,InterPro_v72_Dom_groups);
InterPro_v72_Dom_groups(spc_ind==1)=cellstr('X');
save DRUIDom_Files/InterPro_v72_Dom_groups.mat InterPro_v72_Dom_groups
% -------------------------------
% Domain-Compoung Mapping Process
% -------------------------------
% Associating compounds with single domains:
% Calculating the compound cluster (similarity based) single domain assocation scores for all compounds:
load DRUIDom_Files/Combined_Org_unique_act_inact_Prot_5_var.mat
load DRUIDom_Files/InterPro_v72_Dom_groups.mat
load DRUIDom_Files/InterPro_entriesmatched_onlytarget_Org_onlydom.mat
Domain_mapping_Prot_5.Compounds=Combined_Org_id_unique_Prot_5;
Domain_mapping_Prot_5.Domains=cell(length(Combined_Org_id_unique_Prot_5),1);
Domain_mapping_Prot_5.MapScr=cell(length(Combined_Org_id_unique_Prot_5),1);
for i=1:length(Combined_Org_id_unique_Prot_5)
disp(['Compound number: ' num2str(i), ' / ' num2str(length(Combined_Org_id_unique_Prot_5))])
Lia=ismember(InterPro_entriesmatched_onlytarget_Org_onlydom(:,1),Combined_Org_unique_act_Prot_5{i,1});
InterPro_entriesmatched_temp_act=InterPro_entriesmatched_onlytarget_Org_onlydom(Lia==1,:);
Dom_temp_act=unique(InterPro_entriesmatched_onlytarget_Org_onlydom(Lia==1,2));
Lia2=ismember(InterPro_entriesmatched_onlytarget_Org_onlydom(:,1),Combined_Org_unique_inact_withact_Prot_5{i,1});
InterPro_entriesmatched_temp_inact=InterPro_entriesmatched_onlytarget_Org_onlydom(Lia2==1,:);
clear TP FN FP TN
for j=1:length(Dom_temp_act)
Lian=ismember(InterPro_v72_Dom_groups,Dom_temp_act{j,1});
Dom_temp_act_group=unique(InterPro_v72_Dom_groups(sum(Lian,2)>0,:));
Dom_temp_act_group(strncmp(Dom_temp_act_group(:,1),'X',1),:)=[];
Dom_temp_act_group(:,strncmp(Dom_temp_act_group(1,:),'X',1))=[];
Lia=ismember(InterPro_entriesmatched_temp_act(:,2),Dom_temp_act_group);
TP(j,1)=length(unique(InterPro_entriesmatched_temp_act(Lia==1,1)));
FN(j,1)=length(unique(Combined_Org_unique_act_Prot_5{i,1}))-TP(j,1);
Lia2=ismember(InterPro_entriesmatched_temp_inact(:,2),Dom_temp_act_group);
if sum(Lia2)~=0
FP(j,1)=length(unique(InterPro_entriesmatched_temp_inact(Lia2==1,1)));
else
FP(j,1)=0;
end
TN(j,1)=length(unique(Combined_Org_unique_inact_withact_Prot_5{i,1}))-FP(j,1);
end
REC=TP./(TP+FN);
PRE=TP./(TP+FP);
ACCU=(TP+TN)./(TP+TN+FP+FN);
F1=(2*TP)./(2*TP+FP+FN);
MCC=((TP.*TN)-(FP.*FN))./(((TP+FP).*(TP+FN).*(TN+FP).*(TN+FN)).^(1/2));
Domain_mapping_Prot_5.Domains{i,1}=Dom_temp_act;
Domain_mapping_Prot_5.MapScr{i,1}=[TP FN FP TN REC PRE ACCU F1 MCC];
end
save DRUIDom_Files/Domain_mapping_Prot_5.mat Domain_mapping_Prot_5
% (organizing all mappings)
Domain_mapping_Prot_5_all_Org=cell(5000000,9);
to=1;
for i=1:length(Combined_Org_id_unique_Prot_5)
disp(['Compound number: ' num2str(i), ' / ' num2str(length(Combined_Org_id_unique_Prot_5))])
len_temp=size(Domain_mapping_Prot_5.MapScr{i,1},1);
if len_temp~=0
Domain_mapping_Prot_5_all_Org(to:(to+(len_temp)-1),1)=cellstr(repmat(Domain_mapping_Prot_5.Compounds{i,1},len_temp,1));
Domain_mapping_Prot_5_all_Org(to:(to+(len_temp)-1),2)=Domain_mapping_Prot_5.Domains{i,1};
Domain_mapping_Prot_5_all_Org(to:(to+(len_temp)-1),3:11)=num2cell(Domain_mapping_Prot_5.MapScr{i,1});
to=to+(len_temp);
end
end
del_ind=cellfun(@isempty,Domain_mapping_Prot_5_all_Org(:,1));
Domain_mapping_Prot_5_all_Org(del_ind,:)=[];
length(unique(Domain_mapping_Prot_5_all_Org(:,1)))
length(unique(Domain_mapping_Prot_5_all_Org(:,2)))
t=Domain_mapping_Prot_5_all_Org';
fid=fopen('DRUIDom_Files/Domain_mapping_Prot_5_all_Org.txt','w');
fprintf(fid,'%s\t%s\t%d\t%d\t%d\t%d\t%.4f\t%.4f\t%.4f\t%.4f\t%.4f\n',t{:});
fclose(fid);
Domain_mapping_Prot_5_all_Org_part1=Domain_mapping_Prot_5_all_Org(1:1150000,:);
Domain_mapping_Prot_5_all_Org_part2=Domain_mapping_Prot_5_all_Org(1150001:2300000,:);
Domain_mapping_Prot_5_all_Org_part3=Domain_mapping_Prot_5_all_Org(2300001:end,:);
save DRUIDom_Files/Domain_mapping_Prot_5_all_Org_part1.mat Domain_mapping_Prot_5_all_Org_part1
save DRUIDom_Files/Domain_mapping_Prot_5_all_Org_part2.mat Domain_mapping_Prot_5_all_Org_part2
save DRUIDom_Files/Domain_mapping_Prot_5_all_Org_part3.mat Domain_mapping_Prot_5_all_Org_part3
% (filtering high score mappings)
Domain_mapping_Prot_5_all_MCC07=cell(0,9);
to=1;
for i=1:length(Combined_Org_id_unique_Prot_5)
disp(['Compound number: ' num2str(i), ' / ' num2str(length(Combined_Org_id_unique_Prot_5))])
ind_temp=find(Domain_mapping_Prot_5.MapScr{i,1}(:,9)>=0.7);
if isempty(ind_temp)==0
Domain_mapping_Prot_5_all_MCC07(to:(to+(length(ind_temp))-1),1)=cellstr(repmat(Domain_mapping_Prot_5.Compounds{i,1},length(ind_temp),1));
Domain_mapping_Prot_5_all_MCC07(to:(to+(length(ind_temp))-1),2)=Domain_mapping_Prot_5.Domains{i,1}(ind_temp,1);
Domain_mapping_Prot_5_all_MCC07(to:(to+(length(ind_temp))-1),3:11)=num2cell(Domain_mapping_Prot_5.MapScr{i,1}(ind_temp,1:9));
to=to+(length(ind_temp));
end
end
save DRUIDom_Files/Domain_mapping_Prot_5_all_MCC07.mat Domain_mapping_Prot_5_all_MCC07
length(unique(Domain_mapping_Prot_5_all_MCC07(:,1)))
length(unique(Domain_mapping_Prot_5_all_MCC07(:,2)))
Domain_mapping_Prot_5_all_Acc08=cell(0,9);
to=1;
for i=1:length(Combined_Org_id_unique_Prot_5)
disp(['Compound number: ' num2str(i), ' / ' num2str(length(Combined_Org_id_unique_Prot_5))])
ind_temp=find(Domain_mapping_Prot_5.MapScr{i,1}(:,7)>=0.8);
if isempty(ind_temp)==0
Domain_mapping_Prot_5_all_Acc08(to:(to+(length(ind_temp))-1),1)=cellstr(repmat(Domain_mapping_Prot_5.Compounds{i,1},length(ind_temp),1));
Domain_mapping_Prot_5_all_Acc08(to:(to+(length(ind_temp))-1),2)=Domain_mapping_Prot_5.Domains{i,1}(ind_temp,1);
Domain_mapping_Prot_5_all_Acc08(to:(to+(length(ind_temp))-1),3:11)=num2cell(Domain_mapping_Prot_5.MapScr{i,1}(ind_temp,1:9));
to=to+(length(ind_temp));
end
end
save DRUIDom_Files/Domain_mapping_Prot_5_all_Acc08.mat Domain_mapping_Prot_5_all_Acc08
length(unique(Domain_mapping_Prot_5_all_Acc08(:,1)))
length(unique(Domain_mapping_Prot_5_all_Acc08(:,2)))
Domain_mapping_Prot_5_all_F108=cell(0,9);
to=1;
for i=1:length(Combined_Org_id_unique_Prot_5)
disp(['Compound number: ' num2str(i), ' / ' num2str(length(Combined_Org_id_unique_Prot_5))])
ind_temp=find(Domain_mapping_Prot_5.MapScr{i,1}(:,8)>=0.8);
if isempty(ind_temp)==0
Domain_mapping_Prot_5_all_F108(to:(to+(length(ind_temp))-1),1)=cellstr(repmat(Domain_mapping_Prot_5.Compounds{i,1},length(ind_temp),1));
Domain_mapping_Prot_5_all_F108(to:(to+(length(ind_temp))-1),2)=Domain_mapping_Prot_5.Domains{i,1}(ind_temp,1);
Domain_mapping_Prot_5_all_F108(to:(to+(length(ind_temp))-1),3:11)=num2cell(Domain_mapping_Prot_5.MapScr{i,1}(ind_temp,1:9));
to=to+(length(ind_temp));
end
end
save DRUIDom_Files/Domain_mapping_Prot_5_all_F108.mat Domain_mapping_Prot_5_all_F108
length(unique(Domain_mapping_Prot_5_all_F108(:,1)))
length(unique(Domain_mapping_Prot_5_all_F108(:,2)))
% (according to the performance analysis at the end, multiple filters will be used: F1>=0.5, ACCU>=0.5, REC>=0.5, PRE>=0.5)
Domain_mapping_Prot_5_all_MulFil=cell(4000000,9);
to=1;
for i=1:length(Domain_mapping_Prot_5.Compounds)
disp(['Compound number: ' num2str(i), ' / ' num2str(length(Domain_mapping_Prot_5.Compounds))])
ind_temp=find(Domain_mapping_Prot_5.MapScr{i,1}(:,5)>=0.5 & Domain_mapping_Prot_5.MapScr{i,1}(:,6)>=0.5 & Domain_mapping_Prot_5.MapScr{i,1}(:,7)>=0.5 & Domain_mapping_Prot_5.MapScr{i,1}(:,8)>=0.5 & Domain_mapping_Prot_5.MapScr{i,1}(:,9)>=0);
if isempty(ind_temp)==0
Domain_mapping_Prot_5_all_MulFil(to:(to+(length(ind_temp))-1),1)=cellstr(repmat(Domain_mapping_Prot_5.Compounds{i,1},length(ind_temp),1));
Domain_mapping_Prot_5_all_MulFil(to:(to+(length(ind_temp))-1),2)=Domain_mapping_Prot_5.Domains{i,1}(ind_temp,1);
Domain_mapping_Prot_5_all_MulFil(to:(to+(length(ind_temp))-1),3:11)=num2cell(Domain_mapping_Prot_5.MapScr{i,1}(ind_temp,1:9));
to=to+(length(ind_temp));
end
end
del_ind=cellfun(@isempty,Domain_mapping_Prot_5_all_MulFil(:,1));
Domain_mapping_Prot_5_all_MulFil(del_ind,:)=[];
save DRUIDom_Files/Domain_mapping_Prot_5_all_MulFil.mat Domain_mapping_Prot_5_all_MulFil
length(unique(Domain_mapping_Prot_5_all_MulFil(:,1)))
length(unique(Domain_mapping_Prot_5_all_MulFil(:,2)))
% (manually analyzing the mappings generated by thresholding various performance metrics)
figure;hist(sort(cell2mat(Domain_mapping_Prot_5_all_F108(:,end)),'descend'),0:0.05:1)
figure;hist(sort(cell2mat(Domain_mapping_Prot_5_all_Acc08(:,end)),'descend'),0:0.05:1)
min(cell2mat(Domain_mapping_Prot_5_all_MCC07(:,7)))
min(cell2mat(Domain_mapping_Prot_5_all_MCC07(:,8)))
min(cell2mat(Domain_mapping_Prot_5_all_MCC07(:,9)))
min(cell2mat(Domain_mapping_Prot_5_all_MCC07(:,10)))
min(cell2mat(Domain_mapping_Prot_5_all_F108(:,9)))
Domain_mapping_Prot_5_all_Acc08(ismember(Domain_mapping_Prot_5_all_Acc08(:,2),'IPR000719')==1,:)
LIMK_kinasedom=Domain_mapping_Prot_5_all_MulFil(ismember(Domain_mapping_Prot_5_all_MulFil(:,2),'IPR000719')==1,:);
Domain_mapping_Prot_5_all_Acc08(ismember(Domain_mapping_Prot_5_all_Acc08(:,2),'IPR001478')==1,:)
Domain_mapping_Prot_5.MapScr{ismember(Domain_mapping_Prot_5.Compounds,'11223992')==1,1}(ismember(Domain_mapping_Prot_5.Domains{ismember(Domain_mapping_Prot_5.Compounds,'11223992')==1,1},'IPR039192')==1,:)
% Calculating the single compound (non-similarity based) single domain assocation scores for all compounds:
load DRUIDom_Files/Combined_Org_act_var.mat
load DRUIDom_Files/Combined_Org_inact_withact_var.mat
load DRUIDom_Files/Combined_Org_id_unique.mat
load DRUIDom_Files/Locations_act_inact.mat
% (generating the combined protein groups for each ligand)
parpool(4)
Combined_Org_unique_act_Prot_noSim=cell(length(Combined_Org_id_unique),1);
Combined_Org_unique_inact_withact_Prot_noSim=cell(length(Combined_Org_id_unique),1);
parfor i=1:length(Combined_Org_id_unique)
disp(['Compound number: ' num2str(i), ' / ' num2str(length(Combined_Org_id_unique))])
Combined_Org_thrSim_temp_ind=i;
Combined_Org_unique_act_Prot_noSim{i,1}=unique(Combined_Org_act(ismember(Locb_act,Combined_Org_thrSim_temp_ind)==1,1));
Combined_Org_unique_inact_withact_Prot_noSim{i,1}=unique(Combined_Org_inact_withact(ismember(Locb_inact,Combined_Org_thrSim_temp_ind)==1,1));
end
save DRUIDom_Files/Combined_Org_unique_act_Prot_noSim.mat Combined_Org_unique_act_Prot_noSim
save DRUIDom_Files/Combined_Org_unique_inact_withact_Prot_noSim.mat Combined_Org_unique_inact_withact_Prot_noSim
% (analyzing and thresholding the protein arrays)
Combined_Org_unique_Samplenum_act_inact_noSim_sup=zeros(length(Combined_Org_id_unique),3);
for i=1:length(Combined_Org_id_unique)
disp(['Compound number: ' num2str(i), ' / ' num2str(length(Combined_Org_id_unique))])
Combined_Org_unique_Samplenum_act_inact_noSim_sup(i,1)=length(Combined_Org_unique_act_Prot_noSim{i,1});
Combined_Org_unique_Samplenum_act_inact_noSim_sup(i,2)=length(Combined_Org_unique_inact_withact_Prot_noSim{i,1});
Combined_Org_unique_Samplenum_act_inact_noSim_sup(i,3)=(Combined_Org_unique_Samplenum_act_inact_noSim_sup(i,1)+Combined_Org_unique_Samplenum_act_inact_noSim_sup(i,2))/2;
end
save DRUIDom_Files/Combined_Org_unique_Samplenum_act_inact_noSim_sup.mat Combined_Org_unique_Samplenum_act_inact_noSim_sup
length(find(Combined_Org_unique_Samplenum_act_inact_noSim_sup(:,1)>=1))
length(find(Combined_Org_unique_Samplenum_act_inact_noSim_sup(:,2)>=1))
length(find(Combined_Org_unique_Samplenum_act_inact_noSim_sup(:,1)>=1 & Combined_Org_unique_Samplenum_act_inact_noSim_sup(:,2)>=1))
length(find(Combined_Org_unique_Samplenum_act_inact_noSim_sup(:,1)>=3))
length(find(Combined_Org_unique_Samplenum_act_inact_noSim_sup(:,2)>=3))
length(find(Combined_Org_unique_Samplenum_act_inact_noSim_sup(:,1)>=3 & Combined_Org_unique_Samplenum_act_inact_noSim_sup(:,2)>=3))
length(find(Combined_Org_unique_Samplenum_act_inact_noSim_sup(:,1)>=5))
length(find(Combined_Org_unique_Samplenum_act_inact_noSim_sup(:,2)>=5))
length(find(Combined_Org_unique_Samplenum_act_inact_noSim_sup(:,1)>=5 & Combined_Org_unique_Samplenum_act_inact_noSim_sup(:,2)>=5))
length(find(Combined_Org_unique_Samplenum_act_inact_noSim_sup(:,1)>=10))
length(find(Combined_Org_unique_Samplenum_act_inact_noSim_sup(:,2)>=10))
length(find(Combined_Org_unique_Samplenum_act_inact_noSim_sup(:,1)>=10 & Combined_Org_unique_Samplenum_act_inact_noSim_sup(:,2)>=10))
% (histograms of active and inactive distribution in the noSim dataset)
figure;
histogram(sort(2*Combined_Org_unique_Samplenum_act_inact_noSim_sup(:,3),'descend'),-0.5:1:(max(2*Combined_Org_unique_Samplenum_act_inact_noSim_sup(:,3))+0.5),'FaceAlpha',1)
set(gca,'YScale','log')
axis([0.5 250 0 1000000])
figure;
histogram(sort(Combined_Org_unique_Samplenum_act_inact_noSim_sup(:,1),'descend'),-0.5:1:(max(Combined_Org_unique_Samplenum_act_inact_noSim_sup(:,1))+0.5),'FaceColor',[0 0.7 0],'FaceAlpha',1)
set(gca,'YScale','log')
axis([0.5 250 0 1000000])
figure;
histogram(sort(Combined_Org_unique_Samplenum_act_inact_noSim_sup(:,2),'descend'),-0.5:1:(max(Combined_Org_unique_Samplenum_act_inact_noSim_sup(:,2))+0.5),'FaceColor',[0.8 0 0],'FaceAlpha',1)
set(gca,'YScale','log')
axis([0.5 250 0 1000000])
thr_act_samp=3;
thr_inact_samp=3;
Combined_Org_unique_Samplenum_act_inact_noSim_sup_3=Combined_Org_unique_Samplenum_act_inact_noSim_sup(Combined_Org_unique_Samplenum_act_inact_noSim_sup(:,1)>=thr_act_samp & Combined_Org_unique_Samplenum_act_inact_noSim_sup(:,2)>=thr_inact_samp,:);
Combined_Org_unique_act_Prot_noSim_3=Combined_Org_unique_act_Prot_noSim(Combined_Org_unique_Samplenum_act_inact_noSim_sup(:,1)>=thr_act_samp & Combined_Org_unique_Samplenum_act_inact_noSim_sup(:,2)>=thr_inact_samp,:);
Combined_Org_unique_inact_withact_Prot_noSim_3=Combined_Org_unique_inact_withact_Prot_noSim(Combined_Org_unique_Samplenum_act_inact_noSim_sup(:,1)>=thr_act_samp & Combined_Org_unique_Samplenum_act_inact_noSim_sup(:,2)>=thr_inact_samp,:);
Combined_Org_id_unique_Prot_noSim_3=Combined_Org_id_unique(Combined_Org_unique_Samplenum_act_inact_noSim_sup(:,1)>=thr_act_samp & Combined_Org_unique_Samplenum_act_inact_noSim_sup(:,2)>=thr_inact_samp,:);
save DRUIDom_Files/Combined_Org_unique_act_inact_Prot_noSim_3_var.mat Combined_Org_unique_Samplenum_act_inact_noSim_sup_3 Combined_Org_unique_act_Prot_noSim_3 Combined_Org_unique_inact_withact_Prot_noSim_3 Combined_Org_id_unique_Prot_noSim_3
% (calculating the single domain assocation scores for all compounds)
load DRUIDom_Files/Combined_Org_unique_act_inact_Prot_noSim_3_var.mat
load DRUIDom_Files/InterPro_v72_Dom_groups.mat
load DRUIDom_Files/InterPro_entriesmatched_onlytarget_Org_onlydom.mat
Domain_mapping_Prot_noSim_3.Compounds=Combined_Org_id_unique_Prot_noSim_3;
Domain_mapping_Prot_noSim_3.Domains=cell(length(Combined_Org_id_unique_Prot_noSim_3),1);
Domain_mapping_Prot_noSim_3.MapScr=cell(length(Combined_Org_id_unique_Prot_noSim_3),1);
for i=1:length(Combined_Org_id_unique_Prot_noSim_3)
disp(['Compound number: ' num2str(i), ' / ' num2str(length(Combined_Org_id_unique_Prot_noSim_3))])
Lia=ismember(InterPro_entriesmatched_onlytarget_Org_onlydom(:,1),Combined_Org_unique_act_Prot_noSim_3{i,1});
InterPro_entriesmatched_temp_act=InterPro_entriesmatched_onlytarget_Org_onlydom(Lia==1,:);
Dom_temp_act=unique(InterPro_entriesmatched_onlytarget_Org_onlydom(Lia==1,2));
Lia2=ismember(InterPro_entriesmatched_onlytarget_Org_onlydom(:,1),Combined_Org_unique_inact_withact_Prot_noSim_3{i,1});
InterPro_entriesmatched_temp_inact=InterPro_entriesmatched_onlytarget_Org_onlydom(Lia2==1,:);
clear TP FN FP TN
if isempty(Dom_temp_act)==0
for j=1:length(Dom_temp_act)
Lian=ismember(InterPro_v72_Dom_groups,Dom_temp_act{j,1});
Dom_temp_act_group=unique(InterPro_v72_Dom_groups(sum(Lian,2)>0,:));
Dom_temp_act_group(strncmp(Dom_temp_act_group(:,1),'X',1),:)=[];
Dom_temp_act_group(:,strncmp(Dom_temp_act_group(1,:),'X',1))=[];
Lia=ismember(InterPro_entriesmatched_temp_act(:,2),Dom_temp_act_group);
TP(j,1)=length(unique(InterPro_entriesmatched_temp_act(Lia==1,1)));
FN(j,1)=length(unique(Combined_Org_unique_act_Prot_noSim_3{i,1}))-TP(j,1);
Lia2=ismember(InterPro_entriesmatched_temp_inact(:,2),Dom_temp_act_group);
if sum(Lia2)~=0
FP(j,1)=length(unique(InterPro_entriesmatched_temp_inact(Lia2==1,1)));
else
FP(j,1)=0;
end
TN(j,1)=length(unique(Combined_Org_unique_inact_withact_Prot_noSim_3{i,1}))-FP(j,1);
end
REC=TP./(TP+FN);
PRE=TP./(TP+FP);
ACCU=(TP+TN)./(TP+TN+FP+FN);
F1=(2*TP)./(2*TP+FP+FN);
MCC=((TP.*TN)-(FP.*FN))./(((TP+FP).*(TP+FN).*(TN+FP).*(TN+FN)).^(1/2));
Domain_mapping_Prot_noSim_3.Domains{i,1}=Dom_temp_act;
Domain_mapping_Prot_noSim_3.MapScr{i,1}=[TP FN FP TN REC PRE ACCU F1 MCC];
end
end
save DRUIDom_Files/Domain_mapping_Prot_noSim_3.mat Domain_mapping_Prot_noSim_3
% (organizing all mappings)
Domain_mapping_Prot_noSim_3_all_Org=cell(5000000,9);
to=1;
for i=1:length(Combined_Org_id_unique_Prot_noSim_3)
disp(['Compound number: ' num2str(i), ' / ' num2str(length(Combined_Org_id_unique_Prot_noSim_3))])
len_temp=size(Domain_mapping_Prot_noSim_3.MapScr{i,1},1);
if len_temp~=0
Domain_mapping_Prot_noSim_3_all_Org(to:(to+(len_temp)-1),1)=cellstr(repmat(Domain_mapping_Prot_noSim_3.Compounds{i,1},len_temp,1));
Domain_mapping_Prot_noSim_3_all_Org(to:(to+(len_temp)-1),2)=Domain_mapping_Prot_noSim_3.Domains{i,1};
Domain_mapping_Prot_noSim_3_all_Org(to:(to+(len_temp)-1),3:11)=num2cell(Domain_mapping_Prot_noSim_3.MapScr{i,1});
to=to+(len_temp);
end
end
del_ind=cellfun(@isempty,Domain_mapping_Prot_noSim_3_all_Org(:,1));
Domain_mapping_Prot_noSim_3_all_Org(del_ind,:)=[];
length(unique(Domain_mapping_Prot_noSim_3_all_Org(:,1)))
length(unique(Domain_mapping_Prot_noSim_3_all_Org(:,2)))
t=Domain_mapping_Prot_noSim_3_all_Org';
fid=fopen('DRUIDom_Files/Domain_mapping_Prot_noSim_3_all_Org.txt','w');
fprintf(fid,'%s\t%s\t%d\t%d\t%d\t%d\t%.4f\t%.4f\t%.4f\t%.4f\t%.4f\n',t{:});
fclose(fid);
save DRUIDom_Files/Domain_mapping_Prot_noSim_3_all_Org.mat Domain_mapping_Prot_noSim_3_all_Org
% (raw domain mapping stats: 449,294 mappings)
fid=fopen('DRUIDom_raw_domain-compound_mappings.txt','w');
fprintf(fid,'%s\t%s\t%d\t%d\t%d\t%d\t%.4f\t%.4f\t%.4f\t%.4f\t%.4f\n',t{:});
fclose(fid);
% (filtering high score mappings, using the same filers are previously: MCC>=0, F1>=0.5, ACCU>=0.5, REC>=0.5, PRE>=0.5)
Domain_mapping_Prot_noSim_3_all_MulFil=cell(4000000,9);
to=1;
for i=1:length(Domain_mapping_Prot_noSim_3.Compounds)
disp(['Compound number: ' num2str(i), ' / ' num2str(length(Domain_mapping_Prot_noSim_3.Compounds))])
if isempty(Domain_mapping_Prot_noSim_3.MapScr{i,1})==0
ind_temp=find(Domain_mapping_Prot_noSim_3.MapScr{i,1}(:,5)>=0.5 & Domain_mapping_Prot_noSim_3.MapScr{i,1}(:,6)>=0.5 & Domain_mapping_Prot_noSim_3.MapScr{i,1}(:,7)>=0.5 & Domain_mapping_Prot_noSim_3.MapScr{i,1}(:,8)>=0.5 & Domain_mapping_Prot_noSim_3.MapScr{i,1}(:,9)>=0);
end
if isempty(ind_temp)==0
Domain_mapping_Prot_noSim_3_all_MulFil(to:(to+(length(ind_temp))-1),1)=cellstr(repmat(Domain_mapping_Prot_noSim_3.Compounds{i,1},length(ind_temp),1));
Domain_mapping_Prot_noSim_3_all_MulFil(to:(to+(length(ind_temp))-1),2)=Domain_mapping_Prot_noSim_3.Domains{i,1}(ind_temp,1);
Domain_mapping_Prot_noSim_3_all_MulFil(to:(to+(length(ind_temp))-1),3:11)=num2cell(Domain_mapping_Prot_noSim_3.MapScr{i,1}(ind_temp,1:9));
to=to+(length(ind_temp));
end
ind_temp=[];
end
del_ind=cellfun(@isempty,Domain_mapping_Prot_noSim_3_all_MulFil(:,1));
Domain_mapping_Prot_noSim_3_all_MulFil(del_ind,:)=[];
save DRUIDom_Files/Domain_mapping_Prot_noSim_3_all_MulFil.mat Domain_mapping_Prot_noSim_3_all_MulFil
length(Domain_mapping_Prot_noSim_3_all_MulFil)
length(unique(Domain_mapping_Prot_noSim_3_all_MulFil(:,1)))
length(unique(Domain_mapping_Prot_noSim_3_all_MulFil(:,2)))
% Merging compound similarity based domain associations with noSim associations:
load DRUIDom_Files/Domain_mapping_Prot_5_all_MulFil.mat
load DRUIDom_Files/Domain_mapping_Prot_noSim_3_all_MulFil.mat
% (extracting mutual associations and selecting maximum performance according to MCC for merging)
Domain_mapping_Prot_5_all_MulFil_23=strcat(Domain_mapping_Prot_5_all_MulFil(:,1), {' '}, Domain_mapping_Prot_5_all_MulFil(:,2));
Domain_mapping_Prot_noSim_3_all_MulFil_23=strcat(Domain_mapping_Prot_noSim_3_all_MulFil(:,1), {' '}, Domain_mapping_Prot_noSim_3_all_MulFil(:,2));
[~,I1,I2]=intersect(Domain_mapping_Prot_5_all_MulFil_23,Domain_mapping_Prot_noSim_3_all_MulFil_23);
C1=(cell2mat(Domain_mapping_Prot_5_all_MulFil(I1,end))>cell2mat(Domain_mapping_Prot_noSim_3_all_MulFil(I2,end)));
mer1=Domain_mapping_Prot_5_all_MulFil(I1(C1==1),:);
mer2=Domain_mapping_Prot_noSim_3_all_MulFil(I2(C1==0),:);
I1inv=setdiff((1:length(Domain_mapping_Prot_5_all_MulFil)),I1)';
I2inv=setdiff((1:length(Domain_mapping_Prot_noSim_3_all_MulFil)),I2)';
% (saving the merged and filtered domain accosiation file)
Domain_mapping_Prot_Sim5_noSim3_MulFil_merged=[Domain_mapping_Prot_5_all_MulFil(I1inv,:);Domain_mapping_Prot_noSim_3_all_MulFil(I2inv,:);mer1;mer2];
save DRUIDom_Files/Domain_mapping_Prot_Sim5_noSim3_MulFil_merged.mat Domain_mapping_Prot_Sim5_noSim3_MulFil_merged
t=Domain_mapping_Prot_Sim5_noSim3_MulFil_merged';
fid=fopen('DRUIDom_Files/Domain_mapping_Prot_Sim5_noSim3_MulFil_merged_finalized.txt','w');
fprintf(fid,'%s\t%s\t%d\t%d\t%d\t%d\t%.4f\t%.4f\t%.4f\t%.4f\t%.4f\n',t{:});
fclose(fid);
length(Domain_mapping_Prot_Sim5_noSim3_MulFil_merged)
length(unique(Domain_mapping_Prot_Sim5_noSim3_MulFil_merged(:,1)))
length(unique(Domain_mapping_Prot_Sim5_noSim3_MulFil_merged(:,2)))
% (finalized domain mapping stats: 27,032 mappings between 8,165 compounds and 250 InterPro domains)
fid=fopen('DRUIDom_domain-compound_mappings_finalized.txt','w');
fprintf(fid,'%s\t%s\t%d\t%d\t%d\t%d\t%.4f\t%.4f\t%.4f\t%.4f\t%.4f\n',t{:});
fclose(fid);
% Associating compounds with domain pairs (where it performs better
% compared to mappings to single domains in the corresponding pairs):
% (generating an array for InterPro entry pairs in the same hierarchy, so that these pairs can be subtracted from all domain pairs since these pairs are not 2 domains hits but 2 related entries hit to the same position)
load DRUIDom_Files/InterPro_v72_Dom_groups.mat
InterPro_domain_relation_pairs=cell(0,1);
to=1;
for i=1:length(InterPro_v72_Dom_groups)
if isequal(InterPro_v72_Dom_groups{i,2},'X')~=1
temp=InterPro_v72_Dom_groups(i,ismember(InterPro_v72_Dom_groups(i,:),({'X'}))==0);
n=length(temp);
a=fliplr(fullfact([n n]));
a(~diff(a')',:)=[];
temp_pair=temp(a);
x=strcat(temp_pair(:,1), {'-'}, temp_pair(:,2));
InterPro_domain_relation_pairs(to:(to+(size(x,1))-1),1)=x;
to=to+(size(x,1));
end
end
InterPro_domain_relation_pairs=unique(InterPro_domain_relation_pairs);