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

If you want to count overlapping matches, a plain regular expression as you wrote it isn't the easiest way to approach the problem.

Personally, I would simply iterate over the string either for each character or by resetting pos and using \G as documented in perlre:

use strict; my $line= 'AAALVDENEC'; while( $line =~ /\G.*?(AA|AL|DA|DE|DV|VD|DW|QD|SD|HD|ED|DY|VE|EN|EI|KE +|NV|VP|FV|SS|WK|KK)/igc ) { print sprintf 'Matched [%s] at %d', $1, pos($line); pos( $line )--; }
  • Comment on Re^3: how do i count the 22 selected di-peptides from a multifasta file separately for each sequence
  • Select or Download Code

Replies are listed 'Best First'.
A reply falls below the community's threshold of quality. You may see it by logging in.