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

There is an alternative to matching with overlapping patterns:

#!/usr/bin/perl # http://perlmonks.org/?node_id=1124725 use strict; my @dipeptides = split /\|/, 'AA|AL|DA|DE|DV|VD|DW|QD|SD|HD|ED|DY|VE|EN|EI|KE|NV|VP|FV|SS|WK|KK'; for my $line ( 'AAALVDENEC', 'AATLVDEGDG' ) { my $sum = grep $line =~ $_, @dipeptides; my $abs = @dipeptides - $sum; print "$line sum: $sum abs: $abs\n"; }
  • Comment on Re^3: how do i count the 22 selected di-peptides from a multifasta file separately for each sequence
  • Download Code