New to python but trying to learn, here I wrote a program to count the nucleotides in a fasta file. The approach is that when the line does not contain a ">" symbol then the program counts nucleotides one by one and adds it to the variable sum. The program does not work and I don't know why. Please help!
#!/usr/bin/env python
import sys
# Takes fasta file and counts total bases
infile = open(sys.argv[0], "rU")
sum = 0
line = infile.readlines()
while ">" not in lline:
print (sum)
usage: $ python countbases.py infile.fasta
#!/usr/bin/env python
import sys
# Takes fasta file and counts total bases
infile = open(sys.argv[0], "rU")
sum = 0
line = infile.readlines()
while ">" not in lline:
for i in line:
sum += 1
usage: $ python countbases.py infile.fasta
Comment