[Bioperl-l] Getting a Subset of an Existing EnzymeCollection

Ursula at BT ursula_cox at btinternet.com
Wed May 9 22:12:26 UTC 2007


Dear BioPerl List,

 

I'm new to BioPerl (and Perl for that matter). I have an array of enzyme
names, and a larger collection of enzymes (guaranteed to be a superset by
the way it's constructed). I need to make a new collection containing just
the enzymes corresponding to the names I have in the array.

 

I was hoping that something like:

 

my $all_rebase =
Bio::Restriction::IO->new(-file=>'bionet.704',-format=>'bionet');

my $all_rebase_collection = $all_rebase->read();

 

my @enzymes =
('AasI','AatI','AccII','AatII','AauI','Acc113I','Acc16I','Acc65I','AccB1I','
AccB7I','AccI');

 

my $new_collection = Bio::Restriction::EnzymeCollection(-empty => 1);

foreach $enzyme (all_rebase_collection)

            {

            $new_collection($enzyme) if grep $_ eq $enzyme->name, @enzymes;

            }

 

would work, but I get a syntax error near "$new_collection(".

 

Any clues much appreciated,

 

Ursula Cox





More information about the Bioperl-l mailing list