A Perl implementation of an API for accessing data in SRS via web page retrievals via LWP.
Features supported:
For releases see downloads, or for the current state of development see the Subversion repository.
The module can be installed in the standard Perl way:
perl Makefile.PL
make
make test
make install
Alternatively the module can be used directly by adding the lib/ directory to the Perl @INC path.
NB: the SRS version tests depend on the availability of public SRS servers and some properties of the data available through those servers. Thus these tests may fail due to inability to access a server, or due to data changes. Please take care when interpreting failures in these tests. Since public SRS servers have to be used for these tests the test suites for SRS 6.0 and 8.0 are currently set to be skipped, since we know of no public servers running these versions. If you have access to one of these versions you can enable the appropriate tests by editing the corresponding .t file in the t/ directory, setting the server URL, commenting out the server URL check and uncommenting the test count indicator.
The Srs::BasicApi::SrsUrlApi module contains POD mark-up usable with the perldoc documentation reader. To access this documentation either install the module into your Perl installation, or change the current directory to the lib/ directory containing the module, and run the following command:
perldoc Srs::BasicApi::SrsUrlApi
A simple script to get a set of entries from the command-line:
# Load the module
use Srs::BasicApi::SrsUrlApi;
# Usage message
my $usageMsg = "Usage: getEntries.pl <queryStr> [srsUrl]\n";
# Set the defaults
my (%config) = (
'srsUrl' => 'http://srs.ebi.ac.uk/srs/', # EBI
'queryStr' => '',
'htmlMode' => 0, # ASCII, no HTML markup
'viewName' => '', # will default to complete entries
'chunkSize' => 100, # maximum size of a chunk
);
# Process command-line
if(length(@ARGV) > 0) {
# First argument is the query
$config{'queryStr'} = $ARGV[0];
if($ARGV[1] ne '') {
# Second is the URL
$config{'srsUrl'} = $ARGV[1];
}
}
# Check for query
if($config{'queryStr'} eq '') {
die "Error: no query specified\n",$usageMsg;
}
# Create a connection object
my $srsUrlApi = Srs::BasicApi::SrsUrlApi->new();
$srsUrlApi->setSrsUrl($config{'srsUrl'});
# How many entries
my $numEntries = $srsUrlApi->getCount($config{'queryStr'});
# Get in chunks
for(my $i=1; $i<=$numEntries; $i+=$config{'chunkSize'}) {
# Get the chunk as a string
print $srsUrlApi->getEntriesStr($config{'queryStr'},
$config{'htmlMode'},
$config{'viewName'},
$i,
$config{'chunkSize'}
);
}
\t, rs = \n)urlgetz.pl)~/.urlgetz.rc)-f support (requires custom view support)-vf support (requires custom view support)-sf and -af support to control sequence and alignment formats (requires custom view support)-rs and -cs support for table view separators-lv and -lmin support to view index tokens-lb and -ll support for chunking results-info support for databank details-id support to specify a user ID-sort and -sortDir support to specify sorting for a result set