biotite 1.1.0__cp313-cp313-win_amd64.whl → 1.2.0__cp313-cp313-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/application/application.py +3 -3
- biotite/application/autodock/app.py +1 -1
- biotite/application/blast/webapp.py +1 -1
- biotite/application/clustalo/app.py +1 -1
- biotite/application/localapp.py +2 -2
- biotite/application/msaapp.py +10 -10
- biotite/application/muscle/app3.py +3 -3
- biotite/application/muscle/app5.py +3 -3
- biotite/application/sra/app.py +0 -5
- biotite/application/util.py +21 -1
- biotite/application/viennarna/rnaalifold.py +8 -8
- biotite/application/viennarna/rnaplot.py +3 -1
- biotite/application/viennarna/util.py +1 -1
- biotite/application/webapp.py +1 -1
- biotite/database/afdb/__init__.py +12 -0
- biotite/database/afdb/download.py +191 -0
- biotite/database/entrez/dbnames.py +10 -0
- biotite/database/entrez/download.py +9 -10
- biotite/database/entrez/key.py +1 -1
- biotite/database/entrez/query.py +5 -4
- biotite/database/pubchem/download.py +6 -6
- biotite/database/pubchem/error.py +10 -0
- biotite/database/pubchem/query.py +12 -23
- biotite/database/rcsb/download.py +3 -2
- biotite/database/rcsb/query.py +2 -3
- biotite/database/uniprot/check.py +2 -2
- biotite/database/uniprot/download.py +2 -5
- biotite/database/uniprot/query.py +3 -4
- biotite/file.py +14 -2
- biotite/interface/__init__.py +19 -0
- biotite/interface/openmm/__init__.py +16 -0
- biotite/interface/openmm/state.py +93 -0
- biotite/interface/openmm/system.py +227 -0
- biotite/interface/pymol/__init__.py +198 -0
- biotite/interface/pymol/cgo.py +346 -0
- biotite/interface/pymol/convert.py +185 -0
- biotite/interface/pymol/display.py +267 -0
- biotite/interface/pymol/object.py +1226 -0
- biotite/interface/pymol/shapes.py +178 -0
- biotite/interface/pymol/startup.py +169 -0
- biotite/interface/rdkit/__init__.py +15 -0
- biotite/interface/rdkit/mol.py +490 -0
- biotite/interface/version.py +71 -0
- biotite/interface/warning.py +19 -0
- biotite/sequence/align/__init__.py +0 -4
- biotite/sequence/align/alignment.py +33 -11
- biotite/sequence/align/banded.cp313-win_amd64.pyd +0 -0
- biotite/sequence/align/banded.pyx +21 -21
- biotite/sequence/align/cigar.py +2 -2
- biotite/sequence/align/kmeralphabet.cp313-win_amd64.pyd +0 -0
- biotite/sequence/align/kmeralphabet.pyx +2 -2
- biotite/sequence/align/kmersimilarity.cp313-win_amd64.pyd +0 -0
- biotite/sequence/align/kmertable.cp313-win_amd64.pyd +0 -0
- biotite/sequence/align/kmertable.pyx +6 -6
- biotite/sequence/align/localgapped.cp313-win_amd64.pyd +0 -0
- biotite/sequence/align/localgapped.pyx +47 -47
- biotite/sequence/align/localungapped.cp313-win_amd64.pyd +0 -0
- biotite/sequence/align/localungapped.pyx +10 -10
- biotite/sequence/align/matrix.py +12 -3
- biotite/sequence/align/multiple.cp313-win_amd64.pyd +0 -0
- biotite/sequence/align/pairwise.cp313-win_amd64.pyd +0 -0
- biotite/sequence/align/pairwise.pyx +35 -35
- biotite/sequence/align/permutation.cp313-win_amd64.pyd +0 -0
- biotite/sequence/align/selector.cp313-win_amd64.pyd +0 -0
- biotite/sequence/align/selector.pyx +2 -2
- biotite/sequence/align/statistics.py +1 -1
- biotite/sequence/align/tracetable.cp313-win_amd64.pyd +0 -0
- biotite/sequence/alphabet.py +2 -2
- biotite/sequence/annotation.py +19 -13
- biotite/sequence/codec.cp313-win_amd64.pyd +0 -0
- biotite/sequence/codon.py +1 -2
- biotite/sequence/graphics/alignment.py +25 -39
- biotite/sequence/graphics/dendrogram.py +4 -2
- biotite/sequence/graphics/features.py +2 -2
- biotite/sequence/graphics/logo.py +10 -12
- biotite/sequence/io/fasta/convert.py +1 -2
- biotite/sequence/io/fasta/file.py +1 -1
- biotite/sequence/io/fastq/file.py +3 -3
- biotite/sequence/io/genbank/file.py +3 -3
- biotite/sequence/io/genbank/sequence.py +2 -0
- biotite/sequence/io/gff/convert.py +1 -1
- biotite/sequence/io/gff/file.py +1 -2
- biotite/sequence/phylo/nj.cp313-win_amd64.pyd +0 -0
- biotite/sequence/phylo/tree.cp313-win_amd64.pyd +0 -0
- biotite/sequence/phylo/upgma.cp313-win_amd64.pyd +0 -0
- biotite/sequence/profile.py +19 -25
- biotite/sequence/search.py +0 -1
- biotite/sequence/seqtypes.py +12 -5
- biotite/sequence/sequence.py +1 -2
- biotite/structure/__init__.py +2 -0
- biotite/structure/alphabet/i3d.py +1 -2
- biotite/structure/alphabet/pb.py +1 -2
- biotite/structure/alphabet/unkerasify.py +8 -2
- biotite/structure/atoms.py +35 -27
- biotite/structure/basepairs.py +26 -26
- biotite/structure/bonds.cp313-win_amd64.pyd +0 -0
- biotite/structure/bonds.pyx +8 -5
- biotite/structure/box.py +19 -21
- biotite/structure/celllist.cp313-win_amd64.pyd +0 -0
- biotite/structure/celllist.pyx +83 -67
- biotite/structure/chains.py +5 -37
- biotite/structure/charges.cp313-win_amd64.pyd +0 -0
- biotite/structure/compare.py +420 -13
- biotite/structure/density.py +1 -1
- biotite/structure/dotbracket.py +27 -28
- biotite/structure/filter.py +8 -8
- biotite/structure/geometry.py +15 -15
- biotite/structure/hbond.py +17 -19
- biotite/structure/info/atoms.py +11 -2
- biotite/structure/info/ccd.py +0 -2
- biotite/structure/info/components.bcif +0 -0
- biotite/structure/info/groups.py +0 -3
- biotite/structure/info/misc.py +0 -1
- biotite/structure/info/radii.py +92 -22
- biotite/structure/info/standardize.py +1 -2
- biotite/structure/integrity.py +4 -6
- biotite/structure/io/general.py +2 -2
- biotite/structure/io/gro/file.py +8 -9
- biotite/structure/io/mol/convert.py +1 -1
- biotite/structure/io/mol/ctab.py +33 -28
- biotite/structure/io/mol/mol.py +1 -1
- biotite/structure/io/mol/sdf.py +39 -13
- biotite/structure/io/pdb/convert.py +2 -3
- biotite/structure/io/pdb/file.py +11 -22
- biotite/structure/io/pdb/hybrid36.cp313-win_amd64.pyd +0 -0
- biotite/structure/io/pdbqt/file.py +4 -4
- biotite/structure/io/pdbx/bcif.py +22 -7
- biotite/structure/io/pdbx/cif.py +20 -7
- biotite/structure/io/pdbx/component.py +6 -0
- biotite/structure/io/pdbx/compress.py +2 -2
- biotite/structure/io/pdbx/convert.py +222 -33
- biotite/structure/io/pdbx/encoding.cp313-win_amd64.pyd +0 -0
- biotite/structure/io/trajfile.py +9 -6
- biotite/structure/io/util.py +38 -0
- biotite/structure/mechanics.py +0 -1
- biotite/structure/molecules.py +0 -15
- biotite/structure/pseudoknots.py +7 -13
- biotite/structure/repair.py +2 -4
- biotite/structure/residues.py +13 -24
- biotite/structure/rings.py +335 -0
- biotite/structure/sasa.cp313-win_amd64.pyd +0 -0
- biotite/structure/sasa.pyx +2 -1
- biotite/structure/segments.py +68 -9
- biotite/structure/sequence.py +0 -1
- biotite/structure/sse.py +0 -2
- biotite/structure/superimpose.py +74 -62
- biotite/structure/tm.py +581 -0
- biotite/structure/transform.py +12 -25
- biotite/structure/util.py +3 -3
- biotite/version.py +9 -4
- biotite/visualize.py +111 -1
- {biotite-1.1.0.dist-info → biotite-1.2.0.dist-info}/METADATA +5 -3
- {biotite-1.1.0.dist-info → biotite-1.2.0.dist-info}/RECORD +155 -135
- {biotite-1.1.0.dist-info → biotite-1.2.0.dist-info}/WHEEL +0 -0
- {biotite-1.1.0.dist-info → biotite-1.2.0.dist-info}/licenses/LICENSE.rst +0 -0
|
@@ -46,7 +46,7 @@ def align_local_gapped(seq1, seq2, matrix, seed, int32 threshold,
|
|
|
46
46
|
gap_penalty=-10, max_number=1,
|
|
47
47
|
direction="both", score_only=False,
|
|
48
48
|
max_table_size=None)
|
|
49
|
-
|
|
49
|
+
|
|
50
50
|
Perform a local gapped alignment extending from a given `seed`
|
|
51
51
|
position.
|
|
52
52
|
|
|
@@ -104,7 +104,7 @@ def align_local_gapped(seq1, seq2, matrix, seed, int32 threshold,
|
|
|
104
104
|
in the internal dynamic programming table, i.e. approximately
|
|
105
105
|
the product of the lengths of the aligned regions, would exceed
|
|
106
106
|
the given value.
|
|
107
|
-
|
|
107
|
+
|
|
108
108
|
Returns
|
|
109
109
|
-------
|
|
110
110
|
alignments : list of Alignment
|
|
@@ -115,12 +115,12 @@ def align_local_gapped(seq1, seq2, matrix, seed, int32 threshold,
|
|
|
115
115
|
score : int
|
|
116
116
|
The alignment similarity score.
|
|
117
117
|
Only returned, if `score_only` is ``True``.
|
|
118
|
-
|
|
119
|
-
See
|
|
118
|
+
|
|
119
|
+
See Also
|
|
120
120
|
--------
|
|
121
121
|
align_ungapped
|
|
122
122
|
For ungapped local alignments with the same *X-Drop* technique.
|
|
123
|
-
|
|
123
|
+
|
|
124
124
|
Notes
|
|
125
125
|
-----
|
|
126
126
|
Unilke :func:`align_optimal()`, this function does not allocate
|
|
@@ -135,12 +135,12 @@ def align_local_gapped(seq1, seq2, matrix, seed, int32 threshold,
|
|
|
135
135
|
of substitution matrix or gap penalty.
|
|
136
136
|
You may set `max_table_size` to avoid excessive memory use and
|
|
137
137
|
crashes.
|
|
138
|
-
|
|
138
|
+
|
|
139
139
|
References
|
|
140
140
|
----------
|
|
141
141
|
|
|
142
142
|
.. footbibliography::
|
|
143
|
-
|
|
143
|
+
|
|
144
144
|
Examples
|
|
145
145
|
--------
|
|
146
146
|
|
|
@@ -176,7 +176,7 @@ def align_local_gapped(seq1, seq2, matrix, seed, int32 threshold,
|
|
|
176
176
|
or not matrix.get_alphabet2().extends(seq2.get_alphabet()):
|
|
177
177
|
raise ValueError("The sequences' alphabets do not fit the matrix")
|
|
178
178
|
score_matrix = matrix.score_matrix()
|
|
179
|
-
|
|
179
|
+
|
|
180
180
|
# Check if gap penalty is linear or affine
|
|
181
181
|
if type(gap_penalty) == int:
|
|
182
182
|
if gap_penalty >= 0:
|
|
@@ -186,19 +186,19 @@ def align_local_gapped(seq1, seq2, matrix, seed, int32 threshold,
|
|
|
186
186
|
raise ValueError("Gap penalty must be negative")
|
|
187
187
|
else:
|
|
188
188
|
raise TypeError("Gap penalty must be either integer or tuple")
|
|
189
|
-
|
|
189
|
+
|
|
190
190
|
# Check if max_number is reasonable
|
|
191
191
|
if max_number < 1:
|
|
192
192
|
raise ValueError(
|
|
193
193
|
"Maximum number of returned alignments must be at least 1"
|
|
194
194
|
)
|
|
195
|
-
|
|
195
|
+
|
|
196
196
|
# Check maximum table size
|
|
197
197
|
if max_table_size is None:
|
|
198
198
|
max_table_size = np.iinfo(np.int64).max
|
|
199
199
|
elif max_table_size <= 0:
|
|
200
200
|
raise ValueError("Maximum table size must be a positve value")
|
|
201
|
-
|
|
201
|
+
|
|
202
202
|
|
|
203
203
|
code1 = seq1.code
|
|
204
204
|
code2 = seq2.code
|
|
@@ -212,7 +212,7 @@ def align_local_gapped(seq1, seq2, matrix, seed, int32 threshold,
|
|
|
212
212
|
f"Seed {(seq1_start, seq2_start)} is out of bounds "
|
|
213
213
|
f"for the sequences of length {len(code1)} and {len(code2)}"
|
|
214
214
|
)
|
|
215
|
-
|
|
215
|
+
|
|
216
216
|
|
|
217
217
|
cdef bint upstream
|
|
218
218
|
cdef bint downstream
|
|
@@ -230,7 +230,7 @@ def align_local_gapped(seq1, seq2, matrix, seed, int32 threshold,
|
|
|
230
230
|
# Range check to avoid negative indices
|
|
231
231
|
if seq1_start == 0 or seq2_start == 0:
|
|
232
232
|
upstream = False
|
|
233
|
-
|
|
233
|
+
|
|
234
234
|
if threshold < 0:
|
|
235
235
|
raise ValueError("The threshold value must be a non-negative integer")
|
|
236
236
|
|
|
@@ -261,7 +261,7 @@ def align_local_gapped(seq1, seq2, matrix, seed, int32 threshold,
|
|
|
261
261
|
# Add seed offset to trace indices
|
|
262
262
|
trace[non_gap_mask[:, 0], 0] += offset[0]
|
|
263
263
|
trace[non_gap_mask[:, 1], 1] += offset[1]
|
|
264
|
-
|
|
264
|
+
|
|
265
265
|
if downstream:
|
|
266
266
|
score, downstream_traces = _align_region(
|
|
267
267
|
code1[seq1_start+1:], code2[seq2_start+1:],
|
|
@@ -274,9 +274,9 @@ def align_local_gapped(seq1, seq2, matrix, seed, int32 threshold,
|
|
|
274
274
|
for trace in downstream_traces:
|
|
275
275
|
trace[trace[:, 0] != -1, 0] += offset[0]
|
|
276
276
|
trace[trace[:, 1] != -1, 1] += offset[1]
|
|
277
|
-
|
|
277
|
+
|
|
278
278
|
total_score += score_matrix[code1[seq1_start], code2[seq2_start]]
|
|
279
|
-
|
|
279
|
+
|
|
280
280
|
|
|
281
281
|
if score_only:
|
|
282
282
|
return total_score
|
|
@@ -304,7 +304,7 @@ def align_local_gapped(seq1, seq2, matrix, seed, int32 threshold,
|
|
|
304
304
|
# upstream alignment is performed
|
|
305
305
|
# -> the trace includes only the seed
|
|
306
306
|
traces = [np.array(seed)[np.newaxis, :]]
|
|
307
|
-
|
|
307
|
+
|
|
308
308
|
return [Alignment([seq1, seq2], trace, total_score)
|
|
309
309
|
for trace in traces]
|
|
310
310
|
|
|
@@ -343,7 +343,7 @@ def _align_region(code1, code2, matrix, threshold, gap_penalty,
|
|
|
343
343
|
max_table_size : int
|
|
344
344
|
Raise a :class:`MemoryError`, if a dynamic programming table
|
|
345
345
|
exceeds this size.
|
|
346
|
-
|
|
346
|
+
|
|
347
347
|
Returns
|
|
348
348
|
-------
|
|
349
349
|
score : int or None
|
|
@@ -359,15 +359,15 @@ def _align_region(code1, code2, matrix, threshold, gap_penalty,
|
|
|
359
359
|
affine_penalty = False
|
|
360
360
|
else:
|
|
361
361
|
affine_penalty = True
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
362
|
+
|
|
363
|
+
|
|
364
|
+
|
|
365
365
|
init_size = (
|
|
366
366
|
_min(len(code1)+1, INIT_SIZE),
|
|
367
367
|
_min(len(code2)+1, INIT_SIZE)
|
|
368
368
|
)
|
|
369
369
|
trace_table = np.zeros(init_size, dtype=np.uint8)
|
|
370
|
-
|
|
370
|
+
|
|
371
371
|
|
|
372
372
|
# Table filling
|
|
373
373
|
###############
|
|
@@ -394,7 +394,7 @@ def _align_region(code1, code2, matrix, threshold, gap_penalty,
|
|
|
394
394
|
code1, code2, matrix, trace_table, score_table, threshold,
|
|
395
395
|
gap_penalty, score_only, max_table_size
|
|
396
396
|
)
|
|
397
|
-
|
|
397
|
+
|
|
398
398
|
# If only the score is desired, the traceback is not necessary
|
|
399
399
|
if score_only:
|
|
400
400
|
if affine_penalty:
|
|
@@ -409,8 +409,8 @@ def _align_region(code1, code2, matrix, threshold, gap_penalty,
|
|
|
409
409
|
# The initial score needs to be subtracted again,
|
|
410
410
|
# since it was artificially added for convenience resaons
|
|
411
411
|
return max_score - init_score, None
|
|
412
|
-
|
|
413
|
-
|
|
412
|
+
|
|
413
|
+
|
|
414
414
|
# Traceback
|
|
415
415
|
###########
|
|
416
416
|
# Stores all possible traces (= possible alignments)
|
|
@@ -425,7 +425,7 @@ def _align_region(code1, code2, matrix, threshold, gap_penalty,
|
|
|
425
425
|
state_list = np.zeros(0, dtype=int)
|
|
426
426
|
# The start point is the maximal score in the table
|
|
427
427
|
# Multiple starting points possible,
|
|
428
|
-
# when duplicates of maximal score exist
|
|
428
|
+
# when duplicates of maximal score exist
|
|
429
429
|
if affine_penalty:
|
|
430
430
|
# Only consicder match table (see reason above)
|
|
431
431
|
max_score = np.max(m_table)
|
|
@@ -456,7 +456,7 @@ def _align_region(code1, code2, matrix, threshold, gap_penalty,
|
|
|
456
456
|
# Diagonals are only needed for banded alignments
|
|
457
457
|
lower_diag=0, upper_diag=0
|
|
458
458
|
)
|
|
459
|
-
|
|
459
|
+
|
|
460
460
|
# Replace gap entries in trace with -1
|
|
461
461
|
for i, trace in enumerate(trace_list):
|
|
462
462
|
trace = np.flip(trace, axis=0)
|
|
@@ -465,7 +465,7 @@ def _align_region(code1, code2, matrix, threshold, gap_penalty,
|
|
|
465
465
|
gap_filter[np.unique(trace[:,1], return_index=True)[1], 1] = True
|
|
466
466
|
trace[~gap_filter] = -1
|
|
467
467
|
trace_list[i] = trace
|
|
468
|
-
|
|
468
|
+
|
|
469
469
|
# Limit the number of generated alignments to `max_number`:
|
|
470
470
|
# In most cases this is achieved by discarding branches in
|
|
471
471
|
# 'follow_trace()', however, if multiple local alignment starts
|
|
@@ -514,7 +514,7 @@ def _fill_align_table(CodeType1[:] code1 not None,
|
|
|
514
514
|
max_table_size : int64
|
|
515
515
|
Raise a :class:`MemoryError`, if a dynamic programming table
|
|
516
516
|
exceeds this size.
|
|
517
|
-
|
|
517
|
+
|
|
518
518
|
Returns
|
|
519
519
|
-------
|
|
520
520
|
trace_table
|
|
@@ -523,7 +523,7 @@ def _fill_align_table(CodeType1[:] code1 not None,
|
|
|
523
523
|
The filled score table.
|
|
524
524
|
"""
|
|
525
525
|
cdef int i, j, k=0
|
|
526
|
-
# The ranges for i in the current (k=0)
|
|
526
|
+
# The ranges for i in the current (k=0)
|
|
527
527
|
# and previous (k=1, k=2) antidiagonals, that point to valid cells
|
|
528
528
|
cdef int i_min_k_0=0, i_max_k_0=0
|
|
529
529
|
cdef int i_min_k_1=0, i_max_k_1=0
|
|
@@ -568,7 +568,7 @@ def _fill_align_table(CodeType1[:] code1 not None,
|
|
|
568
568
|
# if the calculated antidiagonal has no range of valid cells
|
|
569
569
|
if i_min > i_max:
|
|
570
570
|
break
|
|
571
|
-
|
|
571
|
+
|
|
572
572
|
j_max = k - i_min
|
|
573
573
|
# Expand ndarrays
|
|
574
574
|
# if their size would be exceeded in the following iteration
|
|
@@ -593,7 +593,7 @@ def _fill_align_table(CodeType1[:] code1 not None,
|
|
|
593
593
|
|
|
594
594
|
for i in range(i_min, i_max+1):
|
|
595
595
|
j = k - i
|
|
596
|
-
|
|
596
|
+
|
|
597
597
|
# Evaluate score from diagonal direction
|
|
598
598
|
if i != 0 and j != 0:
|
|
599
599
|
from_diag = score_table[i-1, j-1]
|
|
@@ -616,14 +616,14 @@ def _fill_align_table(CodeType1[:] code1 not None,
|
|
|
616
616
|
from_left = score_table[i, j-1] + gap_penalty
|
|
617
617
|
else:
|
|
618
618
|
from_left = 0
|
|
619
|
-
|
|
619
|
+
|
|
620
620
|
if score_only:
|
|
621
621
|
score = _max(from_diag, _max(from_left, from_top))
|
|
622
622
|
else:
|
|
623
623
|
trace = get_trace_linear(
|
|
624
624
|
from_diag, from_left, from_top, &score
|
|
625
625
|
)
|
|
626
|
-
|
|
626
|
+
|
|
627
627
|
# Check if the obtained score reaches the required threshold
|
|
628
628
|
# and if they even exceed the maximum score
|
|
629
629
|
if score >= req_score:
|
|
@@ -638,8 +638,8 @@ def _fill_align_table(CodeType1[:] code1 not None,
|
|
|
638
638
|
if score > max_score:
|
|
639
639
|
max_score = score
|
|
640
640
|
req_score = max_score - threshold
|
|
641
|
-
|
|
642
|
-
|
|
641
|
+
|
|
642
|
+
|
|
643
643
|
return np.asarray(trace_table)[:i_max_total+1, :j_max_total+1], \
|
|
644
644
|
np.asarray(score_table)[:i_max_total+1, :j_max_total+1]
|
|
645
645
|
|
|
@@ -690,7 +690,7 @@ def _fill_align_table_affine(CodeType1[:] code1 not None,
|
|
|
690
690
|
max_table_size : int64
|
|
691
691
|
Raise a :class:`MemoryError`, if a dynamic programming table
|
|
692
692
|
exceeds this size.
|
|
693
|
-
|
|
693
|
+
|
|
694
694
|
Returns
|
|
695
695
|
-------
|
|
696
696
|
trace_table
|
|
@@ -699,7 +699,7 @@ def _fill_align_table_affine(CodeType1[:] code1 not None,
|
|
|
699
699
|
The filled score tables.
|
|
700
700
|
"""
|
|
701
701
|
cdef int i, j, k=0
|
|
702
|
-
# The ranges for i in the current (k=0)
|
|
702
|
+
# The ranges for i in the current (k=0)
|
|
703
703
|
# and previous (k=1, k=2) antidiagonals, that point to valid cells
|
|
704
704
|
cdef int i_min_k_0=0, i_max_k_0=0
|
|
705
705
|
cdef int i_min_k_1=0, i_max_k_1=0
|
|
@@ -749,7 +749,7 @@ def _fill_align_table_affine(CodeType1[:] code1 not None,
|
|
|
749
749
|
# if the calculated antidiagonal has no range of valid cells
|
|
750
750
|
if i_min > i_max:
|
|
751
751
|
break
|
|
752
|
-
|
|
752
|
+
|
|
753
753
|
j_max = k - i_min
|
|
754
754
|
# Expand ndarrays
|
|
755
755
|
# if their size would be exceeded in the following iteration
|
|
@@ -811,9 +811,9 @@ def _fill_align_table_affine(CodeType1[:] code1 not None,
|
|
|
811
811
|
else:
|
|
812
812
|
mg2_score = 0
|
|
813
813
|
g2g2_score = 0
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
814
|
+
|
|
815
|
+
|
|
816
|
+
|
|
817
817
|
if score_only:
|
|
818
818
|
m_score = _max(mm_score, _max(g1m_score, g2m_score))
|
|
819
819
|
g1_score = _max(mg1_score, g1g1_score)
|
|
@@ -826,7 +826,7 @@ def _fill_align_table_affine(CodeType1[:] code1 not None,
|
|
|
826
826
|
# The max score values to be written
|
|
827
827
|
&m_score, &g1_score, &g2_score
|
|
828
828
|
)
|
|
829
|
-
|
|
829
|
+
|
|
830
830
|
|
|
831
831
|
# Check if the obtained scores reach the required threshold
|
|
832
832
|
# and if they even exceed the maximum score
|
|
@@ -841,7 +841,7 @@ def _fill_align_table_affine(CodeType1[:] code1 not None,
|
|
|
841
841
|
if m_score > max_score:
|
|
842
842
|
max_score = m_score
|
|
843
843
|
req_score = max_score - threshold
|
|
844
|
-
|
|
844
|
+
|
|
845
845
|
if g1_score >= req_score:
|
|
846
846
|
if i_min_k_0 == k:
|
|
847
847
|
i_min_k_0 = i
|
|
@@ -851,7 +851,7 @@ def _fill_align_table_affine(CodeType1[:] code1 not None,
|
|
|
851
851
|
if g1_score > max_score:
|
|
852
852
|
max_score = g1_score
|
|
853
853
|
req_score = max_score - threshold
|
|
854
|
-
|
|
854
|
+
|
|
855
855
|
if g2_score >= req_score:
|
|
856
856
|
if i_min_k_0 == k:
|
|
857
857
|
i_min_k_0 = i
|
|
@@ -861,11 +861,11 @@ def _fill_align_table_affine(CodeType1[:] code1 not None,
|
|
|
861
861
|
if g2_score > max_score:
|
|
862
862
|
max_score = g2_score
|
|
863
863
|
req_score = max_score - threshold
|
|
864
|
-
|
|
864
|
+
|
|
865
865
|
if is_valid_cell and not score_only:
|
|
866
866
|
trace_table[i,j] = trace
|
|
867
867
|
|
|
868
|
-
|
|
868
|
+
|
|
869
869
|
return np.asarray(trace_table)[:i_max_total+1, :j_max_total+1], \
|
|
870
870
|
np.asarray(m_table )[:i_max_total+1, :j_max_total+1], \
|
|
871
871
|
np.asarray(g1_table )[:i_max_total+1, :j_max_total+1], \
|
|
Binary file
|
|
@@ -38,7 +38,7 @@ def align_local_ungapped(seq1, seq2, matrix, seed, int32 threshold,
|
|
|
38
38
|
"""
|
|
39
39
|
align_local_ungapped(seq1, seq2, matrix, seed, threshold,
|
|
40
40
|
direction="both", score_only=False, check_matrix=True)
|
|
41
|
-
|
|
41
|
+
|
|
42
42
|
Perform a local alignment extending from given `seed` position
|
|
43
43
|
without inserting gaps.
|
|
44
44
|
|
|
@@ -47,7 +47,7 @@ def align_local_ungapped(seq1, seq2, matrix, seed, int32 threshold,
|
|
|
47
47
|
`threshold` below the maximum score found (*X-Drop*).
|
|
48
48
|
The returned alignment contains the range that yielded the maximum
|
|
49
49
|
score.
|
|
50
|
-
|
|
50
|
+
|
|
51
51
|
Parameters
|
|
52
52
|
----------
|
|
53
53
|
seq1, seq2 : Sequence
|
|
@@ -86,7 +86,7 @@ def align_local_ungapped(seq1, seq2, matrix, seed, int32 threshold,
|
|
|
86
86
|
However, unexpected results or crashes may occur, if an
|
|
87
87
|
incompatible `matrix` is given.
|
|
88
88
|
|
|
89
|
-
|
|
89
|
+
|
|
90
90
|
Returns
|
|
91
91
|
-------
|
|
92
92
|
alignment : Alignment
|
|
@@ -95,12 +95,12 @@ def align_local_ungapped(seq1, seq2, matrix, seed, int32 threshold,
|
|
|
95
95
|
score : int
|
|
96
96
|
The alignment similarity score.
|
|
97
97
|
Only returned, if `score_only` is ``True``.
|
|
98
|
-
|
|
99
|
-
See
|
|
98
|
+
|
|
99
|
+
See Also
|
|
100
100
|
--------
|
|
101
101
|
align_gapped
|
|
102
102
|
For gapped local alignments with the same *X-Drop* technique.
|
|
103
|
-
|
|
103
|
+
|
|
104
104
|
Examples
|
|
105
105
|
--------
|
|
106
106
|
|
|
@@ -130,7 +130,7 @@ def align_local_ungapped(seq1, seq2, matrix, seed, int32 threshold,
|
|
|
130
130
|
"The sequences' alphabets do not fit the matrix"
|
|
131
131
|
)
|
|
132
132
|
cdef const int32[:,:] score_matrix = matrix.score_matrix()
|
|
133
|
-
|
|
133
|
+
|
|
134
134
|
cdef bint upstream
|
|
135
135
|
cdef bint downstream
|
|
136
136
|
if direction == "both":
|
|
@@ -144,10 +144,10 @@ def align_local_ungapped(seq1, seq2, matrix, seed, int32 threshold,
|
|
|
144
144
|
downstream = True
|
|
145
145
|
else:
|
|
146
146
|
raise ValueError(f"Direction '{direction}' is invalid")
|
|
147
|
-
|
|
147
|
+
|
|
148
148
|
if threshold < 0:
|
|
149
149
|
raise ValueError("The threshold value must be a non-negative integer")
|
|
150
|
-
|
|
150
|
+
|
|
151
151
|
cdef int seq1_start, seq2_start
|
|
152
152
|
seq1_start, seq2_start = seed
|
|
153
153
|
if seq1_start < 0 or seq2_start < 0:
|
|
@@ -200,7 +200,7 @@ def align_local_ungapped(seq1, seq2, matrix, seed, int32 threshold,
|
|
|
200
200
|
total_score += score
|
|
201
201
|
stop_offset += length
|
|
202
202
|
total_score += score_matrix[code1[seq1_start], code2[seq2_start]]
|
|
203
|
-
|
|
203
|
+
|
|
204
204
|
if score_only:
|
|
205
205
|
return total_score
|
|
206
206
|
else:
|
biotite/sequence/align/matrix.py
CHANGED
|
@@ -173,7 +173,7 @@ class SubstitutionMatrix(object):
|
|
|
173
173
|
self._fill_with_matrix_dict(matrix_dict)
|
|
174
174
|
else:
|
|
175
175
|
raise TypeError(
|
|
176
|
-
"Matrix must be either a dictionary,
|
|
176
|
+
"Matrix must be either a dictionary, an 2-D ndarray or a string"
|
|
177
177
|
)
|
|
178
178
|
# This class is immutable and has a getter function for the
|
|
179
179
|
# score matrix -> make the score matrix read-only
|
|
@@ -442,7 +442,7 @@ class SubstitutionMatrix(object):
|
|
|
442
442
|
for i, symbol in enumerate(self._alph1):
|
|
443
443
|
string += f"{str(symbol):>1}"
|
|
444
444
|
for j in range(len(self._alph2)):
|
|
445
|
-
string += f" {int(self._matrix[i,j]):>3d}"
|
|
445
|
+
string += f" {int(self._matrix[i, j]):>3d}"
|
|
446
446
|
string += "\n"
|
|
447
447
|
# Remove terminal line break
|
|
448
448
|
string = string[:-1]
|
|
@@ -459,6 +459,11 @@ class SubstitutionMatrix(object):
|
|
|
459
459
|
The keys of the dictionary consist of tuples containing the
|
|
460
460
|
aligned symbols and the values are the corresponding scores.
|
|
461
461
|
|
|
462
|
+
Parameters
|
|
463
|
+
----------
|
|
464
|
+
string : str
|
|
465
|
+
The string containing the substitution matrix in NCBI format.
|
|
466
|
+
|
|
462
467
|
Returns
|
|
463
468
|
-------
|
|
464
469
|
matrix_dict : dict
|
|
@@ -486,6 +491,11 @@ class SubstitutionMatrix(object):
|
|
|
486
491
|
The keys of the dictionary consist of tuples containing the
|
|
487
492
|
aligned symbols and the values are the corresponding scores.
|
|
488
493
|
|
|
494
|
+
Parameters
|
|
495
|
+
----------
|
|
496
|
+
matrix_name : str
|
|
497
|
+
The name of the matrix in the internal database.
|
|
498
|
+
|
|
489
499
|
Returns
|
|
490
500
|
-------
|
|
491
501
|
matrix_dict : dict
|
|
@@ -581,7 +591,6 @@ class SubstitutionMatrix(object):
|
|
|
581
591
|
----------
|
|
582
592
|
|
|
583
593
|
.. footbibliography::
|
|
584
|
-
|
|
585
594
|
"""
|
|
586
595
|
from biotite.structure.alphabet.pb import ProteinBlocksSequence
|
|
587
596
|
|
|
Binary file
|
|
Binary file
|