API.pm

- NAME
- SYNOPSIS
- DESCRIPTION
- LICENSE
- FEEDBACK
- AUTHOR - Steve Mathias
- DETAILS
- Imported Packages
- Public Methods

- new
- getDBH
- today
- getTypeByID
- getImportID
- getKwTypesByObjectType
- createCluster
- writeMultiXML
- DESTROY

- Private methods

- _initialize
- _getIDByImportID
- _getOrganismID

# NAME

Genetics::API

# SYNOPSIS

      use Genetics::API ;

      $api = new Genetics::API(DSN => {driver => "mysql",
                                       host => $Host,
                                       database => $Database},
                               user => $UserName,
                               password => $Password) ;

      $sv = $api->getObject({NAME => "Aff"}) ;

      @affSubjects = $api->getSubjectsByPhenotype($sv, 2) ;
      $affCluster = $api->createCluster("HT Affecteds", \@affSubjects) ;
      $api->insertCluster($affCluster) ;
      @unaffSubjects = $api->getSubjectsByPhenotype($sv, 1) ;
      $unaffCluster = $api->createCluster("Normals", \@unaffSubjects) ;
      $api->insertCluster($unaffCluster) ;

      $marker = $api->getObject({TYPE => "Marker", NAME => "agtT174M"}) ;

      $api->chiSquareAssocTest(
                               MARKER => $marker,
                               SC1 => $affCluster,
                               SC2 => $unaffCluster,
                               ALLELETYPE => "Nucleotide",
                              ) ;

See also the GenPerl Tutorial document.

# DESCRIPTION

This module provides an API for interfacing with genperl objects.

An instance of Genetics::API must be instantiated in order to interact with GenPerl objects in a database (or to access any other API methods, for that matter). The parameters passed to the Genetics::API constructor are the database connection parameters. These parameters are passed directly to DBI->connect for the creation of a database handle.

The GenPerl API functionality is separated into the following packages.

The Genetics::API package contains general API methods that do not fit anywhere else right now. This is the only package that needs to be imported into your programs.

Teh Genetics::API::DB::* packages contain methods for managing the persistance of GenPerl objects in a relational database.

The Genetics::API::Analysis package contains methods for the analysis of data contained in GenPerl objects.

# LICENSE

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

# FEEDBACK

Currently, all feedback should be sent directly to the author.

# AUTHOR - Steve Mathias

Email: mathias@genomica.com

Phone: (720) 565-4029

Address: Genomica Corporation 1745 38th Street Boulder, CO 80301

# DETAILS

The rest of the documentation describes each of the object variables and methods. The names of internal variables and methods are preceded with an underscore (_).

# Imported Packages

      strict                Just to be anal
      vars                  Global variables
      Carp                  Error reporting
      DBI                   Database interface
      Genetics::API::Insert
      Genetics::API::Read
      Genetics::API::Update
      Genetics::API::DB::Query ;
      Genetics::API::Delete
      Genetics::API::Analysis  Analysis functions
      Genetics::API::Analysis::Linkage  Linkage analysis functions
      Genetics::Object      GenPerl object modules

# Public Methods

## new

      Function  : Object constructor
      Arguments : Class name and hash array containing initialization arguments.
      Returns   : Blessed hash
      Scope     : Public
      Called by : Main
      Comments  : Creates an empty hash, blesses it into the class name and calls
                  _initialize with the arguments passed

## getDBH

      Function  : Return the DBI database handle associated with an instance
                  of Genetics::API.
      Arguments : Genetics::API instance.
      Returns   : DBI database handle object.
      Scope     : Public
      Called by : Main
      Comments  :

## today

     Function  : Generate a date string, corresponding to the current date-time,
                 suitable for the dateCreated created field.
     Arguments : N/A
     Returns   : String
     Example   : today()
     Scope     : Public class method
     Comments  : The format of the date string generated is YYYY-MM-DD

## getTypeByID

      Function  : Return the object type corresponding to a database ID.
      Arguments : A database id.
      Returns   : 1 on success or undef if an object witht he input id was not
                  successfully deleted.
      Scope     : Public
      Comments  : Only objects saved in a GenPerl database should have an id.

## getImportID

      Function  : Return the ImportID associated with an object.
      Arguments : A Genetics::Object object.
      Returns   : Scalar containing the ImportID associated with the object, or
                  undef if one does not exist.
      Scope     : Public
      Comments  : ImportIDs are stored as Keywords with keywordTypeID 1.  ImportID
                  Keywords are created automatically (by _saveObjectData()) when a
                  new object is created.

## getKwTypesByObjectType

     Function  : For a given object type, return the list of distinct KeywordType
                 names for which there are corresponding Keyword values in the
                 database.
     Arguments : Scalar containing an object type.
     Returns   : Array of scalar text strings.
     Scope     : Public
     Comments  :

## createCluster

      Function  : Create a Genetics::Object::Cluster
      Arguments : A string containing a name for the Cluster and an array
                  reference to a list of Genetics::Object objects.
      Returns   : A Genetics::Object::Cluster object.
      Scope     : Public
      Comments  : This method only creates a Cluster; it does not save it.

## writeMultiXML

      Function  : Write a list of objects out in well-formed GnomML XML format.
      Argument  : Array reference to a list of Genetics::Object objects.
      Returns   : N/A
      Scope     : Public
      Called by :

## DESTROY

      Function  : Deallocate object storage
      Argument  : N/A
      Returns   : N/A
      Scope     : Public
      Called by : Called automatically when the object goes out of scope
                  (ie the internal reference count in the symbol table is
                  zero).  Can be called explicitly.

# Private methods

## _initialize

      Function  : Initialize object
      Arguments : Hash array of attributes/values passed to new
      Returns   : N/A
      Scope     : Private
      Called by :
      Comments  :

## _getIDByImportID

      Function  : Return an Object ID based on an ImportID Keyword.
      Arguments : Scalar containing an ImportID.
      Returns   : Scalar containing an Object ID or undef if one does
                  not exist.
      Scope     : Private
      Comments  : ImportID Keywords are created by _saveObjectData().

## _getOrganismID

      Function  : Return an Organism ID.
      Arguments : Hash reference to a hash containing Organism data.
      Returns   : Scalar containing an Organism ID.
      Scope     : Private
      Called by : saveSubject(), saveMarker(), saveSNP, saveMap(), updateSubject(),
                  updateMarker(), updateSNP, updateMap().
      Comments  : A new Organism is created if one matching the data in %$orgPtr
                  does not exist.