Guest User

dipeptide

a guest
Apr 29th, 2011
314
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.52 KB | None | 0 0
  1. use strict;
  2. use warnings;
  3. use Bio::SeqIO;
  4.  
  5. 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/;
  6. my @comb=();
  7. foreach my $a (@amino){
  8.     foreach my $b (@amino){
  9.         push (@comb,$a.$b)
  10.     }
  11. }
  12. my $in  = Bio::SeqIO->new(-file => "myfile.fasta" , '-format' => 'Fasta');
  13. while ( my $seq= $in->next_seq ) {
  14. my @dipeps=($seq->seq()=~/(?=(.{2}))/g);
  15. my %di_count=();
  16. $di_count{$_}++ for @dipeps;
  17. print ">",$seq->id();
  18. map{exists $di_count{$_}?print " ",$_,",",$di_count{$_}:print " ",$_,",",0}sort @comb;
  19. print "\n";
  20.  
  21. }
Advertisement
Add Comment
Please, Sign In to add comment