in reply to Pattern finding and printing with regex
A more general solution is to write your regex to find the sequence ID rather than removing the '>' character.
$pattern = qr/^(\w*)/; if ($line =~ /$pattern/) { my $id = $1; $I++; print "$i: $id \n"; }
This approach would exclude the optional sequence description if it were included in the fasta file.
UPDATE: AnomalousMonk is correct. I accidentally omitted the '<' from my regex.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Pattern finding and printing with regex
by AnomalousMonk (Archbishop) on Oct 22, 2015 at 01:33 UTC |