[BiO BB] A question about the perl code
Roger Pettett
rmp at sanger.ac.uk
Wed Aug 17 04:30:23 EDT 2005
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/
More information about the BBB
mailing list