Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Have you checked out <a href="http://www.bioperl.org/wiki/HOWTO%3aBeginners" rel="nofollow">BioPerl</a> at all? I haven't checked, but perhaps it already includes the functionality you require. Or are you currently working on an assignment for which you have to write the program yourself?</p> <p><strong>EDIT</strong></p> <p>I'm not quite sure about the first section of the code you have posted. For example, there are blanks within your regexes. Does the string you are trying to match actually include those blanks, or are the codons all written together, as in <code>AUGCCGGAUGA</code>? In the latter case there'd simply be no match, even though the codons you're looking for are present (I'm probably telling you things you know though... I just wanted to point it out, just in case :) ).</p> <p>Also, what's the code of your <code>pos</code> function?</p> <p>One more thing: you don't have to set <code>$_</code>, you can simply match <code>$RNA_seq</code> against a pattern, like so:</p> <pre><code>if ($RNA_seq =~ m/UGA/) { # ... </code></pre> <p><strong>EDIT 2</strong></p> <p>I've thought a bit more about the first section, I think using the <code>index</code> function would be advisable here, as that immediately gives you the position within the sequence:</p> <pre><code>#!/usr/bin/perl use strict; use warnings; use List::Util qw( min ); my $string = 'UGAAUGGGCCAUAUUUGACUGAGUUUCAGAUGCCAUUGGCGAUUAG'; # the genes: *-------------* *---------------* my $prev = -1; my @genes; while (1) { my $start = index($string, 'AUG', $prev+1); my $stop = min grep $_ &gt; -1, (index($string, 'UGA', $start+1), index($string, 'UAA', $start+1), index($string, 'UAG', $start+1)); # exit the loop if index is -1, i.e. if there was no more match last if ($start &lt; 0 or $stop &lt; 0); # using +1 so that 'AUGA' will not count as a gene if ($stop &gt; $start+1) { push @genes, substr($string, $start, $stop); } $prev = $stop; # I'm assuming that no second AUG will come between AUG and a stop codon } print "@genes\n"; </code></pre> <p>This gives you</p> <pre><code>AUGGGCCAUAUUUGA AUGCCAUUGGCGAUUAG </code></pre> <p>I would say it might need some refinement, but I hope it'll be helpful all the same.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload