Skip to content

Commit e7f7123

Browse files
authored
Merge pull request #22 from MobleyLab/beta_sheet_fix
Fix an issue where compact beta sheet proteins had too few candidate protein atoms
2 parents 3705ba5 + e48edbd commit e7f7123

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

boresch_restraints.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,16 @@ def protein_list(traj, l1, residues2exclude=None):
213213
sec_struc = ['H', 'E']
214214
for inx, b in enumerate(structure):
215215

216+
# We will trim the first and last few residues in a stable element of secondary structure
217+
# to avoid getting (potentially) floppy terminal residues in our restraints
218+
# Beta sheets may be shorter than alpha helices so prune differently depending on structure type
219+
if b == 'H':
220+
trim_length = 3
221+
else:
222+
trim_length = 2
223+
224+
#TODO: There are code references here to 'helix' that really ought to refer to whichever secondary structure element we're looking at
225+
216226
if b in sec_struc and skip_start-1 < inx < (len(structure) - skip_end):
217227
# look for a start of a helix
218228
if structure[inx - 1] != b:
@@ -228,14 +238,14 @@ def protein_list(traj, l1, residues2exclude=None):
228238
# Find end of helix
229239
elif structure[inx - 4:inx + 1].count(b) == 5 and structure[inx + 1] != b and start_helix == True:
230240
helix.append('resid ' + str(inx))
231-
# Leave out first 3 and last 3 residues of loop/sheet
232-
ex.append(helix[3:-3])
241+
# Leave out first N residues of loop/sheet
242+
ex.append(helix[trim_length:-trim_length])
233243

234244
# If structure ends with helix account for that
235245
elif structure[inx - 4:inx + 1].count(b) == 5 and inx + 1 == (len(structure) - 6) and start_helix == True:
236246
helix.append('resid ' + str(inx))
237-
# Leave out first 3 and last 3 residues of loop/sheet
238-
ex.append(helix[3:-3])
247+
# Leave out first N residues of loop/sheet
248+
ex.append(helix[trim_length:-trim_length])
239249
else:
240250
if start_helix == True:
241251
helix.append('resid ' + str(inx))
@@ -248,10 +258,10 @@ def protein_list(traj, l1, residues2exclude=None):
248258
# Discard atoms with RMSF > 0.1
249259
indices = [heavy_protein_full.index(h) for h in heavy_protein]
250260
heavy_protein = [h for inx, h in enumerate(heavy_protein) if rmsf[indices[inx]] < 0.1]
251-
261+
252262
#If no protein atoms found, raise exception
253263
if len(heavy_protein) == 0:
254-
raise ValueError('No protein atoms found. Check input files, e.g. check if periodic boundary conditions were removed from trajectory')
264+
raise ValueError('No protein atoms found. Check input files, e.g. check if periodic boundary conditions were removed from trajectory')
255265

256266
#if a list of residue indices is provided: exclude those residues
257267
else:

0 commit comments

Comments
 (0)