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:
Post deleted by serafinososi

 



serafinososi
New User

Jan 30, 2013, 2:35 AM

Post #1 of 2 (404 views)
Post deleted by serafinososi

 


panicz
Novice

Jan 30, 2013, 3:37 AM

Post #2 of 2 (398 views)
Re: [serafinososi] PROTEIN FILE... help me pleaseeee [In reply to] Can't Post

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)

 
 


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

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