in reply to how do i count the 22 selected di-peptides from a multifasta file separately for each sequence

Why bother searching for specific pairs of letters? Just count them all, there are not so many of them, and then pick the counts you are interested in:

use strict; use warnings; my $line= 'AAALVDENEC'; my %counts; $counts{substr $line, $_, 2}++ for 0..length($line)-2; my @wanted = qw(AA AL DA DE DV VD DW QD SD HD ED DY VE EN EI KE NV VP +FV SS WK KK); for (@wanted) { print "$_ => $counts{$_}\n" if defined $counts{$_}; }
  • Comment on Re: how do i count the 22 selected di-peptides from a multifasta file separately for each sequence
  • Download Code