Hi Jyoti,
Jyoti wrote:
I just want help to open and read a file. I have to make a script so that it should open and read a file which is in fasta format. I have done something with subroutine but getting some errors. May be everyone do not know the fasta format.... Fasta format have peculiar feature: its starts with symbol " > " and contains alpabets and numbers. So acc to that code have been given...
Actually the fasta format can have more than one block where each block starts with a line with ">" as the first character. i.e., there can be many ">" in a fasta file.
From Wikipedia, this is in fasta format: >gi|5524211|gb|AAD44166.1| cytochrome b [Elephas maximus maximus] LCLYTHIGRNIYYGSYLYSETWNTGIMLLLITMATAFMGYVLPWGQMSFWGATVITNLFSAIPYIGTNLV EWIWGGFSVDKATLNRFFAFHFILPFTMVALAGVHLTFLHETGSNNPLGLTSDSDKIPFHPYYTIKDFLG LLILILLLLLLALLSPDMLGDPDNHMPADPLNTPLHIKPEWYFLFAYAILRSVPNKLGGVLALFLSIVIL GLMPFLHTSKHRSMMLRPLSQALFWTLTMDLLTLTWIGSQPVEYPYTIIGQMASILYFSIILAFLPIAGX IENY
Can anyone please check the code n lemme know changes please!!!
Well, your code compiles, but quickly looking at it, it seems like the problem is that you are misunderstanding the fasta format. If it starts with ">", it's a comment field. Otherwise, it is a sequence of nucleotides/amino acids that go with the previously given header. (Based on my understanding of the fasta format...you should double-check this yourself...)
And of course, you can use other libraries that already parse fasta files. Ray -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/