X BOL wishing you a very and Happy New year

Alternative content

Our Sponsors



Download BioinformaticsOnline(BOL) Apps in your chrome browser.




Python script for six frame translation of sequences !

  • Public
By LEGE 329 days ago
from Bio import SeqIO from Bio.Seq import Seq def translate_frame(sequence, frame): if frame > 0: translated_seq = sequence[frame-1:].translate() else: reverse_complement = sequence.reverse_complement() translated_seq = reverse_complement[abs(frame)-1:].translate() return translated_seq def six_frame_translation(fasta_file): records = list(SeqIO.parse(fasta_file, "fasta")) for record in records: print(f"Sequence ID: {record.id}") for frame in range(1, 7): protein_sequence = translate_frame(record.seq, frame) frame_type = "Forward" if frame > 0 else "Reverse" print(f"Frame {frame_type} {abs(frame)} Translation:\n{protein_sequence}\n") # Replace 'path/to/your/input.fasta' with the actual path to your input nucleotide sequence in FASTA format input_fasta = 'path/to/your/input.fasta' six_frame_translation(input_fasta)