Hi all,
I have the following code:
import pandas as pd
from Bio import pairwise2
# Import format_alignment method
from Bio.pairwise2 import format_alignment
data = pd.read_csv("../Results/dave.csv")
x =data["S1"]
y =data["S2"]
for i in range(0,len(data)):
X=x[i]
Y=y[i]
global_align = pairwise2.align.globalms(X, Y, 10, -2, -1, -1)
score = global_align[0][2]
# A match score is the score of identical chars, else mismatch score.
# Same open and extend gap penalties for both sequences.
# matches = 10
#mismatch = -2
# gap = -1
# extending = -1
score_list=[]
score_list.append(score)
print(score)
The CSV Dataset:
S1 S2
AAC AAA
BBB BBBAAA
The output:
27.0
The code only applies to the last row of the CSV file. I would like scores generated for each row of the csv please.
Desired Output:
15.0
27.0
Please note that I am very new to Python and BioPython so any help will be greatly appreciated.
Many Thanks,
Ishack
Does anyone know how to solve this please?