Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoSign in
Socket

fastpdb

Package Overview
Dependencies
Maintainers
2
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fastpdb - pypi Package Compare versions

Comparing version
1.2.0
to
1.3.0
+4
-4
.github/workflows/test_and_deploy.yml

@@ -18,3 +18,3 @@ ---

os: [ubuntu-latest, windows-latest, macos-latest]
py-version: ["3.9", "3.10", "3.11"]
py-version: ["3.10", "3.11", "3.12"]
runs-on: ${{ matrix.os }}

@@ -35,3 +35,3 @@ defaults:

- name: Install dependencies
run: pip install "maturin>=0.14,<0.15" "oldest-supported-numpy" pytest
run: pip install "maturin==1.4" "oldest-supported-numpy" pytest
- name: Build wheel

@@ -58,5 +58,5 @@ run: maturin build --release -i python -o dist

with:
python-version: "3.11"
python-version: "3.12"
- name: Install dependencies
run: pip install "maturin>=0.14,<0.15" pytest
run: pip install "maturin==1.4" pytest
- name: Build source distribution

@@ -63,0 +63,0 @@ run: maturin sdist -o dist

+136
-119

@@ -19,8 +19,2 @@ # This file is automatically @generated by Cargo.

name = "cfg-if"
version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
[[package]]
name = "cfg-if"
version = "1.0.0"

@@ -32,3 +26,3 @@ source = "registry+https://github.com/rust-lang/crates.io-index"

