I am working in python
from Bio import *
for current_seq in SeqIO.parse("mysequences.fasta", "fasta"):
if current_seq.seq.tostring() != '':
print( ">", current_seq.id, "\n", current_seq.seq.tostring())
I have this so far but there is an error. Also how would I create a file of the cleaned up version?
Please clarify if you need assistance with python code or other solutions will work.
Use
101010
button to formatcode
portion of your post properly. I have done it for you this time.First you want to collect the good records as a list and then write to file. Biopython writing FASTA files is quite well covered in the the documentation here. The first example there under 'Examples: Input/Output Example - Filtering by sequence length' is fairly similar to your needs and so it should be straightforward to adapt.