biotite 1.0.1__cp312-cp312-macosx_11_0_arm64.whl → 1.1.0__cp312-cp312-macosx_11_0_arm64.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.

Files changed (90) hide show
  1. biotite/application/dssp/app.py +13 -3
  2. biotite/application/localapp.py +34 -0
  3. biotite/application/muscle/app3.py +2 -15
  4. biotite/application/muscle/app5.py +2 -2
  5. biotite/application/util.py +1 -1
  6. biotite/application/viennarna/rnaplot.py +6 -2
  7. biotite/database/rcsb/query.py +6 -6
  8. biotite/database/uniprot/check.py +20 -15
  9. biotite/database/uniprot/download.py +1 -1
  10. biotite/database/uniprot/query.py +1 -1
  11. biotite/sequence/align/alignment.py +16 -3
  12. biotite/sequence/align/banded.cpython-312-darwin.so +0 -0
  13. biotite/sequence/align/banded.pyx +5 -5
  14. biotite/sequence/align/kmeralphabet.cpython-312-darwin.so +0 -0
  15. biotite/sequence/align/kmeralphabet.pyx +17 -0
  16. biotite/sequence/align/kmersimilarity.cpython-312-darwin.so +0 -0
  17. biotite/sequence/align/kmertable.cpython-312-darwin.so +0 -0
  18. biotite/sequence/align/kmertable.pyx +52 -42
  19. biotite/sequence/align/localgapped.cpython-312-darwin.so +0 -0
  20. biotite/sequence/align/localungapped.cpython-312-darwin.so +0 -0
  21. biotite/sequence/align/matrix.py +273 -55
  22. biotite/sequence/align/matrix_data/3Di.mat +24 -0
  23. biotite/sequence/align/matrix_data/PB.license +21 -0
  24. biotite/sequence/align/matrix_data/PB.mat +18 -0
  25. biotite/sequence/align/multiple.cpython-312-darwin.so +0 -0
  26. biotite/sequence/align/pairwise.cpython-312-darwin.so +0 -0
  27. biotite/sequence/align/permutation.cpython-312-darwin.so +0 -0
  28. biotite/sequence/align/selector.cpython-312-darwin.so +0 -0
  29. biotite/sequence/align/tracetable.cpython-312-darwin.so +0 -0
  30. biotite/sequence/alphabet.py +3 -0
  31. biotite/sequence/codec.cpython-312-darwin.so +0 -0
  32. biotite/sequence/graphics/color_schemes/3di_flower.json +48 -0
  33. biotite/sequence/graphics/color_schemes/pb_flower.json +2 -1
  34. biotite/sequence/graphics/colorschemes.py +44 -11
  35. biotite/sequence/phylo/nj.cpython-312-darwin.so +0 -0
  36. biotite/sequence/phylo/tree.cpython-312-darwin.so +0 -0
  37. biotite/sequence/phylo/upgma.cpython-312-darwin.so +0 -0
  38. biotite/sequence/profile.py +86 -4
  39. biotite/sequence/seqtypes.py +124 -3
  40. biotite/setup_ccd.py +197 -0
  41. biotite/structure/__init__.py +4 -3
  42. biotite/structure/alphabet/__init__.py +25 -0
  43. biotite/structure/alphabet/encoder.py +332 -0
  44. biotite/structure/alphabet/encoder_weights_3di.kerasify +0 -0
  45. biotite/structure/alphabet/i3d.py +110 -0
  46. biotite/structure/alphabet/layers.py +86 -0
  47. biotite/structure/alphabet/pb.license +21 -0
  48. biotite/structure/alphabet/pb.py +171 -0
  49. biotite/structure/alphabet/unkerasify.py +122 -0
  50. biotite/structure/atoms.py +129 -40
  51. biotite/structure/bonds.cpython-312-darwin.so +0 -0
  52. biotite/structure/bonds.pyx +72 -21
  53. biotite/structure/celllist.cpython-312-darwin.so +0 -0
  54. biotite/structure/charges.cpython-312-darwin.so +0 -0
  55. biotite/structure/geometry.py +60 -113
  56. biotite/structure/info/__init__.py +1 -0
  57. biotite/structure/info/atoms.py +13 -13
  58. biotite/structure/info/bonds.py +12 -6
  59. biotite/structure/info/ccd.py +125 -32
  60. biotite/structure/info/{ccd/components.bcif → components.bcif} +0 -0
  61. biotite/structure/info/groups.py +63 -17
  62. biotite/structure/info/masses.py +9 -6
  63. biotite/structure/info/misc.py +15 -21
  64. biotite/structure/info/standardize.py +3 -2
  65. biotite/structure/io/mol/sdf.py +41 -40
  66. biotite/structure/io/pdb/convert.py +2 -0
  67. biotite/structure/io/pdb/file.py +74 -3
  68. biotite/structure/io/pdb/hybrid36.cpython-312-darwin.so +0 -0
  69. biotite/structure/io/pdbqt/file.py +32 -32
  70. biotite/structure/io/pdbx/__init__.py +1 -0
  71. biotite/structure/io/pdbx/bcif.py +32 -8
  72. biotite/structure/io/pdbx/cif.py +72 -59
  73. biotite/structure/io/pdbx/component.py +9 -4
  74. biotite/structure/io/pdbx/compress.py +321 -0
  75. biotite/structure/io/pdbx/convert.py +194 -48
  76. biotite/structure/io/pdbx/encoding.cpython-312-darwin.so +0 -0
  77. biotite/structure/io/pdbx/encoding.pyx +98 -17
  78. biotite/structure/molecules.py +141 -141
  79. biotite/structure/sasa.cpython-312-darwin.so +0 -0
  80. biotite/structure/segments.py +1 -2
  81. biotite/structure/util.py +73 -1
  82. biotite/version.py +2 -2
  83. {biotite-1.0.1.dist-info → biotite-1.1.0.dist-info}/METADATA +3 -1
  84. {biotite-1.0.1.dist-info → biotite-1.1.0.dist-info}/RECORD +86 -76
  85. biotite/structure/info/ccd/README.rst +0 -8
  86. biotite/structure/info/ccd/amino_acids.txt +0 -1663
  87. biotite/structure/info/ccd/carbohydrates.txt +0 -1135
  88. biotite/structure/info/ccd/nucleotides.txt +0 -798
  89. {biotite-1.0.1.dist-info → biotite-1.1.0.dist-info}/WHEEL +0 -0
  90. {biotite-1.0.1.dist-info → biotite-1.1.0.dist-info}/licenses/LICENSE.rst +0 -0
