Skip to content

Commit

Permalink
fixes a bug in visualization
Browse files Browse the repository at this point in the history
- different models than the first caused issues in visualizing
- atom offset corrected while parsing
- closes #89
- slight refactoring
  • Loading branch information
fkaiserbio committed Dec 1, 2020
1 parent c61e8d9 commit f6adff9
Show file tree
Hide file tree
Showing 5 changed files with 15,498 additions and 5 deletions.
5 changes: 4 additions & 1 deletion plip/structure/preparation.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ def parse_pdb(self):
corrected_line, newnum = self.fix_pdbline(line, lastnum)
if corrected_line is not None:
if corrected_line.startswith('MODEL'):
# reset atom number when new model is encountered
lastnum = 0
try: # Get number of MODEL (1,2,3)
model_num = int(corrected_line[10:14])
# initialize storage for new model
Expand All @@ -72,7 +74,8 @@ def parse_pdb(self):
other_models = True
except ValueError:
logger.debug(f'ignoring invalid MODEL entry: {corrected_line}')
lastnum = newnum
else:
lastnum = newnum
model_dict[current_model].append(corrected_line)
# select model
try:
Expand Down
Loading

0 comments on commit f6adff9

Please sign in to comment.