Commit 6303f72b authored by cvs2git's avatar cvs2git
Browse files

This commit was manufactured by cvs2svn to create tag 'branch-freeze-july-

branch-point'.

Sprout from master 2000-07-18 14:48:27 UTC Web Admin <w3adm@sanger.ac.uk> 'Added method is_golden to RawContigI.pm'
Delete:
    corba/artemis/INSTALL
    corba/artemis/README
    corba/artemis/artemis-db-mysql.c
    corba/artemis/artemis-db-mysql.h
    corba/artemis/artemis-exon-impl.c
    corba/artemis/artemis-exon-impl.h
    corba/artemis/artemis-mysql-impl.c
    corba/artemis/artemis-mysql-impl.h
    corba/artemis/artemis-qual-helper.c
    corba/artemis/artemis-qual-helper.h
    corba/artemis/artemis.idl
    corba/artemis/ensembl-artemis-client.c
    corba/artemis/ensembl-artemis-server.c
    corba/artemis/makefile
    corba/artemis/test-art-seq-client.c
    corba/artemis/test-artentry-client.c
    corba/artemis/test-artentry-server.c
    corba/artemis/test-artseq-server.c
    corba/popt/CHANGES
    corba/popt/COPYING
    corba/popt/Makefile.am
    corba/popt/Makefile.in
    corba/popt/README
    corba/popt/acconfig.h
    corba/popt/aclocal.m4
    corba/popt/autogen.sh
    corba/popt/config.guess
    corba/popt/config.h.in
    corba/popt/config.sub
    corba/popt/configure
    corba/popt/configure.in
    corba/popt/findme.c
    corba/popt/findme.h
    corba/popt/install-sh
    corba/popt/ltconfig
    corba/popt/ltmain.sh
    corba/popt/missing
    corba/popt/mkinstalldirs
    corba/popt/po/Makefile.in.in
    corba/popt/po/POTFILES.in
    corba/popt/po/popt.pot
    corba/popt/po/ro.po
    corba/popt/po/wa.po
    corba/popt/popt.3
    corba/popt/popt.c
    corba/popt/popt.h
    corba/popt/popt.ps
    corba/popt/poptconfig.c
    corba/popt/popthelp.c
    corba/popt/poptint.h
    corba/popt/poptparse.c
    corba/popt/stamp-h.in
    corba/popt/test1.c
    corba/popt/testit.sh
    corba/seq/bioseq.idl
    corba/seq/ensembl-seq-server.c
    corba/seq/ensembl-seq-server.h
    corba/simpleobjectman/makefile
    corba/simpleobjectman/memwatch.c
    corba/simpleobjectman/memwatch.h
    corba/simpleobjectman/simpleobjectmanager.c
    corba/simpleobjectman/simpleobjectmanager.h
    corba/simpleobjectman/test.c
    corba/simpleobjectman/timetolease-private.h
    corba/simpleobjectman/timetolease.c
    corba/simpleobjectman/timetolease.h
    misc-scripts/fpc/ALLmap
    modules/t/diffdump.t
