Skip to content
Snippets Groups Projects
Verified Commit cab18201 authored by Etienne MORICE's avatar Etienne MORICE
Browse files

Added comparison with ref + fixed in-place return

parent 03c67850
No related branches found
No related tags found
No related merge requests found
......@@ -11,6 +11,8 @@ import Bio.SeqIO
from Bio.SeqRecord import SeqRecord
from Bio.Seq import Seq
import Bio.pairwise2
seqs=[]
handle = open("balibase/RV11.unaligned/BBS11001.fasta")
for seq in Bio.SeqIO.parse(handle, "fasta"):
......@@ -219,9 +221,11 @@ def align2steps(seq1, seq2, d=8, e=4):
j -=1
alx = alx[::-1]
aly = aly[::-1]
seq1.seq = Seq(alx)
seq2.seq = Seq(aly)
return bestScore, seq1, seq2
aseq1 = SeqRecord(seq1)
aseq1.seq = Seq(alx)
aseq2 = SeqRecord(seq2)
aseq2.seq = Seq(aly)
return bestScore, aseq1, aseq2
def test():
# print(align("chat", "cat"))
......@@ -233,4 +237,13 @@ def test():
print(y.seq)
with open("balibase/us/1.fasta", "w") as fd:
Bio.SeqIO.write((x, y), fd, "fasta")
print("Ref:")
ref = Bio.pairwise2.align.globalds(
seqs[0].seq, seqs[1].seq,
Bio.SubsMat.MatrixInfo.blosum62, -8, -4)
for x, y, s, *_ in ref:
print(s)
print(x)
print(y)
test()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment