biotite 1.0.1__cp311-cp311-win_amd64.whl → 1.2.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.

Files changed (177) hide show
  1. biotite/application/application.py +3 -3
  2. biotite/application/autodock/app.py +1 -1
  3. biotite/application/blast/webapp.py +1 -1
  4. biotite/application/clustalo/app.py +1 -1
  5. biotite/application/dssp/app.py +13 -3
  6. biotite/application/localapp.py +36 -2
  7. biotite/application/msaapp.py +10 -10
  8. biotite/application/muscle/app3.py +5 -18
  9. biotite/application/muscle/app5.py +5 -5
  10. biotite/application/sra/app.py +0 -5
  11. biotite/application/util.py +22 -2
  12. biotite/application/viennarna/rnaalifold.py +8 -8
  13. biotite/application/viennarna/rnaplot.py +9 -3
  14. biotite/application/viennarna/util.py +1 -1
  15. biotite/application/webapp.py +1 -1
  16. biotite/database/afdb/__init__.py +12 -0
  17. biotite/database/afdb/download.py +191 -0
  18. biotite/database/entrez/dbnames.py +10 -0
  19. biotite/database/entrez/download.py +9 -10
  20. biotite/database/entrez/key.py +1 -1
  21. biotite/database/entrez/query.py +5 -4
  22. biotite/database/pubchem/download.py +6 -6
  23. biotite/database/pubchem/error.py +10 -0
  24. biotite/database/pubchem/query.py +12 -23
  25. biotite/database/rcsb/download.py +3 -2
  26. biotite/database/rcsb/query.py +8 -9
  27. biotite/database/uniprot/check.py +22 -17
  28. biotite/database/uniprot/download.py +3 -6
  29. biotite/database/uniprot/query.py +4 -5
  30. biotite/file.py +14 -2
  31. biotite/interface/__init__.py +19 -0
  32. biotite/interface/openmm/__init__.py +16 -0
  33. biotite/interface/openmm/state.py +93 -0
  34. biotite/interface/openmm/system.py +227 -0
  35. biotite/interface/pymol/__init__.py +198 -0
  36. biotite/interface/pymol/cgo.py +346 -0
  37. biotite/interface/pymol/convert.py +185 -0
  38. biotite/interface/pymol/display.py +267 -0
  39. biotite/interface/pymol/object.py +1226 -0
  40. biotite/interface/pymol/shapes.py +178 -0
  41. biotite/interface/pymol/startup.py +169 -0
  42. biotite/interface/rdkit/__init__.py +15 -0
  43. biotite/interface/rdkit/mol.py +490 -0
  44. biotite/interface/version.py +71 -0
  45. biotite/interface/warning.py +19 -0
  46. biotite/sequence/align/__init__.py +0 -4
  47. biotite/sequence/align/alignment.py +49 -14
  48. biotite/sequence/align/banded.cp311-win_amd64.pyd +0 -0
  49. biotite/sequence/align/banded.pyx +26 -26
  50. biotite/sequence/align/cigar.py +2 -2
  51. biotite/sequence/align/kmeralphabet.cp311-win_amd64.pyd +0 -0
  52. biotite/sequence/align/kmeralphabet.pyx +19 -2
  53. biotite/sequence/align/kmersimilarity.cp311-win_amd64.pyd +0 -0
  54. biotite/sequence/align/kmertable.cp311-win_amd64.pyd +0 -0
  55. biotite/sequence/align/kmertable.pyx +58 -48
  56. biotite/sequence/align/localgapped.cp311-win_amd64.pyd +0 -0
  57. biotite/sequence/align/localgapped.pyx +47 -47
  58. biotite/sequence/align/localungapped.cp311-win_amd64.pyd +0 -0
  59. biotite/sequence/align/localungapped.pyx +10 -10
  60. biotite/sequence/align/matrix.py +284 -57
  61. biotite/sequence/align/matrix_data/3Di.mat +24 -0
  62. biotite/sequence/align/matrix_data/PB.license +21 -0
  63. biotite/sequence/align/matrix_data/PB.mat +18 -0
  64. biotite/sequence/align/multiple.cp311-win_amd64.pyd +0 -0
  65. biotite/sequence/align/pairwise.cp311-win_amd64.pyd +0 -0
  66. biotite/sequence/align/pairwise.pyx +35 -35
  67. biotite/sequence/align/permutation.cp311-win_amd64.pyd +0 -0
  68. biotite/sequence/align/selector.cp311-win_amd64.pyd +0 -0
  69. biotite/sequence/align/selector.pyx +2 -2
  70. biotite/sequence/align/statistics.py +1 -1
  71. biotite/sequence/align/tracetable.cp311-win_amd64.pyd +0 -0
  72. biotite/sequence/alphabet.py +5 -2
  73. biotite/sequence/annotation.py +19 -13
  74. biotite/sequence/codec.cp311-win_amd64.pyd +0 -0
  75. biotite/sequence/codon.py +1 -2
  76. biotite/sequence/graphics/alignment.py +25 -39
  77. biotite/sequence/graphics/color_schemes/3di_flower.json +48 -0
  78. biotite/sequence/graphics/color_schemes/pb_flower.json +2 -1
  79. biotite/sequence/graphics/colorschemes.py +44 -11
  80. biotite/sequence/graphics/dendrogram.py +4 -2
  81. biotite/sequence/graphics/features.py +2 -2
  82. biotite/sequence/graphics/logo.py +10 -12
  83. biotite/sequence/io/fasta/convert.py +1 -2
  84. biotite/sequence/io/fasta/file.py +1 -1
  85. biotite/sequence/io/fastq/file.py +3 -3
  86. biotite/sequence/io/genbank/file.py +3 -3
  87. biotite/sequence/io/genbank/sequence.py +2 -0
  88. biotite/sequence/io/gff/convert.py +1 -1
  89. biotite/sequence/io/gff/file.py +1 -2
  90. biotite/sequence/phylo/nj.cp311-win_amd64.pyd +0 -0
  91. biotite/sequence/phylo/tree.cp311-win_amd64.pyd +0 -0
  92. biotite/sequence/phylo/upgma.cp311-win_amd64.pyd +0 -0
  93. biotite/sequence/profile.py +105 -29
  94. biotite/sequence/search.py +0 -1
  95. biotite/sequence/seqtypes.py +136 -8
  96. biotite/sequence/sequence.py +1 -2
  97. biotite/setup_ccd.py +197 -0
  98. biotite/structure/__init__.py +6 -3
  99. biotite/structure/alphabet/__init__.py +25 -0
  100. biotite/structure/alphabet/encoder.py +332 -0
  101. biotite/structure/alphabet/encoder_weights_3di.kerasify +0 -0
  102. biotite/structure/alphabet/i3d.py +109 -0
  103. biotite/structure/alphabet/layers.py +86 -0
  104. biotite/structure/alphabet/pb.license +21 -0
  105. biotite/structure/alphabet/pb.py +170 -0
  106. biotite/structure/alphabet/unkerasify.py +128 -0
  107. biotite/structure/atoms.py +163 -66
  108. biotite/structure/basepairs.py +26 -26
  109. biotite/structure/bonds.cp311-win_amd64.pyd +0 -0
  110. biotite/structure/bonds.pyx +79 -25
  111. biotite/structure/box.py +19 -21
  112. biotite/structure/celllist.cp311-win_amd64.pyd +0 -0
  113. biotite/structure/celllist.pyx +83 -67
  114. biotite/structure/chains.py +5 -37
  115. biotite/structure/charges.cp311-win_amd64.pyd +0 -0
  116. biotite/structure/compare.py +420 -13
  117. biotite/structure/density.py +1 -1
  118. biotite/structure/dotbracket.py +27 -28
  119. biotite/structure/filter.py +8 -8
  120. biotite/structure/geometry.py +74 -127
  121. biotite/structure/hbond.py +17 -19
  122. biotite/structure/info/__init__.py +1 -0
  123. biotite/structure/info/atoms.py +24 -15
  124. biotite/structure/info/bonds.py +12 -6
  125. biotite/structure/info/ccd.py +125 -34
  126. biotite/structure/info/{ccd/components.bcif → components.bcif} +0 -0
  127. biotite/structure/info/groups.py +62 -19
  128. biotite/structure/info/masses.py +9 -6
  129. biotite/structure/info/misc.py +15 -22
  130. biotite/structure/info/radii.py +92 -22
  131. biotite/structure/info/standardize.py +4 -4
  132. biotite/structure/integrity.py +4 -6
  133. biotite/structure/io/general.py +2 -2
  134. biotite/structure/io/gro/file.py +8 -9
  135. biotite/structure/io/mol/convert.py +1 -1
  136. biotite/structure/io/mol/ctab.py +33 -28
  137. biotite/structure/io/mol/mol.py +1 -1
  138. biotite/structure/io/mol/sdf.py +80 -53
  139. biotite/structure/io/pdb/convert.py +4 -3
  140. biotite/structure/io/pdb/file.py +85 -25
  141. biotite/structure/io/pdb/hybrid36.cp311-win_amd64.pyd +0 -0
  142. biotite/structure/io/pdbqt/file.py +36 -36
  143. biotite/structure/io/pdbx/__init__.py +1 -0
  144. biotite/structure/io/pdbx/bcif.py +54 -15
  145. biotite/structure/io/pdbx/cif.py +92 -66
  146. biotite/structure/io/pdbx/component.py +15 -4
  147. biotite/structure/io/pdbx/compress.py +321 -0
  148. biotite/structure/io/pdbx/convert.py +410 -75
  149. biotite/structure/io/pdbx/encoding.cp311-win_amd64.pyd +0 -0
  150. biotite/structure/io/pdbx/encoding.pyx +98 -17
  151. biotite/structure/io/trajfile.py +9 -6
  152. biotite/structure/io/util.py +38 -0
  153. biotite/structure/mechanics.py +0 -1
  154. biotite/structure/molecules.py +141 -156
  155. biotite/structure/pseudoknots.py +7 -13
  156. biotite/structure/repair.py +2 -4
  157. biotite/structure/residues.py +13 -24
  158. biotite/structure/rings.py +335 -0
  159. biotite/structure/sasa.cp311-win_amd64.pyd +0 -0
  160. biotite/structure/sasa.pyx +2 -1
  161. biotite/structure/segments.py +69 -11
  162. biotite/structure/sequence.py +0 -1
  163. biotite/structure/sse.py +0 -2
  164. biotite/structure/superimpose.py +74 -62
  165. biotite/structure/tm.py +581 -0
  166. biotite/structure/transform.py +12 -25
  167. biotite/structure/util.py +76 -4
  168. biotite/version.py +9 -4
  169. biotite/visualize.py +111 -1
  170. {biotite-1.0.1.dist-info → biotite-1.2.0.dist-info}/METADATA +6 -2
  171. {biotite-1.0.1.dist-info → biotite-1.2.0.dist-info}/RECORD +173 -143
  172. biotite/structure/info/ccd/README.rst +0 -8
  173. biotite/structure/info/ccd/amino_acids.txt +0 -1663
  174. biotite/structure/info/ccd/carbohydrates.txt +0 -1135
  175. biotite/structure/info/ccd/nucleotides.txt +0 -798
  176. {biotite-1.0.1.dist-info → biotite-1.2.0.dist-info}/WHEEL +0 -0
  177. {biotite-1.0.1.dist-info → biotite-1.2.0.dist-info}/licenses/LICENSE.rst +0 -0
