pyKVFinder.read_xyz
- pyKVFinder.read_xyz(fn: str | Path, vdw: Dict[str, Dict[str, float]] | None = None) ndarray [source]
Reads XYZ file into numpy.ndarrays.
- Parameters:
fn (Union[str, pathlib.Path]) – A path to XYZ file.
vdw (Dict[str, Dict[str, float]], optional) – A dictionary containing radii values, by default None. If None, use output of
read_vdw()
.
- Returns:
atomic – A numpy array with atomic data (residue number, chain, residue name, atom name, xyz coordinates and radius) for each atom.
- Return type:
numpy.ndarray
- Raises:
TypeError – fn must be a string or a pathlib.Path.
Note
The van der Waals radii file defines the radius values for each atom by residue and when not defined, it uses a generic value based on the atom type. The function by default loads the built-in van der Waals radii file: vdw.dat.
See also
read_vdw
,read_pdb
,get_vertices
,get_vertices_from_file
,detect
,constitutional
,hydropathy
Example
With the vdW radii dictionary loaded with
pyKVFinder.read_vdw
, we can read a target XYZ file into Numpy arrays (atomic information and atomic coordinates):>>> import os >>> import pyKVFinder >>> from pyKVFinder import read_xyz >>> xyz = os.path.join(os.path.dirname(pyKVFinder.__file__), 'data', 'tests', '1FMO.xyz') >>> atomic = read_xyz(xyz) >>> atominfo array([['1', 'A', 'UNK', ..., '-15.642', '-14.858', '1.97'], ['2', 'A', 'UNK', ..., '-14.62', '-15.897', '1.66'], ['3', 'A', 'UNK', ..., '-13.357', '-15.508', '1.66'], ..., ['2790', 'A', 'UNK', ..., '18.878', '-9.885', '1.66'], ['2791', 'A', 'UNK', ..., '17.624001', '-9.558', '1.66'], ['2792', 'A', 'UNK', ..., '19.233999', '-13.442', '1.69']], dtype='<U32')
Warning
The function takes the built-in dictionary when the
vdw
argument is not specified. If you wish to use a custom van der Waals radii file, you must read it withread_vdw
as shown earlier and pass it asread_xyz(xyz, vdw=vdw)
.