I'm working on a program that reads trough a FASTQ file and gives the amount of N's per sequence in this file. I managed to get the number of N's per line and I put these in a list. The problem is that I need all the numbers in one list to sum op the total amount of N's in the file but they get printed in their own list.
C:\Users\Zokids\Desktop>N_counting.py test.fastq
[4]
4
[3]
3
[5]
5
This is my output, the List and total amount in the list. I've seen ways to manually combine lists but one can have hundreds of sequences so that's a no go.
def Count_N(line):
'''
This function takes a line and counts the anmount of N´s in the line
'''
List = []
Count = line.count("N") # Count the amount of N´s that are in the line returned by import_fastq_file
List.append(int(Count))
Total = sum(List)
print(List)
print(Total)
This is what I have as code, another function selects the lines.
I hope someone can help me with this. Thank you in advance.