Changes

From Biolecture.org

SeungWon Lee Perl HW

1,567 bytes added, 02:16, 29 November 2015
Created page with "<p>Q.write a simple program to open and write a FASTA file with the content<br /> below:<br /> <br /> >Your_fi..."
<p>Q.write&nbsp;a&nbsp;simple&nbsp;program&nbsp;to&nbsp;open&nbsp;and&nbsp;write&nbsp;a&nbsp;FASTA&nbsp;file&nbsp;with&nbsp;the&nbsp;content<br />
below:<br />
<br />
&gt;Your_first_seq<br />
ATATATATATATATATAATATATATATATATATAATATATATATATATATAATATATATATATATATA<br />
ATATATATATATATATAATATATATATATATATAATATATATATATATATAATATATATATATATATA<br />
ATATATATATATATATAATATATATATATATATAATATATATATATATATAATATATATATATATATA<br />
ATATATATATATATATAATATATATATATATATAATATATATATATATATAATATATATATATATATA</p>

<p>&nbsp;</p>

<p>A1. the perl code</p>

<p><textarea cols="30" name="code" rows="20">
use warnings;
use strict;

open my $fh, &#39;&gt;&#39;, &#39;fasta.txt&#39;;

print &quot;enter your fasta file name\n&quot;;
my $seqname = &lt;&gt;;
print $fh &#39;&gt;&#39;. &quot;$seqname&quot;;

print &quot;enter your fasta sequence(to end inputing sequence, hit 0 and enter)\n&quot;;
while (my $line = &lt;STDIN&gt;) {
last if $line =~ &#39;^0$&#39;;
print $fh $line;
}

close $fh;

print &quot;done\n&quot;;</textarea></p>

<p>A2. Running in consol</p>

<p><img alt="" src="/ckfinder/userfiles/images/fasta(1).png" style="height:190px; width:649px" /></p>

<p>A3. result file</p>

<p><textarea cols="20" rows="20">&gt;Your_first_seq
ATATATATATATATATAATATATATATATATATAATATATATATATATATAATATATATATATATATA
ATATATATATATATATAATATATATATATATATAATATATATATATATATAATATATATATATATATA
ATATATATATATATATAATATATATATATATATAATATATATATATATATAATATATATATATATATA
ATATATATATATATATAATATATATATATATATAATATATATATATATATAATATATATATATATATA
</textarea></p>

<p>the file name is fasta.txt (format is txt)</p>

Navigation menu