@@ -11,19 +11,13 @@ from biotite.structure.info.ccd import get_ccd, get_from_ccd
11
11
 
12
12
  def all_residues():
13
13
  """
14
- Get a list of all residues/compound names in the
15
- PDB chemical components dictionary.
14
+ Get a list of all residues/compound names in the PDB
15
+ *Chemical Component Dictionary* (CCD).
16
16
 
17
17
  Returns
18
18
  -------
19
19
  residues : list of str
20
- A list of all available The up to 3-letter residue names.
21
-
22
- Examples
23
- --------
24
-
25
- >>> print(all_residues()[1000 : 1010])
26
- ['0V9', '0VA', '0VB', '0VC', '0VD', '0VE', '0VF', '0VG', '0VH', '0VI']
20
+ A list of all available residue names.
27
21
  """
28
22
  return get_ccd()["chem_comp"]["id"].as_array().tolist()
29
23
 
@@ -51,10 +45,10 @@ def full_name(res_name):
51
45
  >>> print(full_name("MAN"))
52
46
  alpha-D-mannopyranose
53
47
  """
54
- array = get_from_ccd("chem_comp", res_name.upper(), "name")
55
- if array is None:
48
+ column = get_from_ccd("chem_comp", res_name.upper(), "name")
49
+ if column is None:
56
50
  return None
57
- return array.item()
51
+ return column.as_item()
58
52
 
59
53
 
60
54
  def link_type(res_name):
@@ -84,10 +78,10 @@ def link_type(res_name):
84
78
  >>> print(link_type("HOH"))
85
79
  NON-POLYMER
86
80
  """
87
- array = get_from_ccd("chem_comp", res_name.upper(), "type")
88
- if array is None:
81
+ column = get_from_ccd("chem_comp", res_name.upper(), "type")
82
+ if column is None:
89
83
  return None
90
- return array.item()
84
+ return column.as_item()
91
85
 
92
86
 
93
87
  def one_letter_code(res_name):
@@ -107,7 +101,7 @@ def one_letter_code(res_name):
107
101
  -------
108
102
  one_letter_code : str or None
109
103
  The one-letter code.
110
- None if the compound is not present in the CCD or if no
104
+ ``None`` if the compound is not present in the CCD or if no
111
105
  one-letter code is defined for this compound.
112
106
 
113
107
  Examples
@@ -135,10 +129,10 @@ def one_letter_code(res_name):
135
129
  None
