Hi, I am new to python. I am trying to translate some dna sequences (from a multifasta file) with the biopython .translate() method. However, it seems that by default the alphabet of the fasta sequences is set to SingleLetterAlphabet, and this is a problem to do the translation. Is there a way to change the Alphabet feature of my fasta sequences to "unambiguous_dna" or similar? Thanks for any help!
Can you show us the code you have so far? If you're using SeqIO to read in the file, then you want SeqIO.parse("file.fa", "fasta", alphabet=IUPAC.unambiguous_dna)
Thanks for your reply, Brad. When I try it I get the following error:
The SeqIO parser gives you back SeqRecords (sequences plus name and annotations). translate is a method on Seq objects, so you want to do: 'for rec in SeqIO.parse' and then 'rec.seq.translate()'.
That worked, thank you!!