@@ -287,7 +287,8 @@ class FixedPointEncoding(Encoding):
287
287
  The data type of the array to be encoded.
288
288
  Either a NumPy dtype or a *BinaryCIF* type code is accepted.
289
289
  The dtype must be a float type.
290
- If omitted, 32-bit floats are assumed.
290
+ If omitted, the data type is taken from the data the
291
+ first time :meth:`encode()` is called.
291
292
 
292
293
  Attributes
293
294
  ----------
@@ -304,7 +305,7 @@ class FixedPointEncoding(Encoding):
304
305
  [987 654]
305
306
  """
306
307
  factor: ...
307
- src_type: ... = TypeCode.FLOAT32
308
+ src_type: ... = None
308
309
 
309
310
  def __post_init__(self):
310
311
  if self.src_type is not None:
@@ -315,6 +316,14 @@ class FixedPointEncoding(Encoding):
315
316
  )
316
317
 
317
318
  def encode(self, data):
319
+ # If not given in constructor, it is determined from the data
320
+ if self.src_type is None:
321
+ self.src_type = TypeCode.from_dtype(data.dtype)
322
+ if self.src_type not in (TypeCode.FLOAT32, TypeCode.FLOAT64):
323
+ raise ValueError(
324
+ "Only floating point types are supported"
325
+ )
326
+
318
327
  # Round to avoid wrong values due to floating point inaccuracies
319
328
  return np.round(data * self.factor).astype(np.int32)
320
329
 
@@ -340,7 +349,8 @@ class IntervalQuantizationEncoding(Encoding):
340
349
  The data type of the array to be encoded.
341
350
  Either a NumPy dtype or a *BinaryCIF* type code is accepted.
342
351
  The dtype must be a float type.
343
- If omitted, 32-bit floats are assumed.
352
+ If omitted, the data type is taken from the data the
353
+ first time :meth:`encode()` is called.
344
354
 
345
355
  Attributes
346
356
  ----------
@@ -367,13 +377,17 @@ class IntervalQuantizationEncoding(Encoding):
367
377
  min: ...
368
378
  max: ...
369
379
  num_steps: ...
370
- src_type: ... = TypeCode.FLOAT32
380
+ src_type: ... = None
371
381
 
372
382
  def __post_init__(self):
373
383
  if self.src_type is not None:
374
384
  self.src_type = TypeCode.from_dtype(self.src_type)
375
385
 
376
386
  def encode(self, data):
387
+ # If not given in constructor, it is determined from the data
388
+ if self.src_type is None:
389
+ self.src_type = TypeCode.from_dtype(data.dtype)
390
+
377
391
  steps = np.linspace(
378
392
  self.min, self.max, self.num_steps, dtype=data.dtype
379
393
  )
@@ -524,7 +538,8 @@ class DeltaEncoding(Encoding):
524
538
  first time :meth:`encode()` is called.
525
539
  origin : int, optional
526
540
  The starting value from which the differences are calculated.
527
- If omitted, the origin is set to 0.
541
+ If omitted, the value is taken from the first array element the
542
+ first time :meth:`encode()` is called.
528
543
 
529
544
  Attributes
530
545
  ----------
@@ -535,11 +550,14 @@ class DeltaEncoding(Encoding):
535
550
  --------
536
551
 
537
552
  >>> data = np.array([1, 1, 2, 3, 5, 8])
538
- >>> print(DeltaEncoding().encode(data))
539
- [1 0 1 1 2 3]
553
+ >>> encoding = DeltaEncoding()
554
+ >>> print(encoding.encode(data))
555
+ [0 0 1 1 2 3]
556
+ >>> print(encoding.origin)
557
+ 1
540
558
  """
