Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace pairwise2 with PairwiseAligner #37

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 13 additions & 14 deletions unassigner/align.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import os.path
import subprocess
import tempfile
from Bio import pairwise2
from Bio.Align import PairwiseAligner

from unassigner.parse import write_fasta, parse_fasta
from unassigner.alignment import AlignedPair
Expand Down Expand Up @@ -261,16 +261,15 @@ def _get_subject_seq(self, subject_id):


def align_semiglobal(qseq, sseq):
alignment = pairwise2.align.globalms(
sseq,
qseq,
5,
-4,
-10,
-0.5, # match, mismatch, gapopen, gapextend
penalize_end_gaps=False,
one_alignment_only=True,
)
subj_seq = alignment[0][0]
query_seq = alignment[0][1]
return query_seq, subj_seq
aligner = PairwiseAligner()
aligner.mode = "global"
aligner.match_score = 5
aligner.mismatch_score = -4
aligner.open_gap_score = -10
aligner.extend_gap_score = -0.5
aligner.end_open_gap_score = 0
aligner.end_extend_gap_score = 0
alignments = aligner.align(sseq, qseq)
alignment = alignments[0]

return alignment[1], alignment[0]
Loading