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

Chris Fields cjfields at uiuc.edu
Wed May 9 23:37:33 UTC 2007


On May 9, 2007, at 5:12 PM, Ursula at BT wrote:

> 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.

First, prior to using BioPerl you should really brush up on perl  
itself (Learning Perl, or James Tisdall's Perl for Bioinformatics  
books, the former preferred).  Though there are several scripts  
available to get you started with Bioperl, much of the code is  
written with the expectation that you can write and debug a basic  
perl script (and there is some expectation that you are somewhat  
familiar with OO Perl).

Saying that, let's see what's wrong...

> 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();

The 'bionet' format is not supported; only 'withrefm', 'itype2',  
'bairoch' are (the latter only experimentally).  See 'perldoc  
Bio::Restriction::IO'.

> my @enzymes =
> ('AasI','AatI','AccII','AatII','AauI','Acc113I','Acc16I','Acc65I','Acc 
> B1I','
> AccB7I','AccI');
>
>
>
> my $new_collection = Bio::Restriction::EnzymeCollection(-empty => 1);

Missing a new() constructor here.

> foreach $enzyme (all_rebase_collection)

Not sure what this is.  No '$' sigil for $all_rebase_collection will  
make the compiler look for (and fail to find) the sub  
all_rebase_collection().

>
>             {
>
>             $new_collection($enzyme) if grep $_ eq $enzyme->name,  
> @enzymes;
>
>             }
>
>
>
> would work, but I get a syntax error near "$new_collection(".

Yep.  You don't have your grep sub block in brackets {}, hence the  
error.  See 'perldoc -f grep'.

> Any clues much appreciated,
>
>
>
> Ursula Cox

No prob, but again you might want to brush up on perl.

chris




More information about the Bioperl-l mailing list