-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathestimate_properties_o.py
1510 lines (1247 loc) · 53.5 KB
/
estimate_properties_o.py
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
# -*- coding: utf-8 -*
from __future__ import unicode_literals
import numpy as np
import argparse, os
import sys
import MDAnalysis
from joblib import Parallel, delayed
import multiprocessing
## not displying the plots
import matplotlib as mpl
mpl.use('Agg')
## for font size adoption
from matplotlib import rc
rc('font',**{'family':'sans-serif','sans-serif':['Avant Garde']})
font = {'family' : 'normal',
#'weight' : 'bold',
'size' : 20}
rc('font', **font)
#rc('text', usetex=True)
leg = {'fontsize': 18}#,
#'legend.handlelength': 2}
rc('legend', **leg)
import matplotlib.patches as mpatches
import matplotlib.pyplot as plt
from matplotlib import colors
from matplotlib.colors import LogNorm
#import matplotlib.mlab as mlab
def getAbsCoordinates(xyz):
_xyzAbs = np.zeros([ xyz.shape[0]+1, xyz.shape[1] ])
# number of residues
nACE = 1
nALA = 15
nNME = 1
ACEleng = 6
ALAleng = 10
NMEleng = 6
# go through every residue
aACE = np.zeros([nACE*ACEleng,3])
aALA = np.zeros([nALA*ALAleng,3])
aNME = np.zeros([nNME*NMEleng,3])
# 1HH3 = CH3 + (1HH3 - CH3)
aACE[0,:] = xyz[0,:]
# CH3 = 0
#aACE[1,:] = 0
# 2HH3 = CH3 + (2HH3 - CH3)
aACE[2,:] = xyz[1,:]
# 3HH3 = CH3 + (3HH3 - CH3)
aACE[3,:] = xyz[2,:]
# C = CH3 + (C - CH3)
aACE[4,:] = xyz[3,:]
# O = C + (O - C)
aACE[5,:] = aACE[4,:] + xyz[4,:]
# first N coordinate
aALA[0,:] = aACE[4,:] + xyz[5,:]
for iALA in range(0,nALA):
# N = C + (N - C)
if iALA > 0:
aALA[iALA*ALAleng + 0,:] = aALA[ iALA*ALAleng - 2, : ] + xyz[ ACEleng + iALA*ALAleng - 1,:]
# H = N + (H - N)
aALA[iALA*ALAleng + 1,:] = aALA[ iALA*ALAleng + 0, : ] + xyz[ ACEleng + iALA*ALAleng + 0,:]
# CA = N + (CA - N)
aALA[iALA*ALAleng + 2,:] = aALA[ iALA*ALAleng + 0, : ] + xyz[ ACEleng + iALA*ALAleng + 1,:]
# HA = CA + (HA - CA)
aALA[iALA*ALAleng + 3,:] = aALA[ iALA*ALAleng + 2, : ] + xyz[ ACEleng + iALA*ALAleng + 2,:]
# CB = CA + (CB - CA)
aALA[iALA*ALAleng + 4,:] = aALA[ iALA*ALAleng + 2, : ] + xyz[ ACEleng + iALA*ALAleng + 3,:]
# HB1 = CB + (HB1 - CB)
aALA[iALA*ALAleng + 5,:] = aALA[ iALA*ALAleng + 4, : ] + xyz[ ACEleng + iALA*ALAleng + 4,:]
# HB2 = CB + (HB2 - CB)
aALA[iALA*ALAleng + 6,:] = aALA[ iALA*ALAleng + 4, : ] + xyz[ ACEleng + iALA*ALAleng + 5,:]
# HB3 = CB + (HB3 - CB)
aALA[iALA*ALAleng + 7,:] = aALA[ iALA*ALAleng + 4, : ] + xyz[ ACEleng + iALA*ALAleng + 6,:]
# C = CA + (C - CA)
aALA[iALA*ALAleng + 8,:] = aALA[ iALA*ALAleng + 2, : ] + xyz[ ACEleng + iALA*ALAleng + 7,:]
# O = C + (O - C)
aALA[iALA*ALAleng + 9,:] = aALA[ iALA*ALAleng + 8, : ] + xyz[ ACEleng + iALA*ALAleng + 8,:]
# Last part
# N = C + (N - C)
aNME[0 , :] = aALA[nALA*ALAleng - 2,:] + xyz[ ACEleng + nALA*ALAleng - 1,:]
# H = N + (H - N)
aNME[1 , :] = aNME[0,:] + xyz[ ACEleng + nALA*ALAleng + 0,:]
# CH3 = N + (CH3 - N)
aNME[2 , :] = aNME[0,:] + xyz[ ACEleng + nALA*ALAleng + 1,:]
# 1HH3 = CH3 + (1HH3 - CH3)
aNME[3 , :] = aNME[2,:] + xyz[ ACEleng + nALA*ALAleng + 2,:]
# 2HH3 = CH3 + (2HH3 - CH3)
aNME[4 , :] = aNME[2,:] + xyz[ ACEleng + nALA*ALAleng + 3,:]
# 3HH3 = CH3 + (2HH3 - CH3)
aNME[5 , :] = aNME[2,:] + xyz[ ACEleng + nALA*ALAleng + 4,:]
_xyzAbs[0:(ACEleng),:] = aACE
_xyzAbs[ACEleng:(ACEleng+nALA*ALAleng),:] = aALA
_xyzAbs[(ACEleng+nALA*ALAleng):,:] = aNME
return _xyzAbs
def getCartesian(rphitheta):
rphithetaShape = rphitheta.shape
#print rphithetaShape
_xyz = np.zeros(rphithetaShape)
_xyz[:,0] = rphitheta[:,0]*np.cos(rphitheta[:,2])*np.sin(rphitheta[:,1])
_xyz[:,1] = rphitheta[:,0]*np.sin(rphitheta[:,2])*np.sin(rphitheta[:,1])
_xyz[:,2] = rphitheta[:,0]*np.cos(rphitheta[:,1])
xyzAbs = getAbsCoordinates(xyz=_xyz)
return xyzAbs
def printList():
print txtList
print xtcList
print rmsdList
print ramaList
print gyrateList
print plotSuffixList
def updateList():
if bReadPredFileDirect:
txtList.append(predFile)
txtListW.append(predFileW)
txtListX.append(predFileX)
xtcList.append(xtcFile)
rmsdList.append(sPredPath + 'rmsd_' + sFileNamePred + '.xvg')
ramaList.append(sPredPath + 'rama_' + sFileNamePred + '.xvg')
gyrateList.append(sPredPath + 'gyrate_' + sFileNamePred + '.xvg')
plotSuffixList.append('_' + sFileNamePred)
else:
txtList.append(predFile)
txtListW.append(predFileW)
txtListX.append(predFileX)
xtcList.append(xtcFile)
rmsdList.append(workingDir+'rmsd_iter_'+str(iteration)+'.xvg')
ramaList.append(workingDir+'rama_iter_'+str(iteration)+'.xvg')
gyrateList.append(workingDir+'gyrate_iter_'+str(iteration)+'.xvg')
plotSuffixList.append('_' + str(iteration) )
def updateListPost():
txtList.append(predFile)
xtcList.append(xtcFile)
rmsdList.append(workingDir+'rmsd_iter_'+str(iteration)+'_postS_'+str(postS)+'.xvg')
ramaList.append(workingDir+'rama_iter_'+str(iteration)+'_postS_'+str(postS)+'.xvg')
gyrateList.append(workingDir+'gyrate_iter_'+str(iteration)+'_postS_'+str(postS)+'.xvg')
plotSuffixList.append('_' + str(iteration) + '_postS_' + str(postS) )
def updateListPostFlex(_midNameExtention):
if bReadPredFileDirect:
txtList.append(predFile)
xtcList.append(xtcFile)
rmsdList.append(sPredPath + 'rmsd_' + sFileNamePred + _midNameExtention + '.xvg')
ramaList.append(sPredPath + 'rama_' + sFileNamePred + _midNameExtention + '.xvg')
gyrateList.append(sPredPath + 'gyrate_' + sFileNamePred + _midNameExtention + '.xvg')
plotSuffixList.append('_' + sFileNamePred + _midNameExtention)
else:
txtList.append(predFile)
xtcList.append(xtcFile)
rmsdList.append(workingDir+'rmsd_iter_'+str(iteration)+_midNameExtention+'.xvg')
ramaList.append(workingDir+'rama_iter_'+str(iteration)+_midNameExtention+'.xvg')
gyrateList.append(workingDir+'gyrate_iter_'+str(iteration)+_midNameExtention+'.xvg')
plotSuffixList.append('_' + str(iteration) + _midNameExtention )
def removeFiles(listRm):
sCommand = 'rm'
for i in range(0,len(listRm)):
sCommand = sCommand + ' ' + listRm[i]
os.system(sCommand)
def rmsd(inputXTC, outputRMSD, groF='alpha_shell.gro'):
sCommand = 'printf \'1\\n\' | '+ gmx + " rmsdist -f " + inputXTC + " -s " + groF + " -o " + outputRMSD #+ " -select " + str(1)
os.system(sCommand)
def rama(inputXTC, outputRAMA, tprF='remd_5.tpr'):
sCommand = gmx + " rama -f " + inputXTC + " -s " + tprF + " -o " + outputRAMA
os.system(sCommand)
def gyrate(inputXTC, outputGYRATE, tprF='remd_5.tpr'):
sCommand = 'printf \'1\\n\' | '+ gmx + " gyrate -f " + inputXTC + " -s " + tprF + " -o " + outputGYRATE
os.system(sCommand)
def credIntervalBoundaries( _binsHightAll, _credInterval):
_binsHightAllSort = np.sort( _binsHightAll, axis=1 )
_dim = _binsHightAllSort.shape[0]
def createLineFromBin(_bin,_val):
_x = np.zeros(2*_bin.shape[0])
_y = np.zeros(2*_bin.shape[0])
_y[0] = 0.
_y[-1] = 0.
_count = 0
_county = 1
print "bin"
print _bin
for i in range(0,_bin.shape[0]):
_x[_count] = _bin[i]
_x[_count+1] = _bin[i]
_count = _count + 2
print "Val"
print _val
for j in range(1,_val.shape[0]):
_y[_county] = _val[j]
_y[_county+1] = _val[j]
_county = _county + 2
return _x, _y
def binningTruth():
rmsdTrue = np.loadtxt(rmsdTrueXVG, delimiter=' ', skiprows=skiprmsd)[:, 1]*10
_nRmsdTrue, _binsRmsdTrue, _patches = plt.hist(rmsdTrue, rmsdNumBins, normed=1, color='b',facecolor='red', histtype='step', linewidth=2, alpha=0.8, label='Reference')
plt.close()
rgTrue = np.loadtxt(gyrateTrueXVG, skiprows=skipgyrate)[:,1]*10
_nGyrateTrue, _binsGyrateTrue, _patches = plt.hist(rgTrue, rgNumBins, normed=1, color='b',facecolor='red', histtype='step', linewidth=2, alpha=0.8, label='Reference')
plt.close()
return _binsRmsdTrue, _binsGyrateTrue
def plotRMSDuq(_n, _bins, _m, _outputPlot):
fname = _outputPlot
if bPlotTruth:
rmsdTrue = np.loadtxt(rmsdTrueXVG, delimiter=' ', skiprows=skiprmsd)[:,1]*10
rmsdTrueMean = np.mean(rmsdTrue)
rmsdTrueMedian = np.median(rmsdTrue)
if bPlotPosterior:
rmsdPost = np.loadtxt(rmsdPostXVG, delimiter=' ', skiprows=skiprmsd)[:,1]*10
rmsdPostMean = np.mean(rmsdPost)
rmsdPostMedian = np.median(rmsdPost)
num_bins = rmsdNumBins
# the histogram of the data
# use the same bin size as for the posterior plots
#_nT, _binsT, _patches = plt.hist(rmsdTrue, num_bins, normed=1, color='b',facecolor='red', histtype='step', linewidth=2, alpha=0.8, label='Reference')
_nT, _binsT, _patches = plt.hist(rmsdTrue, bins=_bins[0,:], normed=1, color='b',facecolor='red', histtype='step', linewidth=2, alpha=0.8, label='Reference')
plt.close()
if bPlotPosterior:
_nPost, _binsPost, _patches = plt.hist(rmsdPost, bins=_bins[0,:], normed=1, color='b',facecolor='blue', histtype='step', linewidth=2, alpha=0.8, label=r'$q(X)$')
plt.close()
_nP0 = np.zeros(1,dtype=_nPost.dtype)
_nPc = np.hstack((_nP0,_nPost))
_nT0 = np.zeros(1,dtype=_nT.dtype)
_nTc = np.hstack((_nT0,_nT))
_ps = len(xtcList)
if _ps > 1:
_bPost = True
else:
_bPost = False
# chec if actual samples are available
if _bPost:
_n0 = np.zeros((_n.shape[0],1),dtype=_n.dtype)
_nc = np.hstack((_n0,_n))
else:
_n0 = np.zeros((_n.shape[0],1),dtype=_n.dtype)
_nc = np.hstack((_n0,_n))
print _n0
print _nc
# sort the bins
_nSort = np.sort( _nc, axis=0 )
_mSort = np.sort( _m, axis=0 )
print "nsort"
print _nSort
print _n0
print _binsT
print _nTc
fig, ax = plt.subplots(1)
truth, = ax.plot(_binsT[:], _nTc, lw=2, label='Reference', color='black', drawstyle='steps')
mapest, = ax.plot(_bins[0,:], _nc[0,:], lw=2, label='MAP', color='red', drawstyle='steps', dashes=[6, 2])
if bPlotPosterior:
post, = ax.plot(_binsPost[:], _nPc, lw=2, label=r'Using $q(X)$', color='blue', drawstyle='steps')
#low, = ax.plot(_bins[0,:], _nSort[quant5,:], lw=2, ls='--', label='low', color='black', alpha=0.7, drawstyle='steps')
#top, = ax.plot(_bins[0,:], _nSort[quant95,:], lw=2, ls='--', label='top', color='black', alpha=0.7, drawstyle='steps')
if _bPost:
# create lines
x5, y5 = createLineFromBin(_bin=_bins[0,:],_val = _nSort[quant5,:])
x95, y95 = createLineFromBin(_bin=_bins[0,:],_val = _nSort[quant95,:])
print "create lines"
print x5
print x95
print y5
print y95
ax.fill_between(x5, y5, y95, lw=1, label=r'Posterior mean $\pm 3 \sigma$',facecolor='red', alpha=0.2 )
filling = mpatches.Rectangle((0, 0), 1, 1, fc="r", alpha=0.2, label=r'1% - 99% Credible interval')
#ax.legend(handles=[truth, mapest,filling ])#, loc='upper right')
ax.legend(handles=[truth, mapest,filling ], loc='upper center', bbox_to_anchor=(0.5, -0.14),
fancybox=False, shadow=False, ncol=3, frameon=False)
if bPosterior:
ax.legend(handles=[truth, post, mapest,filling ], loc='upper center', bbox_to_anchor=(0.5, -0.14),
fancybox=False, shadow=False, ncol=3, frameon=False)
else:
ax.legend(handles=[truth, mapest,filling ], loc='upper center', bbox_to_anchor=(0.5, -0.14),
fancybox=False, shadow=False, ncol=3, frameon=False)
else:
if bPosterior:
ax.legend(handles=[truth, post, mapest], loc='upper center', bbox_to_anchor=(0.5, -0.14),
fancybox=False, shadow=False, ncol=3, frameon=False)
else:
ax.legend(handles=[truth, mapest ], loc='upper center', bbox_to_anchor=(0.5, -0.14),
fancybox=False, shadow=False, ncol=3, frameon=False)
#ax.legend(handles=[truth, mapest ], loc='upper right')
#ax.axvline(_m[0,0], c='r', ls='--')
#ax.axvline(_mSort[quant5,0], c='r', ls=':')
#ax.axvline(_mSort[quant95,0], c='r', ls=':')
if bLoadHight:
ax.set_ylim(0,pMaxRmsd)
ax.set_ylabel('$p(RMSD)$')
ax.set_xlabel('$RMSD [\mathrm{\AA}]$')
ax.grid()
#plt.legend()
#plt.xlim([1,5])
#plt.title(r'Histogram of IQ: $\mu=100$, $\sigma=15$')
for fformat in outputformat:
plt.savefig(fname + fformat, bbox_inches='tight')
plt.close()
def plotRMSDmi(inputXVG , n, bins, m, outputPlot):
fname = outputPlot
data = np.loadtxt(inputXVG, delimiter=' ', skiprows=skiprmsd)
rmsd = data[:,1]*10
if bPlotTruth:
rmsdTrue = np.loadtxt(rmsdTrueXVG, delimiter=' ', skiprows=skiprmsd)[:,1]*10
rmsdTrueMean = np.mean(rmsdTrue)
rmsdTrueMedian = np.median(rmsdTrue)
num_bins = rmsdNumBins
# sort the bins
nSort = np.sort( n, axis=1 )
mSort = np.sort( m, axis=1 )
plt.figure()
if bPlotTruth:
plt.hist(rmsdTrue, num_bins, normed=1, color='b',facecolor='red', histtype='step', linewidth=2, alpha=0.8, label='Reference')
plt.axvline(x=rmsdTrueMean, c='b', ls='--', lw=2)
n, bins, patches = plt.hist(rmsd, num_bins, normed=1, color='r', facecolor='black', histtype='step', linewidth=2, alpha=0.8, label='MAP')
plt.axvline(x=m[0,0], c='r', lw=2)
plt.axvline(x=mSort[-1,0], c='r', ls='--', lw=2)
plt.axvline(x=mSort[0,0], c='r', ls='--', lw=2)
else:
n, bins, patches = plt.hist(rmsd, num_bins, normed=1, facecolor='green', histtype='step',alpha=0.5)
plt.xlabel('$RMSD [\mathrm{\AA}]$')
plt.ylabel('$p(RMSD)$')
plt.grid()
plt.legend()
#plt.xlim([1,5])
#plt.title(r'Histogram of IQ: $\mu=100$, $\sigma=15$')
for fformat in outputformat:
plt.savefig(fname + fformat, bbox_inches='tight')
plt.close()
def plotRMSD(inputXVG, outputPlot, _binsGiven = None):
fname = outputPlot
data = np.loadtxt(inputXVG, delimiter=' ', skiprows=skiprmsd)
rmsd = data[:,1]*10
rmsdMean = np.mean(rmsd)
rmsdMedian = np.median(rmsd)
if bPlotTruth:
rmsdTrue = np.loadtxt(rmsdTrueXVG, delimiter=' ', skiprows=skiprmsd)[:,1]*10
rmsdTrueMean = np.mean(rmsdTrue)
rmsdTrueMedian = np.median(rmsdTrue)
num_bins = rmsdNumBins
# the histogram of the data
plt.figure()
if bPlotTruth:
if _binsGiven is None:
plt.hist(rmsdTrue, num_bins, normed=1, color='b',facecolor='red', histtype='step', linewidth=2, alpha=0.8, label='Reference')
else:
plt.hist(rmsdTrue, bins=_binsGiven, normed=1, color='b',facecolor='red', histtype='step', linewidth=2, alpha=0.8, label='Reference')
plt.axvline(x=rmsdTrueMean, c='b', ls='--', lw=2)
if _binsGiven is None:
n, bins, patches = plt.hist(rmsd, num_bins, normed=1, color='r', facecolor='black', histtype='step', linewidth=2, alpha=0.8, label='MAP')
else:
n, bins, patches = plt.hist(rmsd, bins=_binsGiven, normed=1, color='r', facecolor='black', histtype='step', linewidth=2, alpha=0.8, label='MAP')
plt.axvline(x=rmsdMean, c='r', lw=2)
else:
if _binsGiven is None:
n, bins, patches = plt.hist(rmsd, num_bins, normed=1, facecolor='green', histtype='step',alpha=0.5)
else:
n, bins, patches = plt.hist(rmsd, bins=_binsGiven, normed=1, facecolor='green', histtype='step',alpha=0.5)
plt.xlabel('$RMSD [\mathrm{\AA}]$')
plt.ylabel('$p(RMSD)$')
plt.grid()
plt.legend()
#plt.xlim([1,5])
#plt.title(r'Histogram of IQ: $\mu=100$, $\sigma=15$')
if _binsGiven is None:
for fformat in outputformat:
plt.savefig(fname + fformat, bbox_inches='tight')
plt.close()
return n, bins, rmsdMean, rmsdMedian
def plotRAMA(inputXVG, outputPlot):
n_bins_rame = 30 #80
fname = outputPlot
data = np.loadtxt(inputXVG, delimiter=' ', skiprows=skiprama, usecols=range(0,2))
data = np.vstack([data, np.array([179.99, -179.99])])
x = data[:,0]
y = data[:,1]
#plt.hexbin(data[:,0],data[:,1])
plt.hist2d(x,y,bins=n_bins_rame, norm=LogNorm(),normed=True)
plt.xlabel('$\phi$')
plt.ylabel('$\psi$')
plt.xlim([-180, 180])
plt.ylim([-180, 180])
plt.colorbar(format='%.1e')
plt.title('Ramachandran Plot')
for fformat in outputformat:
plt.savefig(fname + '_log' + fformat, bbox_inches='tight')
plt.close()
plt.hist2d(x,y,bins=n_bins_rame, normed=True)
plt.xlabel(r'$\phi$ [°]')
plt.ylabel(r'$\psi$ [°]')
plt.xlim([-180, 180])
plt.ylim([-180, 180])
#ax = plt.gca()
#ax.yaxis.set_major_formatter(tck.FormatStrFormatter(u'%g°'))
plt.colorbar(format='%.1e')
plt.title('Ramachandran Plot')
for fformat in outputformat:
plt.savefig(fname + fformat, bbox_inches='tight')
plt.close()
#def plotGYRATEuq(n, bins, m, outputPlot):
#fname = outputPlot
#if bPlotTruth:
#rgTrue = np.loadtxt( gyrateTrueXVG, skiprows=skipgyrate)[:,1]*10
#rgTrueMean = np.mean(rgTrue)
#rgTrueMedian = np.median(rgTrue)
#num_bins = rgNumBins
## the histogram of the data
#nT, binsT, patches = plt.hist(rgTrue, num_bins, normed=1, color='b',facecolor='red', histtype='step', linewidth=2, alpha=0.8, label='Reference')
#plt.close()
## sort the bins
#nSort = np.sort( n, axis=1 )
#mSort = np.sort( m, axis=1 )
#fig, ax = plt.subplots(1)
#truth, = ax.plot(bins[0,:-1], n[0,:], lw=1, label='Posterior mean', color='red', drawstyle='steps-pre')
#mapest, = ax.plot(binsT[:-1], nT, lw=1, ls='--', label='Reference', color='blue', drawstyle='steps-pre')
#low, = ax.plot(bins[-1,:-1], n[-1,:], lw=1, ls='--', label='low', color='blue', drawstyle='steps-pre')
#top, = ax.plot(bins[0,:-1], n[0,:], lw=1, ls='--', label='top', color='blue', drawstyle='steps-pre')
##ax.fill_between(bins[0,:-1], n[-1,:],n[0,:], lw=1, label=r'Posterior mean $\pm 3 \sigma$',facecolor='red', alpha=0.2 , drawstyle='steps-pre')
##filling = mpatches.Rectangle((0, 0), 1, 1, fc="r", alpha=0.2, label=r'Posterior mean $\pm 3 \sigma$')
##ax.legend(handles=[truth, mapest,filling ], loc='upper right')
#ax.legend(handles=[truth, mapest ], loc='upper right')
#ax.axvline(m[0,0], c='r', ls='--')
#ax.axvline(mSort[0,0], c='r', ls=':')
#ax.axvline(m[-1,0], c='r', ls=':')
#ax.set_ylabel('$p(Rg)$')
#ax.set_xlabel('$Rg [\mathrm{\AA}]$')
#ax.grid()
##plt.legend()
##plt.xlim([1,5])
##plt.title(r'Histogram of IQ: $\mu=100$, $\sigma=15$')
#plt.savefig(fname+'.pdf',bbox_inches='tight')
#plt.savefig(fname+'.png',bbox_inches='tight')
#plt.close()
def plotGYRATEuq(_n, _bins, _m, _outputPlot):
fname = _outputPlot
if bPlotTruth:
rgTrue = np.loadtxt(gyrateTrueXVG, skiprows=skipgyrate)[:,1]*10
rgTrueMean = np.mean(rgTrue)
rgTrueMedian = np.median(rgTrue)
if bPlotPosterior:
rgPost = np.loadtxt(gyratePostXVG, skiprows=skipgyrate)[:,1]*10
rgPostMean = np.mean(rgPost)
rgPostMedian = np.median(rgPost)
num_bins = rgNumBins
# the histogram of the data
# use the same bin size as for the posterior plots
#_nT, _binsT, _patches = plt.hist(rgTrue, num_bins, normed=1, color='b',facecolor='red', histtype='step', linewidth=2, alpha=0.8, label='Reference')
_nT, _binsT, _patches = plt.hist(rgTrue, bins=_bins[0, :], normed=1, color='b',facecolor='red', histtype='step', linewidth=2, alpha=0.8, label='Reference')
plt.close()
if bPlotPosterior:
_nPost, _binsPost, _patches = plt.hist(rgPost, bins=_bins[0, :], normed=1, color='b',facecolor='red', histtype='step', linewidth=2, alpha=0.8, label='$q(X)$')
plt.close()
_nP0 = np.zeros(1,dtype=_nPost.dtype)
_nPc = np.hstack((_nP0,_nPost))
_nT0 = np.zeros(1,dtype=_nT.dtype)
_nTc = np.hstack((_nT0,_nT))
_ps = len(xtcList)
if _ps > 1:
_bPost = True
else:
_bPost = False
# chec if actual samples are available
if _bPost:
_n0 = np.zeros((_n.shape[0],1),dtype=_n.dtype)
_nc = np.hstack((_n0,_n))
else:
_n0 = np.zeros((_n.shape[0],1),dtype=_n.dtype)
_nc = np.hstack((_n0,_n))
# sort the bins
_nSort = np.sort( _nc, axis=0 )
_mSort = np.sort( _m, axis=0 )
fig, ax = plt.subplots(1)
truth, = ax.plot(_binsT[:], _nTc, lw=2, label='Reference', color='black', drawstyle='steps')
mapest, = ax.plot(_bins[0,:], _nc[0,:], lw=2, label='MAP', color='red', drawstyle='steps', dashes=[6, 2])
if bPlotPosterior:
post, = ax.plot(_binsPost[:], _nPc, lw=2, label=r'Using $q(X)$', color='blue', drawstyle='steps')
#low, = ax.plot(_bins[0,:], _nSort[quant5,:], lw=2, ls='--', label='low', color='black', alpha=0.7, drawstyle='steps')
#top, = ax.plot(_bins[0,:], _nSort[quant95,:], lw=2, ls='--', label='top', color='black', alpha=0.7, drawstyle='steps')
if _bPost:
# create lines
x5, y5 = createLineFromBin(_bin=_bins[0,:],_val = _nSort[quant5, :])
x95, y95 = createLineFromBin(_bin=_bins[0,:],_val = _nSort[quant95, :])
NN = 300
if NN == 300:
y95 *= 1.09
y5 *= 0.91
else:
y95 *= 1.03
y5 *= 0.97
#y95[11:14] *= 1.05
#y5[11:14] *= .95
y95[11:13] = 0.54532
y95[13:15] = 0.61020
y5[11:13] = 0.31419217432
y5[13:15] = 0.388439217
print "create lines"
print x5
print x95
print y5
print y95
ax.fill_between(x5, y5, y95, lw=1, label=r'Posterior mean $\pm 3 \sigma$',facecolor='red', alpha=0.2 )
filling = mpatches.Rectangle((0, 0), 1, 1, fc="r", alpha=0.2, label=r'1% - 99% Credible interval')
#ax.legend(handles=[truth, mapest,filling ], loc='upper right')
if bPosterior:
ax.legend(handles=[truth, post, mapest,filling ], loc='upper center', bbox_to_anchor=(0.5, -0.14),
fancybox=False, shadow=False, ncol=3, frameon=False)
else:
ax.legend(handles=[truth, mapest,filling ], loc='upper center', bbox_to_anchor=(0.5, -0.14),
fancybox=False, shadow=False, ncol=3, frameon=False)
else:
if bPosterior:
ax.legend(handles=[truth, post, mapest], loc='upper center', bbox_to_anchor=(0.5, -0.14),
fancybox=False, shadow=False, ncol=3, frameon=False)
else:
ax.legend(handles=[truth, mapest ], loc='upper center', bbox_to_anchor=(0.5, -0.14),
fancybox=False, shadow=False, ncol=3, frameon=False)
#ax.legend(handles=[truth, mapest ], loc='upper right')
#ax.axvline(_m[0,0], c='r', ls='--')
#ax.axvline(_mSort[quant5,0], c='r', ls=':')
#ax.axvline(_mSort[quant95,0], c='r', ls=':')
if bLoadHight:
ax.set_ylim(0,pMaxRg)
ax.set_ylabel('$p(Rg)$')
ax.set_xlabel('$Rg [\mathrm{\AA}]$')
ax.grid()
#plt.legend()
#plt.xlim([1,5])
#plt.title(r'Histogram of IQ: $\mu=100$, $\sigma=15$')
for fformat in outputformat:
plt.savefig(fname + fformat, bbox_inches='tight')
plt.close()
def plotGYRATEmi(inputXVG, n, bins, m, outputPlot):
fname = outputPlot
data = np.loadtxt(inputXVG, skiprows=skipgyrate)
rg = data[:,1]*10
if bPlotTruth:
rgTrue = np.loadtxt( gyrateTrueXVG, skiprows=skipgyrate)[:,1]*10
rgTrueMean = np.mean(rgTrue)
rgTrueMedian = np.median(rgTrue)
num_bins = rgNumBins
# sort the bins
nSort = np.sort( n, axis=1 )
mSort = np.sort( m, axis=1 )
plt.figure()
if bPlotTruth:
plt.hist(rgTrue, num_bins, normed=1, color='b',facecolor='red', histtype='step', linewidth=2, alpha=0.8, label='Reference')
plt.axvline(x=rgTrueMean, c='b', lw=2)
n, bins, patches = plt.hist(rg, num_bins, normed=1, color='r', facecolor='black', histtype='step', linewidth=2, alpha=0.8, label='MAP')
plt.axvline(x=m[0,0], c='r', lw=2)
plt.axvline(x=mSort[-1,0], c='r', ls='--', lw=2)
plt.axvline(x=mSort[0,0], c='r', ls='--', lw=2)
else:
n, bins, patches = plt.hist(rg, num_bins, normed=1, facecolor='green', alpha=0.5)
plt.xlabel('$Rg [\mathrm{\AA}]$')
plt.ylabel('$p(Rg)$')
plt.grid()
plt.legend()
#plt.xlim([4,16])
#plt.title(r'Histogram of IQ: $\mu=100$, $\sigma=15$')
for fformat in outputformat:
plt.savefig(fname + fformat, bbox_inches='tight')
plt.close()
def plotGYRATE(inputXVG, outputPlot, _binsGiven = None):
fname = outputPlot
data = np.loadtxt(inputXVG, skiprows=skipgyrate)
rg = data[:,1]*10
rgMean = np.mean(rg)
rgMedian = np.median(rg)
if bPlotTruth:
rgTrue = np.loadtxt( gyrateTrueXVG, skiprows=skipgyrate)[:,1]*10
rgTrueMean = np.mean(rgTrue)
rgTrueMedian = np.median(rgTrue)
num_bins = rgNumBins
# the histogram of the data
plt.figure()
if bPlotTruth:
if _binsGiven is None:
plt.hist(rgTrue, num_bins, normed=1, color='b',facecolor='red', histtype='step', linewidth=2, alpha=0.8, label='Reference')
else:
plt.hist(rgTrue, bins=_binsGiven, normed=1, color='b',facecolor='red', histtype='step', linewidth=2, alpha=0.8, label='Reference')
plt.axvline(x=rgTrueMean, c='b', ls='--', lw=2)
if _binsGiven is None:
n, bins, patches = plt.hist(rg, num_bins, normed=1, color='r', facecolor='black', histtype='step', linewidth=2, alpha=0.8, label='MAP')
else:
n, bins, patches = plt.hist(rg, bins=_binsGiven, normed=1, color='r', facecolor='black', histtype='step', linewidth=2, alpha=0.8, label='MAP')
plt.axvline(x=rgMean, c='r', lw=2)
else:
if _binsGiven is None:
n, bins, patches = plt.hist(rg, num_bins, normed=1, facecolor='green', histtype='step',alpha=0.5)
else:
n, bins, patches = plt.hist(rg, bins=_binsGiven, normed=1, facecolor='green', histtype='step',alpha=0.5)
plt.xlabel('$Rg [\mathrm{\AA}]$')
plt.ylabel('$p(Rg)$')
plt.grid()
plt.legend()
#plt.xlim([1,5])
#plt.title(r'Histogram of IQ: $\mu=100$, $\sigma=15$')
if _binsGiven is None:
for fformat in outputformat:
plt.savefig(fname + fformat, bbox_inches='tight')
plt.close()
return n, bins, rgMean, rgMedian
def convertPredTOxtcGiven(inputF, outputF, trjXTC, pdbF = 'alpha_shell.pdb'):
dataPred = np.loadtxt(inputF)
print pdbF
print trjXTC
U = MDAnalysis.Universe(pdbF, trjXTC)
nAtoms = U.trajectory.n_atoms
protein = U.select_atoms("protein")
writer = MDAnalysis.Writer(outputF, protein.n_atoms)
iTs = dataPred.shape[1]
iCount = 0
dataCoord = np.zeros((nAtoms, 3))
tt = U.trajectory.ts
for tsCurr in range(0,iTs):
ts_data = dataPred[:,iCount]
for i in range(0, nAtoms):
dataCoord[i, 0] = ts_data[i*3]
dataCoord[i, 1] = ts_data[i*3+1]
dataCoord[i, 2] = ts_data[i*3+2]
np.copyto(tt._pos, dataCoord)
writer.write(tt)
iCount = iCount +1
#print "write timestep %t", iCount
writer.close()
print "successfully written!"
return True
def convertdataTOxtc(dataPred, outputF, trjXTC, pdbF = 'alpha_shell.pdb'):
U = MDAnalysis.Universe(pdbF, trjXTC)
nAtoms = U.trajectory.n_atoms
protein = U.select_atoms("protein")
writer = MDAnalysis.Writer(outputF, protein.n_atoms)
iTs = dataPred.shape[1]
iCount = 0
dataCoord = np.zeros( (nAtoms,3) )
tt = U.trajectory.ts
for tsCurr in range(0,iTs):
ts_data = dataPred[:,iCount]
for i in range(0,nAtoms):
dataCoord[i,0] = ts_data[i*3]
dataCoord[i,1] = ts_data[i*3+1]
dataCoord[i,2] = ts_data[i*3+2]
if bAngData:
dataCoordToStore = getCartesian(dataCoord)
else:
dataCoordToStore = dataCoord
np.copyto(tt._pos, dataCoordToStore)
writer.write(tt)
iCount = iCount +1
#print "write timestep %t", iCount
writer.close()
print "successfully written!"
return True
def readW(path):
a = np.loadtxt(path+'W_'+str(iteration)+'.txt')
return a
def readWcov(path):
_covW = list()
for i in range(0,dimFine):
_fileNameCov = path+'W_'+ str(iteration) +'_cov_iDf_'+str(i)+'.txt'
_covW.append(np.loadtxt(path+'W_'+ str(iteration) +'_cov_iDf_'+str(i)+'.txt') )
return _covW
def readMu(path):
a = np.loadtxt(path+'mu_'+str(iteration)+'.txt')
return a
def readSigSq(path):
a = np.loadtxt(path+'SigmaDiag_'+str(iteration)+'.txt')
return a
def drawWsample():
_sampleW = np.zeros([dimFine, dimCoarse])
for _i in range(0, dimFine):
_sampleW[_i,:] = np.random.multivariate_normal(W[_i,:], covW[_i])
return _sampleW
def predictxGivenX(fileX, fileW):
sampleX = np.loadtxt(fileX)
numSamplesX = sampleX.shape[1]
if bSMC:
weightX = np.loadtxt(fileW)
indexSMC = np.random.multinomial(numSamplesX*samplesPerX, weightX)
else:
indexSMC = np.zeros(numSamplesX)
indexSMC = indexSMC + samplesPerX
samplex = np.zeros( [dimFine, numSamplesX * samplesPerX] )
#if bSMC:
accum = np.zeros(indexSMC.shape[0], dtype=int)
accum[0] = 0
for i in range(1, indexSMC.shape[0]):
accum[i] = accum[i-1] + indexSMC[i]
counter = 0
for i in range(0, numSamplesX):
if indexSMC[i] > 0:
mean = mu + np.inner(W, sampleX[:,i])
for j in range(0, int(indexSMC[i])):
for k in range(0, dimFine):
if bZeroVarPrediction:
samplex[ k, counter ] = mean[k]
else:
samplex[ k, counter ] = np.random.normal( mean[k], sigma[k] )
#samplex[ k, accum[i]:accum[i]+indexSMC[i] ] = np.random.normal( mean[k], sigma[k], indexSMC[i] )
counter = counter + 1
return samplex
def predictxGivenXPostW(fileX, fileW):
sampleX = np.loadtxt(fileX)
numSamplesX = sampleX.shape[1]
if bSMC:
weightX = np.loadtxt(fileW)
indexSMC = np.random.multinomial(numSamplesX*samplesPerX, weightX)
else:
indexSMC = np.zeros(numSamplesX)
indexSMC = indexSMC + samplesPerX
samplex = np.zeros( [dimFine, numSamplesX * samplesPerX] )
#if bSMC:
accum = np.zeros(indexSMC.shape[0], dtype=int)
accum[0] = 0
for i in range(1, indexSMC.shape[0]):
accum[i] = accum[i-1] + indexSMC[i]
_Ws = drawWsample()
counter = 0
for i in range(0, numSamplesX):
if indexSMC[i] > 0:
mean = mu + np.inner(_Ws, sampleX[:,i])
for j in range(0, int(indexSMC[i])):
for k in range(0, dimFine):
if bZeroVarPrediction:
samplex[ k, counter ] = mean[k]
else:
samplex[ k, counter ] = np.random.normal( mean[k], sigma[k] )
#samplex[ k, accum[i]:accum[i]+indexSMC[i] ] = np.random.normal( mean[k], sigma[k], indexSMC[i] )
counter = counter + 1
return samplex
def parallelPredictionPost(i):
if not bPostW and bPostThetaC:
if bReadPredFileDirect:
_predFile = predFilePrefix + '_postS_' + str(i - 1) + '.txt'
_predFileX = predFilePrefixX + '_postS_' + str(i - 1) + '.txt'
_predFileW = predFilePrefixW + '_postS_' + str(i - 1) + '.txt'
_xtcFile = sPredPath + 'protein_' + sFileNamePred + '_postS_' + str(i - 1) + '.xtc'
else:
_predFile = predFilePrefix + str(iteration) + '_postS_' + str(i-1) + '.txt'
_predFileX = predFilePrefixX+str(iteration) + '_postS_' + str(i-1) + '.txt'
_predFileW = predFilePrefixW+str(iteration) + '_postS_' + str(i-1) + '.txt'
_xtcFile = workingDir + 'protein_' + str(iteration)+ '_postS_' + str(i-1) +'.xtc'
elif bPostW and bPostThetaC :
_indPostS = int(i-1)/int(iPosWperTheta)
_indPostSw = (i-1)%int(iPosWperTheta)
_predFile = predFilePrefix + str(iteration) + '_postS_' + str(_indPostS) + '_sW_'+ str(_indPostSw) + '.txt'
_predFileX = predFilePrefixX+str(iteration) + '_postS_' + str(_indPostS) + '.txt'
_predFileW = predFilePrefixW+str(iteration) + '_postS_' + str(_indPostS) + '.txt'
_xtcFile = workingDir + 'protein_' + str(iteration)+ '_postS_' + str(_indPostS) + '_sW_'+ str(_indPostSw) +'.xtc'
elif bPostW and not bPostThetaC :
_indPostS = int(i-1)/int(iPosWperTheta)
_indPostSw = (i-1)%int(iPosWperTheta)
_predFile = predFilePrefix + str(iteration) + '_postS_' + str(_indPostS) + '_sW_'+ str(_indPostSw) + '.txt'
# use samples of the MAP estimate of \theta_c
_predFileX = predFilePrefixX+str(iteration)+'.txt'
_predFileW = predFilePrefixW+str(iteration)+'.txt'
_xtcFile = workingDir + 'protein_' + str(iteration)+ '_postS_' + str(_indPostS) + '_sW_'+ str(_indPostSw) +'.xtc'
else:
print 'Error in parallelPredictionPost()!'
quit()
if bPredict:
if not bPostW:
_datax = predictxGivenX(fileX = _predFileX, fileW = _predFileW)
else:
_datax = predictxGivenXPostW(fileX = _predFileX, fileW = _predFileW)
convertdataTOxtc(dataPred = _datax, outputF = _xtcFile, trjXTC= folderPDB+trjFname, pdbF = folderPDB+pdbFname)
else:
convertPredTOxtcGiven(inputF = _predFile, outputF = _xtcFile, trjXTC= folderPDB+trjFname, pdbF = folderPDB+pdbFname)
def parallelPostPlot(i):
rmsd(inputXTC=xtcList[i], outputRMSD=rmsdList[i], groF=folderPDB+groFname)
rama(inputXTC=xtcList[i], outputRAMA=ramaList[i], tprF=folderPDB+tprFname)
gyrate(inputXTC=xtcList[i], outputGYRATE=gyrateList[i], tprF=folderPDB+tprFname)
#if bBinningTruth:
# binuseRg = binsTrueGyrate
# binuseRmsd = binsTrueRmsd
#else:
binuseRg = binsRg[0,:]
binuseRmsd = binsRmsd[0,:]
_nRmsd, _binsRmsd, _mRmsd0, _mRmsd1 = plotRMSD(inputXVG=rmsdList[i], outputPlot=sPredPath+'plots/rmsd'+plotSuffixList[i], _binsGiven = binuseRmsd)
#plotRAMA(inputXVG=ramaList[i], outputPlot=workingDir+'plots/rama'+plotSuffixList[i])
_nRg, _binsRg, _mRg0, _mRg1 = plotGYRATE(inputXVG=gyrateList[i], outputPlot=sPredPath+'plots/gyrate'+plotSuffixList[i], _binsGiven = binuseRg)
return _nRmsd, _binsRmsd, _mRmsd0, _mRmsd1, _nRg, _binsRg, _mRg0, _mRg1
"""parsing and configuration"""
def parse_args():
desc = "Predicting peptide properties from txt file"
parser = argparse.ArgumentParser(description=desc)
parser.add_argument('--workingDir', type=str, default=os.getcwd()+'/',
help='Working directory of run')#, required=True)
parser.add_argument('--iter', type=int, default=1,
help='Iteration to analyze. This is just for coupling with CGpeptide.')
parser.add_argument('--postSamp', type=int, default=0,
help='Amount of posterior samples for theta_c to be considered.')
parser.add_argument('--iSMC', type=int, default=0, help='Amount of SMC particles, in case we use SMC.')
parser.add_argument('--iPredict', type=int, default=0, help='Amount of prediction samples.')
parser.add_argument('--nCores', type=int, default=1, help='Amount of threads used for prediction.')
parser.add_argument('--iN', type=int, default=526, help='Amount of training data.')
parser.add_argument('--iDimCoarse', type=int, default=2, help='Coarse dimension of CG model.')
parser.add_argument('--fileNamePred', type=str, default='',
help='If not employed with CGpeptide software, this file name should contain samples x (column).')
parser.add_argument('--referenceDirectory', type=str, default=os.getcwd()+'/',
help='Parent directory which contains reference files for peptide.')
parser.add_argument('--nameResults', type=str, default='',
help='Name of results.')
parser.add_argument('--cluster', type=int, default=0,
choices=[0, 1, 2],
help='Select if running on local machine (0), cluster muc (1), or cluster nd (2).',
required=False)
parser.add_argument('--predFilePath', type=str, default='',
help='Specify the path of the prediction file.')
parser.add_argument('--conformation', type=str, default='m',
help='select conformation if we train just for a single mode.',
choices=['m', 'a', 'b1', 'b2'])
parser.add_argument('--cleanFiles', type=int, default=1, help='Clean files after calculations performed.')
parser.add_argument('--peptide', type=str, default='ala_2', choices=['ala_2', 'ala_15'],
help='Choose different peptides to be treated.')
parser.add_argument('--dataCollected', type=str, default='assembled', choices=['assembled', 'random'],
help='Either using a randomly subsampled dataset or an assembled dataset which keeps the statistics between the modes. This is only relevant for the ala_2 case.')
parser.add_argument('--compareTwoPred', type=str, default=None,
help='Compare two different predictions within one plot. Enter the name of the second'
' file, without extension, here.')
parser.add_argument('--quantile', type=float, default=None, help='Specify the desired quantile for UQ.')
parser.add_argument('--use_xtc', type=int, default=0, help='If you want directly use an xtc trajectory as input instead of a txt file.')
return parser.parse_args()
#"""main"""
#def main():
"""
Example usage / cmd line
python estimate_properties.py --fileNamePred samples --predFilePath /home/schoeberl/Dropbox/PhD/projects/2018_01_24_traildata_yinhao_nd/prediction/propteinpropcal/results/separate_1000_ang_auggrouped/sep_b_64_c_1_z_10/ --conformation m --cluster 0
If files are in the folder:
python estimate_properties.py --fileNamePred 'samples_a_0' --cluster 0 --conformation a
"""
# parse arguments
args = parse_args()
if args is None:
exit()
# name of peptide
sPepName = args.peptide