name = "fastpdb"
version = "1.2.0"
version = "1.3.0"
dependencies = [

@@ -41,44 +35,24 @@ "ndarray",

[[package]]
name = "indoc"
version = "0.3.6"
name = "heck"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "47741a8bc60fb26eb8d6e0238bbb26d8575ff623fdc97b1a2c00c050b9684ed8"
dependencies = [
"indoc-impl",
"proc-macro-hack",
]
checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
[[package]]
name = "indoc-impl"
version = "0.3.6"
name = "indoc"
version = "2.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ce046d161f000fffde5f432a0d034d0341dc152643b2598ed5bfce44c4f3a8f0"
dependencies = [
"proc-macro-hack",
"proc-macro2",
"quote",
"syn",
"unindent",
]
checksum = "1e186cfbae8084e513daff4240b4797e342f988cecda4fb6c939150f96315fd8"
[[package]]
name = "instant"
version = "0.1.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c"
dependencies = [
"cfg-if 1.0.0",
]
[[package]]
name = "libc"
version = "0.2.144"
version = "0.2.152"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b00cc1c228a6782d0f076e7b232802e0c5689d41bb5df366f2a6b6621cfdfe1"
checksum = "13e3bf6590cbc649f4d1a3eefc9d5d6eb746f5200ffb04e5e142700b8faa56e7"
[[package]]
name = "lock_api"
version = "0.4.9"
version = "0.4.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df"
checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45"
dependencies = [

@@ -91,5 +65,5 @@ "autocfg",

name = "matrixmultiply"
version = "0.3.7"
version = "0.3.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "090126dc04f95dc0d1c1c91f61bdd474b3930ca064c1edc8a849da2c6cbe1e77"
checksum = "7574c1cf36da4798ab73da5b215bbf444f50718207754cb522201d78d1cd0ff2"
dependencies = [

@@ -101,2 +75,11 @@ "autocfg",

[[package]]
name = "memoffset"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c"
dependencies = [
"autocfg",
]
[[package]]
name = "ndarray"

@@ -116,5 +99,5 @@ version = "0.15.6"

name = "num-complex"
version = "0.4.3"
version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "02e0d21255c828d6f128a1e41534206671e8c3ea0c62f32291e808dc82cff17d"
checksum = "1ba157ca0885411de85d6ca030ba7e2a83a28636056c7c699b07c8b6f7383214"
dependencies = [

@@ -136,5 +119,5 @@ "num-traits",

name = "num-traits"
version = "0.2.15"
version = "0.2.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd"
checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c"
dependencies = [

@@ -146,12 +129,13 @@ "autocfg",

name = "numpy"
version = "0.14.1"
version = "0.20.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09c15af63aa0c74e0f7230d4e95d9a3d71a23449905f30f50b055df9a6a6a3e6"
checksum = "bef41cbb417ea83b30525259e30ccef6af39b31c240bda578889494c5392d331"
dependencies = [
"cfg-if 0.1.10",
"libc",
"ndarray",
"num-complex",
"num-integer",
"num-traits",
"pyo3",
"rustc-hash",
]

@@ -161,13 +145,12 @@

name = "once_cell"
version = "1.17.2"
version = "1.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9670a07f94779e00908f3e686eab508878ebb390ba6e604d3a284c00e8d0487b"
checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
[[package]]
name = "parking_lot"
version = "0.11.2"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99"
checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f"
dependencies = [
"instant",
"lock_api",

@@ -179,44 +162,18 @@ "parking_lot_core",

name = "parking_lot_core"
version = "0.8.6"
version = "0.9.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "60a2cfe6f0ad2bfc16aefa463b497d5c7a5ecd44a23efa72aa342d90177356dc"
checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e"
dependencies = [
"cfg-if 1.0.0",
"instant",
"cfg-if",
"libc",
"redox_syscall",
"smallvec",
"winapi",
"windows-targets",
]
[[package]]
name = "paste"
version = "0.1.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "45ca20c77d80be666aef2b45486da86238fabe33e38306bd3118fe4af33fa880"
dependencies = [
"paste-impl",
"proc-macro-hack",
]
[[package]]
name = "paste-impl"
version = "0.1.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d95a7db200b97ef370c8e6de0088252f7e0dfff7d047a28528e47456c0fc98b6"
dependencies = [
"proc-macro-hack",
]
[[package]]
name = "proc-macro-hack"
version = "0.5.20+deprecated"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068"
[[package]]
name = "proc-macro2"
version = "1.0.59"
version = "1.0.76"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6aeca18b86b413c660b781aa319e4e2648a3e6f9eadc9b47e9038e6fe9f3451b"
checksum = "95fc56cda0b5c3325f5fbbd7ff9fda9e02bb00bb3dac51252d2f1bfa1cb8cc8c"
dependencies = [

@@ -228,12 +185,13 @@ "unicode-ident",

name = "pyo3"
version = "0.14.5"
version = "0.20.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "35100f9347670a566a67aa623369293703322bb9db77d99d7df7313b575ae0c8"
checksum = "9a89dc7a5850d0e983be1ec2a463a171d20990487c3cfcd68b5363f1ee3d6fe0"
dependencies = [
"cfg-if 1.0.0",
"cfg-if",
"indoc",
"libc",
"memoffset",
"parking_lot",
"paste",
"pyo3-build-config",
"pyo3-ffi",
"pyo3-macros",

@@ -245,15 +203,27 @@ "unindent",

name = "pyo3-build-config"
version = "0.14.5"
version = "0.20.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d12961738cacbd7f91b7c43bc25cfeeaa2698ad07a04b3be0aa88b950865738f"
checksum = "07426f0d8fe5a601f26293f300afd1a7b1ed5e78b2a705870c5f30893c5163be"
dependencies = [
"once_cell",
"target-lexicon",
]
[[package]]
name = "pyo3-ffi"
version = "0.20.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dbb7dec17e17766b46bca4f1a4215a85006b4c2ecde122076c562dd058da6cf1"
dependencies = [
"libc",
"pyo3-build-config",
]
[[package]]
name = "pyo3-macros"
version = "0.14.5"
version = "0.20.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc0bc5215d704824dfddddc03f93cb572e1155c68b6761c37005e1c288808ea8"
checksum = "05f738b4e40d50b5711957f142878cfa0f28e054aa0ebdfc3fd137a843f74ed3"
dependencies = [
"proc-macro2",
"pyo3-macros-backend",

@@ -266,8 +236,8 @@ "quote",

name = "pyo3-macros-backend"
version = "0.14.5"
version = "0.20.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "71623fc593224afaab918aa3afcaf86ed2f43d34f6afde7f3922608f253240df"
checksum = "0fc910d4851847827daf9d6cdd4a823fbdaab5b8818325c5e97a86da79e8881f"
dependencies = [
"heck",
"proc-macro2",
"pyo3-build-config",
"quote",

@@ -279,5 +249,5 @@ "syn",

name = "quote"
version = "1.0.28"
version = "1.0.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488"
checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef"
dependencies = [

@@ -295,5 +265,5 @@ "proc-macro2",

name = "redox_syscall"
version = "0.2.16"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a"
checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa"
dependencies = [

@@ -304,18 +274,24 @@ "bitflags",

[[package]]
name = "scopeguard"
name = "rustc-hash"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
[[package]]
name = "scopeguard"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
[[package]]
name = "smallvec"
version = "1.10.0"
version = "1.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0"
checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970"
[[package]]
name = "syn"
version = "1.0.109"
version = "2.0.48"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f"
dependencies = [

@@ -328,33 +304,74 @@ "proc-macro2",

[[package]]
name = "target-lexicon"
version = "0.12.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "69758bda2e78f098e4ccb393021a0963bb3442eac05f135c30f61b7370bbafae"
[[package]]
name = "unicode-ident"
version = "1.0.9"
version = "1.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0"
checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
[[package]]
name = "unindent"
version = "0.1.11"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e1766d682d402817b5ac4490b3c3002d91dfa0d22812f341609f97b08757359c"
checksum = "c7de7d73e1754487cb58364ee906a499937a0dfabd86bcb980fa99ec8c8fa2ce"
[[package]]
name = "winapi"
version = "0.3.9"
name = "windows-targets"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c"
dependencies = [
"winapi-i686-pc-windows-gnu",
"winapi-x86_64-pc-windows-gnu",
"windows_aarch64_gnullvm",
"windows_aarch64_msvc",
"windows_i686_gnu",
"windows_i686_msvc",
"windows_x86_64_gnu",
"windows_x86_64_gnullvm",
"windows_x86_64_msvc",
]
[[package]]
name = "winapi-i686-pc-windows-gnu"
version = "0.4.0"
name = "windows_aarch64_gnullvm"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
[[package]]
name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"
name = "windows_aarch64_msvc"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
[[package]]
name = "windows_i686_gnu"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
[[package]]
name = "windows_i686_msvc"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
[[package]]
name = "windows_x86_64_gnu"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
[[package]]
name = "windows_x86_64_msvc"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
[package]
name = "fastpdb"
version = "1.2.0"
version = "1.3.0"
edition = "2018"
[dependencies]
numpy = "0.14"
numpy = "0.20"
ndarray = "0.15"
[dependencies.pyo3]
version = "0.14"
version = "0.20"
features = ["extension-module"]

@@ -16,2 +16,2 @@

name = "fastpdb"
crate-type = ["cdylib"]
crate-type = ["cdylib"]
Metadata-Version: 2.1
Name: fastpdb
Version: 1.2.0
Version: 1.3.0
Classifier: Development Status :: 5 - Production/Stable

@@ -13,3 +13,3 @@ Classifier: Intended Audience :: Science/Research

Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
Requires-Dist: biotite >= 0.37
Requires-Dist: biotite >=0.39
License-File: LICENSE

@@ -16,0 +16,0 @@ Summary: A high performance drop-in replacement for Biotite's PDBFile.

[project]
name = "fastpdb"
version = "1.2.0"
version = "1.3.0"
description = "A high performance drop-in replacement for Biotite's PDBFile."

@@ -28,3 +28,3 @@ readme = "README.rst"

dependencies = [
"biotite >= 0.37"
"biotite >= 0.39"
]

@@ -42,5 +42,5 @@

requires = [
"maturin>=0.14,<0.15",
"maturin==1.4",
"oldest-supported-numpy"
]
build-backend = "maturin"
__name__ = "fastpdb"
__author__ = "Patrick Kunzmann"
__all__ = ["PDBFile"]
__version__ = "1.2.0"
__version__ = "1.3.0"
import os
import warnings
import numpy as np

@@ -19,3 +20,3 @@ from biotite.file import is_text

self._pdb_file = RustPDBFile([])
@staticmethod

@@ -34,11 +35,11 @@ def read(file):

pdb_file._pdb_file = RustPDBFile(file.read().splitlines())
# Synchronize with PDB file representation in Rust
# Synchronize with PDB file representation in Rust
pdb_file.lines = pdb_file._pdb_file.lines
pdb_file._index_models_and_atoms()
return pdb_file
def get_model_count(self):
return self._pdb_file.get_model_count()
def get_remark(self, number):

@@ -53,7 +54,7 @@ return self._pdb_file.parse_remark(int(number))

return coord
def get_structure(self, model=None, altloc="first", extra_fields=None, include_bonds=False):
"""
Get an :class:`AtomArray` or :class:`AtomArrayStack` from the PDB file.
Parameters

@@ -92,3 +93,3 @@ ----------

does not support bond orders.
Returns

@@ -115,3 +116,3 @@ -------

if model is None:

@@ -139,7 +140,7 @@ coord = self._pdb_file.parse_coord_multi_model()

ins_code = np.frombuffer(ins_code, dtype="U1")
res_name = np.frombuffer(res_name, dtype="U3")
res_name = np.frombuffer(res_name, dtype="U5")
atom_name = np.frombuffer(atom_name, dtype="U6")
element = np.frombuffer(element, dtype="U2")
altloc_id = np.frombuffer(altloc_id, dtype="U1")
if coord.ndim == 3:

@@ -159,6 +160,6 @@ atoms = struc.AtomArrayStack(coord.shape[0], coord.shape[1])

atoms.element = element
for field in (extra_fields if extra_fields is not None else []):
if field == "atom_id":
# Copy is necessary to avoid double masking in
# Copy is necessary to avoid double masking in
# later altloc ID filtering

@@ -175,7 +176,10 @@ atoms.set_annotation("atom_id", atom_id.copy())

box = self._pdb_file.parse_box()
if box is None:
atoms.box = None
else:
try:
box = self._pdb_file.parse_box()
except:
warnings.warn(
"File contains invalid 'CRYST1' record, box is ignored"
)
if box is not None:
len_a, len_b, len_c, alpha, beta, gamma = box

@@ -192,4 +196,4 @@ box = struc.vectors_from_unitcell(

)
# Filter altloc IDs

@@ -210,4 +214,4 @@ if altloc == "occupancy":

raise ValueError(f"'{altloc}' is not a valid 'altloc' option")
if include_bonds:

@@ -222,4 +226,4 @@ bond_list = struc.BondList(

return atoms
def set_structure(self, atoms):

@@ -229,3 +233,3 @@ """

file.
This makes also use of the optional annotation arrays

@@ -236,3 +240,3 @@ ``'atom_id'``, ``'b_factor'``, ``'occupancy'`` and ``'charge'``.

continuous numbering.
Parameters

@@ -244,3 +248,3 @@ ----------

model.
Notes

@@ -267,12 +271,12 @@ -----

)
# Write 'ATOM' and 'MODEL' records
# Convert Unicode arrays into uint32 arrays for usage in Rust
chain_id = np.frombuffer(atoms.chain_id, dtype=np.uint32).reshape(-1, 4)
ins_code = np.frombuffer(atoms.ins_code, dtype=np.uint32).reshape(-1, 1)
res_name = np.frombuffer(atoms.res_name, dtype=np.uint32).reshape(-1, 3)
atom_name = np.frombuffer(atoms.atom_name, dtype=np.uint32).reshape(-1, 6)
element = np.frombuffer(atoms.element, dtype=np.uint32).reshape(-1, 2)
chain_id = _convert_unicode_to_uint32(atoms.chain_id)
ins_code = _convert_unicode_to_uint32(atoms.ins_code)
res_name = _convert_unicode_to_uint32(atoms.res_name)
atom_name = _convert_unicode_to_uint32(atoms.atom_name)
element = _convert_unicode_to_uint32(atoms.element)
categories = atoms.get_annotation_categories()

@@ -296,7 +300,7 @@ atom_id = atoms.atom_id if "atom_id" in categories else None

charge = charge.astype(np.int64, copy=False)
# Treat a single model as multi-model structure
if coord.ndim == 2:
coord = coord[np.newaxis, :, :]
self._pdb_file.write_models(

@@ -307,3 +311,3 @@ coord, chain_id, res_id, ins_code,

)
# Write 'CONECT' records

@@ -331,7 +335,7 @@ if atoms.bonds is not None:

# Synchronize with PDB file representation in Rust
# Synchronize with PDB file representation in Rust
self.lines = self._pdb_file.lines
self._index_models_and_atoms()
def _index_models_and_atoms(self):

@@ -341,1 +345,16 @@ self._pdb_file.index_models_and_atoms()

self._atom_line_i = self._pdb_file.atom_line_i
def _convert_unicode_to_uint32(array):
"""
Convert a unicode string array into a 2D uint32 array.
The second dimension corresponds to the character position within a
string.
"""
dtype = array.dtype
if not np.issubdtype(dtype, np.str_):
raise TypeError("Expected unicode string array")
length = array.shape[0]
n_char = dtype.itemsize // 4
return np.frombuffer(array, dtype=np.uint32).reshape(length, n_char)

@@ -46,3 +46,3 @@ //! Low-level PDB file parsing and writing.

impl PDBFile {
/// Create an new [`PDBFile`].

@@ -103,3 +103,3 @@ /// The lines of text are given to `lines`.

/// Get the number of models contained in the file.

@@ -185,3 +185,3 @@ fn get_model_count(&self) -> usize {

/// The returned tuple contains the following annotations in the given order:
///
///
/// - `chain_id`

@@ -217,7 +217,7 @@ /// - `res_id`

let atom_line_i: Vec<usize> = self.get_atom_indices(model)?;
let mut chain_id: Array<u32, Ix2> = Array::zeros((atom_line_i.len(), 4));
let mut res_id: Array<i64, Ix1> = Array::zeros(atom_line_i.len());
let mut ins_code: Array<u32, Ix2> = Array::zeros((atom_line_i.len(), 1));
let mut res_name: Array<u32, Ix2> = Array::zeros((atom_line_i.len(), 3));
let mut res_name: Array<u32, Ix2> = Array::zeros((atom_line_i.len(), 5));
let mut hetero: Array<bool, Ix1> = Array::default(atom_line_i.len());

@@ -227,3 +227,3 @@ let mut atom_name: Array<u32, Ix2> = Array::zeros((atom_line_i.len(), 6));

let mut altloc_id: Array<u32, Ix2> = Array::zeros((atom_line_i.len(), 1));
let mut atom_id: Array<i64, Ix1>;

@@ -258,3 +258,3 @@ if include_atom_id {

}
// Iterate over ATOM and HETATM records to write annotation arrays

@@ -302,3 +302,3 @@ for (atom_i, line_i) in atom_line_i.iter().enumerate() {

}
Python::with_gil(|py| {

@@ -336,3 +336,3 @@ Ok((

});
// Cannot preemptively determine number of bonds

@@ -420,7 +420,7 @@ // -> Memory allocation for all bonds is not possible

let mut suffix: Vec<String> = Vec::new();
for i in 0..coord.shape()[1] {
let element_i = parse_string_from_array(&element, i)?;
let atom_name_i = parse_string_from_array(&atom_name, i)?;
prefix.push(format!(

@@ -461,3 +461,3 @@ "{:6}{:>5} {:4} {:>3} {:1}{:>4}{:1} ",

}
for atom_i in 0..coord.shape()[1] {
for atom_i in 0..coord.shape()[1] {
let coord_string = format!(

@@ -484,3 +484,3 @@ "{:>8.3}{:>8.3}{:>8.3}",

/// to atom indices.
fn write_bonds(&mut self,
fn write_bonds(&mut self,
bonds: Py<PyArray<i32, Ix2>>,

@@ -491,3 +491,3 @@ atom_id: Py<PyArray<i64, Ix1>>) -> PyResult<()> {

let atom_id = atom_id.as_ref(py).to_owned_array();
for (center_i, bonded_indices) in bonds.outer_iter().enumerate() {

@@ -567,3 +567,3 @@ let mut n_added: usize = 0;

},
None => {

@@ -607,3 +607,3 @@ let length = self.get_model_length()?;

}
// Get the start and stop line index for this model index

@@ -617,3 +617,3 @@ let (model_start, model_stop) = match model_i.cmp(&(self.model_start_i.len() as isize - 1)){

Ordering::Equal => (
self.model_start_i[model_i as usize],
self.model_start_i[model_i as usize],
self.lines.len()

@@ -624,3 +624,3 @@ ),

};
// Get the atom records within these line boundaries

@@ -633,4 +633,4 @@ Ok(

}
/// Get the number of atoms in each model of the PDB file.

@@ -655,3 +655,3 @@ /// A `PyErr` is returned if the number of atoms per model differ from each other.

}
match length {

@@ -658,0 +658,0 @@ None => panic!("Length cannot be 'None'"),