CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner: Re: [serafinososi] PROTEIN FILE... help me pleaseeee: Edit Log



panicz
Novice

Jan 30, 2013, 3:37 AM


Views: 397
Re: [serafinososi] PROTEIN FILE... help me pleaseeee

Well, you seem quite desperate... a student, huh?

Code
#!/usr/bin/perl 

print "Please type the file name of the protein sequence data: ";
$proteinfilename = <STDIN>;
chomp $proteinfilename;

unless (open(PROTEINFILE, '<', $proteinfilename)){
die "File \"$proteinfilename\" doesn\'t seem to exist!!\n";
}

while(<PROTEINFILE>) {
next if(/^>/ or /^\s*$/); # skip empties and signature
chomp; # remove trailing newline
$seq .= $_; # accumulate lines in $seq
}

print "The aminoacid sequence $seq contains "
.($seq =~ tr/F/F/)." Phenylalanine aminoacids\n";

I think your teacher should be satisfied (especially if he looks at this forum too), but I encourage you to go deeper into programming -- the code above is an almost exact translation of your task into perl (see how much shorter!), so it's quite trivial and shoudln't be difficult for you to understand.

Regards.

PS. 'please' is spelled with only one 'e' at the end


(This post was edited by panicz on Jan 30, 2013, 6:43 AM)


Edit Log:
Post edited by panicz (Novice) on Jan 30, 2013, 3:49 AM
Post edited by panicz (Novice) on Jan 30, 2013, 6:43 AM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives