biotite 1.1.0__cp313-cp313-macosx_11_0_arm64.whl → 1.2.0__cp313-cp313-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 (155) 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/localapp.py +2 -2
  6. biotite/application/msaapp.py +10 -10
  7. biotite/application/muscle/app3.py +3 -3
  8. biotite/application/muscle/app5.py +3 -3
  9. biotite/application/sra/app.py +0 -5
  10. biotite/application/util.py +21 -1
  11. biotite/application/viennarna/rnaalifold.py +8 -8
  12. biotite/application/viennarna/rnaplot.py +3 -1
  13. biotite/application/viennarna/util.py +1 -1
  14. biotite/application/webapp.py +1 -1
  15. biotite/database/afdb/__init__.py +12 -0
  16. biotite/database/afdb/download.py +191 -0
  17. biotite/database/entrez/dbnames.py +10 -0
  18. biotite/database/entrez/download.py +9 -10
  19. biotite/database/entrez/key.py +1 -1
  20. biotite/database/entrez/query.py +5 -4
  21. biotite/database/pubchem/download.py +6 -6
  22. biotite/database/pubchem/error.py +10 -0
  23. biotite/database/pubchem/query.py +12 -23
  24. biotite/database/rcsb/download.py +3 -2
  25. biotite/database/rcsb/query.py +2 -3
  26. biotite/database/uniprot/check.py +2 -2
  27. biotite/database/uniprot/download.py +2 -5
  28. biotite/database/uniprot/query.py +3 -4
  29. biotite/file.py +14 -2
  30. biotite/interface/__init__.py +19 -0
  31. biotite/interface/openmm/__init__.py +16 -0
  32. biotite/interface/openmm/state.py +93 -0
  33. biotite/interface/openmm/system.py +227 -0
  34. biotite/interface/pymol/__init__.py +198 -0
  35. biotite/interface/pymol/cgo.py +346 -0
  36. biotite/interface/pymol/convert.py +185 -0
  37. biotite/interface/pymol/display.py +267 -0
  38. biotite/interface/pymol/object.py +1226 -0
  39. biotite/interface/pymol/shapes.py +178 -0
  40. biotite/interface/pymol/startup.py +169 -0
  41. biotite/interface/rdkit/__init__.py +15 -0
  42. biotite/interface/rdkit/mol.py +490 -0
  43. biotite/interface/version.py +71 -0
  44. biotite/interface/warning.py +19 -0
  45. biotite/sequence/align/__init__.py +0 -4
  46. biotite/sequence/align/alignment.py +33 -11
  47. biotite/sequence/align/banded.cpython-313-darwin.so +0 -0
  48. biotite/sequence/align/banded.pyx +21 -21
  49. biotite/sequence/align/cigar.py +2 -2
  50. biotite/sequence/align/kmeralphabet.cpython-313-darwin.so +0 -0
  51. biotite/sequence/align/kmeralphabet.pyx +2 -2
  52. biotite/sequence/align/kmersimilarity.cpython-313-darwin.so +0 -0
  53. biotite/sequence/align/kmertable.cpython-313-darwin.so +0 -0
  54. biotite/sequence/align/kmertable.pyx +6 -6
  55. biotite/sequence/align/localgapped.cpython-313-darwin.so +0 -0
  56. biotite/sequence/align/localgapped.pyx +47 -47
  57. biotite/sequence/align/localungapped.cpython-313-darwin.so +0 -0
  58. biotite/sequence/align/localungapped.pyx +10 -10
  59. biotite/sequence/align/matrix.py +12 -3
  60. biotite/sequence/align/multiple.cpython-313-darwin.so +0 -0
  61. biotite/sequence/align/pairwise.cpython-313-darwin.so +0 -0
  62. biotite/sequence/align/pairwise.pyx +35 -35
  63. biotite/sequence/align/permutation.cpython-313-darwin.so +0 -0
  64. biotite/sequence/align/selector.cpython-313-darwin.so +0 -0
  65. biotite/sequence/align/selector.pyx +2 -2
  66. biotite/sequence/align/statistics.py +1 -1
  67. biotite/sequence/align/tracetable.cpython-313-darwin.so +0 -0
  68. biotite/sequence/alphabet.py +2 -2
  69. biotite/sequence/annotation.py +19 -13
  70. biotite/sequence/codec.cpython-313-darwin.so +0 -0
  71. biotite/sequence/codon.py +1 -2
  72. biotite/sequence/graphics/alignment.py +25 -39
  73. biotite/sequence/graphics/dendrogram.py +4 -2
  74. biotite/sequence/graphics/features.py +2 -2
  75. biotite/sequence/graphics/logo.py +10 -12
  76. biotite/sequence/io/fasta/convert.py +1 -2
  77. biotite/sequence/io/fasta/file.py +1 -1
  78. biotite/sequence/io/fastq/file.py +3 -3
  79. biotite/sequence/io/genbank/file.py +3 -3
  80. biotite/sequence/io/genbank/sequence.py +2 -0
  81. biotite/sequence/io/gff/convert.py +1 -1
  82. biotite/sequence/io/gff/file.py +1 -2
  83. biotite/sequence/phylo/nj.cpython-313-darwin.so +0 -0
  84. biotite/sequence/phylo/tree.cpython-313-darwin.so +0 -0
  85. biotite/sequence/phylo/upgma.cpython-313-darwin.so +0 -0
  86. biotite/sequence/profile.py +19 -25
  87. biotite/sequence/search.py +0 -1
  88. biotite/sequence/seqtypes.py +12 -5
  89. biotite/sequence/sequence.py +1 -2
  90. biotite/structure/__init__.py +2 -0
  91. biotite/structure/alphabet/i3d.py +1 -2
  92. biotite/structure/alphabet/pb.py +1 -2
  93. biotite/structure/alphabet/unkerasify.py +8 -2
  94. biotite/structure/atoms.py +35 -27
  95. biotite/structure/basepairs.py +26 -26
  96. biotite/structure/bonds.cpython-313-darwin.so +0 -0
  97. biotite/structure/bonds.pyx +8 -5
  98. biotite/structure/box.py +19 -21
  99. biotite/structure/celllist.cpython-313-darwin.so +0 -0
  100. biotite/structure/celllist.pyx +83 -67
  101. biotite/structure/chains.py +5 -37
  102. biotite/structure/charges.cpython-313-darwin.so +0 -0
  103. biotite/structure/compare.py +420 -13
  104. biotite/structure/density.py +1 -1
  105. biotite/structure/dotbracket.py +27 -28
  106. biotite/structure/filter.py +8 -8
  107. biotite/structure/geometry.py +15 -15
  108. biotite/structure/hbond.py +17 -19
  109. biotite/structure/info/atoms.py +11 -2
  110. biotite/structure/info/ccd.py +0 -2
  111. biotite/structure/info/components.bcif +0 -0
  112. biotite/structure/info/groups.py +0 -3
  113. biotite/structure/info/misc.py +0 -1
  114. biotite/structure/info/radii.py +92 -22
  115. biotite/structure/info/standardize.py +1 -2
  116. biotite/structure/integrity.py +4 -6
  117. biotite/structure/io/general.py +2 -2
  118. biotite/structure/io/gro/file.py +8 -9
  119. biotite/structure/io/mol/convert.py +1 -1
  120. biotite/structure/io/mol/ctab.py +33 -28
  121. biotite/structure/io/mol/mol.py +1 -1
  122. biotite/structure/io/mol/sdf.py +39 -13
  123. biotite/structure/io/pdb/convert.py +2 -3
  124. biotite/structure/io/pdb/file.py +11 -22
  125. biotite/structure/io/pdb/hybrid36.cpython-313-darwin.so +0 -0
  126. biotite/structure/io/pdbqt/file.py +4 -4
  127. biotite/structure/io/pdbx/bcif.py +22 -7
  128. biotite/structure/io/pdbx/cif.py +20 -7
  129. biotite/structure/io/pdbx/component.py +6 -0
  130. biotite/structure/io/pdbx/compress.py +2 -2
  131. biotite/structure/io/pdbx/convert.py +222 -33
  132. biotite/structure/io/pdbx/encoding.cpython-313-darwin.so +0 -0
  133. biotite/structure/io/trajfile.py +9 -6
  134. biotite/structure/io/util.py +38 -0
  135. biotite/structure/mechanics.py +0 -1
  136. biotite/structure/molecules.py +0 -15
  137. biotite/structure/pseudoknots.py +7 -13
  138. biotite/structure/repair.py +2 -4
  139. biotite/structure/residues.py +13 -24
  140. biotite/structure/rings.py +335 -0
  141. biotite/structure/sasa.cpython-313-darwin.so +0 -0
  142. biotite/structure/sasa.pyx +2 -1
  143. biotite/structure/segments.py +68 -9
  144. biotite/structure/sequence.py +0 -1
  145. biotite/structure/sse.py +0 -2
  146. biotite/structure/superimpose.py +74 -62
  147. biotite/structure/tm.py +581 -0
  148. biotite/structure/transform.py +12 -25
  149. biotite/structure/util.py +3 -3
  150. biotite/version.py +9 -4
  151. biotite/visualize.py +111 -1
  152. {biotite-1.1.0.dist-info → biotite-1.2.0.dist-info}/METADATA +5 -3
  153. {biotite-1.1.0.dist-info → biotite-1.2.0.dist-info}/RECORD +155 -135
  154. {biotite-1.1.0.dist-info → biotite-1.2.0.dist-info}/WHEEL +0 -0
  155. {biotite-1.1.0.dist-info → biotite-1.2.0.dist-info}/licenses/LICENSE.rst +0 -0
