Suppose I have a file with n
DNA sequences, each one in a line. I need to turn them into a list and then calculate each sequence's length and then total length of all of them together. I am not sure how to do that before they are into a list.
# open file and writing each sequences' length
f= open('seq.txt' , 'r')
for line in f:
line= line.strip()
print (line)
print ('this is the length of the given sequence', len(line))
# turning into a list:
lines = [line.strip() for line in open('seq.txt')]
print (lines)
How can I do math calculations from the list? Ex. the total length of all sequences together? Standard deviation from their different lengths etc.