I need some help pleaseeeee: the question is... Develop a Perl program that ask the user to type the name of a file in the working directory (containing one protein sequence in FASTA format) and prints the number of Phenylalanine aminoacids in the sequence. -It prints a message, prompting the user to insert the file name. -It reads the file name assigning it to one variable. -It opens for reading the file with that name. If the file is not existing it gives an error message. -A scalar variable that will contain the sequence is initialized to the empty string “”. -The program reads one after the other (with a while loop) the lines of the file assigning the read line to a variable. - If the line starts with “>” (it is the first line of a FASTA file) the line is not considered. Else all the white spaces are removed from the line and the line is postponed to the sequence. -When all the lines have been read the while loops terminates and the program continues closing the file. -Using the translate command, the program counts the number of F in the sequence, assigning it to a variable. -It prints the message: “The aminoacid sequence ” followed by the variable containing the read sequence “ contains “ followed by the variable with the number of F, followed by “Phenylalanine aminoacids” followed by new line.
This is the "protein file": >gi|403369491|gb|EJY84591.1| Transcriptional regulator, Sir2 family protein Oxytricha trifallax MMKQLIKHNKNTPLFNFLRVKFSSTAATIQTQQTVNKPIESKFKEEKLDNYHDIYEKSKRLAEQISQSKS FICFTGAGLSTSTGIPDYRSTSNTLAQTGAGAYELEISEEDKKSKTRQIRSQVQRAKPSISHMALHALME NGYLKHLISQNTDGLHLKSGIPYQNLTELHGNTTVEYCKSCSKIYFRDFRCRSSEDPYHHLTGRQCEDLK CGGELADEIVHFGESIPKDKLVEALTAASQSDLCLTMGTSLRVKPANQIPIQTIKNKGQLAIVNLQYTPF DEIAQIRMHSFTDQVLEIVCQELNIKIPEYQMKRRIHIIRNAETNEIVVYGSYGNHKNIKLSFMQRMEYI DNKNHVYLALDKEPFHIIPDYFNFQNINTDQEEVEFRIHFYGHNSEPYFQLTLPRQSILELQAGEHLICD ITFDYDKLEWK I wrote this but doesn't work:
#!/usr/bin/perl -w print "Please type the file name of the protein sequence data: "; $proteinfilename = <STDIN>; unless ( open (PROTEINFILE, $proteinfilename) ) { print "File \"$proteinfilename\" doesn\'t seem to exist!!\n"; } $protein = <PROTEINFILE> ; $empty = " " , (<PROTEINFILE>); while ( $protein = <PROTEINFILE> ) { if ( $protein =~ /^>/ ) { next $protein; } else { $protein =~ s/$empty//g ; $protein = join ($protein, @protein); print $protein; } }
Update: Thx
In reply to PROTEIN FILE help me pleaseee by serafinososi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |