add-elem-info¶
Overview¶
add-elem-info repairs the element-symbol columns (77–78) of ATOM/HETATM
records in a PDB file.
Output behavior¶
If
-o/--outis omitted and--overwriteis notTrue, the output is written to<input>_add_elem.pdb(i.e., it replaces a trailing.pdbwith_add_elem.pdb).If
--overwrite Trueand-o/--outis omitted, the input file is overwritten in-place. When-o/--outis supplied,--overwriteis ignored.
Usage¶
pdb2reaction add-elem-info -i INPUT.pdb [-o OUTPUT.pdb] [--overwrite {True\|False}]
Examples¶
# Populate element fields and write to "<input>_add_elem.pdb"
pdb2reaction add-elem-info -i 1abc.pdb
# Write to a specific output file
pdb2reaction add-elem-info -i 1abc.pdb -o 1abc_fixed.pdb
# Overwrite the input file in-place
pdb2reaction add-elem-info -i 1abc.pdb --overwrite True
Workflow¶
Parse the input file with
Bio.PDB.PDBParser, mirroring the residue definitions used inextract.py(AMINO_ACIDS,WATER_RES,ION).For each atom, guess the element by combining the atom name, residue name, and whether the record is HETATM:
Monatomic ion residues in the
IONdict: use the corresponding element.Proteins/nucleic acids/water: apply special handling for H/D, Se, and first-letter mapping for C/N/O/P/S; carbon side-chain labels default to C.
Other ligands: use atom-name prefixes and fall back to element-symbol normalization (recognizing halogens, deuterium → hydrogen, etc.).
Write the structure through
PDBIO:default output:
<input>_add_elem.pdb(when-o/--outis omitted and--overwriteis notTrue)-o/--out: write to the specified path;--overwriteis ignored when this is provided--overwrite True(without-o/--out): overwrite the input path in-place
Print a summary reporting how many atoms were assigned/reassigned, plus per-element totals and a truncated list of unresolved atoms.
CLI options¶
Option |
Description |
Default |
|---|---|---|
|
Input PDB file. |
Required |
|
Output path. When set, |
None → |
|
Overwrite the input file in-place when |
|
Outputs¶
A PDB file with element symbols populated/corrected:
<input>_add_elem.pdbby default (when-o/--outis omitted and--overwriteis notTrue)OUTPUT.pdbif-o/--outis provided (regardless of--overwrite)INPUT.pdboverwritten in-place if--overwrite Trueis set without-o/--out
Console report with totals for processed/assigned atoms, per-element counts, and up to 50 unresolved atoms.
Notes¶
Only columns 77–78 are modified; coordinates, occupancies, B-factors, charges, altlocs, insertion codes, and record ordering stay untouched.
ATOM and HETATM records across all models/chains/residues are supported.
Deuterium labels map to hydrogen; selenium (
SE*) and halogens are recognized automatically.