In my home area you\'ll find the following file \'/home/jorvis1/e_coli_k12_dh10b
ID: 3851437 • Letter: I
Question
In my home area you'll find the following file '/home/jorvis1/e_coli_k12_dh10b.faa', which is in FASTA format. Write a script to count the number of sequence entries within this file and report the count like:
There were 4126 sequences within the file.
This is what I have so far. I don't get an error, but nothing prints.
#!/usr/bin/env python3
count = 0
for line in open('/home/jorvis/e_coli_k12_dh10b.faa'):
count = count + 1
if line.startswith(">"):
print(" There were " + str(count) + " records in file ")
Explanation / Answer
indentation on the line if line.startswith(">") is not in the for loop.
This may be the reason for not getting any of the output
The condition may not be getting true and so the if statement is not being executed.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.