Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use strict;
- use warnings;
- use Bio::SeqIO;
- my @amino=qw/A C D E F G H I K L M N P Q R S T U V W X Y/;
- my @comb=();
- foreach my $a (@amino){
- foreach my $b (@amino){
- push (@comb,$a.$b)
- }
- }
- my $in = Bio::SeqIO->new(-file => "myfile.fasta" , '-format' => 'Fasta');
- while ( my $seq= $in->next_seq ) {
- my @dipeps=($seq->seq()=~/(?=(.{2}))/g);
- my %di_count=();
- $di_count{$_}++ for @dipeps;
- print ">",$seq->id();
- map{exists $di_count{$_}?print " ",$_,",",$di_count{$_}:print " ",$_,",",0}sort @comb;
- print "\n";
- }
Advertisement
Add Comment
Please, Sign In to add comment