136
130
 
137
131
  """
138
- array = get_from_ccd("chem_comp", res_name.upper(), "one_letter_code")
139
- if array is None:
132
+ column = get_from_ccd("chem_comp", res_name.upper(), "one_letter_code")
133
+ if column is None:
140
134
  return None
141
- item = array.item()
142
- if item == "":
135
+ if column.mask is not None:
136
+ # Value is masked, i.e. inapplicable or missing
143
137
  return None
144
- return item
138
+ return column.as_item()
@@ -121,8 +121,8 @@ def standardize_order(atoms):
121
121
  stop = starts[i + 1]
122
122
 
123
123
  res_name = atoms.res_name[start]
124
- standard_atom_names = get_from_ccd("chem_comp_atom", res_name, "atom_id")
125
- if standard_atom_names is None:
124
+ chem_comp_atom = get_from_ccd("chem_comp_atom", res_name, "atom_id")
125
+ if chem_comp_atom is None:
126
126
  # If the residue is not in the CCD, keep the current order
127
127
  warnings.warn(
128
128
  f"Residue '{res_name}' is not in the CCD, "
@@ -131,6 +131,7 @@ def standardize_order(atoms):
131
131
  reordered_indices[start:stop] = np.arange(start, stop)
132
132
  continue
133
133
 
134
+ standard_atom_names = chem_comp_atom.as_array()
134
135
  reordered_indices[start:stop] = (
135
136
  _reorder(atoms.atom_name[start:stop], standard_atom_names) + start
136
137
  )
@@ -314,19 +314,19 @@ class SDRecord:
314
314
  >>> record = SDRecord(header=Header(mol_name="ALA", dimensions="3D"))
315
315
  >>> record.set_structure(atoms)
316
316
  >>> print(record.get_structure())
317
- 0 N -0.970 0.490 1.500
318
- 0 C 0.260 0.420 0.690
319
- 0 C -0.090 0.020 -0.720
320
- 0 O -1.060 -0.680 -0.920
321
- 0 C 1.200 -0.620 1.300
322
- 0 O 0.660 0.440 -1.740
323
- 0 H -1.380 -0.420 1.480
324
- 0 H -0.680 0.660 2.450
325
- 0 H 0.750 1.390 0.680
326
- 0 H 1.460 -0.330 2.320
327
- 0 H 0.720 -1.590 1.310
328
- 0 H 2.110 -0.680 0.700
329
- 0 H 0.440 0.180 -2.650
317
+ 0 N -0.966 0.493 1.500
318
+ 0 C 0.257 0.418 0.692
319
+ 0 C -0.094 0.017 -0.716
320
+ 0 O -1.056 -0.682 -0.923
321
+ 0 C 1.204 -0.620 1.296
322
+ 0 O 0.661 0.439 -1.742
323
+ 0 H -1.383 -0.425 1.482
324
+ 0 H -0.676 0.661 2.452
325
+ 0 H 0.746 1.392 0.682
326
+ 0 H 1.459 -0.330 2.316
327
+ 0 H 0.715 -1.594 1.307
328
+ 0 H 2.113 -0.676 0.697
329
+ 0 H 0.435 0.182 -2.647
330
330
  >>> # Add the record to an SD file
331
331
  >>> file = SDFile()
332
332
  >>> file["ALA"] = record
@@ -335,19 +335,19 @@ class SDRecord:
335
335
  3D
336
336
  <BLANKLINE>
337
337
  13 12 0 0 0 0 0 0 0 1 V2000
338
- -0.9700 0.4900 1.5000 N 0 0 0 0 0 0 0 0 0 0 0 0
339
- 0.2600 0.4200 0.6900 C 0 0 0 0 0 0 0 0 0 0 0 0
340
- -0.0900 0.0200 -0.7200 C 0 0 0 0 0 0 0 0 0 0 0 0
341
- -1.0600 -0.6800 -0.9200 O 0 0 0 0 0 0 0 0 0 0 0 0
342
- 1.2000 -0.6200 1.3000 C 0 0 0 0 0 0 0 0 0 0 0 0
343
- 0.6600 0.4400 -1.7400 O 0 0 0 0 0 0 0 0 0 0 0 0
344
- -1.3800 -0.4200 1.4800 H 0 0 0 0 0 0 0 0 0 0 0 0
345
- -0.6800 0.6600 2.4500 H 0 0 0 0 0 0 0 0 0 0 0 0
346
- 0.7500 1.3900 0.6800 H 0 0 0 0 0 0 0 0 0 0 0 0
347
- 1.4600 -0.3300 2.3200 H 0 0 0 0 0 0 0 0 0 0 0 0
348
- 0.7200 -1.5900 1.3100 H 0 0 0 0 0 0 0 0 0 0 0 0
349
- 2.1100 -0.6800 0.7000 H 0 0 0 0 0 0 0 0 0 0 0 0
350
- 0.4400 0.1800 -2.6500 H 0 0 0 0 0 0 0 0 0 0 0 0
338
+ -0.9660 0.4930 1.5000 N 0 0 0 0 0 0 0 0 0 0 0 0
339
+ 0.2570 0.4180 0.6920 C 0 0 0 0 0 0 0 0 0 0 0 0
340
+ -0.0940 0.0170 -0.7160 C 0 0 0 0 0 0 0 0 0 0 0 0
341
+ -1.0560 -0.6820 -0.9230 O 0 0 0 0 0 0 0 0 0 0 0 0
342
+ 1.2040 -0.6200 1.2960 C 0 0 0 0 0 0 0 0 0 0 0 0
343
+ 0.6610 0.4390 -1.7420 O 0 0 0 0 0 0 0 0 0 0 0 0
344
+ -1.3830 -0.4250 1.4820 H 0 0 0 0 0 0 0 0 0 0 0 0
345
+ -0.6760 0.6610 2.4520 H 0 0 0 0 0 0 0 0 0 0 0 0
346
+ 0.7460 1.3920 0.6820 H 0 0 0 0 0 0 0 0 0 0 0 0
347
+ 1.4590 -0.3300 2.3160 H 0 0 0 0 0 0 0 0 0 0 0 0
348
+ 0.7150 -1.5940 1.3070 H 0 0 0 0 0 0 0 0 0 0 0 0
349
+ 2.1130 -0.6760 0.6970 H 0 0 0 0 0 0 0 0 0 0 0 0
350
+ 0.4350 0.1820 -2.6470 H 0 0 0 0 0 0 0 0 0 0 0 0
351
351
  1 2 1 0 0 0 0
352
352
  1 7 1 0 0 0 0
353
353
  1 8 1 0 0 0 0
@@ -362,6 +362,7 @@ class SDRecord:
362
362
  6 13 1 0 0 0 0
363
363
  M END
364
364
  $$$$
365
+ <BLANKLINE>
365
366
  """
