Skip to content

Commit

Permalink
skip missing pdbx columns
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruibin-Liu committed Oct 4, 2023
1 parent 43e60d9 commit 8423ed4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions moldf/pdb_dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,13 @@ def _pdbx_to_pdb(self, keep_original: bool = False):
keep_original (optional): whether to keep the original columns in the PDBx
'_atom_site' DataFrame. Defaults to **False**.
"""
for pdb_name, pdbx_name in PDBX_COLS.items():
pdbx_cols = {k: v for k, v in PDBX_COLS.items() if v in self.columns}
for pdb_name, pdbx_name in pdbx_cols.items():
self[pdb_name] = self[pdbx_name]
if not keep_original:
drop_columns = [col for col in self.columns if col not in PDBX_COLS.keys()]
drop_columns = [col for col in self.columns if col not in pdbx_cols.keys()]
self.drop(columns=drop_columns, inplace=True)
self._pdb_format = "PDBx"
self = self[list(PDBX_COLS.keys())]

@property
def pdb_format(self) -> str:
Expand Down

0 comments on commit 8423ed4

Please sign in to comment.