@@ -17,10 +17,13 @@ __all__ = [
17
17
 
18
18
 
19
19
  import numpy as np
20
- from biotite.sequence.align import SubstitutionMatrix, align_optimal, get_codes
20
+ from biotite.sequence.align.alignment import get_codes, remove_gaps
21
+ from biotite.sequence.align.matrix import SubstitutionMatrix
22
+ from biotite.sequence.align.pairwise import align_optimal
21
23
  from biotite.sequence.alphabet import common_alphabet
22
24
  from biotite.sequence.seqtypes import ProteinSequence
23
25
  from biotite.structure.atoms import coord
26
+ from biotite.structure.chains import chain_iter
24
27
  from biotite.structure.filter import filter_amino_acids, filter_nucleotides
25
28
  from biotite.structure.geometry import centroid, distance
26
29
  from biotite.structure.sequence import to_sequence
@@ -97,7 +100,6 @@ class AffineTransformation:
97
100
  [ -7. 6. 8.]
98
101
  [-10. 9. 11.]
99
102
  [-13. 12. 14.]]
100
-
101
103
  """
102
104
  mobile_coord = coord(atoms)
103
105
  original_shape = mobile_coord.shape
@@ -176,7 +178,6 @@ class AffineTransformation:
176
178
  [ -7. 6. 8. 1.]
177
179
  [-10. 9. 11. 1.]
178
180
  [-13. 12. 14. 1.]]
179
-
180
181
  """
