ORegAnno records can be access programmatically via "Web Services". Two methods are currently provided using "Web Services":
- getSearchFields()
- searchRecords(String search_field, String query)
getSearchFields() provides the searchable fields like "all", "stable_id", "tfGene", etc.
searchRecords(String search_field, String query) searches using a search field and a query string for records in the ORegAnno database (returns a String array).
fetchRecord(String record_stable_id) fetches the record data from ORegAnno for a stable id.
Several Web Services for Genomic mappings are listed at the bottom of this page.
Using
SOAP::Lite modules. You can access all the records in the database with the following script.
#!/usr/bin/perl
use strict;
use Data::Dumper;
use SOAP::Lite;
my $osa = SOAP::Lite
-> uri('OregannoServerImpl')
-> proxy('http://www.oreganno.org/oregano/soap/');
my $response = $osa->searchRecords(
SOAP::Data->name(field => SOAP::Data->type(string => "all")),
SOAP::Data->name(query => SOAP::Data->type(string => "OREG*")));
if ($response->fault) {
die $response->faultstring;
} else {
my @results = @{$response->result};
foreach my $result (@results) {
my $response2 = $osa->fetchRecord(SOAP::Data->name(record_stable_id => SOAP::Data->type(string => "$result")));
if ($response2->fault) {
die $response2->faultstring;
} else {
my $record = $response2->result;
print Dumper $record;
}
}
}
In this example, we are pointing towards the server at www.oreganno.org and running the method
searchRecords using the
stable_id field
and the query
OREG*. This returns the stable id of all the records in the ORegAnno database (
NOTE: This query takes a while, and may timeout your SOAP connection. If a timeout occurs, use the modified statement:
my $osa = SOAP::Lite
-> uri('OregannoServerImpl')
-> proxy('http://www.oreganno.org/oregano/soap/', timeout => 1000);
The return stable ids are stored in a String array. For each stable id, fetchRecord is called to retrieve the record
data. Results from this call are stored in a hash. To access the type field of each record, we could use the statement
$result->{'record'}->{'type'};
NOTE: All modules are part of Perl 5.8. Test this example using perl58.
getQueueSearchFields() provides the searchable fields like "all", "abstract", etc.
searchQueue( String search_field_restriction,
String search_query_restriction,
String user_restriction,
String state_restriction,
String evidence_restriction,
String tf_type_restriction,
String score_restriction) Searches the publication queue and returns a String array of matching PubMED ids.
fetchQueuedPublication(String pubmed_id) Returns the queue record for a particular PubMED id.
Here is an example of a script which checks to see if a list of pubmed ids are PENDING in the queue.
#!/usr/bin/perl
use strict;
use SOAP::Lite;
my $osa = SOAP::Lite
-> uri('OregannoServerImpl')
-> proxy('http://www.oreganno.org/oregano/soap/');
my $file = @ARGV[0]; ##A file with a pmid on each line
if (!defined($file)) { die "No input file has been defined as argument 1"; }
open(FILE, $file) || die ("Cannot open file: $file");
while (my $line = ) {
chomp($line);
if ($line =~ /[0-9]+/g) {
my $pmid = $line;
my $response = $osa->fetchQueuedPublication(
SOAP::Data->name(pubmed_id => SOAP::Data->type(string => "$pmid")));
if ($response->fault) {
die $response->faultstring;
} else {
my $publication = $response->result;
my $state = $publication->{'queuedPublication'}->{'currentQueuedPublicationState'}->{'state'};
if ($state eq "PENDING") {
print $pmid . "\n";
} else {
print STDERR "Ignoring $pmid\n";
}
}
} else {
close(FILE);
die("Line does not contain a PMID: " . $line);
}
}
close (FILE);
If you experience any problems with these services, please drop us a line.