Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I lifted Borodin's process_seq function but used Bio:SeqIO to read in the file sequence by sequence, an advantage over manually reading line by line and the logic to determine various processing. I believe those advantages are:</p> <ul> <li>Code that has been developed and tested by many others</li> <li>Whenever possible, if output is done via the Bio::SeqIO module, the result file can then be read using Bio::SeqIO read (<code>next_seq</code>) method.</li> <li>Other reasons I can't think of now :-)</li> </ul> <p>I imagine the BioPerl package of Bio Genetic code modules must be overwhelming to a biologist beginning programming. He might not be willing to try to dig out the information he needs to begin building a program. <a href="http://www.bioperl.org/wiki/Main_Page" rel="nofollow">BioPerl wiki</a> is a good starting place, especially the Howto section, and then there's a how to for beginners and others. You'll find code examples which are mostly(?) helpful. <a href="http://search.cpan.org/~cjfields/BioPerl-1.6.901/Bio/Seq.pm" rel="nofollow">Bio::Seq</a> has some good code examples in the beginning and is where most of the general sequence functions are. Also, for input/output, the <a href="http://search.cpan.org/~cjfields/BioPerl-1.6.901/Bio/SeqIO.pm" rel="nofollow">Bio::SeqIO</a> module is used and it has examples at the beginning of it's manual.</p> <pre><code>#!/usr/bin/perl use strict; use warnings; use Bio::SeqIO; my $gpat = '[G]{3,5}'; my $npat = '[A-Z]{1,25}'; my $pattern = $gpat.$npat.$gpat.$npat.$gpat.$npat.$gpat; my $regex = qr/$pattern/i; my $in = Bio::SeqIO-&gt;new ( -file =&gt; "fasta_dat.txt", -format =&gt; 'fasta'); my @totals; while ( my $seq = $in-&gt;next_seq() ) { process($seq); } print "Totals: "; print "@totals\n"; sub process { my $seq = shift; my @offset = map {sprintf '%.0f', $seq-&gt;length * $_ / 3} 1..3; my $sequence = $seq-&gt;seq; my @count = (0,0,0); while ($sequence =~ /$regex/g) { my $place = $-[0]; for my $i (0 .. 2) { next if $place &gt;= $offset[$i]; $count[$i]++; last; } } print $seq-&gt;id, "\n@count\n"; $totals[$_] += $count[$_] for 0 .. $#count; } </code></pre>
    singulars
    1. This table or related slice is empty.
    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.
 

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