in reply to Re^2: how do i count the 22 selected di-peptides from a multifasta file separately for each sequence
in thread how do i count the 22 selected di-peptides from a multifasta file separately for each sequence
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: how do i count the 22 selected di-peptides from a multifasta file separately for each sequence
by SOMEN (Initiate) on Apr 26, 2015 at 11:16 UTC |