Entering edit mode
                    7.8 years ago
        Abdul Rafay Khan
        
    
        ★
    
    1.2k
    > File "dna2prot2-working-test-Copy.py", line 29, in <module> print
> (entry.seq).translate()#This will translate nucleotide sequence to
> amino acid sequence AttributeError: 'NoneType' object has no attribute
> 'translate'
Code:
import sys 
from Bio import SeqIO
from Bio.SeqIO.FastaIO import *
def fasta_reader(filename):   with open(filename) as handle:
    for record in FastaIterator(handle):
        yield record           
for entry in fasta_reader("test.txt"):
    print entry.id) #This is header of fasta entry
    print
    print (entry.seq) #This is sequence of specific fasta entry
    print
    dna=str (entry.seq)
    print ( entry.id)
from Bio.Tools import Translate  
    print (entry.seq).translate()#This will translate nucleotide sequence to amino acid sequence
                    
                
                
I did my best to properly format the code...
And does entry.seq look as expected?