Skip to content

Commit cc3c191

Browse files
author
Hahnbeom Park
committed
fixing estogram dimension problem in cst generation script
1 parent 21c1775 commit cc3c191

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

modeling/estogram2cst.py

+12-5
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def estimate_lddtG_from_lr(pred):
112112
nres = len(pred)
113113
P0mean = np.zeros(nres)
114114
for i in range(nres):
115-
n = 0
115+
n = 0.001
116116
for j in range(nres):
117117
if abs(i-j) < 13: continue ## up to 3 H turns
118118
n += 1
@@ -134,7 +134,7 @@ def ULR_from_pred(pred,lddtG,
134134
# non-local distance accuracy -- removes bias from helices
135135
P0mean = np.zeros(nres)
136136
for i in range(nres):
137-
n = 0
137+
n = 0.001
138138
for j in range(nres):
139139
if abs(i-j) < 13: continue ## up to 3 H turns
140140
n += 1
@@ -144,7 +144,7 @@ def ULR_from_pred(pred,lddtG,
144144
#soften by 9-window sliding
145145
P0mean_soft = np.zeros(nres)
146146
for i in range(nres):
147-
n = 0
147+
n = 0.001
148148
for k in range(-4,5):
149149
if i+k < 0 or i+k >= nres: continue
150150
n += 1
@@ -252,6 +252,9 @@ def estogram2cst(dat,pdb,cencst,facst,
252252

253253
Q = np.mean(dat['lddt'])
254254
dat = dat['estogram']
255+
if dat.shape[0] == len(DELTA) and dat.shape[-2] != len(DELTA):
256+
dat = np.transpose(dat)
257+
255258
nres = len(dat)
256259
d0mtrx = utils.read_d0mtrx(pdb)
257260
aas = utils.pdb2res(pdb)
@@ -414,9 +417,13 @@ def dat2ulr(pdb,pred,lddtG):
414417

415418
def main(npz,pdb,cstprefix=None):
416419
dat = np.load(npz)
420+
esto = dat['estogram']
421+
if esto.shape[0] == len(DELTA) and esto.shape[-2] != len(DELTA):
422+
esto = np.transpose(esto)
423+
417424
lddtG = np.mean(dat['lddt'])
418-
lddtG_lr = estimate_lddtG_from_lr(dat['estogram']) #this is long-range-only lddt
419-
ulrs = dat2ulr(pdb,dat['estogram'],lddtG_lr)
425+
lddtG_lr = estimate_lddtG_from_lr(esto) #this is long-range-only lddt
426+
ulrs = dat2ulr(pdb,esto,lddtG_lr)
420427

421428
ulr_exharm,weakcst,refcorr = ([],'spline',True)
422429
if '-exulr_from_harm' in sys.argv:

0 commit comments

Comments
 (0)