541
559
  src_type: ... = None
542
- origin: ... = 0
560
+ origin: ... = None
543
561
 
544
562
  def __post_init__(self):
545
563
  if self.src_type is not None:
@@ -549,6 +567,8 @@ class DeltaEncoding(Encoding):
549
567
  # If not given in constructor, it is determined from the data
550
568
  if self.src_type is None:
551
569
  self.src_type = TypeCode.from_dtype(data.dtype)
570
+ if self.origin is None:
571
+ self.origin = data[0]
552
572
 
553
573
  data = data - self.origin
554
574
  return np.diff(data, prepend=0).astype(np.int32, copy=False)
@@ -582,7 +602,8 @@ class IntegerPackingEncoding(Encoding):
582
602
  is_unsigned : bool, optional
583
603
  Whether the values should be packed into signed or unsigned
584
604
  integers.
585
- If omitted, the values are packed into signed integers.
605
+ If omitted, first time :meth:`encode()` is called, determines whether
606
+ the values fit into unsigned integers.
586
607
 
587
608
  Attributes
588
609
  ----------
@@ -601,7 +622,7 @@ class IntegerPackingEncoding(Encoding):
601
622
  """
602
623
  byte_count: ...
603
624
  src_size: ... = None
604
- is_unsigned: ... = False
625
+ is_unsigned: ... = None
605
626
 
606
627
  def encode(self, data):
607
628
  if self.src_size is None:
@@ -610,6 +631,9 @@ class IntegerPackingEncoding(Encoding):
610
631
  raise IndexError(
611
632
  "Given source size does not match actual data size"
612
633
  )
634
+ if self.is_unsigned is None:
635
+ # Only positive values -> use unsigned integers
636
+ self.is_unsigned = data.min().item() >= 0
613
637
 
614
638
  data = data.astype(np.int32, copy=False)
615
639
  return self._encode(
@@ -672,7 +696,7 @@ class IntegerPackingEncoding(Encoding):
672
696
  # Get length of output array
673
697
  # by summing up required length of each element
674
698
  cdef int number
675
- cdef int length = 0
699
+ cdef long length = 0
676
700
  for i in range(data.shape[0]):
677
701
  number = data[i]
678
702
  if number < 0:
@@ -750,7 +774,7 @@ class StringArrayEncoding(Encoding):
750
774
  If omitted, the unique strings are determined from the data the
751
775
  first time :meth:`encode()` is called.
752
776
  data_encoding : list of Encoding, optional
753
- The encodings that are applied to the indiy array.
777
+ The encodings that are applied to the index array.
754
778
  If omitted, the array is directly encoded into bytes without
755
779
  further compression.
756
780
  offset_encoding : list of Encoding, optional
@@ -837,8 +861,11 @@ class StringArrayEncoding(Encoding):
837
861
  raise TypeError("Data must be of string type")
838
862
 
839
863
  if self.strings is None:
840
- # 'unique()' already sorts the strings
841
- self.strings = np.unique(data)
864
+ # 'unique()' already sorts the strings, but this is not necessarily
865
+ # desired, as this makes efficient encoding of the indices more difficult
866
+ # -> Bring into the original order
867
+ _, unique_indices = np.unique(data, return_index=True)
868
+ self.strings = data[np.sort(unique_indices)]
842
869
  check_present = False
843
870
  else:
844
871
  check_present = True
@@ -888,6 +915,19 @@ _encoding_classes_kinds = {
888
915
 
889
916
 
890
917
  def deserialize_encoding(content):
918
+ """
919
+ Create a :class:`Encoding` by deserializing the given *BinaryCIF* content.
920
+
921
+ Parameters
922
+ ----------
923
+ content : dict
924
+ The encoding represenet as *BinaryCIF* dictionary.
925
+
926
+ Returns
927
+ -------
928
+ encoding : Encoding
929
+ The deserialized encoding.
930
+ """
891
931
  try:
892
932
  encoding_class = _encoding_classes[content["kind"]]
893
933
  except KeyError:
@@ -898,28 +938,69 @@ def deserialize_encoding(content):
898
938
 
899
939
 
900
940
  def create_uncompressed_encoding(array):
901
- dtype = array.dtype
941
+ """
942
+ Create a simple encoding for the given array that does not compress the data.
902
943
 
