Skip to content

Commit

Permalink
Drop unexpected columsn when writing PDB dataframes #124
Browse files Browse the repository at this point in the history
  • Loading branch information
a-r-j authored Apr 21, 2023
1 parent 1ff101c commit 7674e37
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions biopandas/pdb/pandas_pdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,9 @@ def to_pdb(self, path, records=None, gz=False, append_newline=True):

dfs = {r: self.df[r].copy() for r in records if not self.df[r].empty}

# Drop unexpected columns
dfs = {k: v[[pdb_df_columns]] for k, v in dfs.items() if k in {"ATOM", "HETATM"}}

for r in dfs:
for col in pdb_records[r]:
dfs[r][col["id"]] = dfs[r][col["id"]].apply(col["strf"])
Expand Down

0 comments on commit 7674e37

Please sign in to comment.