366
367
 
367
368
  def __init__(self, header=None, ctab=None, metadata=None):
@@ -542,7 +543,7 @@ class SDFile(File, MutableMapping):
542
543
  ----------
543
544
  record : CIFBlock
544
545
  The sole record of the file.
545
- If the file contains multiple blocks, an exception is raised.
546
+ If the file contains multiple records, an exception is raised.
546
547
 
547
548
  Examples
548
549
  --------
@@ -678,19 +679,19 @@ class SDFile(File, MutableMapping):
678
679
  <BLANKLINE>
679
680
  <BLANKLINE>
680
681
  13 12 0 0 0 0 0 0 0 1 V2000
681
- -0.9700 0.4900 1.5000 N 0 0 0 0 0 0 0 0 0 0 0 0
682
- 0.2600 0.4200 0.6900 C 0 0 0 0 0 0 0 0 0 0 0 0
683
- -0.0900 0.0200 -0.7200 C 0 0 0 0 0 0 0 0 0 0 0 0
684
- -1.0600 -0.6800 -0.9200 O 0 0 0 0 0 0 0 0 0 0 0 0
685
- 1.2000 -0.6200 1.3000 C 0 0 0 0 0 0 0 0 0 0 0 0
686
- 0.6600 0.4400 -1.7400 O 0 0 0 0 0 0 0 0 0 0 0 0
687
- -1.3800 -0.4200 1.4800 H 0 0 0 0 0 0 0 0 0 0 0 0
688
- -0.6800 0.6600 2.4500 H 0 0 0 0 0 0 0 0 0 0 0 0
689
- 0.7500 1.3900 0.6800 H 0 0 0 0 0 0 0 0 0 0 0 0
690
- 1.4600 -0.3300 2.3200 H 0 0 0 0 0 0 0 0 0 0 0 0
691
- 0.7200 -1.5900 1.3100 H 0 0 0 0 0 0 0 0 0 0 0 0
692
- 2.1100 -0.6800 0.7000 H 0 0 0 0 0 0 0 0 0 0 0 0
693
- 0.4400 0.1800 -2.6500 H 0 0 0 0 0 0 0 0 0 0 0 0
682
+ -0.9660 0.4930 1.5000 N 0 0 0 0 0 0 0 0 0 0 0 0
683
+ 0.2570 0.4180 0.6920 C 0 0 0 0 0 0 0 0 0 0 0 0
684
+ -0.0940 0.0170 -0.7160 C 0 0 0 0 0 0 0 0 0 0 0 0
685
+ -1.0560 -0.6820 -0.9230 O 0 0 0 0 0 0 0 0 0 0 0 0
686
+ 1.2040 -0.6200 1.2960 C 0 0 0 0 0 0 0 0 0 0 0 0
687
+ 0.6610 0.4390 -1.7420 O 0 0 0 0 0 0 0 0 0 0 0 0
688
+ -1.3830 -0.4250 1.4820 H 0 0 0 0 0 0 0 0 0 0 0 0
689
+ -0.6760 0.6610 2.4520 H 0 0 0 0 0 0 0 0 0 0 0 0
690
+ 0.7460 1.3920 0.6820 H 0 0 0 0 0 0 0 0 0 0 0 0
691
+ 1.4590 -0.3300 2.3160 H 0 0 0 0 0 0 0 0 0 0 0 0
692
+ 0.7150 -1.5940 1.3070 H 0 0 0 0 0 0 0 0 0 0 0 0
693
+ 2.1130 -0.6760 0.6970 H 0 0 0 0 0 0 0 0 0 0 0 0
694
+ 0.4350 0.1820 -2.6470 H 0 0 0 0 0 0 0 0 0 0 0 0
694
695
  1 2 1 0 0 0 0
