theward has asked for the wisdom of the Perl Monks concerning the following question:
Hi All,
I am a newbie at Perl and am trying to teach myself to become better. I would like to ask for some wisdom.
I have some code and know what it's doing but I can't get my head around how it's actually doing it. I have a fasta file (micro.txt) with several microRNAs in the form of: >hsa-let-7a-5pTGAGGTAGTAGGTTGTATAGTT>hsa-let-7a-3pCTATACAA......etc the code is:
my $micro = 'micro.txt'; open(IN, $micro) or die "Can't open file $micro because $!\n"; while(my $line=<IN>) { if ($line=~/>/) { chomp($line); $line=~s/>//; my $sequence=<IN>; chomp($sequence); } close(IN);
I know that the code is separating the 'header' (i.e.>hsa-let-7a-5p) and 'sequence' part (i.e. TGAGGTAGTAGGTTGTATAGTT) but how is this doing it by just using chomp? My understanding was that chomp just removed any whitespace at the end of a line?? Please help!!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Not sure how it's working?
by AnomalousMonk (Archbishop) on Feb 13, 2015 at 06:45 UTC | |
|
Re: Not sure how it's working?
by jmmitc06 (Beadle) on Feb 13, 2015 at 06:54 UTC | |
|
Re: Not sure how it's working?
by Anonymous Monk on Feb 13, 2015 at 04:39 UTC | |
|
Re: Not sure how it's working?
by Anonymous Monk on Feb 13, 2015 at 06:43 UTC |