biotite 0.41.2__cp311-cp311-win_amd64.whl → 1.0.0__cp311-cp311-win_amd64.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/__init__.py +2 -3
- biotite/application/__init__.py +1 -1
- biotite/application/application.py +20 -10
- biotite/application/autodock/__init__.py +1 -1
- biotite/application/autodock/app.py +74 -79
- biotite/application/blast/__init__.py +1 -1
- biotite/application/blast/alignment.py +19 -10
- biotite/application/blast/webapp.py +92 -85
- biotite/application/clustalo/__init__.py +1 -1
- biotite/application/clustalo/app.py +46 -61
- biotite/application/dssp/__init__.py +1 -1
- biotite/application/dssp/app.py +8 -11
- biotite/application/localapp.py +62 -60
- biotite/application/mafft/__init__.py +1 -1
- biotite/application/mafft/app.py +16 -22
- biotite/application/msaapp.py +78 -89
- biotite/application/muscle/__init__.py +1 -1
- biotite/application/muscle/app3.py +50 -64
- biotite/application/muscle/app5.py +23 -31
- biotite/application/sra/__init__.py +1 -1
- biotite/application/sra/app.py +64 -68
- biotite/application/tantan/__init__.py +1 -1
- biotite/application/tantan/app.py +22 -45
- biotite/application/util.py +7 -9
- biotite/application/viennarna/rnaalifold.py +34 -28
- biotite/application/viennarna/rnafold.py +24 -39
- biotite/application/viennarna/rnaplot.py +36 -21
- biotite/application/viennarna/util.py +17 -12
- biotite/application/webapp.py +13 -14
- biotite/copyable.py +13 -13
- biotite/database/__init__.py +1 -1
- biotite/database/entrez/__init__.py +1 -1
- biotite/database/entrez/check.py +2 -3
- biotite/database/entrez/dbnames.py +7 -5
- biotite/database/entrez/download.py +55 -49
- biotite/database/entrez/key.py +1 -1
- biotite/database/entrez/query.py +62 -23
- biotite/database/error.py +2 -1
- biotite/database/pubchem/__init__.py +1 -1
- biotite/database/pubchem/download.py +43 -45
- biotite/database/pubchem/error.py +2 -2
- biotite/database/pubchem/query.py +34 -31
- biotite/database/pubchem/throttle.py +3 -4
- biotite/database/rcsb/__init__.py +1 -1
- biotite/database/rcsb/download.py +44 -52
- biotite/database/rcsb/query.py +85 -80
- biotite/database/uniprot/check.py +6 -3
- biotite/database/uniprot/download.py +6 -11
- biotite/database/uniprot/query.py +115 -31
- biotite/file.py +12 -31
- biotite/sequence/__init__.py +3 -3
- biotite/sequence/align/__init__.py +2 -2
- biotite/sequence/align/alignment.py +99 -90
- biotite/sequence/align/banded.cp311-win_amd64.pyd +0 -0
- biotite/sequence/align/buckets.py +12 -10
- biotite/sequence/align/cigar.py +43 -52
- biotite/sequence/align/kmeralphabet.cp311-win_amd64.pyd +0 -0
- biotite/sequence/align/kmeralphabet.pyx +55 -51
- biotite/sequence/align/kmersimilarity.cp311-win_amd64.pyd +0 -0
- biotite/sequence/align/kmertable.cp311-win_amd64.pyd +0 -0
- biotite/sequence/align/kmertable.pyx +3 -2
- biotite/sequence/align/localgapped.cp311-win_amd64.pyd +0 -0
- biotite/sequence/align/localungapped.cp311-win_amd64.pyd +0 -0
- biotite/sequence/align/matrix.py +81 -82
- biotite/sequence/align/multiple.cp311-win_amd64.pyd +0 -0
- biotite/sequence/align/multiple.pyx +1 -1
- biotite/sequence/align/pairwise.cp311-win_amd64.pyd +0 -0
- biotite/sequence/align/permutation.cp311-win_amd64.pyd +0 -0
- biotite/sequence/align/permutation.pyx +12 -4
- biotite/sequence/align/selector.cp311-win_amd64.pyd +0 -0
- biotite/sequence/align/selector.pyx +52 -54
- biotite/sequence/align/statistics.py +32 -33
- biotite/sequence/align/tracetable.cp311-win_amd64.pyd +0 -0
- biotite/sequence/alphabet.py +51 -65
- biotite/sequence/annotation.py +78 -77
- biotite/sequence/codec.cp311-win_amd64.pyd +0 -0
- biotite/sequence/codon.py +90 -79
- biotite/sequence/graphics/__init__.py +1 -1
- biotite/sequence/graphics/alignment.py +184 -103
- biotite/sequence/graphics/colorschemes.py +10 -12
- biotite/sequence/graphics/dendrogram.py +79 -34
- biotite/sequence/graphics/features.py +133 -99
- biotite/sequence/graphics/logo.py +22 -28
- biotite/sequence/graphics/plasmid.py +229 -178
- biotite/sequence/io/fasta/__init__.py +1 -1
- biotite/sequence/io/fasta/convert.py +44 -33
- biotite/sequence/io/fasta/file.py +42 -55
- biotite/sequence/io/fastq/__init__.py +1 -1
- biotite/sequence/io/fastq/convert.py +11 -14
- biotite/sequence/io/fastq/file.py +68 -112
- biotite/sequence/io/genbank/__init__.py +2 -2
- biotite/sequence/io/genbank/annotation.py +12 -20
- biotite/sequence/io/genbank/file.py +74 -76
- biotite/sequence/io/genbank/metadata.py +74 -62
- biotite/sequence/io/genbank/sequence.py +13 -14
- biotite/sequence/io/general.py +39 -30
- biotite/sequence/io/gff/__init__.py +2 -2
- biotite/sequence/io/gff/convert.py +10 -15
- biotite/sequence/io/gff/file.py +81 -65
- biotite/sequence/phylo/__init__.py +1 -1
- biotite/sequence/phylo/nj.cp311-win_amd64.pyd +0 -0
- biotite/sequence/phylo/tree.cp311-win_amd64.pyd +0 -0
- biotite/sequence/phylo/upgma.cp311-win_amd64.pyd +0 -0
- biotite/sequence/profile.py +57 -28
- biotite/sequence/search.py +17 -15
- biotite/sequence/seqtypes.py +200 -164
- biotite/sequence/sequence.py +15 -17
- biotite/structure/__init__.py +3 -3
- biotite/structure/atoms.py +221 -235
- biotite/structure/basepairs.py +260 -271
- biotite/structure/bonds.cp311-win_amd64.pyd +0 -0
- biotite/structure/bonds.pyx +29 -32
- biotite/structure/box.py +67 -71
- biotite/structure/celllist.cp311-win_amd64.pyd +0 -0
- biotite/structure/chains.py +55 -39
- biotite/structure/charges.cp311-win_amd64.pyd +0 -0
- biotite/structure/compare.py +32 -32
- biotite/structure/density.py +13 -18
- biotite/structure/dotbracket.py +20 -22
- biotite/structure/error.py +10 -2
- biotite/structure/filter.py +82 -77
- biotite/structure/geometry.py +130 -119
- biotite/structure/graphics/atoms.py +60 -43
- biotite/structure/graphics/rna.py +81 -68
- biotite/structure/hbond.py +112 -93
- biotite/structure/info/__init__.py +0 -2
- biotite/structure/info/atoms.py +10 -11
- biotite/structure/info/bonds.py +41 -43
- biotite/structure/info/ccd.py +4 -5
- biotite/structure/info/groups.py +1 -3
- biotite/structure/info/masses.py +5 -10
- biotite/structure/info/misc.py +1 -1
- biotite/structure/info/radii.py +20 -20
- biotite/structure/info/standardize.py +15 -26
- biotite/structure/integrity.py +18 -71
- biotite/structure/io/__init__.py +3 -4
- biotite/structure/io/dcd/__init__.py +1 -1
- biotite/structure/io/dcd/file.py +22 -20
- biotite/structure/io/general.py +47 -61
- biotite/structure/io/gro/__init__.py +1 -1
- biotite/structure/io/gro/file.py +73 -72
- biotite/structure/io/mol/__init__.py +1 -1
- biotite/structure/io/mol/convert.py +8 -11
- biotite/structure/io/mol/ctab.py +37 -36
- biotite/structure/io/mol/header.py +14 -10
- biotite/structure/io/mol/mol.py +9 -53
- biotite/structure/io/mol/sdf.py +47 -50
- biotite/structure/io/netcdf/__init__.py +1 -1
- biotite/structure/io/netcdf/file.py +24 -23
- biotite/structure/io/pdb/__init__.py +1 -1
- biotite/structure/io/pdb/convert.py +32 -20
- biotite/structure/io/pdb/file.py +151 -172
- biotite/structure/io/pdb/hybrid36.cp311-win_amd64.pyd +0 -0
- biotite/structure/io/pdbqt/__init__.py +1 -1
- biotite/structure/io/pdbqt/convert.py +17 -11
- biotite/structure/io/pdbqt/file.py +128 -80
- biotite/structure/io/pdbx/__init__.py +1 -2
- biotite/structure/io/pdbx/bcif.py +36 -44
- biotite/structure/io/pdbx/cif.py +64 -62
- biotite/structure/io/pdbx/component.py +10 -16
- biotite/structure/io/pdbx/convert.py +235 -246
- biotite/structure/io/pdbx/encoding.cp311-win_amd64.pyd +0 -0
- biotite/structure/io/trajfile.py +76 -93
- biotite/structure/io/trr/__init__.py +1 -1
- biotite/structure/io/trr/file.py +12 -15
- biotite/structure/io/xtc/__init__.py +1 -1
- biotite/structure/io/xtc/file.py +11 -14
- biotite/structure/mechanics.py +9 -11
- biotite/structure/molecules.py +3 -4
- biotite/structure/pseudoknots.py +53 -67
- biotite/structure/rdf.py +23 -21
- biotite/structure/repair.py +137 -86
- biotite/structure/residues.py +26 -16
- biotite/structure/sasa.cp311-win_amd64.pyd +0 -0
- biotite/structure/{resutil.py → segments.py} +24 -23
- biotite/structure/sequence.py +10 -11
- biotite/structure/sse.py +100 -119
- biotite/structure/superimpose.py +39 -77
- biotite/structure/transform.py +97 -71
- biotite/structure/util.py +11 -13
- biotite/version.py +2 -2
- biotite/visualize.py +69 -55
- {biotite-0.41.2.dist-info → biotite-1.0.0.dist-info}/METADATA +5 -5
- biotite-1.0.0.dist-info/RECORD +322 -0
- biotite/structure/io/ctab.py +0 -72
- biotite/structure/io/mmtf/__init__.py +0 -21
- biotite/structure/io/mmtf/assembly.py +0 -214
- biotite/structure/io/mmtf/convertarray.cp311-win_amd64.pyd +0 -0
- biotite/structure/io/mmtf/convertarray.pyx +0 -341
- biotite/structure/io/mmtf/convertfile.cp311-win_amd64.pyd +0 -0
- biotite/structure/io/mmtf/convertfile.pyx +0 -501
- biotite/structure/io/mmtf/decode.cp311-win_amd64.pyd +0 -0
- biotite/structure/io/mmtf/decode.pyx +0 -152
- biotite/structure/io/mmtf/encode.cp311-win_amd64.pyd +0 -0
- biotite/structure/io/mmtf/encode.pyx +0 -183
- biotite/structure/io/mmtf/file.py +0 -233
- biotite/structure/io/npz/__init__.py +0 -20
- biotite/structure/io/npz/file.py +0 -152
- biotite/structure/io/pdbx/legacy.py +0 -267
- biotite/structure/io/tng/__init__.py +0 -13
- biotite/structure/io/tng/file.py +0 -46
- biotite/temp.py +0 -86
- biotite-0.41.2.dist-info/RECORD +0 -340
- {biotite-0.41.2.dist-info → biotite-1.0.0.dist-info}/WHEEL +0 -0
- {biotite-0.41.2.dist-info → biotite-1.0.0.dist-info}/licenses/LICENSE.rst +0 -0
biotite/structure/error.py
CHANGED
|
@@ -8,24 +8,32 @@ This module contains all possible errors of the `structure` subpackage.
|
|
|
8
8
|
|
|
9
9
|
__name__ = "biotite.structure"
|
|
10
10
|
__author__ = "Patrick Kunzmann"
|
|
11
|
-
__all__ = [
|
|
12
|
-
|
|
11
|
+
__all__ = [
|
|
12
|
+
"BadStructureError",
|
|
13
|
+
"IncompleteStructureWarning",
|
|
14
|
+
"UnexpectedStructureWarning",
|
|
15
|
+
]
|
|
13
16
|
|
|
14
17
|
|
|
15
18
|
class BadStructureError(Exception):
|
|
16
19
|
"""
|
|
17
20
|
Indicates that a structure is not suitable for a certain operation.
|
|
18
21
|
"""
|
|
22
|
+
|
|
19
23
|
pass
|
|
20
24
|
|
|
25
|
+
|
|
21
26
|
class IncompleteStructureWarning(Warning):
|
|
22
27
|
"""
|
|
23
28
|
Indicates that a structure is not complete.
|
|
24
29
|
"""
|
|
30
|
+
|
|
25
31
|
pass
|
|
26
32
|
|
|
33
|
+
|
|
27
34
|
class UnexpectedStructureWarning(Warning):
|
|
28
35
|
"""
|
|
29
36
|
Indicates that a structure was not expected.
|
|
30
37
|
"""
|
|
38
|
+
|
|
31
39
|
pass
|
biotite/structure/filter.py
CHANGED
|
@@ -9,32 +9,64 @@ arrays and atom array stacks.
|
|
|
9
9
|
|
|
10
10
|
__name__ = "biotite.structure"
|
|
11
11
|
__author__ = "Patrick Kunzmann, Tom David Müller"
|
|
12
|
-
__all__ = [
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
__all__ = [
|
|
13
|
+
"filter_solvent",
|
|
14
|
+
"filter_monoatomic_ions",
|
|
15
|
+
"filter_nucleotides",
|
|
16
|
+
"filter_canonical_nucleotides",
|
|
17
|
+
"filter_amino_acids",
|
|
18
|
+
"filter_canonical_amino_acids",
|
|
19
|
+
"filter_carbohydrates",
|
|
20
|
+
"filter_intersection",
|
|
21
|
+
"filter_first_altloc",
|
|
22
|
+
"filter_highest_occupancy_altloc",
|
|
23
|
+
"filter_peptide_backbone",
|
|
24
|
+
"filter_phosphate_backbone",
|
|
25
|
+
"filter_linear_bond_continuity",
|
|
26
|
+
"filter_polymer",
|
|
27
|
+
]
|
|
19
28
|
|
|
20
|
-
import warnings
|
|
21
29
|
|
|
22
|
-
import numpy as np
|
|
23
30
|
from functools import partial
|
|
24
|
-
|
|
25
|
-
from .
|
|
26
|
-
from .info.groups import
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
import numpy as np
|
|
32
|
+
from biotite.structure.atoms import array as atom_array
|
|
33
|
+
from biotite.structure.info.groups import (
|
|
34
|
+
amino_acid_names,
|
|
35
|
+
carbohydrate_names,
|
|
36
|
+
nucleotide_names,
|
|
37
|
+
)
|
|
38
|
+
from biotite.structure.residues import get_residue_count, get_residue_starts
|
|
39
|
+
|
|
40
|
+
_canonical_aa_list = [
|
|
41
|
+
"ALA",
|
|
42
|
+
"ARG",
|
|
43
|
+
"ASN",
|
|
44
|
+
"ASP",
|
|
45
|
+
"CYS",
|
|
46
|
+
"GLN",
|
|
47
|
+
"GLU",
|
|
48
|
+
"GLY",
|
|
49
|
+
"HIS",
|
|
50
|
+
"ILE",
|
|
51
|
+
"LEU",
|
|
52
|
+
"LYS",
|
|
53
|
+
"MET",
|
|
54
|
+
"PHE",
|
|
55
|
+
"PRO",
|
|
56
|
+
"PYL",
|
|
57
|
+
"SER",
|
|
58
|
+
"THR",
|
|
59
|
+
"TRP",
|
|
60
|
+
"TYR",
|
|
61
|
+
"VAL",
|
|
62
|
+
"SEC",
|
|
63
|
+
]
|
|
32
64
|
_canonical_nucleotide_list = ["A", "DA", "G", "DG", "C", "DC", "U", "DT"]
|
|
33
65
|
|
|
34
|
-
_solvent_list = ["HOH","SOL"]
|
|
66
|
+
_solvent_list = ["HOH", "SOL"]
|
|
35
67
|
|
|
36
|
-
_peptide_backbone_atoms = [
|
|
37
|
-
_phosphate_backbone_atoms = [
|
|
68
|
+
_peptide_backbone_atoms = ["N", "CA", "C"]
|
|
69
|
+
_phosphate_backbone_atoms = ["P", "O5'", "C5'", "C4'", "C3'", "O3'"]
|
|
38
70
|
|
|
39
71
|
|
|
40
72
|
def filter_monoatomic_ions(array):
|
|
@@ -55,7 +87,7 @@ def filter_monoatomic_ions(array):
|
|
|
55
87
|
"""
|
|
56
88
|
# Exclusively in monoatomic ions,
|
|
57
89
|
# the element name is equal to the residue name
|
|
58
|
-
return
|
|
90
|
+
return array.res_name == array.element
|
|
59
91
|
|
|
60
92
|
|
|
61
93
|
def filter_solvent(array):
|
|
@@ -206,37 +238,6 @@ def filter_carbohydrates(array):
|
|
|
206
238
|
return np.isin(array.res_name, carbohydrate_names())
|
|
207
239
|
|
|
208
240
|
|
|
209
|
-
def filter_backbone(array):
|
|
210
|
-
"""
|
|
211
|
-
Filter all peptide backbone atoms of one array.
|
|
212
|
-
|
|
213
|
-
This includes the "N", "CA" and "C" atoms of amino acids.
|
|
214
|
-
|
|
215
|
-
DEPRECATED: Please use :func:`filter_peptide_backbone` to filter
|
|
216
|
-
for protein backbone atoms.
|
|
217
|
-
|
|
218
|
-
Parameters
|
|
219
|
-
----------
|
|
220
|
-
array : AtomArray or AtomArrayStack
|
|
221
|
-
The array to be filtered.
|
|
222
|
-
|
|
223
|
-
Returns
|
|
224
|
-
-------
|
|
225
|
-
filter : ndarray, dtype=bool
|
|
226
|
-
This array is `True` for all indices in `array`, where the atom
|
|
227
|
-
as an backbone atom.
|
|
228
|
-
"""
|
|
229
|
-
warnings.warn(
|
|
230
|
-
"Please use `filter_peptide_backbone()` to filter "
|
|
231
|
-
"for protein backbone atoms.",
|
|
232
|
-
DeprecationWarning
|
|
233
|
-
)
|
|
234
|
-
return ( ((array.atom_name == "N") |
|
|
235
|
-
(array.atom_name == "CA") |
|
|
236
|
-
(array.atom_name == "C")) &
|
|
237
|
-
filter_amino_acids(array) )
|
|
238
|
-
|
|
239
|
-
|
|
240
241
|
def _filter_atom_names(array, atom_names):
|
|
241
242
|
return np.isin(array.atom_name, atom_names)
|
|
242
243
|
|
|
@@ -259,8 +260,9 @@ def filter_peptide_backbone(array):
|
|
|
259
260
|
is a part of the peptide backbone.
|
|
260
261
|
"""
|
|
261
262
|
|
|
262
|
-
return
|
|
263
|
-
|
|
263
|
+
return _filter_atom_names(array, _peptide_backbone_atoms) & filter_amino_acids(
|
|
264
|
+
array
|
|
265
|
+
)
|
|
264
266
|
|
|
265
267
|
|
|
266
268
|
def filter_phosphate_backbone(array):
|
|
@@ -281,8 +283,9 @@ def filter_phosphate_backbone(array):
|
|
|
281
283
|
is a part of the phosphate backbone.
|
|
282
284
|
"""
|
|
283
285
|
|
|
284
|
-
return
|
|
285
|
-
|
|
286
|
+
return _filter_atom_names(array, _phosphate_backbone_atoms) & filter_nucleotides(
|
|
287
|
+
array
|
|
288
|
+
)
|
|
286
289
|
|
|
287
290
|
|
|
288
291
|
def filter_linear_bond_continuity(array, min_len=1.2, max_len=1.8):
|
|
@@ -328,21 +331,20 @@ def filter_linear_bond_continuity(array, min_len=1.2, max_len=1.8):
|
|
|
328
331
|
|
|
329
332
|
|
|
330
333
|
def _is_polymer(array, min_size, pol_type):
|
|
331
|
-
|
|
332
|
-
if pol_type.startswith('p'):
|
|
334
|
+
if pol_type.startswith("p"):
|
|
333
335
|
filt_fn = filter_amino_acids
|
|
334
|
-
elif pol_type.startswith(
|
|
336
|
+
elif pol_type.startswith("n"):
|
|
335
337
|
filt_fn = filter_nucleotides
|
|
336
|
-
elif pol_type.startswith(
|
|
338
|
+
elif pol_type.startswith("c"):
|
|
337
339
|
filt_fn = filter_carbohydrates
|
|
338
340
|
else:
|
|
339
|
-
raise ValueError(f
|
|
341
|
+
raise ValueError(f"Unsupported polymer type {pol_type}")
|
|
340
342
|
|
|
341
343
|
mask = filt_fn(array)
|
|
342
344
|
return get_residue_count(array[mask]) >= min_size
|
|
343
345
|
|
|
344
346
|
|
|
345
|
-
def filter_polymer(array, min_size=2, pol_type=
|
|
347
|
+
def filter_polymer(array, min_size=2, pol_type="peptide"):
|
|
346
348
|
"""
|
|
347
349
|
Filter for atoms that are a part of a consecutive standard macromolecular
|
|
348
350
|
polymer entity.
|
|
@@ -365,13 +367,14 @@ def filter_polymer(array, min_size=2, pol_type='peptide'):
|
|
|
365
367
|
|
|
366
368
|
"""
|
|
367
369
|
# Import `check_res_id_continuity` here to avoid circular imports
|
|
368
|
-
from .integrity import check_res_id_continuity
|
|
370
|
+
from biotite.structure.integrity import check_res_id_continuity
|
|
371
|
+
|
|
369
372
|
split_idx = check_res_id_continuity(array)
|
|
370
373
|
|
|
371
374
|
check_pol = partial(_is_polymer, min_size=min_size, pol_type=pol_type)
|
|
372
375
|
bool_idx = map(
|
|
373
376
|
lambda a: np.full(len(a), check_pol(atom_array(a)), dtype=bool),
|
|
374
|
-
np.split(array, split_idx)
|
|
377
|
+
np.split(array, split_idx),
|
|
375
378
|
)
|
|
376
379
|
return np.concatenate(list(bool_idx))
|
|
377
380
|
|
|
@@ -415,13 +418,17 @@ def filter_intersection(array, intersect):
|
|
|
415
418
|
intersect_categories = intersect.get_annotation_categories()
|
|
416
419
|
# Check atom equality only for categories,
|
|
417
420
|
# which exist in both arrays
|
|
418
|
-
categories = [
|
|
419
|
-
|
|
421
|
+
categories = [
|
|
422
|
+
category
|
|
423
|
+
for category in array.get_annotation_categories()
|
|
424
|
+
if category in intersect_categories
|
|
425
|
+
]
|
|
420
426
|
for i in range(array.array_length()):
|
|
421
427
|
subfilter = np.full(intersect.array_length(), True, dtype=bool)
|
|
422
428
|
for category in categories:
|
|
423
|
-
subfilter &= (
|
|
424
|
-
|
|
429
|
+
subfilter &= (
|
|
430
|
+
intersect.get_annotation(category) == array.get_annotation(category)[i]
|
|
431
|
+
)
|
|
425
432
|
filter[i] = subfilter.any()
|
|
426
433
|
return filter
|
|
427
434
|
|
|
@@ -479,15 +486,15 @@ def filter_first_altloc(atoms, altloc_ids):
|
|
|
479
486
|
1 CB 4.000 5.000 6.000
|
|
480
487
|
"""
|
|
481
488
|
# Filter all atoms without altloc code
|
|
482
|
-
altloc_filter = np.
|
|
489
|
+
altloc_filter = np.isin(altloc_ids, [".", "?", " ", ""])
|
|
483
490
|
|
|
484
491
|
# And filter all atoms for each residue with the first altloc ID
|
|
485
492
|
residue_starts = get_residue_starts(atoms, add_exclusive_stop=True)
|
|
486
493
|
for start, stop in zip(residue_starts[:-1], residue_starts[1:]):
|
|
487
|
-
letter_altloc_ids = [
|
|
494
|
+
letter_altloc_ids = [loc for loc in altloc_ids[start:stop] if loc.isalpha()]
|
|
488
495
|
if len(letter_altloc_ids) > 0:
|
|
489
496
|
first_id = letter_altloc_ids[0]
|
|
490
|
-
altloc_filter[start:stop] |=
|
|
497
|
+
altloc_filter[start:stop] |= altloc_ids[start:stop] == first_id
|
|
491
498
|
else:
|
|
492
499
|
# No altloc ID in this residue -> Nothing to do
|
|
493
500
|
pass
|
|
@@ -556,7 +563,7 @@ def filter_highest_occupancy_altloc(atoms, altloc_ids, occupancies):
|
|
|
556
563
|
1 CB 6.000 5.000 4.000
|
|
557
564
|
"""
|
|
558
565
|
# Filter all atoms without altloc code
|
|
559
|
-
altloc_filter = np.
|
|
566
|
+
altloc_filter = np.isin(altloc_ids, [".", "?", " ", ""])
|
|
560
567
|
|
|
561
568
|
# And filter all atoms for each residue with the highest sum of
|
|
562
569
|
# occupancies
|
|
@@ -565,19 +572,17 @@ def filter_highest_occupancy_altloc(atoms, altloc_ids, occupancies):
|
|
|
565
572
|
occupancies_in_res = occupancies[start:stop]
|
|
566
573
|
altloc_ids_in_res = altloc_ids[start:stop]
|
|
567
574
|
|
|
568
|
-
letter_altloc_ids = [
|
|
575
|
+
letter_altloc_ids = [loc for loc in altloc_ids_in_res if loc.isalpha()]
|
|
569
576
|
|
|
570
577
|
if len(letter_altloc_ids) > 0:
|
|
571
578
|
highest = -1.0
|
|
572
579
|
highest_id = None
|
|
573
580
|
for id in set(letter_altloc_ids):
|
|
574
|
-
occupancy_sum = np.sum(
|
|
575
|
-
occupancies_in_res[altloc_ids_in_res == id]
|
|
576
|
-
)
|
|
581
|
+
occupancy_sum = np.sum(occupancies_in_res[altloc_ids_in_res == id])
|
|
577
582
|
if occupancy_sum > highest:
|
|
578
583
|
highest = occupancy_sum
|
|
579
584
|
highest_id = id
|
|
580
|
-
altloc_filter[start:stop] |=
|
|
585
|
+
altloc_filter[start:stop] |= altloc_ids[start:stop] == highest_id
|
|
581
586
|
else:
|
|
582
587
|
# No altloc ID in this residue -> Nothing to do
|
|
583
588
|
pass
|