
panicz
Novice
Jan 30, 2013, 3:37 AM
Post #2 of 2
(237 views)
|
|
Re: [serafinososi] PROTEIN FILE... help me pleaseeee
[In reply to]
|
Can't Post
|
|
Well, you seem quite desperate... a student, huh?
#!/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)
|