Skip to content

Commit

Permalink
Merge pull request #133 from rigdenlab/changes
Browse files Browse the repository at this point in the history
Changes
  • Loading branch information
hlasimpk committed Aug 26, 2020
2 parents edc8000 + bd24942 commit c1bcc80
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 19,011 deletions.
24 changes: 24 additions & 0 deletions simbad/util/pdb_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,30 @@ def select_chain_by_id(self, chain_id):
if chain.name != chain_id:
model.remove_chain(chain.name)

def select_residues(self, delete=None, to_keep=None, delete_idx=None, to_keep_idx=None):
self.keep_first_model_only()
self.keep_first_chain_only()
to_remove = []
chain = self.structure[0][0]
for i, residue in enumerate(chain):
if (delete_idx or to_keep_idx) and residue.het_flag == "H":
continue
remove = False
if delete and residue.seqid in delete:
remove = True
elif delete_idx and i in delete:
remove = True
elif to_keep and residue.seqid not in to_keep:
remove = True
elif to_keep_idx and i not in to_keep_idx:
remove = True
if remove:
to_remove.append(i)

# iterate over in reverse so indices don't change
for i in to_remove[::-1]:
del chain[i]

def standardize(self):
self.structure.remove_hydrogens()
self.structure.remove_ligands_and_waters()
Expand Down

0 comments on commit c1bcc80

Please sign in to comment.