Introduction to AcePerl |
||
|
AcePerl is an excellent Perlmodule which provides access to ACeDB databases, and is written by Lincoln Stein, who also wrote CGI.pm. AcePerl is an object-oriented Perl module, so you
need to be happy with object-oriented Perl to use it. AcePerl can be used
to access ACeDB databases either by contacting an There are two principal types of object in AcePerl, Database handle objects andData objects. Database handle objectsThese are connections to ACeDB databases. A conection
is made with the #!/usr/local/bin/perl -w Data objectsFetching objects from the databaseOnce you have a connection to the ACeDB database,
objects can be retrieved from it using the my $seq = $db->fetch(Sequence => 'bK390B3') Accessing tags in the objectThe object's data tree can be accessed with the
my $author = $seq->at('Origin.From_Author[1]');
This call fetches the tag one hop to the right (specified
by IMPORTANT: Everything is an objectEverything which you get from a database with AcePerl
is an object. These objects automatically convert themselves into a string
when called in a string context (in the print statement above for example).
What actually happens internally is that the This can trap you when you store data retrieved
with AcePerl in your Perl script (in a hash for example), because you can
rapidly run out of memory as you accumulate numbers of large AcePerl objects.
If, for instance, you stored the To store just the string, you need to call my( %seq_authors ); # For storing the author of each sequence Getting lists of tagsCalled in array context, the my @sub_list = $seq->at('Structure.Subsequence[1]');
|
||