Skip to content

Commit

Permalink
Remove 'None' states
Browse files Browse the repository at this point in the history
The split states algorithm added atoms without alt codes in a residue
that already had other atoms with alt codes to a new state since called
'None'. Now, these are copied to all states.
  • Loading branch information
benjiemc committed Sep 29, 2023
1 parent 99ab368 commit 6a5c59d
Show file tree
Hide file tree
Showing 3 changed files with 7,747 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/python_pdb/entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -573,10 +573,15 @@ def split_states(self, all_combinations=False):
residue_states = {}

for atom in residue:
if atom.alt_loc not in residue_states:
residue_states[atom.alt_loc] = Residue(residue.name, residue.seq_id, residue.insert_code)
if atom.alt_loc:
if atom.alt_loc not in residue_states:
residue_states[atom.alt_loc] = Residue(residue.name, residue.seq_id, residue.insert_code)

residue_states[atom.alt_loc].add_atom(atom.copy())
residue_states[atom.alt_loc].add_atom(atom.copy())

else:
for residue_state in residue_states.values():
residue_state.add_atom(atom.copy())

conformations.append([(model_serial_number, chain_name, res) for res in residue_states.values()])

Expand Down
Loading

0 comments on commit 6a5c59d

Please sign in to comment.