Hello, I am currently trying to work through an assignment in which we are tasked with creating a python program to: iterate through a FASTQ file, convert the phred scores into quality scores, and then add the sum of each quality score correlated with each nucleotide position into an array. For instance, position 0 of the array will contain the sum of all the quality scores of the first nucleotide of each sequence in the file. We first had to create an array filled with 102, 0.0 values as place holders for the sums (each sequence is 102 nucleotides long). I have so far been able to iterate and convert the phred scores into quality scores, but I do not know how to iterate through the scores any further.
array = [0.0] * 102
def convert_phred(c):
return ord(c) - 33
i = 1
for lines in fh:
i+=1
if i % 4 == 1:
for char in lines:
print(convert_phred(char))