bfactor_csv¶
Transfer a per-residue numeric column from a CSV into the B-factor column of a PDB.
Prompts for CSV path, PDB path, and the CSV column to transfer.
- CSV must identify residues by columns (case-insensitive):
Chain -> one of: [“chain”, “Chain”, “CHAIN”] (optional; blank if absent)
ResSeq -> one of: [“resseq”,”resseqid”,”resnum”,”res_seq”,”residue”,”Residue”,”resid”,”ResID”,”ResSeq”] (required)
ICode -> one of: [“icode”,”inscode”,”insertion”,”iCode”,”ICode”] (optional; blank if absent)
Column chosen must be numeric; duplicates per residue key are not allowed.
Every residue present in the PDB must be present exactly once in the CSV mapping.
Non-ATOM/HETATM (e.g., HEADER, TER, REMARK) are preserved as-is.
Output: <pdb_stem>_bfactor_from_csv_<col>.pdb
Module Contents¶
Functions¶
|
|
|
|
|
|
|
Return (chain, resseq, icode) from ATOM/HETATM line. |
|
Overwrite B-factor (cols 61-66, 1-based) with {:6.3f}, preserve occupancy. |
|
|
|
|
|
- bfactor_csv.die(msg: str, code: int = 1)¶
- bfactor_csv.ask_path(prompt: str, default: str | None = None) str¶
- bfactor_csv.is_atom_record(line: str) bool¶
- bfactor_csv.residue_key_from_pdb_line(line: str) Tuple[str, str, str]¶
Return (chain, resseq, icode) from ATOM/HETATM line.
- bfactor_csv.format_bfactor(line: str, b: float) str¶
Overwrite B-factor (cols 61-66, 1-based) with {:6.3f}, preserve occupancy.
- bfactor_csv.find_column(df: pandas.DataFrame, candidates) str | None¶
- bfactor_csv.sanitize_for_filename(s: str) str¶
- bfactor_csv.main()¶