Our Sponsors



Download BioinformaticsOnline(BOL) Apps in your chrome browser.




Perl script for six frame translation !

  • Public
By LEGE 329 days ago
#!/usr/bin/perl use strict; use warnings; use Bio::SeqIO; # Path to your input nucleotide sequence file in FASTA format my $input_fasta = 'path/to/your/input.fasta'; # Step 1: Read the input FASTA file my $seqio = Bio::SeqIO->new(-file => $input_fasta, -format => 'fasta'); my $sequence = $seqio->next_seq; # Step 2: Perform six-frame translation my @frames = (1, 2, 3, -1, -2, -3); foreach my $frame (@frames) { my $translated_seq = translate_frame($sequence, $frame); my $frame_type = $frame > 0 ? "Forward" : "Reverse"; print "Frame $frame_type $frame Translation:\n$translated_seq\n"; } # Subroutine to translate a sequence in a specific frame sub translate_frame { my ($sequence, $frame) = @_; my $translated_seq; if ($frame > 0) { $translated_seq = $sequence->translate(-frame => $frame)->seq; } else { # If frame is negative, reverse and complement the sequence before translation my $revcomp_seq = $sequence->revcom; $translated_seq = $revcomp_seq->translate(-frame => abs($frame))->seq; } return $translated_seq; }