FAA File Sequence
I used this sequence of codes to print the sequences with a header:
but now that I'm trying to print without a header (the lines with > in the start) using this other code, I'm not getting it
Is there any other code that can do this, a more direct one or using the same sequence with sth different?
• 1,694 views
•
link
2 answers
I managed to solve it with this code:
openFile = open('genoma9.faa', 'r')
writeFile = open('updatedFile.txt', 'w')
for txtLine in openFile .readlines():
if not (txtLine.startswith('>WP')):
print(txtLine)
writeFile.write(txtLine)
writeFile.close()
openFile.close()
• 0 views
•
link
The read() method returns the specified number of bytes from the file. Default is -1 which means the whole file.
here you read the whole file. If the file is too large, it won't fit in memory.
Is there any other code that can do this
iterate over each line, fill the name and the sequence of the current sequence.
• 0 views
•
link
Log in to answer this question.