Hi Xicheng, Thanks. I search the list before I post the question but I can't find similar topics. Could you please tell me some ealier posts? Also I try to use your code to read a very small file containing only these two records. Here is what I got:
This is record 1. This is sequence: This is record 2. This is sequence: This is record 3. This is sequence: I can't print each record out. How do I fix it? And here is my code: #!/usr/bin/perl-w use strict; my $filename='sequence.fasta'; open(FILENAME,$filename) or die " This $filename cannot be open!!!\n\n"; {local $/='>'; my $count_record=0; while (<FILENAME>){ ++$count_record; print "This is record $count_record.\n"; print "This is sequence:$sequence\n"; } } exit; ~ --- Xicheng <[EMAIL PROTECTED]> wrote: > This is a FAQ problem, so I would not post it in the > group, pls see the > following code. > =================== > #!/usr/bin/perl -w > use strict; > open FH, "<data.txt" or die "cant open data.txt: > $!"; > { > local $/='>'; > while (<FH>) { > # do sth on $_; # $_ does not include the > leading '>' though. > } > } > Dont know if this can go smoothly with your 2.7G > file though. Good > luck, > XC > ===================== > > Chen Li wrote: > > Hi all, > > > > I have a big file (2.7G) containing multiple > records > > in this format: > > >gi|618748|dbj|D21618.1| MUS74F01 mouse embryonal > > carcinoma cell line F9 Mus mus culus cDNA clone > 74F01, > > mRNA sequence > > > GCTGCCTCGACGATCTTCGCTTGCNTCCTCGCTCGCTGTCCCGTTGTCCTAGCCCGCCGCCGCCCGCTGAGCTTGTCTTT > > > ACCCTGCTTGCAGACATGGCTGACATCAAGAACAACCCCGAATATTTCTTTCGTNANCCGGTGTNATGGCGCTCGTCCGC > > AATGTTTTAGCGGCATGGGCCGCTATTGACAGCAAGAG > > >gi|618749|dbj|D21619.1| MUS74F09 mouse embryonal > > carcinoma cell line F9 Mus mus culus cDNA clone > 74F09, > > mRNA sequence > > > GGCGNNNTGGCCTCGGGCGGCTGGACGTGCCCAGCGCCCGATTAACAAGATACATTTAATTGCTGTGTTTAACCAAATGT > > > TTGAAGGCTGTGGGACTTTTTGAAATCATATGATCTCCTAAAAGCTGTTCACATTGTTCATTAA > > > > Each record starts with ">". I want to read each > > record once at a time.I hear about a special > variable > > call $/ might do the job but not sure how to use > it. I > > wonder if anyone could help me out. > > > > Thanks, > > > > Li > > > > > > > > > > > > > > __________________________________________ > > Yahoo! DSL - Something to write home about. > > Just $16.99/mo. or less. > > dsl.yahoo.com > > __________________________________________ Yahoo! DSL Something to write home about. Just $16.99/mo. or less. dsl.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>