I am glad I am using perl and not python or any thing else. Thanks to Bob who got me started with perl and Jay with bio-perl helping me every step of the way. :-)<br><br>
<div><span class="gmail_quote">On 2/28/07, <b class="gmail_sendername">Jay Hannah</b> &lt;<a href="mailto:jay@jays.net">jay@jays.net</a>&gt; wrote:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Reading this article:<br><a href="http://www.linuxjournal.com/article/6977">http://www.linuxjournal.com/article/6977
</a><br>Sequencing the SARS Virus - Linux Journal, Nov 2003<br><br>This guy needs Perl and/or BioPerl.&nbsp;&nbsp;:)<br><br>&gt; The sequence file is in FASTA format consisting of a header line<br>&gt; and the sequence, split into fixed-width lines. The following
<br>&gt; counts the number of Gs and Cs in the sequence and presents the<br>&gt; total as a fraction of the total number of bases:<br>&gt;<br>&gt; &gt; grep -v &quot;^&gt;&quot; AY274119.fa | fold -w 1 |<br>&gt; tr &quot;ATGC&quot; &quot;..xx&quot; | sort | uniq -c |
<br>&gt; sed &#39;s/[^0-9]//g&#39; | t -s &quot;\012&quot; &quot; &quot; |<br>&gt; sed &#39;s/\([0-9]*\) \([0-9]*\)/scale = 3;<br>&gt; ↪\2 \/ (\1+\2)/&#39; |<br>&gt; bc -i<br>&gt; scale = 3; 12127 / (17624+12127)<br>&gt; .407
<br>&gt;<br>&gt; Out of the 29,751 bases in our sequence, 12,127 are either G or C,<br>&gt; giving a GC content of 41%.<br><br>BioPerl version:<br><br>use Bio::SeqIO;<br>my $io = Bio::SeqIO-&gt;new(<br>&nbsp;&nbsp;-file&nbsp;&nbsp; =&gt; &#39;
AY274119.fa&#39;,<br>&nbsp;&nbsp;-format =&gt; &#39;Fasta&#39;<br>);<br>my $seq = $io-&gt;next_seq-&gt;seq;<br>print ( ($seq =~ tr/GC/GC/) / length ($seq) );<br><br>Command-line Perl:<br><br>perl -e &#39;$/ = undef; $_ = &lt;&gt;; s/&gt;.*//; s/\n//g; print tr/GC/GC/ /
<br>length($_)&#39; AY274119.fa<br><br>I&#39;m sure you can Perl Golf my stabs at it.&nbsp;&nbsp;:)<br><br>j<br><a href="http://seqlab.net">seqlab.net</a><br><a href="http://www.bioperl.org/wiki/User:Jhannah">http://www.bioperl.org/wiki/User:Jhannah
</a><br><br><br><br><br>_______________________________________________<br>Omaha-pm mailing list<br><a href="mailto:Omaha-pm@pm.org">Omaha-pm@pm.org</a><br><a href="http://mail.pm.org/mailman/listinfo/omaha-pm">http://mail.pm.org/mailman/listinfo/omaha-pm
</a></blockquote></div><br><br clear="all"><br>-- <br>Dhundy R. Bastola<br>Assistant Professor<br>Department of Pediatrics<br>University of Nebraska Medical Center<br>Omaha NE 68198<br>Always reply to: <a href="mailto:dbastola@unmc.edu">
dbastola@unmc.edu</a><br>