Last active
March 20, 2024 09:17
-
-
Save tbrittoborges/929ced78855945f3e296 to your computer and use it in GitHub Desktop.
guide to read .pdb files with pandas
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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