[Bioperl-l] A question about the perl code

Johan Viklund johan.viklund at gmail.com
Tue Aug 16 13:09:07 EDT 2005


Hi,

If you have all the pairs in an array, say @nucleotide_pairs, and the
pair you randomly selected in the scalar $pair this will work:

@selected_pairs = grep { not /[$pair]/ } @nucleotide_pairs;

For a description on what grep does look in the perlfunc perldoc page
(on the web: <http://www.perldoc.com/perl5.8.4/pod/func/grep.html>

On 8/16/05, Alex Zhang <mayagao1999 at yahoo.com> wrote:
> Dear all,
> 
> I made a group A which includes 16 combinations of any
> two nucleotides like: AA,AC,AG,AT,
> CA,CC,CG,CT,
> GA,GC,GG,GT,
> TA,TC,TG,TT
> 
> If  I randomly got a pair like AC, I want to exclude
> AC, AT, AG, AA, TC, CC, GC. In other words, I want to
> exclude the pairs in group A which has the same
> nucleotide with the pair randomly selected. Can
> anybody suggest me how to approach this using Perl?
> 
> Thanks!
>    Alex
> 
> 
> 
> ____________________________________________________
> Start your day with Yahoo! - make it your home page
> http://www.yahoo.com/r/hs
> 
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at portal.open-bio.org
> http://portal.open-bio.org/mailman/listinfo/bioperl-l
> 


-- 
Johan Viklund
E-post: <johan.viklund at gmail.com>
-----------------
perl -we '$,=" ";$_=bless sub{shift;print
split(/::/,ref)},Just::Another::Perl::Hacker;&$_'



More information about the Bioperl-l mailing list