Difference between revisions of "SeungWon Lee Perl HW"

From Biolecture.org
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...")
(No difference)

Revision as of 02:16, 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

<textarea cols="30" name="code" rows="20"> 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";</textarea>

A2. Running in consol

A3. result file

<textarea cols="20" rows="20">>Your_first_seq ATATATATATATATATAATATATATATATATATAATATATATATATATATAATATATATATATATATA ATATATATATATATATAATATATATATATATATAATATATATATATATATAATATATATATATATATA ATATATATATATATATAATATATATATATATATAATATATATATATATATAATATATATATATATATA ATATATATATATATATAATATATATATATATATAATATATATATATATATAATATATATATATATATA </textarea>

the file name is fasta.txt (format is txt)