Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
guide to read .pdb files with pandas
import pandas as pd
colspecs = [(0, 6), (6, 11), (12, 16), (16, 17), (17, 20), (21, 22), (22, 26),
(26, 27), (30, 38), (38, 46), (46, 54), (54, 60), (60, 66), (76, 78),
(78, 80)]
names = ['ATOM', 'serial', 'name', 'altloc', 'resname', 'chainid', 'resseq',
'icode', 'x', 'y', 'z', 'occupancy', 'tempfactor', 'element', 'charge']
pdb = pd.read_fwf(pdb_path, names=names, colspecs=colspecs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment