MobyLite Perl API

Please note that the MobyLite API uses the bioMOBY Client libraries. So make sure those libraries work with the repositories you want to use.

MobyLite API: Introduction

MobyLite is a Perl API used to call BioMOBY services. It uses the standard biomoby api as an internal engine, but hides most of the protocol to the user. This means that moby datatypes are mapped into perl objects, biomoby services are available as standard perl functions, biomoby exceptions are mapped into perl exceptions, etc.

MobyLite: Download

A Perl API to use BioMOBY services.

Empty version:

Download tarball: MobyLite.tar.gz
Tutorial: See tutorial

Moby-dev version (contains dataTypes ontology and services from Moby-dev repository):

Download tarball: MobyLite_Inab.tar.gz
Tutorial: See tutorial

MobyLite: Installation (Makefile.PL)

  1. Set the environment variables:

    A. BioMOBY repository:

    You can choose the bioMOBY repository you want to you use by setting the environment variables:

    MOBY_SERVER: Repository URL.
    MOBY_URI: Repository URI.

    If these environment variables are not set you will be asked to choose a repository during the installation.

    B. MobyLite directories:

    The MobyLite Perl API generates automatic code and objects. If you want, you can choose the names of the libraries and the directories that will be generated:

    ROOT_PATH: This is the base path for the library. This means that SERVICESLIB and ONTOLOGY_PACKAGE paths will be relateive the the ROOT_PATH. ***
    SERVICESLIB: Directory for the packages that will execute the services. ***
    ONTOLOGY_PACKAGE: Path and name of the ontology package library (the objects library). ***

    *** Important note: If you want to install the MobyLite Perl API like a regular Perl library (usually in the /usr/lib/Perl directory), remember to set the services lib directory and the ontology package in the lib/MOBY/INB/MobyLite directory.


    ROOT_PATH = /home/users/pedra/perl-libs
    SERVICESLIB = MobyLite/Services

  2. This would create the following packages in the '/home/users/pedra/perl-libs' directory:
    Which would be used like this:
    use lib qw(/home/users/pedra/perl-libs);
    use MobyLite::Services::inb_bsc_es
    use MobyLite::Services::Ontology_Package

    If these environment variables are not set the installation will use these default values:

    ROOT_PATH = none
    SERVICESLIB = lib/MOBY/INB/MobyLite/Services

  3. Perl Makefile.PL

    Procceed like a regular application installation:

    $Mydir/MobyLite> Perl Makefile.PL
    Here you will be asked if you want to retrieve the Ontology and Web-Services from a repository. If this is the first time you install the MobyLite Perl API and you haven't done a previous manual installation you should answer 'yes'. This will prepare the automatically generated code from the repository you choose.

    $Mydir/MobyLite> make

    $Mydir/MobyLite> make test
    This is just a simple test, it calls a service to retrieve an aminoacid sequence and checks if the returned sequence is ok. It should work on moby-dev and inab repositories.

    $Mydir/MobyLite> make install ***

  4. *** Only when installing the library in the Perl system libraries.

MobyLite: Installation (manual)

  1. Download an empty version of MobyLite Perl API.
  2. Choose a repository: Set environment variables MOBY_SERVER, MOBY_URI.
  3. Retrieve ontology information:
    $Mydir/MobyLite> perl > MyOntology
  4. Retrieve web services information:
    $Mydir/MobyLite> perl > MyServices
  5. Prepare Perl package wrappers for BioMOBY objects:
    $Mydir/MobyLite> perl MyOntology
  6. Pepares Perl package wrapers for BioMOBY services:
    $Mydir/MobyLite> perl MyServicesLib MyServices
  7. Create HTML Documentation (optional, requires Pod-Tree-1.11):
    $Mydir/MobyLite> perl pods2html dir/MobyLite html_dir/MobyLite --index MobyLite

    For each perl file (.pm or .pl) in "dir/MobyLite", a documentation html file will be created in the "html_dir/MobyLite" directory.

MobyLite: Quick user guide (

  1. Import the service libraries you want to use:
    use inb_bsc_es;
  2. Import the objects package:
    use MyPackage;
  3. Create the input object/s:
    my $uniprotId = Object->new($id 'Uniprot');
  4. Call the Perl function/s:
    my $AASeq = inb_bsc_es::getAminoAcidSequence (
    id => $uniprotId

  5. Print result/s:
    print $AASeq->SequenceString;

Advanced features:
  1. RefreshWSDL parameter:
    All methods have a 'refreshWSDL' parameter ("true"/"false") used to refresh its WSDL. Default is "false".
  2. Error handling:
    Functions might return exceptions and/or warnings. Warnings are printed on the STDERR. Errors are reported using the $@ Perl variable.


use MyPackage; # Package containing data types
use inb_bsc_es; # Package containing services from

my $id = $ARGV[0];
my $uniprotId = Object->new($id,'Uniprot');

# Obtaining sequence from Uniprot, an AminoAcidSequence object is created.
my $AASeq = inb_bsc_es::getAminoAcidSequence (
	id => $uniprotId

# Running Blastp with error handling. A Blast_text object is created.
my $BlastRep;
	$BlastRep = inb_bsc_es::runNCBIBlastp(
		sequence => $AASeq

unless ($@) {
	print $BlastRep->content; # a standard Blast report if no error
} else {
	print "Error: Blast execution failed: $@";