Skip to content

Commit 7674e37

Browse files
authored
Drop unexpected columsn when writing PDB dataframes #124
1 parent 1ff101c commit 7674e37

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

biopandas/pdb/pandas_pdb.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -610,6 +610,9 @@ def to_pdb(self, path, records=None, gz=False, append_newline=True):
610610

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

613+
# Drop unexpected columns
614+
dfs = {k: v[[pdb_df_columns]] for k, v in dfs.items() if k in {"ATOM", "HETATM"}}
615+
613616
for r in dfs:
614617
for col in pdb_records[r]:
615618
dfs[r][col["id"]] = dfs[r][col["id"]].apply(col["strf"])

0 commit comments

Comments
 (0)