903
- if np.issubdtype(dtype, np.str_):
944
+ Parameters
945
+ ----------
946
+ array : ndarray
947
+ The array to to create the encoding for.
948
+
949
+ Returns
950
+ -------
951
+ encoding : list of Encoding
952
+ The encoding for the data.
953
+ """
954
+ if np.issubdtype(array.dtype, np.str_):
904
955
  return [StringArrayEncoding()]
905
956
  else:
906
957
  return [ByteArrayEncoding()]
907
958
 
908
959
 
909
960
  def encode_stepwise(data, encoding):
961
+ """
962
+ Apply a list of encodings stepwise to the given data.
963
+
964
+ Parameters
965
+ ----------
966
+ data : ndarray
967
+ The data to be encoded.
968
+ encoding : list of Encoding
969
+ The encodings to be applied.
970
+
971
+ Returns
972
+ -------
973
+ encoded_data : ndarray or bytes
974
+ The encoded data.
975
+ """
910
976
  for encoding in encoding:
911
977
  data = encoding.encode(data)
912
978
  return data
913
979
 
914
980
 
915
981
  def decode_stepwise(data, encoding):
982
+ """
983
+ Apply a list of encodings stepwise to the given data.
984
+
985
+ Parameters
986
+ ----------
987
+ data : ndarray or bytes
988
+ The data to be decoded.
989
+ encoding : list of Encoding
990
+ The encodings to be applied.
991
+
992
+ Returns
993
+ -------
994
+ decoded_data : ndarray
995
+ The decoded data.
996
+ """
916
997
  for enc in reversed(encoding):
917
998
  data = enc.decode(data)
918
999
  return data
919
1000
 
920
1001
 
921
1002
  def _camel_to_snake_case(attribute_name):
922
- return re.sub(CAMEL_CASE_PATTERN, "_", attribute_name).lower()
1003
+ return CAMEL_CASE_PATTERN.sub("_", attribute_name).lower()
923
1004
 
924
1005
 
925
1006
  def _snake_to_camel_case(attribute_name):
@@ -187,9 +187,11 @@ class TrajectoryFile(File, metaclass=abc.ABCMeta):
187
187
  time : float or ndarray, dtype=float32, shape=(n,) or None
188
188
  The simulation time of the current frame or stack in *ps*.
189
189
 
190
- See also
190
+ See Also
191
191
  --------
192
- read_iter_structure
192
+ read_iter_structure :
193
+ Get an :class:`AtomArray` for each frame or an :class:`AtomArrayStack`
194
+ for each chunk of frames instead.
193
195
 
194
196
  Notes
195
197
  -----
@@ -315,9 +317,10 @@ class TrajectoryFile(File, metaclass=abc.ABCMeta):
315
317
  If `stack_size` is set, multiple frames are returned as
316
318
  :class:`AtomArrayStack`.
317
319
 
318
- See also
320
+ See Also
319
321
  --------
320
- read_iter
322
+ read_iter :
323
+ Get an the raw data for each frame or for each chunk of frames instead.
321
324
 
322
325
  Notes
323
326
  -----
@@ -480,7 +483,7 @@ class TrajectoryFile(File, metaclass=abc.ABCMeta):
480
483
 
481
484
  Parameters
482
485
  ----------
483
- time : ndarray, dtype=float, shape=(m,3,3)
486
+ box : ndarray, dtype=float, shape=(m,3,3)
484
487
  The box vectors to be set.
485
488
  """
