|
2 | 2 | import os.path
|
3 | 3 | import subprocess
|
4 | 4 | import tempfile
|
5 |
| -from Bio import pairwise2 |
| 5 | +from Bio.Align import PairwiseAligner |
6 | 6 |
|
7 | 7 | from unassigner.parse import write_fasta, parse_fasta
|
8 | 8 | from unassigner.alignment import AlignedPair
|
@@ -261,16 +261,15 @@ def _get_subject_seq(self, subject_id):
|
261 | 261 |
|
262 | 262 |
|
263 | 263 | def align_semiglobal(qseq, sseq):
|
264 |
| - alignment = pairwise2.align.globalms( |
265 |
| - sseq, |
266 |
| - qseq, |
267 |
| - 5, |
268 |
| - -4, |
269 |
| - -10, |
270 |
| - -0.5, # match, mismatch, gapopen, gapextend |
271 |
| - penalize_end_gaps=False, |
272 |
| - one_alignment_only=True, |
273 |
| - ) |
274 |
| - subj_seq = alignment[0][0] |
275 |
| - query_seq = alignment[0][1] |
276 |
| - return query_seq, subj_seq |
| 264 | + aligner = PairwiseAligner() |
| 265 | + aligner.mode = "global" |
| 266 | + aligner.match_score = 5 |
| 267 | + aligner.mismatch_score = -4 |
| 268 | + aligner.open_gap_score = -10 |
| 269 | + aligner.extend_gap_score = -0.5 |
| 270 | + aligner.end_open_gap_score = 0 |
| 271 | + aligner.end_extend_gap_score = 0 |
| 272 | + alignments = aligner.align(sseq, qseq) |
| 273 | + alignment = alignments[0] |
| 274 | + |
| 275 | + return alignment[1], alignment[0] |
0 commit comments