181
182
  n_models = self.rotation.shape[0]
182
183
  rotation_mat = _3d_identity(n_models, 4)
@@ -222,7 +223,7 @@ def superimpose(fixed, mobile, atom_mask=None):
222
223
  fixed : AtomArray, shape(n,) or AtomArrayStack, shape(m,n) or ndarray, shape(n,), dtype=float or ndarray, shape(m,n), dtype=float
223
224
  The fixed structure(s).
224
225
  Alternatively coordinates can be given.
225
- mobile: AtomArray, shape(n,) or AtomArrayStack, shape(m,n) or ndarray, shape(n,), dtype=float or ndarray, shape(m,n), dtype=float
226
+ mobile : AtomArray, shape(n,) or AtomArrayStack, shape(m,n) or ndarray, shape(n,), dtype=float or ndarray, shape(m,n), dtype=float
226
227
  The structure(s) which is/are superimposed on the `fixed`
227
228
  structure.
228
229
  Each atom at index *i* in `mobile` must correspond the
@@ -231,7 +232,7 @@ def superimpose(fixed, mobile, atom_mask=None):
231
232
  :class:`AtomArrayStack` objects, they must have the same
232
233
  number of models.
233
234
  Alternatively coordinates can be given.
234
- atom_mask: ndarray, dtype=bool, optional
235
+ atom_mask : ndarray, dtype=bool, optional
235
236
  If given, only the atoms covered by this boolean mask will be
