biotite 1.3.0__cp312-cp312-macosx_10_13_x86_64.whl → 1.5.0__cp312-cp312-macosx_10_13_x86_64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of biotite might be problematic. Click here for more details.
- biotite/application/dssp/app.py +63 -6
- biotite/database/afdb/download.py +12 -6
- biotite/database/rcsb/download.py +1 -0
- biotite/database/rcsb/query.py +2 -2
- biotite/interface/pymol/object.py +3 -1
- biotite/interface/rdkit/mol.py +5 -5
- biotite/sequence/align/banded.cpython-312-darwin.so +0 -0
- biotite/sequence/align/kmeralphabet.cpython-312-darwin.so +0 -0
- biotite/sequence/align/kmersimilarity.cpython-312-darwin.so +0 -0
- biotite/sequence/align/kmertable.cpython-312-darwin.so +0 -0
- biotite/sequence/align/localgapped.cpython-312-darwin.so +0 -0
- biotite/sequence/align/localungapped.cpython-312-darwin.so +0 -0
- biotite/sequence/align/multiple.cpython-312-darwin.so +0 -0
- biotite/sequence/align/pairwise.cpython-312-darwin.so +0 -0
- biotite/sequence/align/permutation.cpython-312-darwin.so +0 -0
- biotite/sequence/align/selector.cpython-312-darwin.so +0 -0
- biotite/sequence/align/tracetable.cpython-312-darwin.so +0 -0
- biotite/sequence/codec.cpython-312-darwin.so +0 -0
- biotite/sequence/phylo/nj.cpython-312-darwin.so +0 -0
- biotite/sequence/phylo/tree.cpython-312-darwin.so +0 -0
- biotite/sequence/phylo/upgma.cpython-312-darwin.so +0 -0
- biotite/structure/atoms.py +1 -1
- biotite/structure/bonds.cpython-312-darwin.so +0 -0
- biotite/structure/bonds.pyx +67 -6
- biotite/structure/box.py +1 -1
- biotite/structure/celllist.cpython-312-darwin.so +0 -0
- biotite/structure/chains.py +34 -0
- biotite/structure/charges.cpython-312-darwin.so +0 -0
- biotite/structure/compare.py +2 -0
- biotite/structure/filter.py +2 -1
- biotite/structure/geometry.py +164 -2
- biotite/structure/info/atoms.py +8 -0
- biotite/structure/info/components.bcif +0 -0
- biotite/structure/io/pdb/convert.py +1 -0
- biotite/structure/io/pdb/file.py +31 -7
- biotite/structure/io/pdb/hybrid36.cpython-312-darwin.so +0 -0
- biotite/structure/io/pdbx/bcif.py +7 -4
- biotite/structure/io/pdbx/cif.py +6 -3
- biotite/structure/io/pdbx/compress.py +15 -11
- biotite/structure/io/pdbx/convert.py +42 -26
- biotite/structure/io/pdbx/encoding.cpython-312-darwin.so +0 -0
- biotite/structure/io/pdbx/encoding.pyx +39 -8
- biotite/structure/residues.py +173 -1
- biotite/structure/rings.py +117 -1
- biotite/structure/sasa.cpython-312-darwin.so +0 -0
- biotite/structure/segments.py +39 -3
- biotite/structure/util.py +14 -22
- biotite/version.py +16 -3
- {biotite-1.3.0.dist-info → biotite-1.5.0.dist-info}/METADATA +1 -1
- {biotite-1.3.0.dist-info → biotite-1.5.0.dist-info}/RECORD +52 -52
- {biotite-1.3.0.dist-info → biotite-1.5.0.dist-info}/WHEEL +0 -0
- {biotite-1.3.0.dist-info → biotite-1.5.0.dist-info}/licenses/LICENSE.rst +0 -0
biotite/application/dssp/app.py
CHANGED
|
@@ -11,8 +11,13 @@ from tempfile import NamedTemporaryFile
|
|
|
11
11
|
import numpy as np
|
|
12
12
|
from biotite.application.application import AppState, requires_state
|
|
13
13
|
from biotite.application.localapp import LocalApp, cleanup_tempfile, get_version
|
|
14
|
-
from biotite.structure.
|
|
14
|
+
from biotite.structure.error import BadStructureError
|
|
15
|
+
from biotite.structure.filter import filter_amino_acids
|
|
16
|
+
from biotite.structure.io.pdbx.cif import CIFCategory, CIFColumn, CIFFile
|
|
17
|
+
from biotite.structure.io.pdbx.component import MaskValue
|
|
15
18
|
from biotite.structure.io.pdbx.convert import set_structure
|
|
19
|
+
from biotite.structure.repair import create_continuous_res_ids
|
|
20
|
+
from biotite.structure.residues import get_residue_starts
|
|
16
21
|
|
|
17
22
|
|
|
18
23
|
class DsspApp(LocalApp):
|
|
@@ -49,17 +54,19 @@ class DsspApp(LocalApp):
|
|
|
49
54
|
>>> app.start()
|
|
50
55
|
>>> app.join()
|
|
51
56
|
>>> print(app.get_sse())
|
|
52
|
-
['C' 'H' 'H' 'H' 'H' 'H' 'H' 'H' 'T' 'T' 'G' 'G' 'G' 'G' 'T' 'C' '
|
|
53
|
-
'
|
|
57
|
+
['C' 'H' 'H' 'H' 'H' 'H' 'H' 'H' 'T' 'T' 'G' 'G' 'G' 'G' 'T' 'C' 'P' 'P'
|
|
58
|
+
'P' 'C']
|
|
54
59
|
"""
|
|
55
60
|
|
|
56
61
|
def __init__(self, atom_array, bin_path="mkdssp"):
|
|
57
62
|
super().__init__(bin_path)
|
|
58
63
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
# -> Add these annotations to a copy of the input structure
|
|
64
|
+
if not np.all(filter_amino_acids(atom_array)):
|
|
65
|
+
raise BadStructureError("The input structure must contain only amino acids")
|
|
62
66
|
self._array = atom_array.copy()
|
|
67
|
+
# DSSP requires also the
|
|
68
|
+
# 'occupancy', 'b_factor' and 'charge' fields
|
|
69
|
+
# -> Add these placeholder values
|
|
63
70
|
categories = self._array.get_annotation_categories()
|
|
64
71
|
if "charge" not in categories:
|
|
65
72
|
self._array.set_annotation(
|
|
@@ -73,6 +80,10 @@ class DsspApp(LocalApp):
|
|
|
73
80
|
self._array.set_annotation(
|
|
74
81
|
"occupancy", np.ones(self._array.array_length(), dtype=float)
|
|
75
82
|
)
|
|
83
|
+
# DSSP>=4 complains about the `pdbx_poly_seq_scheme` category,
|
|
84
|
+
# if `seq_id` does not start at 1
|
|
85
|
+
self._array.res_id = create_continuous_res_ids(self._array)
|
|
86
|
+
|
|
76
87
|
try:
|
|
77
88
|
# The parameters have changed in version 4
|
|
78
89
|
self._new_cli = get_version(bin_path)[0] >= 4
|
|
@@ -86,6 +97,9 @@ class DsspApp(LocalApp):
|
|
|
86
97
|
def run(self):
|
|
87
98
|
in_file = CIFFile()
|
|
88
99
|
set_structure(in_file, self._array)
|
|
100
|
+
in_file.block["pdbx_poly_seq_scheme"] = _create_pdbx_poly_seq_scheme(
|
|
101
|
+
self._array, in_file.block["atom_site"]["label_entity_id"].as_array(str)
|
|
102
|
+
)
|
|
89
103
|
in_file.write(self._in_file)
|
|
90
104
|
self._in_file.flush()
|
|
91
105
|
if self._new_cli:
|
|
@@ -157,3 +171,46 @@ class DsspApp(LocalApp):
|
|
|
157
171
|
app.start()
|
|
158
172
|
app.join()
|
|
159
173
|
return app.get_sse()
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
def _create_pdbx_poly_seq_scheme(atom_array, entity_ids):
|
|
177
|
+
"""
|
|
178
|
+
Create the ``pdbx_poly_seq_scheme`` category, as required by DSSP.
|
|
179
|
+
|
|
180
|
+
Parameters
|
|
181
|
+
----------
|
|
182
|
+
atom_array : AtomArray
|
|
183
|
+
The atom array to create the category from.
|
|
184
|
+
entity_ids : ndarray, dtype=str
|
|
185
|
+
The entity IDs for each atoms.
|
|
186
|
+
|
|
187
|
+
Returns
|
|
188
|
+
-------
|
|
189
|
+
pdbx_poly_seq_scheme : CIFCategory
|
|
190
|
+
The ``pdbx_poly_seq_scheme`` category.
|
|
191
|
+
"""
|
|
192
|
+
res_start_indices = get_residue_starts(atom_array)
|
|
193
|
+
chain_id = atom_array.chain_id[res_start_indices]
|
|
194
|
+
res_name = atom_array.res_name[res_start_indices]
|
|
195
|
+
res_id = atom_array.res_id[res_start_indices]
|
|
196
|
+
ins_code = atom_array.ins_code[res_start_indices]
|
|
197
|
+
hetero = atom_array.hetero[res_start_indices]
|
|
198
|
+
entity_id = entity_ids[res_start_indices]
|
|
199
|
+
|
|
200
|
+
poly_seq_scheme = CIFCategory()
|
|
201
|
+
poly_seq_scheme["asym_id"] = chain_id
|
|
202
|
+
poly_seq_scheme["entity_id"] = entity_id
|
|
203
|
+
poly_seq_scheme["seq_id"] = res_id
|
|
204
|
+
poly_seq_scheme["mon_id"] = res_name
|
|
205
|
+
poly_seq_scheme["ndb_seq_num"] = res_id
|
|
206
|
+
poly_seq_scheme["pdb_seq_num"] = res_id
|
|
207
|
+
poly_seq_scheme["auth_seq_num"] = res_id
|
|
208
|
+
poly_seq_scheme["pdb_mon_id"] = res_name
|
|
209
|
+
poly_seq_scheme["auth_mon_id"] = res_name
|
|
210
|
+
poly_seq_scheme["pdb_strand_id"] = chain_id
|
|
211
|
+
poly_seq_scheme["pdb_ins_code"] = CIFColumn(
|
|
212
|
+
ins_code, np.where(ins_code == "", MaskValue.MISSING, MaskValue.PRESENT)
|
|
213
|
+
)
|
|
214
|
+
poly_seq_scheme["hetero"] = np.where(hetero, "y", "n")
|
|
215
|
+
|
|
216
|
+
return poly_seq_scheme
|
|
@@ -16,8 +16,11 @@ from biotite.database.error import RequestError
|
|
|
16
16
|
_METADATA_URL = "https://alphafold.com/api/prediction"
|
|
17
17
|
_BINARY_FORMATS = ["bcif"]
|
|
18
18
|
# Adopted from https://www.uniprot.org/help/accession_numbers
|
|
19
|
+
# adding the optional 'AF-' prefix and '-F1' suffix used by RCSB
|
|
19
20
|
_UNIPROT_PATTERN = (
|
|
20
|
-
"
|
|
21
|
+
r"^(?P<prefix>(AF-)|(AF_AF))?"
|
|
22
|
+
r"(?P<id>[OPQ][0-9][A-Z0-9]{3}[0-9]|[A-NR-Z][0-9]([A-Z][A-Z0-9]{2}[0-9]){1,2})"
|
|
23
|
+
r"(?P<suffix>-?F1)?$"
|
|
21
24
|
)
|
|
22
25
|
|
|
23
26
|
|
|
@@ -31,8 +34,8 @@ def fetch(ids, format, target_path=None, overwrite=False, verbose=False):
|
|
|
31
34
|
----------
|
|
32
35
|
ids : str or iterable object of str
|
|
33
36
|
A single ID or a list of IDs of the file(s) to be downloaded.
|
|
34
|
-
They can be either UniProt IDs (e.g. ``P12345``)
|
|
35
|
-
(e.g. ``AF-
|
|
37
|
+
They can be either UniProt IDs (e.g. ``P12345``), AlphaFold DB IDs
|
|
38
|
+
(e.g. ``AF-P12345-F1``) or computational RCSB IDs (e.g. ``AF_AFP12345F1``).
|
|
36
39
|
format : {'pdb', 'pdbx', 'cif', 'mmcif', 'bcif', 'fasta'}
|
|
37
40
|
The format of the files to be downloaded.
|
|
38
41
|
target_path : str, optional
|
|
@@ -142,7 +145,10 @@ def _get_file_url(id, format):
|
|
|
142
145
|
The URL of the file to be downloaded.
|
|
143
146
|
"""
|
|
144
147
|
uniprot_id = _extract_id(id)
|
|
145
|
-
|
|
148
|
+
try:
|
|
149
|
+
metadata = requests.get(f"{_METADATA_URL}/{uniprot_id}").json()
|
|
150
|
+
except requests.exceptions.JSONDecodeError:
|
|
151
|
+
raise RequestError("Received malformed JSON response")
|
|
146
152
|
if len(metadata) == 0:
|
|
147
153
|
raise RequestError(f"ID {id} is invalid")
|
|
148
154
|
# A list of length 1 is always returned, if the response is valid
|
|
@@ -167,10 +173,10 @@ def _extract_id(id):
|
|
|
167
173
|
uniprot_id : str
|
|
168
174
|
The UniProt ID.
|
|
169
175
|
"""
|
|
170
|
-
match = re.
|
|
176
|
+
match = re.match(_UNIPROT_PATTERN, id)
|
|
171
177
|
if match is None:
|
|
172
178
|
raise ValueError(f"Cannot extract AFDB identifier from '{id}'")
|
|
173
|
-
return match.group()
|
|
179
|
+
return match.group("id")
|
|
174
180
|
|
|
175
181
|
|
|
176
182
|
def _assert_valid_file(response, id):
|
|
@@ -155,6 +155,7 @@ def _assert_valid_file(response_text, pdb_id):
|
|
|
155
155
|
"<title>PDB Archive over AWS</title>",
|
|
156
156
|
"No fasta files were found.",
|
|
157
157
|
"No valid PDB IDs were submitted.",
|
|
158
|
+
"The requested URL was incorrect, too long or otherwise malformed.",
|
|
158
159
|
]
|
|
159
160
|
):
|
|
160
161
|
raise RequestError("PDB ID {:} is invalid".format(pdb_id))
|
biotite/database/rcsb/query.py
CHANGED
|
@@ -74,7 +74,7 @@ class SingleQuery(Query, metaclass=abc.ABCMeta):
|
|
|
74
74
|
A terminal query node for the RCSB search API.
|
|
75
75
|
|
|
76
76
|
Multiple :class:`SingleQuery` objects can be combined to
|
|
77
|
-
:class:`CompositeQuery`objects using the ``|`` and ``&`` operators.
|
|
77
|
+
:class:`CompositeQuery` objects using the ``|`` and ``&`` operators.
|
|
78
78
|
|
|
79
79
|
This is the abstract base class for all queries that are
|
|
80
80
|
terminal nodes.
|
|
@@ -783,7 +783,7 @@ def search(
|
|
|
783
783
|
The type of the returned identifiers:
|
|
784
784
|
|
|
785
785
|
- ``'entry'``: Only the PDB ID is returned (e.g. ``'XXXX'``).
|
|
786
|
-
These can be used directly
|
|
786
|
+
These can be used directly as input to :func:`fetch()`.
|
|
787
787
|
- ``'assembly'``: The PDB ID appended with assembly ID is
|
|
788
788
|
returned (e.g. ``'XXXX-1'``).
|
|
789
789
|
- ``'polymer_entity'``: The PDB ID appended with entity ID of
|
|
@@ -388,7 +388,9 @@ class PyMOLObject:
|
|
|
388
388
|
elif isinstance(selection, str):
|
|
389
389
|
return f"%{self._name} and ({selection})"
|
|
390
390
|
else:
|
|
391
|
-
|
|
391
|
+
if not isinstance(selection, slice):
|
|
392
|
+
selection = np.asarray(selection)
|
|
393
|
+
sel = self.where(selection)
|
|
392
394
|
if sel == "none" and not_none:
|
|
393
395
|
raise ValueError("Selection contains no atoms")
|
|
394
396
|
return sel
|
biotite/interface/rdkit/mol.py
CHANGED
|
@@ -59,7 +59,7 @@ _STANDARD_ANNOTATIONS = frozenset(
|
|
|
59
59
|
"charge",
|
|
60
60
|
"b_factor",
|
|
61
61
|
"occupancy",
|
|
62
|
-
"
|
|
62
|
+
"altloc_id",
|
|
63
63
|
}
|
|
64
64
|
)
|
|
65
65
|
|
|
@@ -202,8 +202,8 @@ def to_mol(
|
|
|
202
202
|
rdkit_atom_res_info.SetOccupancy(atoms.occupancy[i].item())
|
|
203
203
|
if "b_factor" in has_annot:
|
|
204
204
|
rdkit_atom_res_info.SetTempFactor(atoms.b_factor[i].item())
|
|
205
|
-
if "
|
|
206
|
-
rdkit_atom_res_info.SetAltLoc(atoms.
|
|
205
|
+
if "altloc_id" in has_annot:
|
|
206
|
+
rdkit_atom_res_info.SetAltLoc(atoms.altloc_id[i].item())
|
|
207
207
|
rdkit_atom.SetPDBResidueInfo(rdkit_atom_res_info)
|
|
208
208
|
|
|
209
209
|
# add extra annotations
|
|
@@ -361,7 +361,7 @@ def from_mol(mol, conformer_id=None, add_hydrogen=None):
|
|
|
361
361
|
atoms.add_annotation("charge", int)
|
|
362
362
|
atoms.add_annotation("b_factor", float)
|
|
363
363
|
atoms.add_annotation("occupancy", float)
|
|
364
|
-
atoms.add_annotation("
|
|
364
|
+
atoms.add_annotation("altloc_id", str)
|
|
365
365
|
|
|
366
366
|
for rdkit_atom in rdkit_atoms:
|
|
367
367
|
_atom_idx = rdkit_atom.GetIdx()
|
|
@@ -406,7 +406,7 @@ def from_mol(mol, conformer_id=None, add_hydrogen=None):
|
|
|
406
406
|
atoms.res_id[_atom_idx] = residue_info.GetResidueNumber()
|
|
407
407
|
atoms.ins_code[_atom_idx] = residue_info.GetInsertionCode()
|
|
408
408
|
atoms.res_name[_atom_idx] = residue_info.GetResidueName()
|
|
409
|
-
atoms.
|
|
409
|
+
atoms.altloc_id[_atom_idx] = residue_info.GetAltLoc()
|
|
410
410
|
atoms.hetero[_atom_idx] = residue_info.GetIsHeteroAtom()
|
|
411
411
|
atoms.b_factor[_atom_idx] = residue_info.GetTempFactor()
|
|
412
412
|
atoms.occupancy[_atom_idx] = residue_info.GetOccupancy()
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
biotite/structure/atoms.py
CHANGED
|
@@ -1554,7 +1554,7 @@ def coord(item):
|
|
|
1554
1554
|
Atom coordinates.
|
|
1555
1555
|
"""
|
|
1556
1556
|
|
|
1557
|
-
if
|
|
1557
|
+
if isinstance(item, (Atom, _AtomArrayBase)):
|
|
1558
1558
|
return item.coord
|
|
1559
1559
|
elif isinstance(item, np.ndarray):
|
|
1560
1560
|
return item.astype(np.float32, copy=False)
|
|
Binary file
|
biotite/structure/bonds.pyx
CHANGED
|
@@ -517,14 +517,41 @@ class BondList(Copyable):
|
|
|
517
517
|
0 1 SINGLE
|
|
518
518
|
1 2 DOUBLE
|
|
519
519
|
"""
|
|
520
|
-
bond_types = self._bonds[:,2]
|
|
521
520
|
for aromatic_type, non_aromatic_type in [
|
|
522
521
|
(BondType.AROMATIC_SINGLE, BondType.SINGLE),
|
|
523
522
|
(BondType.AROMATIC_DOUBLE, BondType.DOUBLE),
|
|
524
523
|
(BondType.AROMATIC_TRIPLE, BondType.TRIPLE),
|
|
525
524
|
(BondType.AROMATIC, BondType.ANY),
|
|
526
525
|
]:
|
|
527
|
-
|
|
526
|
+
mask = self._bonds[:, 2] == aromatic_type
|
|
527
|
+
self._bonds[mask, 2] = non_aromatic_type
|
|
528
|
+
|
|
529
|
+
def remove_kekulization(self):
|
|
530
|
+
"""
|
|
531
|
+
Remove the bond order information from aromatic bonds, i.e. convert all
|
|
532
|
+
aromatic bonds to :attr:`BondType.ANY`.
|
|
533
|
+
|
|
534
|
+
Examples
|
|
535
|
+
--------
|
|
536
|
+
|
|
537
|
+
>>> bond_list = BondList(3)
|
|
538
|
+
>>> bond_list.add_bond(0, 1, BondType.AROMATIC_SINGLE)
|
|
539
|
+
>>> bond_list.add_bond(1, 2, BondType.AROMATIC_DOUBLE)
|
|
540
|
+
>>> bond_list.remove_kekulization()
|
|
541
|
+
>>> for i, j, bond_type in bond_list.as_array():
|
|
542
|
+
... print(i, j, BondType(bond_type).name)
|
|
543
|
+
0 1 AROMATIC
|
|
544
|
+
1 2 AROMATIC
|
|
545
|
+
"""
|
|
546
|
+
kekulized_mask = np.isin(
|
|
547
|
+
self._bonds[:, 2],
|
|
548
|
+
(
|
|
549
|
+
BondType.AROMATIC_SINGLE,
|
|
550
|
+
BondType.AROMATIC_DOUBLE,
|
|
551
|
+
BondType.AROMATIC_TRIPLE,
|
|
552
|
+
),
|
|
553
|
+
)
|
|
554
|
+
self._bonds[kekulized_mask, 2] = BondType.AROMATIC
|
|
528
555
|
|
|
529
556
|
def remove_bond_order(self):
|
|
530
557
|
"""
|
|
@@ -532,6 +559,41 @@ class BondList(Copyable):
|
|
|
532
559
|
"""
|
|
533
560
|
self._bonds[:,2] = BondType.ANY
|
|
534
561
|
|
|
562
|
+
def convert_bond_type(self, original_bond_type, new_bond_type):
|
|
563
|
+
"""
|
|
564
|
+
convert_bond_type(original_bond_type, new_bond_type)
|
|
565
|
+
|
|
566
|
+
Convert all occurences of a given bond type into another bond type.
|
|
567
|
+
|
|
568
|
+
Parameters
|
|
569
|
+
----------
|
|
570
|
+
original_bond_type : BondType or int
|
|
571
|
+
The bond type to convert.
|
|
572
|
+
new_bond_type : BondType or int
|
|
573
|
+
The new bond type.
|
|
574
|
+
|
|
575
|
+
Examples
|
|
576
|
+
--------
|
|
577
|
+
|
|
578
|
+
>>> bond_list = BondList(4)
|
|
579
|
+
>>> bond_list.add_bond(0, 1, BondType.DOUBLE)
|
|
580
|
+
>>> bond_list.add_bond(1, 2, BondType.COORDINATION)
|
|
581
|
+
>>> bond_list.add_bond(2, 3, BondType.COORDINATION)
|
|
582
|
+
>>> for i, j, bond_type in bond_list.as_array():
|
|
583
|
+
... print(i, j, BondType(bond_type).name)
|
|
584
|
+
0 1 DOUBLE
|
|
585
|
+
1 2 COORDINATION
|
|
586
|
+
2 3 COORDINATION
|
|
587
|
+
>>> bond_list.convert_bond_type(BondType.COORDINATION, BondType.SINGLE)
|
|
588
|
+
>>> for i, j, bond_type in bond_list.as_array():
|
|
589
|
+
... print(i, j, BondType(bond_type).name)
|
|
590
|
+
0 1 DOUBLE
|
|
591
|
+
1 2 SINGLE
|
|
592
|
+
2 3 SINGLE
|
|
593
|
+
"""
|
|
594
|
+
mask = self._bonds[:, 2] == original_bond_type
|
|
595
|
+
self._bonds[mask, 2] = new_bond_type
|
|
596
|
+
|
|
535
597
|
def get_atom_count(self):
|
|
536
598
|
"""
|
|
537
599
|
get_atom_count()
|
|
@@ -1437,9 +1499,8 @@ _DEFAULT_DISTANCE_RANGE = {
|
|
|
1437
1499
|
def connect_via_distances(atoms, dict distance_range=None, bint inter_residue=True,
|
|
1438
1500
|
default_bond_type=BondType.ANY, bint periodic=False):
|
|
1439
1501
|
"""
|
|
1440
|
-
connect_via_distances(atoms, distance_range=None,
|
|
1441
|
-
|
|
1442
|
-
periodic=False)
|
|
1502
|
+
connect_via_distances(atoms, distance_range=None, inter_residue=True,
|
|
1503
|
+
default_bond_type=BondType.ANY, periodic=False)
|
|
1443
1504
|
|
|
1444
1505
|
Create a :class:`BondList` for a given atom array, based on
|
|
1445
1506
|
pairwise atom distances.
|
|
@@ -1589,7 +1650,7 @@ def connect_via_distances(atoms, dict distance_range=None, bint inter_residue=Tr
|
|
|
1589
1650
|
def connect_via_residue_names(atoms, bint inter_residue=True,
|
|
1590
1651
|
dict custom_bond_dict=None):
|
|
1591
1652
|
"""
|
|
1592
|
-
connect_via_residue_names(atoms,
|
|
1653
|
+
connect_via_residue_names(atoms, inter_residue=True, custom_bond_dict=None)
|
|
1593
1654
|
|
|
1594
1655
|
Create a :class:`BondList` for a given atom array (stack), based on
|
|
1595
1656
|
the deposited bonds for each residue in the RCSB ``components.cif``
|
biotite/structure/box.py
CHANGED
|
@@ -361,7 +361,7 @@ def repeat_box(atoms, amount=1):
|
|
|
361
361
|
if atoms.box is None:
|
|
362
362
|
raise BadStructureError("Structure has no box")
|
|
363
363
|
|
|
364
|
-
repeat_coord, indices = repeat_box_coord(atoms.coord, atoms.box)
|
|
364
|
+
repeat_coord, indices = repeat_box_coord(atoms.coord, atoms.box, amount)
|
|
365
365
|
# Unroll repeated coordinates for input to 'repeat()'
|
|
366
366
|
if repeat_coord.ndim == 2:
|
|
367
367
|
repeat_coord = repeat_coord.reshape(-1, atoms.array_length(), 3)
|
|
Binary file
|
biotite/structure/chains.py
CHANGED
|
@@ -16,6 +16,7 @@ __all__ = [
|
|
|
16
16
|
"get_chain_masks",
|
|
17
17
|
"get_chain_starts_for",
|
|
18
18
|
"get_chain_positions",
|
|
19
|
+
"get_all_chain_positions",
|
|
19
20
|
"chain_iter",
|
|
20
21
|
"get_chains",
|
|
21
22
|
"get_chain_count",
|
|
@@ -24,6 +25,7 @@ __all__ = [
|
|
|
24
25
|
|
|
25
26
|
from biotite.structure.segments import (
|
|
26
27
|
apply_segment_wise,
|
|
28
|
+
get_all_segment_positions,
|
|
27
29
|
get_segment_masks,
|
|
28
30
|
get_segment_positions,
|
|
29
31
|
get_segment_starts,
|
|
@@ -212,11 +214,43 @@ def get_chain_positions(array, indices):
|
|
|
212
214
|
-------
|
|
213
215
|
start_indices : ndarray, dtype=int, shape=(k,)
|
|
214
216
|
The indices that point to the position of the chains.
|
|
217
|
+
|
|
218
|
+
See Also
|
|
219
|
+
--------
|
|
220
|
+
get_all_chain_positions :
|
|
221
|
+
Similar to this function, but for all atoms in the :class:`struc.AtomArray`.
|
|
215
222
|
"""
|
|
216
223
|
starts = get_chain_starts(array, add_exclusive_stop=True)
|
|
217
224
|
return get_segment_positions(starts, indices)
|
|
218
225
|
|
|
219
226
|
|
|
227
|
+
def get_all_chain_positions(array):
|
|
228
|
+
"""
|
|
229
|
+
For each atom, obtain the position of the chain
|
|
230
|
+
corresponding to this atom in the input `array`.
|
|
231
|
+
|
|
232
|
+
For example, the position of the first chain in the atom array is
|
|
233
|
+
``0``, the the position of the second chain is ``1``, etc.
|
|
234
|
+
|
|
235
|
+
Parameters
|
|
236
|
+
----------
|
|
237
|
+
array : AtomArray or AtomArrayStack
|
|
238
|
+
The atom array (stack) to determine the chains from.
|
|
239
|
+
|
|
240
|
+
Returns
|
|
241
|
+
-------
|
|
242
|
+
chain_indices : ndarray, dtype=int, shape=(k,)
|
|
243
|
+
The indices that point to the position of the chains.
|
|
244
|
+
|
|
245
|
+
See Also
|
|
246
|
+
--------
|
|
247
|
+
get_chain_positions :
|
|
248
|
+
Similar to this function, but for a given subset of atom indices.
|
|
249
|
+
"""
|
|
250
|
+
starts = get_chain_starts(array, add_exclusive_stop=True)
|
|
251
|
+
return get_all_segment_positions(starts, array.array_length())
|
|
252
|
+
|
|
253
|
+
|
|
220
254
|
def get_chains(array):
|
|
221
255
|
"""
|
|
222
256
|
Get the chain IDs of an atom array (stack).
|
|
Binary file
|
biotite/structure/compare.py
CHANGED
|
@@ -449,6 +449,8 @@ def lddt(
|
|
|
449
449
|
# Aggregate the fractions over the desired level
|
|
450
450
|
if isinstance(aggregation, str) and aggregation == "all":
|
|
451
451
|
# Average over all contacts
|
|
452
|
+
if len(fraction_preserved_bins) == 0:
|
|
453
|
+
return np.float32(np.nan)
|
|
452
454
|
return np.mean(fraction_preserved_bins, axis=-1)
|
|
453
455
|
else:
|
|
454
456
|
# A string is also a 'Sequence'
|
biotite/structure/filter.py
CHANGED
|
@@ -63,7 +63,8 @@ _canonical_aa_list = [
|
|
|
63
63
|
]
|
|
64
64
|
_canonical_nucleotide_list = ["A", "DA", "G", "DG", "C", "DC", "U", "DT"]
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
# Residue names of solvent molecules non only in CCD, but also from modeling software
|
|
67
|
+
_solvent_list = ["HOH", "DOD", "SOL", "WAT", "H2O", "TIP3", "TIP4", "TIP5"]
|
|
67
68
|
|
|
68
69
|
_peptide_backbone_atoms = ["N", "CA", "C"]
|
|
69
70
|
_phosphate_backbone_atoms = ["P", "O5'", "C5'", "C4'", "C3'", "O3'"]
|