parent f170af2d
The artemis corba server is a C based orb server which connects to
MySQL on the backend. To make this work, you need a C ORB and MYSQL
development libaries. If you dont have them, these are freely
available and portable to most UNIX systems. Maximum portability is
definitely on linux systems, where this server was developed (redhat
if people are interested). Next up are Solaris, then SGI and finally
Alpha (compiling ORBit on alphas tends to be interesting).
For linux users, and people with a good GNU step up, you may
have all the tools already here. This is generally when you have installed
linux in a "development" mode. For gnu systems, if you have the gnome desktop
compiled on your system, you have a working ORBit ORB already.
To see whether you have orbit or not, go
which orbit-idl
and it should be there if ORBit has been installed
To see whether you have mysql or not go
mysql (you should come up with the mysql prompt. Go quit to get out)
Now look in /usr/include/ - there should be a mysql directory
in there. If not, you need to install mysql client libraries (if you are
installing binary versions, then make sure it is the same version as your
server).
NO WORRIES if you don't have them installed. Generally it is easy to install,
using the standard GNU system of ./configure, make, make install
a) Compiling ORBIT to http://www.gnome.org/ for ORBit
downloads. ORBit itself needs indent (ftp.gnu.org),
gettext(ftp.gnu.org) and glib (ftp.gtk.org). Download the tarballs
for these and go
./configure
make
<become root>
make install.
Do this for indent, gettext and glib first, then orbit.
If you are not root, simply
a) make a directory called /.../somewhere/Icanwriteto/local/
b) go .configure --prefix=/.../somewhere/Icanwriteto/local/
c) make sure your LD_LIBRARY_PATH points to .../local/lib and
your path has .../local/bin so that the libaries are picked up correctly.
At this point, if something is not working, then here is a checklist:
- the correct version of glib - ORBit tends to need an up to date
version of Glib, (1.2 or greater). go glib-config to see what version
you have.
- LD_LIBRARY_PATH needs to be set correctly. It should point somewhere
like /usr/local/lib or whereever the libraries get put
b) Installing MySQL. This is an abbreviated version, as you should
really read the "installing ensembl on mysql" documentation on the web
site. What you need in particular here are the development libaries. MySQL
installs from source fine on most systems, and if this is the case, then
you would have built the development libaries.
Pick up mysql tarball from one of the download sites listed in
www.mysql.org. Compile as usual using ./configure, make, <become root>,
make install. See above for not compiling with root permissions. You then
need to intialise the database by going mysql_install_db, and set root
passwords and some user passwords. Then you need to download the ensembl
test data from ftp.sanger.ac.uk/pub/ensembl/alpha , initialise the database
from the sql/table.sql found in the ensembl source code and load the database.
There is a perl script in the ensembl source code which provides considerable
more hand holding than this description. Check it out at
scripts/install_ensembl.pl.
c) popt libraries.
The ensembl source now bundles the popt command line parsing libaries.
Simple cd into ensembl/corba/popt, go ./configure, and make. The servers
will find these libraries as a relative path from their source directory
d) SimpleObjectManager
The corba standard does not provide any standard as to how to manage objects.
I wrote a simple object manager to provide time-to-lease memory management
and maximum object counts. It is in corba/simpleobjectman. You need to
cd into that directory and type make.
e) Building the servers.
Having built the popt libraries and the simpleobjectmanager, go
orbit-idl artemis.idl
and then
make ensembl-artemis-server
make ensembl-artemis-client
This builds the server and the client. To run the server, go
./ensembl-artemis-server
./ensembl-artemis-server --help gives you options
Try out the client by going
./ensembl-artemis-client
The server writes out the file db.ior which the client reads. Of course, the
server must be running to allow the client to work.
This directory contains the source code to build an artemis
based corba server. It contains the following files:
artemis.idl - the idl for the artemis viewer
Server side main functions:
ensembl-artemis-server - fully operational ensembl artemis server,
really justs build a DB object from artemis-db-mysql
and lets it do the main business.
Needs popt libaries for command line processing
test-artentry-server - builds a object for the artemis entry. Mainly
used for testing and development
test-artseq-server - builds a object for just the sequence. Mainly
used fro testing and development
Server side implementations:
artemis-db-mysql.[ch] - implementation of artemis database. Needs
artemis-mysql-impl, artemis-exon-impl,
artemis-qual-helper to work, and mysql libraries.
artemis-mysql-impl.[ch] Implementation of sequnces, transcripts and
exons objects using artemis. Needs
artemis-exon-impl, artemis-qual-helper, and mysql
libaries
artemis-exon-impl.[ch] In memory implementation of exon objects. Does
not require any mysql database
artemis-qual-helper.[ch] Routines for building qualifier structs for
artemis
Client side programs:
test-artentry-client Client for testing artentries
test-artseq-client Client for testing sequences.
#include "artemis-db-mysql.h"
#include "timetolease.h"
#include <stdio.h>
/*
* This is the implementation specific structure for an
* ensembl-artemis database and the functions around this. Most of
* this file is boiler plate implementation generated by orbit-idl's
* skeleton implementation. The meat of this is held in lower down this file
*
*/
typedef struct
{
POA_Ensembl_artemis_DB servant;
PortableServer_POA poa;
MYSQL * connection; /* connection to the ensembl database */
int verbose; /* talk to stderr or not? */
SimpleObjectManagerAdaptor soma;
} impl_POA_Ensembl_artemis_DB;
static void impl_Ensembl_artemis_DB__destroy(impl_POA_Ensembl_artemis_DB *
servant, CORBA_Environment * ev);
static Ensembl_artemis_Entry
impl_Ensembl_artemis_DB_getEntry(impl_POA_Ensembl_artemis_DB * servant,
CORBA_char * entryname,
CORBA_Environment * ev);
static Ensembl_artemis_EntryNameList
*impl_Ensembl_artemis_DB_getallEntryNames(impl_POA_Ensembl_artemis_DB *
servant, CORBA_Environment * ev);
static Ensembl_artemis_FeatureDefinitionList
*impl_Ensembl_artemis_DB_getFeatureDefinitionList
(impl_POA_Ensembl_artemis_DB * servant, CORBA_Environment * ev);
static CORBA_long
impl_Ensembl_artemis_DB_max_sequence_length(impl_POA_Ensembl_artemis_DB *
servant, CORBA_Environment * ev);
static PortableServer_ServantBase__epv impl_Ensembl_artemis_DB_base_epv = {
NULL, /* _private data */
NULL, /* finalize routine */
NULL, /* default_POA routine */
};
static POA_Ensembl_artemis_DB__epv impl_Ensembl_artemis_DB_epv = {
NULL, /* _private */
(gpointer) & impl_Ensembl_artemis_DB_getEntry,
(gpointer) & impl_Ensembl_artemis_DB_getallEntryNames,
(gpointer) & impl_Ensembl_artemis_DB_getFeatureDefinitionList,
};
/*** vepv structures ***/
static POA_Ensembl_artemis_DB__vepv impl_Ensembl_artemis_DB_vepv = {
&impl_Ensembl_artemis_DB_base_epv,
&impl_Ensembl_artemis_DB_epv,
};
/*** Stub implementations ***/
static Ensembl_artemis_DB
impl_Ensembl_artemis_DB__create(PortableServer_POA poa,
CORBA_Environment * ev)
{
Ensembl_artemis_DB retval;
impl_POA_Ensembl_artemis_DB *newservant;
PortableServer_ObjectId *objid;
newservant = g_new0(impl_POA_Ensembl_artemis_DB, 1);
newservant->servant.vepv = &impl_Ensembl_artemis_DB_vepv;
newservant->poa = poa;
POA_Ensembl_artemis_DB__init((PortableServer_Servant) newservant, ev);
objid = PortableServer_POA_activate_object(poa, newservant, ev);
CORBA_free(objid);
retval = PortableServer_POA_servant_to_reference(poa, newservant, ev);
return retval;
}
/*** INTERESTING STUFF from now on ***/
/*
* This is the only publically visible function. It builds a new
* implementation, registers it with the ORB and gives back the object
* reference to the caller, which can do what it likes with it ;)
*/
Ensembl_artemis_DB new_EA_Database(PortableServer_POA poa,MYSQL * connection,int verbose,SimpleObjectManagerAdaptor soma,CORBA_Environment * ev)
{
Ensembl_artemis_DB retval;
impl_POA_Ensembl_artemis_DB *newservant;
PortableServer_ObjectId *objid;
g_assert(connection);
fprintf(stderr,"Going to build db object\n");
newservant = g_new0(impl_POA_Ensembl_artemis_DB, 1);
newservant->servant.vepv = &impl_Ensembl_artemis_DB_vepv;
newservant->poa = poa;
newservant->connection = connection;
newservant->verbose = verbose;
newservant->soma = soma;
POA_Ensembl_artemis_DB__init((PortableServer_Servant) newservant, ev);
objid = PortableServer_POA_activate_object(poa, newservant, ev);
CORBA_free(objid);
retval = PortableServer_POA_servant_to_reference(poa, newservant, ev);
if( newservant->verbose ) {
fprintf(stderr,"DB: Making a new database with verbose flag set\n");
}
return retval;
}
static void
impl_Ensembl_artemis_DB__destroy(impl_POA_Ensembl_artemis_DB * servant,
CORBA_Environment * ev)
{
PortableServer_ObjectId *objid;
objid = PortableServer_POA_servant_to_id(servant->poa, servant, ev);
PortableServer_POA_deactivate_object(servant->poa, objid, ev);
CORBA_free(objid);
POA_Ensembl_artemis_DB__fini((PortableServer_Servant) servant, ev);
g_free(servant);
}
/*
* This function delegates all its hard work to the
* new_Ensembl_artemis_Entry function in the artemis-mysql-impl.c
* function. That is where the bulk of the processing occurs
*/
static Ensembl_artemis_Entry
impl_Ensembl_artemis_DB_getEntry(impl_POA_Ensembl_artemis_DB * servant,
CORBA_char * entryname,
CORBA_Environment * ev)
{
Ensembl_artemis_Entry retval;
char sqlbuffer[1024];
MYSQL_RES * result;
MYSQL_ROW row;
int state;
retval = new_Ensembl_artemis_Entry(servant->poa,servant->connection,g_strdup(entryname),servant->soma,ev);
if ((ev)->_major != CORBA_NO_EXCEPTION ) {
return;
}
SimpleObjectManagerAdaptor_log_message(&servant->soma,0,"Made new entry with entryname %s\n",entryname);
/* show_alloc_blocks(stderr);*/
return retval;
}
/*
* Pretty simply loop over all entries in the clone table
*/
static Ensembl_artemis_EntryNameList *
impl_Ensembl_artemis_DB_getallEntryNames(impl_POA_Ensembl_artemis_DB *
servant, CORBA_Environment * ev)
{
Ensembl_artemis_EntryNameList *retval;
char sqlbuffer[1024];
MYSQL_RES * result;
MYSQL_ROW row;
int state;
int no,i;
sprintf(sqlbuffer,"SELECT id from contig");
state = mysql_query(servant->connection,sqlbuffer);
result = mysql_store_result(servant->connection);
no = mysql_num_rows(result);
retval = CORBA_sequence_CORBA_string__alloc();
retval->_buffer = (CORBA_char **) calloc(no,sizeof(CORBA_char *));
retval->_length = no;
retval->_maximum = no;
i = 0;
while( row= mysql_fetch_row(result) ) {
retval->_buffer[i++] = CORBA_string_dup(row[0]);
}
return retval;
}
static Ensembl_artemis_FeatureDefinitionList *
impl_Ensembl_artemis_DB_getFeatureDefinitionList(impl_POA_Ensembl_artemis_DB *
servant,
CORBA_Environment * ev)
{
Ensembl_artemis_FeatureDefinitionList *retval;
retval = CORBA_sequence_Ensembl_artemis_FeatureDefinition__alloc();
retval->_buffer = CORBA_sequence_Ensembl_artemis_FeatureDefinition_allocbuf(2);
retval->_length = 2;
retval->_maximum = 2;
retval->_buffer[0].key = CORBA_string_dup("exon");
retval->_buffer[0].qualifiers._buffer = CORBA_sequence_CORBA_string_allocbuf(3);
retval->_buffer[0].qualifiers._length = 3;
retval->_buffer[0].qualifiers._maximum = 3;
retval->_buffer[0].qualifiers._buffer[0] = CORBA_string_dup("created");
retval->_buffer[0].qualifiers._buffer[1] = CORBA_string_dup("modified");
retval->_buffer[0].qualifiers._buffer[2] = CORBA_string_dup("exon_id");
retval->_buffer[0].key = CORBA_string_dup("mRNA");
retval->_buffer[0].qualifiers._buffer = CORBA_sequence_CORBA_string_allocbuf(1);
retval->_buffer[0].qualifiers._length = 1;
retval->_buffer[0].qualifiers._maximum = 1;
retval->_buffer[0].qualifiers._buffer[0] = CORBA_string_dup("transcript_id");
return retval;
}
#ifndef ARTEMIS_DB_HEADER
#define ARTEMIS_DB_HEADER
#include "artemis-mysql-impl.h"
Ensembl_artemis_DB new_EA_Database(PortableServer_POA poa,MYSQL * connection,int verbose,SimpleObjectManagerAdaptor soma,CORBA_Environment * ev);
#endif
#include "artemis-exon-impl.h"
/*** App-specific servant structures ***/
typedef struct
{
POA_Ensembl_artemis_Feature servant;
PortableServer_POA poa;
SimpleObjectManagerAdaptor soma;
int start;
int end;
int strand;
char * created;
char * modified;
char * id;
int start_phase;
}
impl_POA_Ensembl_artemis_Feature;
/*** Implementation stub prototypes ***/
static void
impl_Ensembl_artemis_Feature__destroy(impl_POA_Ensembl_artemis_Feature *
servant, CORBA_Environment * ev);
static CORBA_char
*impl_Ensembl_artemis_Feature_getKey(impl_POA_Ensembl_artemis_Feature *
servant, CORBA_Environment * ev);
static CORBA_char
*impl_Ensembl_artemis_Feature_getLocation(impl_POA_Ensembl_artemis_Feature
* servant,
CORBA_Environment * ev);
static Ensembl_artemis_QualifierList
*impl_Ensembl_artemis_Feature_getQualifiers
(impl_POA_Ensembl_artemis_Feature * servant, CORBA_Environment * ev);
/*** epv structures ***/
static PortableServer_ServantBase__epv impl_Ensembl_artemis_Feature_base_epv = {
NULL, /* _private data */
NULL, /* finalize routine */
NULL, /* default_POA routine */
};
static POA_Ensembl_artemis_Feature__epv impl_Ensembl_artemis_Feature_epv = {
NULL, /* _private */
(gpointer) & impl_Ensembl_artemis_Feature_getKey,
(gpointer) & impl_Ensembl_artemis_Feature_getLocation,
(gpointer) & impl_Ensembl_artemis_Feature_getQualifiers,
};
/*** vepv structures ***/
static POA_Ensembl_artemis_Feature__vepv impl_Ensembl_artemis_Feature_vepv = {
&impl_Ensembl_artemis_Feature_base_epv,
&impl_Ensembl_artemis_Feature_epv,
};
/*** Stub implementations ***/
static Ensembl_artemis_Feature
impl_Ensembl_artemis_Feature__create(PortableServer_POA poa,
CORBA_Environment * ev)
{
Ensembl_artemis_Feature retval;
impl_POA_Ensembl_artemis_Feature *newservant;
PortableServer_ObjectId *objid;
newservant = g_new0(impl_POA_Ensembl_artemis_Feature, 1);
newservant->servant.vepv = &impl_Ensembl_artemis_Feature_vepv;
newservant->poa = poa;
POA_Ensembl_artemis_Feature__init((PortableServer_Servant) newservant, ev);
objid = PortableServer_POA_activate_object(poa, newservant, ev);
CORBA_free(objid);
retval = PortableServer_POA_servant_to_reference(poa, newservant, ev);
return retval;
}
static int remove_EA_Exon_func(gpointer data)
{
impl_POA_Ensembl_artemis_Feature * serv;
serv = (impl_POA_Ensembl_artemis_Feature *) data;
SimpleObjectManagerAdaptor_log_message(&serv->soma,G_LOG_LEVEL_MESSAGE,"Removing exon %s",serv->id);
impl_Ensembl_artemis_Feature__destroy(serv,serv->soma.ev);
return 0;
}
Ensembl_artemis_Feature new_EA_Exon_Feature(PortableServer_POA poa,const char * id,const char * created,const char * modified,int start,int end,int strand,int phase,SimpleObjectManagerAdaptor soma,CORBA_Environment *ev)
{
Ensembl_artemis_Feature retval;
impl_POA_Ensembl_artemis_Feature *newservant;
PortableServer_ObjectId *objid;
newservant = g_new0(impl_POA_Ensembl_artemis_Feature, 1);
newservant->servant.vepv = &impl_Ensembl_artemis_Feature_vepv;
newservant->poa = poa;
newservant->id = g_strdup(id);
newservant->created = g_strdup(created);
newservant->modified = g_strdup(modified);
newservant->start = start;
newservant->end = end;
newservant->start_phase = phase;
newservant->strand = strand;
newservant->soma = soma;
POA_Ensembl_artemis_Feature__init((PortableServer_Servant) newservant, ev);
objid = PortableServer_POA_activate_object(poa, newservant, ev);
CORBA_free(objid);
SimpleObjectManagerAdaptor_activate(&newservant->soma,"EAFeatureE",id,retval,(gpointer)newservant,remove_EA_Exon_func);
retval = PortableServer_POA_servant_to_reference(poa, newservant, ev);
return retval;
}
static void
impl_Ensembl_artemis_Feature__destroy(impl_POA_Ensembl_artemis_Feature *
servant, CORBA_Environment * ev)
{
PortableServer_ObjectId *objid;
objid = PortableServer_POA_servant_to_id(servant->poa, servant, ev);
PortableServer_POA_deactivate_object(servant->poa, objid, ev);
CORBA_free(objid);
g_free(servant->id);
g_free(servant->modified);
g_free(servant->created);
POA_Ensembl_artemis_Feature__fini((PortableServer_Servant) servant, ev);
g_free(servant);
}
static CORBA_char *
impl_Ensembl_artemis_Feature_getKey(impl_POA_Ensembl_artemis_Feature *
servant, CORBA_Environment * ev)
{
CORBA_char *retval;
retval = CORBA_string_dup("exon");
return retval;
}
static CORBA_char *
impl_Ensembl_artemis_Feature_getLocation(impl_POA_Ensembl_artemis_Feature *
servant, CORBA_Environment * ev)
{
CORBA_char *retval;
char buffer[1024];
if( servant->strand == 1 ) {
sprintf(buffer,"%d..%d",servant->start,servant->end);
} else {
sprintf(buffer,"complement(%d..%d)",servant->start,servant->end);
}
retval = CORBA_string_dup(buffer);
return retval;
}
static Ensembl_artemis_QualifierList *
impl_Ensembl_artemis_Feature_getQualifiers(impl_POA_Ensembl_artemis_Feature *
servant, CORBA_Environment * ev)
{
Ensembl_artemis_QualifierList *retval;
retval = CORBA_sequence_Ensembl_artemis_Qualifier__alloc();
retval->_buffer = CORBA_sequence_Ensembl_artemis_Qualifier_allocbuf (3);
retval->_buffer[0] = new_EA_Qualifier("created",servant->created);
retval->_buffer[1] = new_EA_Qualifier("modified",servant->modified);
retval->_buffer[2] = new_EA_Qualifier("exon_id",servant->id);
retval->_length = 3;
retval->_maximum = 3;
/*retval->_buffer[3] = new_EA_Qualifier("exon_id",servant->id);*/
CORBA_sequence_set_release(retval,1);
return retval;
}
#ifndef ARTEMIS_EXON_IMPL_HEADER
#define ARTEMIS_EXON_IMPL_HEADER
#include "artemis.h"
#include "artemis-qual-helper.h"
#include "simpleobjectmanager.h"
Ensembl_artemis_Feature new_EA_Exon_Feature(PortableServer_POA poa,const char * id,const char * created,const char * modified,int start,int end,int strand,int phase,SimpleObjectManagerAdaptor soma,CORBA_Environment *ev);
#endif
</