Contents

What is CaCOREperl?

CaCOREperl is a Perl application programming interface to caCORE hosted vocabulary, metadata, and biomedical data. It implements the caCORE object model with object-oriented methodology, and encapsulates SOAP::Lite and XML parsing so that programmers deal with caCORE objects directly. CaCOREperl is available in Windows, Solaris and other Perl supported operating systems
CaCOREperl requires Perl version 5.5 or above.
Current version of CaCOREperl is 3.1.

Main Features of CaCOREperl:

The complete CaCOREperl Package contains:

Getting Started

Install Perl

Perl comes installed on Unix and Linux platforms. For window based systems, you can download a Perl version from www.activestate.com.

Install CaCORE and its required Perl modules

This step installs CaCORE and its dependend modules. In addition to the CaCORE itself, CaCOREperl utilizes the XML::DOM module. You must install both CaCORE and XML::DOM.

There are multiple ways to installing Perl modules, the following are three of them.

Using make

First unzip the CaCORE to a temporary folder.Then open a Command window, cd to the directory that contains this README file and type the following.

perl Makefile.PL
Alternatively, if you plan to install CaCORE somewhere other than your system's perl library directory. You can type something like this:
perl Makefile.PL PREFIX=/home/me/perl INSTALLDIRS=perl
Then to build you run make.
make
You can then test the module by typing:
make test
If you have write access to the perl library directories, you may then install by typing:
make install

Using Perl Module Manager (PPM)

This works on Windows platform only. In addition: Then you can start PPM (depends on the version, this can be done through the Start->Programs->ActiveState Perl, or from a command prompt, cd to the \bin, and run ppm). This will bring up a command prompt PPM dialogue. From this dialogue, type in:
install XML-DOM
This will install the XML::DOM module on your PC.

Using CPAN

This will work on any platform, any Perl version. Run the command:

perl -MCPAN -e shell
Refer to the CPAN documentation for more details on how to use this command.

Manual installation

This is only recommened only if all else failed. You can unzip this distribution, and copy the entire CaCORE folder under the lib folder to the lib/site folder in your Perl installation folder. For example, assume that you unzip this distribtion to C:\temp, and your Perl installation is in C:\Perl, you can open a command prompt and type:

copy C:\temp\CaCORE\lib\CaCORE C:\Perl\lib\site

Sample Scripts

You can find sample scripts in the examples folder. This folder contains example code that illustrates actual use of the package.

In the /t/caBIO and /t/caMOD directory of your CaCOREperl install there is also a collection of sample scripts with .pl entension.

CaCORE Object descriptions

Each object in CaCORE follows the basic principles of object oriented pattern:

Refer to index.html for descirption of CaCORE objects.

Search via object associations

Use the getX method to retrieve associated object X with many-to-one relationships.

# search by association: many to one
my $chromo1 = $chromos[0];
print "start chormosome id=" . $chromo1->getId . "\n";
my $taxon = $chromo1->getTaxon;
print "find taxon: id= " . $taxon->getId . " scientificName=" . $taxon->getScientificName ."\n";

Use the getXCollection method to retrieve a list of associated object X with one-to-many relationships.

# test 3: use association: one to many
my @genes = $chromo1->getGeneCollection;
foreach my $gn (@genes) {
print "Gene: id= " . $gn->getId . " symbol=" . $gn->getSymbol . "\n";
}
my $num = $#genes + 1;
print "number of result: " . $num . "\n";

Search via ApplicationService utility

The ApplicationService class exposes two methods: queryObject and query for search. In fact, the get association methods on the domain objects are just wrappers for these methods.

use CaCORE::ApplicationService;
use CaCORE::CaBIO;
my $gene = new CaCORE::CaBIO::Gene;
$gene->setSymbol("NAT2");
my $appsvc = CaCORE::ApplicationService->
instance("http://cabio.nci.nih.gov/cacore30/ws/caCOREService");
my @chromos = $appsvc->queryObject("CaCORE::CaBIO::Chromosome", $gene);

Nested Search

The first parameter in the search method can be constructed as a "navigation path" to the target object. This example retrives all the Taxons related to the Chromosomes that are related to a Gene object:

my @taxons = $appsvc->queryObject("CaCORE::CaBIO::Taxon,CaCORE::CaBIO::Chromosome", $gene);
foreach my $tx (@taxons){
print "id= " . $tx->getId . " scientificName=" . $tx->getScientificName ."\n";
}

Result set control

Depending on the search criteria, a search may yield a large result set, which cause slower response time and increase the likelihood of error. A throttle mechanism is provided by:

ApplicationService->query(targetClassName, knowSourceObject, startingIndex, requestedSize)
For example:
my @geneSet = $appsvc->query("CaCORE::CaBIO::Gene", $chromo1, 10, 20);
This will retrieve related Gene objects from a Chromosome object, the result set starts from index number 10, and contains up to 20 Gene objects.

Currently, in order to control performance, the ApplicationService->search method returns up to 1000 objects by default.

More info

See More Resources for additional sources of information.