695
696
  1 7 1 0 0 0 0
696
697
  1 8 1 0 0 0 0
@@ -218,6 +218,8 @@ def get_assembly(
218
218
  assembly : AtomArray or AtomArrayStack
219
219
  The assembly.
220
220
  The return type depends on the `model` parameter.
221
+ Contains the `sym_id` annotation, which enumerates the copies of the asymmetric
222
+ unit in the assembly.
221
223
 
222
224
  Examples
223
225
  --------
@@ -7,6 +7,7 @@ __author__ = "Patrick Kunzmann, Daniel Bauer, Claude J. Rogers"
7
7
  __all__ = ["PDBFile"]
8
8
 
9
9
  import warnings
10
+ from collections import namedtuple
10
11
  import numpy as np
11
12
  from biotite.file import InvalidFileError, TextFile
12
13
  from biotite.structure.atoms import AtomArray, AtomArrayStack, repeat
@@ -53,6 +54,8 @@ _c = slice(24, 33)
53
54
  _alpha = slice(33, 40)
54
55
  _beta = slice(40, 47)
55
56
  _gamma = slice(47, 54)
57
+ _space = slice(55, 66)
58
+ _z = slice(66, 70)
56
59
 
57
60
 
58
61
  class PDBFile(TextFile):
@@ -545,6 +548,38 @@ class PDBFile(TextFile):
545
548
 
546
549
  return array
547
550
 
551
+ def get_space_group(self):
552
+ """
553
+ Extract the space group and Z value from the CRYST1 record.
554
+
555
+ Returns
556
+ -------
557
+ space_group : str
558
+ The extracted space group.
559
+ z_val : int
560
+ The extracted Z value.
561
+ """
562
+ # Initialize the namedtuple
563
+ SpaceGroupInfo = namedtuple("SpaceGroupInfo", ["space_group", "z_val"])
564
+
565
+ # CRYST1 is a one-time record so we can extract it directly
566
+ for line in self.lines:
567
+ if line.startswith("CRYST1"):
568
+ try:
569
+ # Extract space group and Z value
570
+ space_group = str(line[_space])
571
+ z_val = int(line[_z])
572
+ except ValueError:
573
+ # File contains invalid 'CRYST1' record
574
+ raise InvalidFileError(
575
+ "File does not contain valid space group and/or Z values"
576
+ )
577
+ # Set default values
578
+ space_group = "P 1"
579
+ z_val = 1
580
+ break
581
+ return SpaceGroupInfo(space_group=space_group, z_val=z_val)
582
+
548
583
  def set_structure(self, array, hybrid36=False):
549
584
  """
550
585
  Set the :class:`AtomArray` or :class:`AtomArrayStack` for the
@@ -700,6 +735,32 @@ class PDBFile(TextFile):
700
735
 
701
736
  self._index_models_and_atoms()
702
737
 
738
+ def set_space_group(self, info):
739
+ """
740
+ Update the CRYST1 record with the provided space group and Z value.
741
+
742
+ Parameters
743
+ ----------
744
+ info : tuple(str, int) or SpaceGroupInfo
745
+ Contains the space group and Z-value.
746
+ """
747
+ for i, line in enumerate(self.lines):
748
+ if line.startswith("CRYST1"):
749
+ try:
750
+ # Format the replacement string
751
+ space_group_str = info.space_group.ljust(11)
752
+ z_val_str = str(info.z_val).rjust(4)
753
+
754
+ # Replace the existing CRYST1 record
755
+ self.lines[i] = line[:55] + space_group_str + z_val_str + line[70:]
756
+ except (ValueError, AttributeError) as e:
757
+ # Raise an exception with context
758
+ raise AttributeError(
759
+ f"Failed to update CRYST1 record. "
760
+ f"Line: {line.strip()} | Error: {e}"
761
+ )
762
+ break
763
+
703
764
  def list_assemblies(self):
704
765
  """
705
766
  List the biological assemblies that are available for the
@@ -790,6 +851,8 @@ class PDBFile(TextFile):
790
851
  assembly : AtomArray or AtomArrayStack
791
852
  The assembly.
792
853
  The return type depends on the `model` parameter.
854
+ Contains the `sym_id` annotation, which enumerates the copies of the
855
+ asymmetric unit in the assembly.
793
856
 
794
857
  Examples
795
858
  --------
@@ -853,8 +916,12 @@ class PDBFile(TextFile):
853
916
  affected_chain_ids = []
854
917
  transform_start = None
855
918
  for j, line in enumerate(assembly_lines[start:stop]):
856
- if line.startswith("APPLY THE FOLLOWING TO CHAINS:") or line.startswith(
857
- " AND CHAINS:"
919
+ if any(
920
+ line.startswith(chain_signal_string)
921
+ for chain_signal_string in [
922
+ "APPLY THE FOLLOWING TO CHAINS:",
923
+ " AND CHAINS:",
924
+ ]
858
925
  ):
859
926
  affected_chain_ids += [
860
927
  chain_id.strip() for chain_id in line[30:].split(",")
@@ -1148,7 +1215,11 @@ def _apply_transformations(structure, rotations, translations):
1148
1215
  coord += translation
1149
1216
  assembly_coord[i] = coord
1150
1217
 
1151
- return repeat(structure, assembly_coord)
1218
+ assembly = repeat(structure, assembly_coord)
1219
+ assembly.set_annotation(
1220
+ "sym_id", np.repeat(np.arange(len(rotations)), structure.array_length())
1221
+ )
1222
+ return assembly
1152
1223
 
1153
1224
 
1154
1225
  def _check_pdb_compatibility(array, hybrid36):
@@ -58,48 +58,48 @@ class PDBQTFile(TextFile):
58
58
  >>> mask = file.set_structure(ligand, rotatable_bonds="all")
59
59
  >>> # Print removed nonpolar hydrogen atoms
60
60
  >>> print(ligand[~mask])
61
- HET 0 BTN H101 H 3.740 1.170 0.970
62
- HET 0 BTN H102 H 4.070 1.340 -0.770
63
- HET 0 BTN H91 H 2.800 -0.740 -1.210
64
- HET 0 BTN H92 H 2.480 -0.910 0.530
65
- HET 0 BTN H81 H 1.290 1.260 0.520
66
- HET 0 BTN H82 H 1.620 1.440 -1.220
67
- HET 0 BTN H71 H 0.350 -0.650 -1.660
68
- HET 0 BTN H72 H 0.020 -0.820 0.080
69
- HET 0 BTN H2 H -0.840 1.580 -1.630
70
- HET 0 BTN H61 H -3.800 1.840 1.290
71
- HET 0 BTN H62 H -3.370 2.740 -0.200
72
- HET 0 BTN H5 H -4.310 0.810 -1.210
73
- HET 0 BTN H4 H -2.450 -0.040 -2.250
61
+ HET 0 BTN H101 H 3.745 1.171 0.974
62
+ HET 0 BTN H102 H 4.071 1.343 -0.767
63
+ HET 0 BTN H91 H 2.802 -0.740 -1.211
64
+ HET 0 BTN H92 H 2.476 -0.912 0.530
65
+ HET 0 BTN H81 H 1.289 1.265 0.523
66
+ HET 0 BTN H82 H 1.616 1.437 -1.218
67
+ HET 0 BTN H71 H 0.346 -0.646 -1.662
68
+ HET 0 BTN H72 H 0.020 -0.818 0.079
69
+ HET 0 BTN H2 H -0.838 1.576 -1.627
70
+ HET 0 BTN H61 H -3.797 1.837 1.286
71
+ HET 0 BTN H62 H -3.367 2.738 -0.205
72
+ HET 0 BTN H5 H -4.307 0.812 -1.205
73
+ HET 0 BTN H4 H -2.451 -0.038 -2.252
74
74
  >>> print(file)
75
75
  ROOT
76
- HETATM 1 C11 BTN 0 5.090 -0.280 0.170 1.00 0.00 0.258 C
77
- HETATM 2 O11 BTN 0 4.960 -1.470 0.030 1.00 0.00 -0.264 OA
76
+ HETATM 1 C11 BTN 0 5.089 -0.280 0.173 1.00 0.00 0.258 C
77
+ HETATM 2 O11 BTN 0 4.956 -1.473 0.030 1.00 0.00 -0.264 OA
78
78
  ENDROOT
79
79
  BRANCH 1 3
80
- HETATM 3 O12 BTN 0 6.300 0.230 0.440 1.00 0.00 -0.331 OA
81
- HETATM 17 HO2 BTN 0 7.030 -0.390 0.520 1.00 0.00 0.221 HD
80
+ HETATM 3 O12 BTN 0 6.299 0.233 0.444 1.00 0.00 -0.331 OA
81
+ HETATM 17 HO2 BTN 0 7.034 -0.391 0.517 1.00 0.00 0.221 HD
82
82
  ENDBRANCH 1 3
83
83
  BRANCH 1 4
84
- HETATM 4 C10 BTN 0 3.900 0.630 0.040 1.00 0.00 0.105 C
84
+ HETATM 4 C10 BTN 0 3.896 0.631 0.039 1.00 0.00 0.105 C
85
85
  BRANCH 4 5
86
- HETATM 5 C9 BTN 0 2.650 -0.200 -0.280 1.00 0.00 0.010 C
86
+ HETATM 5 C9 BTN 0 2.651 -0.200 -0.276 1.00 0.00 0.010 C
87
87
  BRANCH 5 6
88
- HETATM 6 C8 BTN 0 1.440 0.720 -0.410 1.00 0.00 0.002 C
88
+ HETATM 6 C8 BTN 0 1.440 0.725 -0.412 1.00 0.00 0.002 C
89
89
  BRANCH 6 7
90
- HETATM 7 C7 BTN 0 0.200 -0.110 -0.730 1.00 0.00 0.016 C
90
+ HETATM 7 C7 BTN 0 0.196 -0.106 -0.727 1.00 0.00 0.016 C
91
91
  BRANCH 7 8
92
- HETATM 8 C2 BTN 0 -1.020 0.820 -0.860 1.00 0.00 0.065 C
93
- HETATM 9 S1 BTN 0 -1.420 1.600 0.750 1.00 0.00 -0.154 SA
94
- HETATM 10 C6 BTN 0 -3.200 1.830 0.370 1.00 0.00 0.090 C
95
- HETATM 11 C5 BTN 0 -3.530 0.580 -0.480 1.00 0.00 0.091 C
96
- HETATM 12 N1 BTN 0 -3.970 -0.510 0.410 1.00 0.00 -0.239 NA
97
- HETATM 13 C3 BTN 0 -3.140 -1.550 0.270 1.00 0.00 0.272 C
98
- HETATM 14 O3 BTN 0 -3.270 -2.590 0.890 1.00 0.00 -0.259 OA
99
- HETATM 15 N2 BTN 0 -2.150 -1.340 -0.610 1.00 0.00 -0.239 NA
100
- HETATM 16 C4 BTN 0 -2.290 0.010 -1.170 1.00 0.00 0.093 C
101
- HETATM 18 HN1 BTN 0 -4.740 -0.470 1.000 1.00 0.00 0.132 HD
102
- HETATM 19 HN2 BTN 0 -1.460 -1.980 -0.840 1.00 0.00 0.132 HD
92
+ HETATM 8 C2 BTN 0 -1.015 0.819 -0.863 1.00 0.00 0.065 C
93
+ HETATM 9 S1 BTN 0 -1.419 1.604 0.751 1.00 0.00 -0.154 SA
94
+ HETATM 10 C6 BTN 0 -3.205 1.827 0.371 1.00 0.00 0.090 C
95
+ HETATM 11 C5 BTN 0 -3.530 0.581 -0.476 1.00 0.00 0.091 C
96
+ HETATM 12 N1 BTN 0 -3.970 -0.507 0.412 1.00 0.00 -0.239 NA
97
+ HETATM 13 C3 BTN 0 -3.141 -1.549 0.271 1.00 0.00 0.272 C
98
+ HETATM 14 O3 BTN 0 -3.271 -2.589 0.888 1.00 0.00 -0.259 OA
99
+ HETATM 15 N2 BTN 0 -2.154 -1.343 -0.612 1.00 0.00 -0.239 NA
100
+ HETATM 16 C4 BTN 0 -2.289 0.010 -1.175 1.00 0.00 0.093 C
101
+ HETATM 18 HN1 BTN 0 -4.738 -0.474 1.004 1.00 0.00 0.132 HD
102
+ HETATM 19 HN2 BTN 0 -1.462 -1.982 -0.843 1.00 0.00 0.132 HD
103
103
  ENDBRANCH 7 8
104
104
  ENDBRANCH 6 7
105
105
  ENDBRANCH 5 6
@@ -18,5 +18,6 @@ __author__ = "Patrick Kunzmann"
18
18
  from .bcif import *
19
19
  from .cif import *
20
20
  from .component import *
21
+ from .compress import *
21
22
  from .convert import *
22
23
  from .encoding import *
@@ -38,8 +38,9 @@ class BinaryCIFData(_Component):
38
38
  array : array_like or int or float or str
39
39
  The data array to be stored.
40
40
  If a single item is given, it is converted into an array.
41
- encoding : list of Encoding
41
+ encoding : list of Encoding , optional
42
42
  The encoding steps that are successively applied to the data.
43
+ By default, the data is stored uncompressed directly as bytes.
43
44
 
44
45
  Attributes
45
46
  ----------
@@ -61,7 +62,7 @@ class BinaryCIFData(_Component):
61
62
  >>> print(data.array)
62
63
  ['apple']
63
64
 
64
- Well-chosen encoding can significantly reduce the serialized data
65
+ A well-chosen encoding can significantly reduce the serialized data
65
66
  size:
66
67
 
67
68
  >>> # Default uncompressed encoding
@@ -457,7 +458,12 @@ class BinaryCIFBlock(_HierarchicalContainer):
457
458
  """
458
459
 
459
460
  def __init__(self, categories=None):
460
- super().__init__(categories)
461
+ if categories is None:
462
+ categories = {}
463
+ super().__init__(
464
+ # Actual bcif files use leading '_' as category names
465
+ {"_" + name: category for name, category in categories.items()}
466
+ )
461
467
 
462
468
  @staticmethod
463
469
  def subcomponent_class():
@@ -470,25 +476,43 @@ class BinaryCIFBlock(_HierarchicalContainer):
470
476
  @staticmethod
471
477
  def deserialize(content):
472
478
  return BinaryCIFBlock(
473
- BinaryCIFBlock._deserialize_elements(content["categories"], "name")
479
+ {
480
+ # The superclass uses leading '_' in category names,
481
+ # but on the level of this class, the leading '_' is omitted
482
+ name.lstrip("_"): category
483
+ for name, category in BinaryCIFBlock._deserialize_elements(
484
+ content["categories"], "name"
485
+ ).items()
486
+ }
474
487
  )
475
488
 
476
489
  def serialize(self):
477
490
  return {"categories": self._serialize_elements("name")}
478
491
 
479
492
  def __getitem__(self, key):
480
- # Actual bcif files use leading '_' as categories
481
- return super().__getitem__("_" + key)
493
+ try:
494
+ return super().__getitem__("_" + key)
495
+ except KeyError:
496
+ raise KeyError(key)
482
497
 
483
498
  def __setitem__(self, key, element):
484
- return super().__setitem__("_" + key, element)
499
+ try:
500
+ return super().__setitem__("_" + key, element)
501
+ except KeyError:
502
+ raise KeyError(key)
485
503
 
486
504
  def __delitem__(self, key):
487
- return super().__setitem__("_" + key)
505
+ try:
506
+ return super().__setitem__("_" + key)
507
+ except KeyError:
508
+ raise KeyError(key)
488
509
 
489
510
  def __iter__(self):
490
511
  return (key.lstrip("_") for key in super().__iter__())
491
512
 
513
+ def __contains__(self, key):
514
+ return super().__contains__("_" + key)
515
+
492
516
 
493
517
  class BinaryCIFFile(File, _HierarchicalContainer):
494
518
  """