236
237
  considered for superimposition.
237
238
  This means that the algorithm will minimize the RMSD based
@@ -253,8 +254,8 @@ def superimpose(fixed, mobile, atom_mask=None):
253
254
 
254
255
  See Also
255
256
  --------
256
- superimpose_without_outliers : Superimposition with outlier removal
257
- superimpose_homologs : Superimposition of homologous structures
257
+ superimpose_without_outliers : Superimposition with outlier removal.
258
+ superimpose_homologs : Superimposition of homologous structures.
258
259
 
259
260
  Notes
260
261
  -----
@@ -340,13 +341,12 @@ def superimpose_without_outliers(
340
341
  the remaining atoms (called *anchors*) again until no outlier
341
342
  remains.
342
343
 
343
-
344
344
  Parameters
345
345
  ----------
346
346
  fixed : AtomArray, shape(n,) or AtomArrayStack, shape(m,n) or ndarray, shape(n,), dtype=float or ndarray, shape(m,n), dtype=float
347
347
  The fixed structure(s).
348
348
  Alternatively coordinates can be given.
349
- mobile: AtomArray, shape(n,) or AtomArrayStack, shape(m,n) or ndarray, shape(n,), dtype=float or ndarray, shape(m,n), dtype=float
349
+ mobile : AtomArray, shape(n,) or AtomArrayStack, shape(m,n) or ndarray, shape(n,), dtype=float or ndarray, shape(m,n), dtype=float
350
350
  The structure(s) which is/are superimposed on the `fixed`
351
351
  structure.
352
352
  Each atom at index *i* in `mobile` must correspond the
@@ -389,8 +389,8 @@ def superimpose_without_outliers(
389
389
 
390
390
  See Also
391
391
  --------
392
- superimpose : Superimposition without outlier removal
393
- superimpose_homologs : Superimposition of homologous structures
392
+ superimpose : Superimposition without outlier removal.
393
+ superimpose_homologs : Superimposition of homologous structures.
394
394
 
395
395
  Notes
396
396
  -----
@@ -464,10 +464,16 @@ def superimpose_without_outliers(
464
464
 
465
465
 
466
466
  def superimpose_homologs(
467
- fixed, mobile, substitution_matrix=None, gap_penalty=-10, min_anchors=3, **kwargs
467
+ fixed,
468
+ mobile,
469
+ substitution_matrix=None,
470
+ gap_penalty=-10,
471
+ min_anchors=3,
472
+ terminal_penalty=False,
473
+ **kwargs,
468
474
  ):
469
475
  r"""
470
- Superimpose one protein or nucleotide chain onto another one,
476
+ Superimpose a protein or nucleotide structure onto another one,
471
477
  considering sequence differences and conformational outliers.
472
478
 
473
479
  The method finds corresponding residues by sequence alignment and
@@ -480,11 +486,11 @@ def superimpose_homologs(
480
486
  ----------
481
487
  fixed : AtomArray, shape(n,) or AtomArrayStack, shape(m,n)
482
488
  The fixed structure(s).
483
- Must comprise a single chain.
484
489
  mobile : AtomArray, shape(n,) or AtomArrayStack, shape(m,n)
485
- The structure(s) which is/are superimposed on the `fixed`
486
- structure.
487
- Must comprise a single chain.
490
+ The structure(s) which is/are superimposed on the `fixed` structure.
491
+ Must contain the same number of chains as `fixed` with corresponding chains
492
+ being in the same order.
493
+ The specific chain IDs can be different.
488
494
  substitution_matrix : str or SubstitutionMatrix, optional
489
495
  The (name of the) substitution matrix used for sequence
490
496
  alignment.
@@ -504,6 +510,9 @@ def superimpose_homologs(
504
510
  `mobile` in this fallback case, an exception is raised.
505
511
  Furthermore, the outlier removal is stopped, if less than
506
512
  `min_anchors` anchors would be left.
513
+ terminal_penalty : bool, optional
514
+ If set to true, gap penalties are applied to terminal gaps in the sequence
515
+ alignment.
507
516
  **kwargs
508
517
  Additional parameters for
509
518
  :func:`superimpose_without_outliers()`.
@@ -525,8 +534,9 @@ def superimpose_homologs(
525
534
 
526
535
  See Also
527
536
  --------
528
- superimpose : Superimposition without outlier removal
529
- superimpose_without_outliers : Internally used for outlier removal
537
+ superimpose : Superimposition without outlier removal.
538
+ superimpose_without_outliers : Internally used for outlier removal.
539
+ superimpose_structural_homologs : Better suited for low sequence similarity.
530
540
 
531
541
  Notes
532
542
  -----
@@ -540,7 +550,7 @@ def superimpose_homologs(
540
550
  or len(mobile_anchor_indices) < min_anchors
541
551
  ):
542
552
  raise ValueError(
543
- "Structures have too few CA atoms for required number of anchors"
553
+ "Structures have too few backbone atoms for required number of anchors"
544
554
  )
545
555
 
546
556
  anchor_indices = _find_matching_anchors(
@@ -548,18 +558,19 @@ def superimpose_homologs(
548
558
  mobile[..., mobile_anchor_indices],
549
559
  substitution_matrix,
550
560
  gap_penalty,
561
+ terminal_penalty,
551
562
  )
552
563
  if len(anchor_indices) < min_anchors:
553
564
  # Fallback: Match all backbone anchors
554
565
  if len(fixed_anchor_indices) != len(mobile_anchor_indices):
555
566
  raise ValueError(
556
567
  "Tried fallback due to low anchor number, "
557
- "but number of CA atoms does not match"
568
+ "but number of backbone atoms does not match"
558
569
  )
559
570
  fixed_anchor_indices = fixed_anchor_indices
560
571
  mobile_anchor_indices = mobile_anchor_indices
561
572
  else:
562
- # The anchor indices point to the CA atoms
573
+ # The anchor indices point to the backbone atoms
563
574
  # -> get the corresponding indices for the whole structure
564
575
  fixed_anchor_indices = fixed_anchor_indices[anchor_indices[:, 0]]
565
576
  mobile_anchor_indices = mobile_anchor_indices[anchor_indices[:, 1]]
@@ -639,51 +650,52 @@ def _find_matching_anchors(
639
650
  mobile_anchors_atoms,
640
651
  substitution_matrix,
641
652
  gap_penalty,
653
+ terminal_penalty,
642
654
  ):
643
655
  """
644
656
  Find corresponding residues using pairwise sequence alignment.
645
657
  """
646
- fixed_seq = _to_sequence(fixed_anchor_atoms)
647
- mobile_seq = _to_sequence(mobile_anchors_atoms)
648
- common_alph = common_alphabet([fixed_seq.alphabet, mobile_seq.alphabet])
649
- if common_alph is None:
650
- raise ValueError("Cannot superimpose peptides with nucleic acids")
651
-
652
- if substitution_matrix is None:
653
- if isinstance(fixed_seq, ProteinSequence):
654
- substitution_matrix = SubstitutionMatrix.std_protein_matrix()
655
- else:
656
- substitution_matrix = SubstitutionMatrix.std_nucleotide_matrix()
657
- elif isinstance(substitution_matrix, str):
658
- substitution_matrix = SubstitutionMatrix(
659
- common_alph, common_alph, substitution_matrix
660
- )
661
- score_matrix = substitution_matrix.score_matrix()
658
+ anchor_list = []
659
+ fixed_seq_offset = 0
660
+ mobile_seq_offset = 0
661
+ for fixed_chain, mobile_chain in zip(
662
+ chain_iter(fixed_anchor_atoms), chain_iter(mobile_anchors_atoms), strict=True
663
+ ):
664
+ # The input is a single chain -> expect a single sequence
665
+ fixed_seq = to_sequence(fixed_chain, allow_hetero=True)[0][0]
666
+ mobile_seq = to_sequence(mobile_chain, allow_hetero=True)[0][0]
667
+
668
+ common_alph = common_alphabet([fixed_seq.alphabet, mobile_seq.alphabet])
669
+ if common_alph is None:
670
+ raise ValueError("Cannot superimpose peptides with nucleic acids")
671
+ if substitution_matrix is None:
672
+ if isinstance(fixed_seq, ProteinSequence):
673
+ substitution_matrix = SubstitutionMatrix.std_protein_matrix()
674
+ else:
675
+ substitution_matrix = SubstitutionMatrix.std_nucleotide_matrix()
676
+ elif isinstance(substitution_matrix, str):
677
+ substitution_matrix = SubstitutionMatrix(
678
+ common_alph, common_alph, substitution_matrix
679
+ )
662
680
 
663
- alignment = align_optimal(
664
- fixed_seq,
665
- mobile_seq,
666
- substitution_matrix,
667
- gap_penalty,
668
- terminal_penalty=False,
669
- max_number=1,
670
- )[0]
671
- alignment_codes = get_codes(alignment)
672
- anchor_mask = (
673
- # Anchors must be similar amino acids
674
- (score_matrix[alignment_codes[0], alignment_codes[1]] > 0)
681
+ alignment = align_optimal(
682
+ fixed_seq,
683
+ mobile_seq,
684
+ substitution_matrix,
685
+ gap_penalty,
686
+ terminal_penalty=terminal_penalty,
687
+ max_number=1,
688
+ )[0]
675
689
  # Cannot anchor gaps
676
- & (alignment_codes[0] != -1)
677
- & (alignment_codes[1] != -1)
678
- )
679
- anchors = alignment.trace[anchor_mask]
680
- return anchors
690
+ alignment = remove_gaps(alignment)
691
+ ali_codes = get_codes(alignment)
692
+ score_matrix = substitution_matrix.score_matrix()
693
+ # Anchors must be similar amino acids
694
+ anchors = alignment.trace[score_matrix[ali_codes[0], ali_codes[1]] > 0]
681
695
 
696
+ anchors += fixed_seq_offset, mobile_seq_offset
697
+ fixed_seq_offset += len(fixed_seq)
698
+ mobile_seq_offset += len(mobile_seq)
699
+ anchor_list.append(anchors)
682
700
 
683
- def _to_sequence(atoms):
684
- sequences, _ = to_sequence(atoms, allow_hetero=True)
685
- if len(sequences) == 0:
686
- raise ValueError("Structure does not contain any amino acids or nucleotides")
687
- if len(sequences) > 1:
688
- raise ValueError("Structure contains multiple chains, but only one is allowed")
689
- return sequences[0]
701
+ return np.concatenate(anchor_list, axis=0)