Here's one way to match overlapping patterns:
#!/usr/bin/perl # http://perlmonks.org/?node_id=1124725 use Data::Dump qw(pp); use strict; $| = 1; my %answer; for my $line ( 'AAALVDENEC', 'AATLVDEGDG' ) { $answer{$line}{$_}++ for $line =~ /(?=(AA|AL|DA|DE|DV|VD|DW|QD|SD|HD|ED|DY|VE|EN|EI|KE|NV|VP|FV|SS|W +K|KK))/g; } pp \%answer;
which produces:
{ AAALVDENEC => { AA => 2, AL => 1, DE => 1, EN => 1, VD => 1 }, AATLVDEGDG => { AA => 1, DE => 1, VD => 1 }, }
That has the 5 and 3 you are looking for.
In reply to Re^3: how do i count the 22 selected di-peptides from a multifasta file separately for each sequence
by Anonymous Monk
in thread how do i count the 22 selected di-peptides from a multifasta file separately for each sequence
by SOMEN
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |