I am editting a PDB file. I successfully edit the columns using pandas but I can not write the right spacing between the column. My PDB file looks like this:
HETATM 4 OM MEG A 1 -13.151 3.216 0.791 O
I name the columns as ['A','B','C','D',..............] I control the spaces like this:
dx['I'] = dx['I'].map('{:8.3f}'.format)
If anyone is sure that Biopython can do this, please tell me how?
Mensur Dlakic Thanks a lot for the reply. My PDB file still not working. What is the best tool to edit pdb files?
I have no idea what the best tool is to edit PDB files, as I usually have no need for it. On those rare occasions when the editing is needed, I use Wordpad.
Also,
editing a PDB file
is a bit of a general statement. Most people would have no need to edit the headers of the descriptive portion of the file. Most definitely atom coordinates should not be edited. So if by editing you mean extracting a certain chain, or renumbering the residues, BioPython has functions for those tasks, and there are many other programs that can do the same. PDB files and their parsers existed way beforepandas
was invented.Mensur Dlakic Thanks! I had a PDB file for a polymer with one chain, the chain is 3 molecules old, I need it to be 400+ molecules. I did that with pandas, but I can not put the right spaces between columns.