my @startsRF1 =();
my @startsRF2 =();
my @startsRF3 =();
my @stopsRF1 = ();
my @stopsRF2 = ();
my @stopsRF3 = ();
my @arrayOfORFs = ();
my @arrayOfTranslations = ();
my $joinedAminoAcids = ();
while ($seq =~ m/ATG|TTG|CTG|ATT|CTA|GTG|ATT/gi){
my $matchPosition = pos($seq) - 3;
if (($matchPosition % 3) == 0) {
push (@startsRF1, $matchPosition);
}
while ($seq =~ m/TAG|TAA|TGA/gi){
my $matchPosition = pos($seq);
if (($matchPosition % 3) == 0) {
push (@stopsRF1, $matchPosition);
}
my $codonRange = "";
my $startPosition = 0;
my $stopPosition = 0;
@startsRF1 = reverse(@startsRF1);
@stopsRF1 = reverse(@stopsRF1);
while (scalar(@startsRF1) > 0) {
$codonRange = "";
$startPosition = pop(@startsRF1);
if ($startPosition < $stopPosition) {
next;
}
my $ORFseq = "";
while (scalar(@stopsRF1) > 0) {
$stopPosition = pop(@stopsRF1);
if ($stopPosition > $startPosition) {
my $difF = $stopPosition - $startPosition;
$ORFseq = substr($seq, $startPosition,(length($seq)-(length($seq)-$difF)));
push (@arrayOfORFs, $ORFseq);
}
foreach $ORFseq (@arrayOfORFs){
my @growingProtein = ();
for (my $i = 0; $i <= (length($ORFseq) - 3); $i = $i + 3) {
my $codon = substr($ORFseq, $i, 3);
if (exists( $genetic_code{$codon} )){
push (@growingProtein, $genetic_code{$codon});
}
else {
push (@growingProtein, "X");
}
}
my $joinedAminoAcids = join("",@growingProtein);
push (@arrayOfTranslations, $joinedAminoAcids);
}
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.