486
489
  self._check_model_count(box)
@@ -546,7 +549,7 @@ class TrajectoryFile(File, metaclass=abc.ABCMeta):
546
549
  ------
547
550
  NotImplementedError
548
551
  """
549
- raise NotImplementedError("Copying is not implemented " "for trajectory files")
552
+ raise NotImplementedError("Copying is not implemented for trajectory files")
550
553
 
551
554
  @classmethod
552
555
  @abc.abstractmethod
@@ -0,0 +1,38 @@
1
+ # This source code is part of the Biotite package and is distributed
2
+ # under the 3-Clause BSD License. Please see 'LICENSE.rst' for further
3
+ # information.
4
+
5
+ """
6
+ Common functions used by a number of subpackages.
7
+ """
8
+
9
+ __name__ = "biotite.structure.io"
10
+ __author__ = "Patrick Kunzmann"
11
+ __all__ = ["number_of_integer_digits"]
12
+
13
+ import numpy as np
14
+
15
+
16
+ def number_of_integer_digits(values):
17
+ """
18
+ Get the maximum number of characters needed to represent the
19
+ pre-decimal positions of the given numeric values.
20
+
21
+ Parameters
22
+ ----------
23
+ values : ndarray, dtype=float
24
+ The values to be checked.
25
+
26
+ Returns
27
+ -------
28
+ n_digits : int
29
+ The maximum number of characters needed to represent the
30
+ pre-decimal positions of the given numeric values.
31
+ """
32
+ if len(values) == 0:
33
+ return 0
34
+ values = values.astype(int, copy=False)
35
+ n_digits = 0
36
+ n_digits = max(n_digits, len(str(np.min(values))))
37
+ n_digits = max(n_digits, len(str(np.max(values))))
38
+ return n_digits
@@ -30,7 +30,6 @@ def gyration_radius(array, masses=None):
30
30
  Must have the same length as `array`. By default, the standard
31
31
  atomic mass for each element is taken.
32
32
 
33
-
34
33
  Returns
35
34
  -------
36
35
  masses : float or ndarray, dtype=float