Difference between revisions of "SeungWon Lee Perl HW"
imported>Seung won lee (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...") |
imported>Seung won lee |
||
Line 12: | Line 12: | ||
<p>A1. the perl code</p> | <p>A1. the perl code</p> | ||
− | < | + | <blockquote> |
− | use warnings; | + | <p>use warnings;<br /> |
− | use strict; | + | use strict;</p> |
− | open my $fh, '>', 'fasta.txt'; | + | <p>open my $fh, '>', 'fasta.txt';</p> |
− | print "enter your fasta file name\n"; | + | <p>print "enter your fasta file name\n";<br /> |
− | my $seqname = <>; | + | my $seqname = <>;<br /> |
− | print $fh '>'. "$seqname"; | + | print $fh '>'. "$seqname";</p> |
− | print "enter your fasta sequence(to end inputing sequence, hit 0 and enter)\n"; | + | <p>print "enter your fasta sequence(to end inputing sequence, hit 0 and enter)\n";<br /> |
− | while (my $line = <STDIN>) { | + | while (my $line = <STDIN>) {<br /> |
− | + | last if $line =~ '^0$';<br /> | |
− | + | print $fh $line;<br /> | |
− | } | + | }</p> |
− | close $fh; | + | <p>close $fh;</p> |
− | print "done\n";</ | + | <p>print "done\n";</p> |
+ | </blockquote> | ||
+ | |||
+ | <p> </p> | ||
+ | |||
+ | <p>download the code <a href="/ckfinder/userfiles/files/fasta_code.txt">/ckfinder/userfiles/files/fasta_code.txt</a></p> | ||
+ | |||
+ | <p>the .pl format can't upload, so I change pl to txt. when you open the file, you have to save as .pl</p> | ||
<p>A2. Running in consol</p> | <p>A2. Running in consol</p> | ||
Line 38: | Line 45: | ||
<p>A3. result file</p> | <p>A3. result file</p> | ||
− | < | + | <blockquote>>Your_first_seq<br /> |
+ | ATATATATATATATATAATATATATATATATATAATATATATATATATATAATATATATATATATATA<br /> | ||
+ | ATATATATATATATATAATATATATATATATATAATATATATATATATATAATATATATATATATATA<br /> | ||
+ | ATATATATATATATATAATATATATATATATATAATATATATATATATATAATATATATATATATATA<br /> | ||
ATATATATATATATATAATATATATATATATATAATATATATATATATATAATATATATATATATATA | ATATATATATATATATAATATATATATATATATAATATATATATATATATAATATATATATATATATA | ||
− | + | <p> </p> | |
− | + | </blockquote> | |
− | + | ||
− | < | + | <p>the file name is fasta.txt (format is txt) </p> |
− | <p> | + | <p>download file : <a href="/ckfinder/userfiles/files/fasta.txt">/ckfinder/userfiles/files/fasta.txt</a></p> |
Latest revision as of 02:22, 29 November 2015
Q.write a simple program to open and write a FASTA file with the content
below:
>Your_first_seq
ATATATATATATATATAATATATATATATATATAATATATATATATATATAATATATATATATATATA
ATATATATATATATATAATATATATATATATATAATATATATATATATATAATATATATATATATATA
ATATATATATATATATAATATATATATATATATAATATATATATATATATAATATATATATATATATA
ATATATATATATATATAATATATATATATATATAATATATATATATATATAATATATATATATATATA
A1. the perl code
use warnings;
use strict;open my $fh, '>', 'fasta.txt';
print "enter your fasta file name\n";
my $seqname = <>;
print $fh '>'. "$seqname";print "enter your fasta sequence(to end inputing sequence, hit 0 and enter)\n";
while (my $line = <STDIN>) {
last if $line =~ '^0$';
print $fh $line;
}close $fh;
print "done\n";
download the code /ckfinder/userfiles/files/fasta_code.txt
the .pl format can't upload, so I change pl to txt. when you open the file, you have to save as .pl
A2. Running in consol
A3. result file
>Your_first_seq
ATATATATATATATATAATATATATATATATATAATATATATATATATATAATATATATATATATATA
ATATATATATATATATAATATATATATATATATAATATATATATATATATAATATATATATATATATA
ATATATATATATATATAATATATATATATATATAATATATATATATATATAATATATATATATATATA
ATATATATATATATATAATATATATATATATATAATATATATATATATATAATATATATATATATATA
the file name is fasta.txt (format is txt)
download file : /ckfinder/userfiles/files/fasta.txt