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.
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.
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
perl Makefile.PL PREFIX=/home/me/perl INSTALLDIRS=perl
make
make test
make install
install XML-DOM
This will work on any platform, any Perl version. Run the command:
perl -MCPAN -e shell
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
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.
Each object in CaCORE follows the basic principles of object oriented pattern:
new
method. For example: my $gene = new CaCORE::CaBIO::Gene
;$gene->setSymbol("NAT2")
and $gene->getFullName
getX
(for many-to-one associations)
or getXCollection
(for one-to-many associations) methods. Where "X" is the name of the associated object.
Example: $gene->getTaxon
retrieves the Taxon object associated with the Gene object, since one Taxon
object is associated with many Gene objects, and $gene->getPathwayCollection
retrieves all the Pathway objects associated,
with the Gene object. Since one Gene object is associated with many Pathway objects.Refer to index.html for descirption of CaCORE objects.
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";
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);
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:
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)
my @geneSet = $appsvc->query("CaCORE::CaBIO::Gene", $chromo1, 10, 20);
Currently, in order to control performance, the ApplicationService->search method returns up to 1000 objects by default.
See More Resources for additional sources of information.