Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: how do i count the 22 selected di-peptides from a multifasta file separately for each sequence

by hdb (Monsignor)
on Apr 26, 2015 at 14:11 UTC ( [id://1124754]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1124754]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2024-04-19 03:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found