-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
WM.frm
1759 lines (1428 loc) · 54.9 KB
/
WM.frm
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
VERSION 5.00
Begin VB.Form Form1
Caption = "Demo - motif detection"
ClientHeight = 11265
ClientLeft = 5880
ClientTop = 1950
ClientWidth = 17580
LinkTopic = "Form1"
Picture = "WM.frx":0000
ScaleHeight = 751
ScaleMode = 3 'Pixel
ScaleWidth = 1172
StartUpPosition = 2 'CenterScreen
Begin VB.CheckBox y_axis
Caption = "Reverse axis"
Height = 350
Left = 9840
TabIndex = 46
Top = 0
Width = 1215
End
Begin VB.Frame MatrixXYZ
Caption = "General information"
Height = 5055
Left = 4920
TabIndex = 9
Top = 5280
Width = 7215
Begin VB.CommandButton ShowVariants
Caption = "Text matrix"
Height = 375
Index = 0
Left = 240
TabIndex = 27
Top = 360
Width = 1335
End
Begin VB.CommandButton ShowVariants
Caption = "Count matrix"
Height = 375
Index = 1
Left = 1560
TabIndex = 26
ToolTipText = "Position Frequency Matrix (PFM)"
Top = 360
Width = 1335
End
Begin VB.CommandButton ShowVariants
Caption = "Weight matrix"
Height = 375
Index = 2
Left = 2880
TabIndex = 25
ToolTipText = "Position Probability Matrix (PPM)"
Top = 360
Width = 1335
End
Begin VB.CommandButton ShowVariants
Caption = "LogRatio matrix"
Height = 375
Index = 3
Left = 4200
TabIndex = 24
ToolTipText = " Position Weight Matrix (PWM)"
Top = 360
Width = 1575
End
Begin VB.CommandButton ShowVariants
Caption = "Info"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Index = 4
Left = 5760
TabIndex = 23
Top = 360
Width = 1215
End
Begin VB.PictureBox IF_holder
Appearance = 0 'Flat
AutoRedraw = -1 'True
ForeColor = &H80000008&
Height = 4215
Left = 240
ScaleHeight = 279
ScaleMode = 3 'Pixel
ScaleWidth = 447
TabIndex = 22
Top = 720
Width = 6735
Begin VB.PictureBox NPSet
Appearance = 0 'Flat
AutoRedraw = -1 'True
BackColor = &H80000005&
ForeColor = &H80000008&
Height = 1575
Left = 5040
Picture = "WM.frx":0446
ScaleHeight = 103
ScaleMode = 3 'Pixel
ScaleWidth = 95
TabIndex = 42
Top = 120
Visible = 0 'False
Width = 1455
End
Begin VB.PictureBox FreqPanel
Appearance = 0 'Flat
AutoRedraw = -1 'True
BackColor = &H80000005&
ForeColor = &H80000008&
Height = 2175
Left = 240
ScaleHeight = 143
ScaleMode = 3 'Pixel
ScaleWidth = 415
TabIndex = 34
Top = 1800
Width = 6255
End
Begin VB.Line Line2
BorderColor = &H00C0C0C0&
X1 = 16
X2 = 416
Y1 = 64
Y2 = 64
End
Begin VB.Label w_pos
BackStyle = 0 'Transparent
Caption = "..."
BeginProperty Font
Name = "Lucida Console"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00808080&
Height = 375
Left = 240
TabIndex = 43
Top = 600
Width = 6255
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "Unordered Sequence Logo:"
BeginProperty Font
Name = "Lucida Console"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00808080&
Height = 375
Left = 240
TabIndex = 36
Top = 1440
Width = 6255
End
End
Begin VB.PictureBox MP_holder
AutoRedraw = -1 'True
BackColor = &H00FFFFFF&
Height = 4215
Left = 240
ScaleHeight = 277
ScaleMode = 3 'Pixel
ScaleWidth = 445
TabIndex = 20
Top = 720
Visible = 0 'False
Width = 6735
Begin VB.CheckBox Fallow_M
BackColor = &H00FFFFFF&
Caption = "Fallow Matrix !"
Height = 375
Left = 600
TabIndex = 32
Top = 3120
Value = 1 'Checked
Width = 1935
End
Begin VB.TextBox Mlog
Appearance = 0 'Flat
BackColor = &H00C0FFC0&
Height = 285
Index = 0
Left = 5760
TabIndex = 21
Text = "0"
Top = 120
Visible = 0 'False
Width = 495
End
End
Begin VB.PictureBox MW_holder
AutoRedraw = -1 'True
BackColor = &H00FFFFFF&
Height = 4215
Left = 240
ScaleHeight = 277
ScaleMode = 3 'Pixel
ScaleWidth = 445
TabIndex = 18
Top = 720
Visible = 0 'False
Width = 6735
Begin VB.CheckBox FollowWM
BackColor = &H00FFFFFF&
Caption = "Follow Weight Matrix"
Height = 255
Left = 480
TabIndex = 33
Top = 3120
Value = 1 'Checked
Width = 2055
End
Begin VB.TextBox Mwght
Appearance = 0 'Flat
BackColor = &H00C0FFFF&
Height = 285
Index = 0
Left = 5760
TabIndex = 19
Text = "0"
Top = 120
Visible = 0 'False
Width = 495
End
End
Begin VB.PictureBox MV_holder
AutoRedraw = -1 'True
BackColor = &H00FFFFFF&
Height = 4215
Left = 240
ScaleHeight = 277
ScaleMode = 3 'Pixel
ScaleWidth = 445
TabIndex = 16
Top = 720
Visible = 0 'False
Width = 6735
Begin VB.TextBox Mval
Appearance = 0 'Flat
BackColor = &H00C0E0FF&
Height = 285
Index = 0
Left = 5760
TabIndex = 17
Text = "0"
Top = 120
Visible = 0 'False
Width = 495
End
End
Begin VB.PictureBox MT_holder
AutoRedraw = -1 'True
BackColor = &H00FFFFFF&
Height = 4215
Left = 240
ScaleHeight = 277
ScaleMode = 3 'Pixel
ScaleWidth = 445
TabIndex = 14
Top = 720
Visible = 0 'False
Width = 6735
Begin VB.TextBox MTxt
Appearance = 0 'Flat
BackColor = &H00C0C0FF&
Height = 285
Index = 0
Left = 5760
TabIndex = 15
Text = "0"
Top = 120
Visible = 0 'False
Width = 495
End
End
End
Begin VB.Frame Frame2
Caption = "Parameters"
Height = 5055
Left = 12360
TabIndex = 6
Top = 5280
Width = 5055
Begin VB.Frame Frame5
Caption = "Make score values from:"
Height = 2415
Left = 240
TabIndex = 28
Top = 2400
Width = 4575
Begin VB.CheckBox LR_DANU
Caption = "Use the values from Position Weight Matrix (PWM)"
Height = 375
Index = 0
Left = 240
TabIndex = 31
ToolTipText = "sum from the LogRatio matrix ..."
Top = 480
Value = 1 'Checked
Width = 4215
End
Begin VB.CommandButton Scann
Caption = "Scan for motif"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 240
TabIndex = 30
Top = 1560
Width = 4095
End
Begin VB.CheckBox LR_DANU
Caption = "Use the values from Position Probability Matrix (PPM)"
Height = 375
Index = 1
Left = 240
TabIndex = 29
ToolTipText = "sum from the Weight matrix ..."
Top = 960
Width = 4215
End
End
Begin VB.Frame Frame3
Caption = "Zoom on signal"
Height = 1455
Left = 240
TabIndex = 10
Top = 720
Width = 4575
Begin VB.OptionButton ZSO
Caption = "Zoom signal"
Height = 255
Left = 240
TabIndex = 13
Top = 360
Value = -1 'True
Width = 1215
End
Begin VB.OptionButton SLO
Caption = "Signal level (with follow matrix option)"
Height = 255
Left = 240
TabIndex = 12
Top = 840
Width = 3975
End
Begin VB.HScrollBar Zoom_Scale
Height = 255
Left = 1560
Max = 200
Min = 4
TabIndex = 11
Top = 360
Value = 30
Width = 2895
End
End
Begin VB.Timer RealTime
Interval = 100
Left = 4440
Top = 240
End
Begin VB.TextBox Lungime_fereastra
Enabled = 0 'False
Height = 285
Left = 3000
TabIndex = 7
Text = "30"
Top = 360
Width = 615
End
Begin VB.Label Label2
Alignment = 1 'Right Justify
BackStyle = 0 'Transparent
Caption = "Sliding window length:"
Height = 255
Left = 960
TabIndex = 8
Top = 360
Width = 1935
End
End
Begin VB.Frame Frame1
Caption = "The motif set (input)"
Height = 5055
Left = 240
TabIndex = 3
Top = 5280
Width = 4455
Begin VB.OptionButton Val_Z
Caption = "Initialize PFM with zero values"
Height = 255
Left = 240
TabIndex = 45
ToolTipText = "Position Frequency Matrix (PFM), also known as the count matrix"
Top = 3840
Value = -1 'True
Width = 3975
End
Begin VB.OptionButton Val_P
Caption = "Initialize PFM with pseudocounts (0.000001)"
Height = 255
Left = 240
TabIndex = 44
ToolTipText = "Position Frequency Matrix (PFM), also known as the count matrix"
Top = 3480
Width = 3975
End
Begin VB.TextBox WMatrix
BeginProperty Font
Name = "Courier New"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 2895
Left = 240
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 5
Text = "WM.frx":2C78
Top = 360
Width = 3975
End
Begin VB.CommandButton Make_Matrix
Caption = "Make Position weight matrix (PWM)"
Height = 615
Left = 240
TabIndex = 4
Top = 4200
Width = 3975
End
End
Begin VB.PictureBox Center_patt
AutoRedraw = -1 'True
BackColor = &H00FFFFFF&
Height = 4695
Left = 12360
ScaleHeight = 309
ScaleMode = 3 'Pixel
ScaleWidth = 333
TabIndex = 2
Top = 360
Width = 5055
Begin VB.Line Line10
BorderStyle = 3 'Dot
X1 = 168
X2 = 168
Y1 = 0
Y2 = 312
End
Begin VB.Line Line9
BorderStyle = 3 'Dot
X1 = 336
X2 = -8
Y1 = 152
Y2 = 152
End
End
Begin VB.PictureBox Picture1
AutoRedraw = -1 'True
BackColor = &H00FFFFFF&
Height = 2415
Left = 240
ScaleHeight = 157
ScaleMode = 3 'Pixel
ScaleWidth = 717
TabIndex = 1
Top = 360
Width = 10815
Begin VB.Label down_label
BackStyle = 0 'Transparent
Caption = "Different from the motif set (red)"
BeginProperty Font
Name = "Lucida Console"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 120
TabIndex = 39
Top = 2040
Width = 5175
End
Begin VB.Label up_label
BackStyle = 0 'Transparent
Caption = "Like the motif set (blue)"
BeginProperty Font
Name = "Lucida Console"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 120
TabIndex = 38
Top = 120
Width = 4455
End
Begin VB.Line Zero
BorderColor = &H00404040&
X1 = 0
X2 = 728
Y1 = 80
Y2 = 80
End
Begin VB.Shape Window_Shape
BorderColor = &H00808080&
Height = 4095
Left = 0
Top = 0
Visible = 0 'False
Width = 15
End
End
Begin VB.TextBox secventata
Height = 2055
Left = 240
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 0
Text = "WM.frx":2CE7
Top = 3120
Width = 11895
End
Begin VB.Line Line6
X1 = 744
X2 = 744
Y1 = 176
Y2 = 192
End
Begin VB.Line Line5
X1 = 744
X2 = 744
Y1 = 16
Y2 = 32
End
Begin VB.Line Line4
X1 = 744
X2 = 720
Y1 = 24
Y2 = 24
End
Begin VB.Line Line3
X1 = 744
X2 = 720
Y1 = 184
Y2 = 184
End
Begin VB.Label down_val
BackStyle = 0 'Transparent
Caption = "0"
BeginProperty Font
Name = "Lucida Console"
Size = 11.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 11280
TabIndex = 48
Top = 2640
Width = 855
End
Begin VB.Label up_val
BackStyle = 0 'Transparent
Caption = "0"
BeginProperty Font
Name = "Lucida Console"
Size = 11.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 11280
TabIndex = 47
Top = 240
Width = 855
End
Begin VB.Image Image1
Height = 720
Left = -7680
Picture = "WM.frx":343C
Top = 10560
Width = 25290
End
Begin VB.Label Label8
BackStyle = 0 'Transparent
Caption = "Zoom into the signal using the sliding window length:"
Height = 255
Left = 12360
TabIndex = 41
Top = 120
Width = 4815
End
Begin VB.Label Label7
BackStyle = 0 'Transparent
Caption = "The main signal over the entire sequence:"
Height = 255
Left = 240
TabIndex = 40
Top = 120
Width = 5415
End
Begin VB.Label Label4
Caption = "0"
BeginProperty Font
Name = "Lucida Console"
Size = 11.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 11280
TabIndex = 37
Top = 1440
Width = 135
End
Begin VB.Line Line1
X1 = 728
X2 = 744
Y1 = 104
Y2 = 104
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "Find motif in sequence:"
Height = 255
Left = 240
TabIndex = 35
Top = 2880
Width = 4935
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
' ________________________________ ____________________
' / Demo - motif detection \________________________/ v1.00 |
' | |
' | Name: Demo - motif detection V1.0 |
' | Category: Open source software |
' | Author: Paul A. Gagniuc |
' | Book: Algorithms in Bioinformatics: Theory and Implementation |
' | Email: paul_gagniuc@acad.ro |
' | ____________________________________________________________________________ |
' | |
' | Date Created: January 2014 |
' | Update: August 2021 |
' | Tested On: WinXP, WinVista, Win7, Win8, Win10 |
' | Use: Analysis of splice sites |
' | |
' | _____________________________ |
' |_________________/ \_______________________________|
'
Dim M() As String 'stores the rows for Matrix ()
Dim Weight() As String 'proportions
Dim Matrix() As String 'matrix of nucleotides
Dim Matrix_Val() As String 'no of A and T and C and G in cols of Matrix()
Dim Weight_Max() As String 'order by max values
Dim MLogRatio() As String 'Log weight
'######################
Dim MX_pos As Variant
Dim MY_pos As Variant
Dim space_x As Integer
Dim space_y As Integer
'######################
Dim Interface_on As Boolean
Dim select_start_reminder As Integer
Private Sub Form_Load()
Interface_on = False
'##################
MX_pos = 20
MY_pos = 25
space_x = 3
space_y = 3
'##################
secventata.Text = Replace(secventata.Text, Chr(10), "")
secventata.Text = Replace(secventata.Text, Chr(13), "")
'X
Line9.X1 = 0
Line9.X2 = Center_patt.ScaleWidth
Line9.Y1 = (Center_patt.ScaleHeight / 2)
Line9.Y2 = (Center_patt.ScaleHeight / 2)
Line9.Visible = True
'Y
Line10.X1 = (Center_patt.ScaleWidth / 2)
Line10.X2 = (Center_patt.ScaleWidth / 2)
Line10.Y1 = 0
Line10.Y2 = Center_patt.ScaleWidth
Line10.Visible = True
Line1.Y1 = Picture1.Top + (Picture1.ScaleHeight / 2) + 2
Line1.Y2 = Line1.Y1
Zero.Y1 = (Picture1.ScaleHeight / 2)
Zero.Y2 = Zero.Y1
Label4.Top = Line1.Y1 - (Label4.Height / 2) + 3
'Make_Matrix_Click
DoEvents
Scann_Click
End Sub
Private Sub LR_DANU_MouseUp(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
For i = 0 To LR_DANU.UBound
LR_DANU(i).Value = 0
Next i
LR_DANU(Index).Value = 1
Scann_Click
DoEvents
ShowVariants_Click (4)
End Sub
'##########################################################################
'##########################################################################
'##########################################################################
Private Sub Make_Matrix_Click()
'Format textbox in case of bad input
'--------------------------------------------------------------------------
If Len(WMatrix.Text) < 3 Then Exit Sub
WMatrix.Text = UCase(WMatrix.Text)
WMatrix.Text = Replace(WMatrix.Text, vbCrLf & vbCrLf, vbCrLf)
Dim ttmp() As String
ttmp() = Split(WMatrix.Text, vbCrLf)
If (ttmp(UBound(ttmp())) > "") Then WMatrix.Text = WMatrix.Text & vbCrLf
s = WMatrix.Text
t = (Len(s) - Len(Replace(s, vbCrLf, ""))) / 2 '[vbcrlf represents two chr]
Frame1.Caption = "The motif set (input): " & t & " motifs"
'--------------------------------------------------------------------------
M() = Split(WMatrix.Text, vbCrLf)
Rows = UBound(M()) - 1
cols = Len(M(0)) - 1
'------ Matrix(n,n) umplut cu caractere -----------------------------------
ReDim Matrix(0 To Rows, 0 To cols) As String
For i = 0 To Rows
For j = 0 To cols
Matrix(i, j) = Mid(M(i), j + 1, 1)
'MsgBox "Matrix(" & i & "|" & j & ")" & Mid(M(i), j + 1, 1)
Next j
Next i
'--------------------------------------------------------------------------
'------ Matrix_Val(n,4) umplut cu valori ----------------------------------
Dim Xb(0 To 3) As String
ReDim Matrix_Val(0 To 3, 0 To cols) As String
For j = 0 To cols
For e = 0 To 3
If Val_Z.Value = True Then Xb(e) = 0
If Val_P.Value = True Then Xb(e) = 0.000001
Next e
For i = 0 To Rows
n = Matrix(i, j)
If n = "A" Then Xb(0) = Xb(0) + 1
If n = "C" Then Xb(1) = Xb(1) + 1
If n = "G" Then Xb(2) = Xb(2) + 1
If n = "T" Then Xb(3) = Xb(3) + 1
Next i
For v = 0 To 3
Matrix_Val(v, j) = Xb(v)
'MsgBox "col = " & j & vbCrLf & "v= " & Xb(v)
Next v
Next j
'--------------------------------------------------------------------------
'------ Weight Matrix (0 to 1 values for each nucleotide in the row) ------
ReDim Weight(0 To cols, 0 To 3) As String
Dim nx(0 To 3) As String
For j = 0 To cols
For v = 0 To 3
nx(v) = Val(Matrix_Val(v, j))
Next v
For v = 0 To 3
'Weight(j, v) = (1 / (Val(nx(0)) + Val(nx(1)) + Val(nx(2)) + Val(nx(3)))) * Val(Matrix_Val(v, j))
If Val_Z.Value = True Then Weight(j, v) = Round(Val(Matrix_Val(v, j)) / (Rows + 1), 1)
If Val_P.Value = True Then Weight(j, v) = Val(Matrix_Val(v, j)) / (Rows + 1)
'----------------------
'If v = 0 Then X = "A"
'If v = 1 Then X = "C"
'If v = 2 Then X = "G"
'If v = 3 Then X = "T"
'MsgBox "col = " & j & vbCrLf & "v= " & X & vbCrLf & Matrix_Val(v, j) & vbCrLf & Weight(j, v)
'---------------------
Next v
Next j
'--------------------------------------------------------------------------
'------ MLogRatio (Log ratio = N/0.25) ------------------------------------
ReDim MLogRatio(0 To cols, 0 To 3) As String
Dim nl(0 To 3) As String
For j = 0 To cols
For v = 0 To 3
If Val(Weight(j, v)) = 0 Then
MLogRatio(j, v) = 0
Else
MLogRatio(j, v) = Round(Log(Val(Weight(j, v)) / 0.25), 3)
End If
'----------------------
'If v = 0 Then X = "A"
'If v = 1 Then X = "C"
'If v = 2 Then X = "G"
'If v = 3 Then X = "T"
'MsgBox "col = " & j & vbCrLf & "v= " & X & vbCrLf & vbCrLf & MLogRatio(j, v)
'---------------------
Next v
Next j
'--------------------------------------------------------------------------
Call FreqNuc(Len(M(0)))
ShowVariants_Click (4)
End Sub
Function FreqNuc(ByVal cols As Integer)
Dim aY(0 To 3) As Integer
xBuc = FreqPanel.ScaleWidth / cols
ybuc = FreqPanel.ScaleHeight / 100
For i = 1 To cols
plus = 0
For j = 0 To 3
If j = 0 Then
sX = 0
sY = 0
sW = 46
sH = 47
xColor = vbGreen 'A
End If
If j = 1 Then
sX = 46
sY = 0
sW = 41
sH = 47
xColor = vbRed 'C
End If
If j = 2 Then
sX = 43
sY = 49
sW = 44
sH = 49
xColor = vbBlue 'G
End If
If j = 3 Then
sX = 4
sY = 50
sW = 38
sH = 47
xColor = vbYellow 'T
End If
aY(j) = Val(Weight(i - 1, j)) * 100 'Nx4 (Weight(0 To Cols, 0 To 3))
'FreqPanel.Line (xBuc * oldi, plus)-(xBuc * i, plus + (ybuc * aY(j))), xColor, BF
pX = xBuc * oldi
pY = plus
pWith = xBuc
pHeight = (ybuc * aY(j)) + 1
FreqPanel.PaintPicture NPSet.Picture, pX, pY, pWith, pHeight, sX, sY, sW, sH, vbSrcCopy
plus = plus + (ybuc * aY(j))
'Debug.Print aY(j)
Next j
oldi = i
Next i
End Function
'Public Function SortArray(ByRef TheArray As Variant)
'Sorted = False
'Do While Not Sorted
' Sorted = True
'For X = 0 To UBound(TheArray) - 1
' If TheArray(X) > TheArray(X + 1) Then
' Temp = TheArray(X + 1)
' TheArray(X + 1) = TheArray(X)
' TheArray(X) = Temp