chisurf.fio.structure.coordinates module¶
Read PDB files.
PDB files contain atomic coordinates.
- Author
Requirements¶
Revisions¶
Notes
The API is not stable yet and might change between revisions.
References
Examples
-
chisurf.fio.structure.coordinates.
assign_element_to_atom_name
(atom_name: 'str')[source]¶ Tries to guess element from atom name if not recognised.
- Parameters
atom_name (
str
) – string
Examples
>>> assign_element_to_atom_name('CA') C
-
chisurf.fio.structure.coordinates.
fetch_pdb_string
(pdb_id: 'str') → 'str'[source]¶ Downloads from the RCSB a PDB file with the specified PDB-ID
- Parameters
pdb_id (
str
) – The PDB-ID that is downloadedget_binary – If get_binary is True a binary string is returned.
- Return type
str
- Returns
-
chisurf.fio.structure.coordinates.
get_atom_index
(atoms: 'np.array', chain_identifier: 'str', residue_seq_number: 'int', atom_name: 'str', residue_name: 'str', **kwargs)[source]¶ Get the atom index by the the identifier
- Parameters
atoms (
array
) –chain_identifier (
str
) –residue_seq_number (
int
) –atom_name (
str
) –residue_name (
str
) –kwargs –
- Returns
-
chisurf.fio.structure.coordinates.
parse_string_pdb
(string: 'str', assign_charge: 'bool' = False, verbose: 'bool' = False)[source]¶ - Parameters
string (
str
) –assign_charge (
bool
) –verbose (
bool
) –
- Returns
-
chisurf.fio.structure.coordinates.
read
(filename: 'str', assign_charge: 'bool' = False, verbose: 'bool' = False, **kwargs) → 'np.ndarray'[source]¶ Open pdb_file and read each line into pdb (a list of lines)
- Parameters
filename (
str
) –assign_charge (
bool
) –
- Return type
ndarray
- Returns
numpy structured array containing the PDB info and VdW-radii and charges
Examples
>>> import chisurf.fio >>> pdb_file = './test/data/atomic_coordinates/pdb_files/hGBP1_closed.pdb' >>> pdb = chisurf.fio.structure.coordinates.read(pdb_file, verbose=True) >>> pdb[:5] array([ (0, ' ', 7, 'MET', 1, 'N', 'N', [72.739, -17.501, 8.879], 0.0, 1.65, 0.0, 14.0067), (1, ' ', 7, 'MET', 2, 'CA', 'C', [73.841, -17.042, 9.747], 0.0, 1.76, 0.0, 12.0107), (2, ' ', 7, 'MET', 3, 'C', 'C', [74.361, -18.178, 10.643], 0.0, 1.76, 0.0, 12.0107), (3, ' ', 7, 'MET', 4, 'O', 'O', [73.642, -18.708, 11.489], 0.0, 1.4, 0.0, 15.9994), (4, ' ', 7, 'MET', 5, 'CB', 'C', [73.384, -15.89, 10.649], 0.0, 1.76, 0.0, 12.0107)], dtype=[('i', '<i4'), ('chain', 'S1'), ('res_id', '<i4'), ('res_name', 'S5'), ('atom_id', '<i4'), ('atom_name', 'S5 '), ('element', 'S1'), ('xyz', '<f8', (3,)), ('charge', '<f8'), ('radius', '<f8'), ('bfactor', '<f8'), ('mass', '<f8') ])
-
chisurf.fio.structure.coordinates.
write_pdb
(filename: 'str', atoms=None, append_model: 'bool' = False, append_coordinates: 'bool' = False, verbose: 'bool' = False)[source]¶ Writes a structured numpy array containing the PDB-info to a PDB-file
If append_model and append_coordinates are False the file is overwritten. Otherwise the atomic-coordinates are appended to the existing file.
- Parameters
filename (
str
) – target-filenameatoms – structured numpy array
append_model (
bool
) – bool If True the atoms are appended as a new modelsappend_coordinates (
bool
) – If True the coordinates are appended to the file
-
chisurf.fio.structure.coordinates.
write_points
(filename: 'str', points: 'np.ndarray', verbose: 'bool' = False, mode: 'str' = 'xyz', density: 'np.ndarray' = None)[source]¶ - Parameters
filename (
str
) –points (
ndarray
) –verbose (
bool
) –mode (
str
) –density (
Optional
[ndarray
]) –
- Returns
-
chisurf.fio.structure.coordinates.
write_xyz
(filename: 'str', points: 'np.array', verbose: 'bool' = False)[source]¶ Writes the points as xyz-format file. The xyz-format file can be opened and displayed for instance in PyMol
- Parameters
filename (
str
) – stringpoints (
array
) – arrayverbose (
bool
) – bool