[BiO BB] A question about the perl code

Alex Zhang mayagao1999 at yahoo.com
Wed Aug 17 11:39:36 EDT 2005


That helps! Thank you!

Roger Pettett <rmp at sanger.ac.uk> wrote:On Tue, 16 Aug 2005, Alex Zhang 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?

How about something like this?

my @group = qw(AA AC AG AT
CA CC CG CT
GA GC GG GT
TA TC TG TT);
my $rand = $group[rand(scalar @group)];
my @filtered = grep { $_ !~ /[$rand]/ } @group;

print join("\n", @filtered);


-- 
Roger Pettett, rmp at sanger.ac.uk
Project Leader (Web Systems)
The Sanger Institute, WTGC, Cambridge CB10 1SA, UK
http://www.sanger.ac.uk/
http://decipher.sanger.ac.uk/
http://www.ensembl.org/
_______________________________________________
Bioinformatics.Org general forum - BiO_Bulletin_Board at bioinformatics.org
https://bioinformatics.org/mailman/listinfo/bio_bulletin_board


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.bioinformatics.org/pipermail/bbb/attachments/20050817/7255561d/attachment.html>


More information about the BBB mailing list