view release on metacpan or search on metacpan
time. See L<Cache::SizeAwareFileCache> for more details.
=item B<-program>
By default AcePerl will use its internal compiled code calls to
establish a connection to Ace servers, and will launch a I<tace>
subprocess to communicate with local Ace databases. The B<-program>
argument allows you to customize this behavior by forcing AcePerl to
use a local program to communicate with the database. This argument
should point to an executable on your system. You may use either a
complete path or a bare command name, in which case the PATH
environment variable will be consulted. For example, you could force
AcePerl to use the I<aceclient> program to connect to the remote host
by connecting this way:
$db = Ace->connect(-host => 'beta.crbm.cnrs-mop.fr',
-port => 20000100,
-program=>'aceclient');
=item B<-classmapper>
Create a new object in the database with the indicated class and name
and return a pointer to it. Will return undef if the object already
exists in the database. The object isn't actually written into the database
until you call Ace::Object::commit().
=head2 raw_query() method
$r = $db->raw_query('Model');
Send a command to the database and return its unprocessed output.
This method is necessary to gain access to features that are not yet
implemented in this module, such as model browsing and complex
queries.
=head2 classes() method
@classes = $db->classes();
@all_classes = $db->classes(1);
This method returns a list of all the object classes known to the
with a true value. You can retrieve the current value of the setting
by calling the method with no arguments.
Note that activating timestamps disables some of the speed
optimizations in AcePerl. Thus they should only be activated if you
really need the information.
=head2 auto_save()
Sets or queries the I<auto_save> variable. If true, the "save"
command will be issued automatically before the connection to the
database is severed. The default is true.
Examples:
$db->auto_save(1);
$flag = $db->auto_save;
=head2 error() method
Ace->error;
Ace/Local.pm view on Meta::CPAN
read() operations, and indicates that there is more data to read.
B<encore()> is functionally equivalent to:
$encore = $accessor->status == STATUS_PENDING;
In fact, this is how it's implemented.
=head2 auto_save()
Sets or queries the I<auto_save> variable. If true, the "save"
command will be issued automatically before the connection to the
database is severed. The default is true.
Examples:
$accessor->auto_save(1);
$flag = $accessor->auto_save;
=head1 SEE ALSO
L<Ace>, L<Ace::Object>, L<Ace::Iterator>, L<Ace::Model>
Ace/Object.pm view on Meta::CPAN
$fax_no = $object->get('Fax',2);
--> undef # nothing beyond the fax number
@address = $object->get('Address',2);
--> ('CRBM duCNRS','BP 5051','34033 Montpellier','FRANCE',
'mieg@kaa.cnrs-mop.fr,'33-67-613324','33-67-521559')
It is important to note that B<get()> only traverses tags. It will
not traverse nodes that aren't tags, such as strings, integers or
objects. This is in keeping with the behavior of the Ace query
language "show" command.
This restriction can lead to confusing results. For example, consider
the following object:
Clone: B0280 Position Map Sequence-III Ends Left 3569
Right 3585
Pmap ctg377 -1040 -1024
Positive Positive_locus nhr-10
Sequence B0280
Location RW
Ace/Object.pm view on Meta::CPAN
$^A = '';
foreach (@lines) {
my @data = split("\t");
push(@data,('')x(@max-@data));
formline ($format1,@data);
formline ($format2,@data);
}
return ($result = $^A,$^A='')[0];
}
# run a series of GIF commands and return the Gif and the semi-parsed
# "boxes" structure. Commands is typically a series of mouseclicks
# ($gif,$boxes) = $aceObject->asGif(-clicks=>[[$x1,$y1],[$x2,$y2]...],
# -dimensions=>[$x,$y]);
sub asGif {
my $self = shift;
my ($clicks,$dimensions,$display,$view,$coords,$getcoords) = rearrange(['CLICKS',
['DIMENSIONS','DIM'],
'DISPLAY',
'VIEW',
'COORDS',
'GETCOORDS',
],@_);
$display = "-D $display" if $display;
$view = "-view $view" if $view;
my $c;
if ($coords) {
$c = ref($coords) ? "-coords @$coords" : "-coords $coords";
}
my @commands;
if ($view || $c || $self->class =~ /Map/i) {
@commands = "gif map \"@{[$self->name]}\" $view $c";
} else {
@commands = "gif display $display $view @{[$self->class]} \"@{[$self->name]}\"";
}
push(@commands,"Dimensions @$dimensions") if ref($dimensions);
push(@commands,map { "mouseclick @{$_}" } @$clicks) if ref($clicks);
if ($getcoords) { # just want the coordinates
my ($start,$stop);
my $data = $self->db->raw_query(join(' ; ',@commands));
return unless $data =~ /\"[^\"]+\" ([\d.-]+) ([\d.-]+)/;
($start,$stop) = ($1,$2);
return ($start,$stop);
}
push(@commands,"gifdump -");
# do the query
my $data = $self->db->raw_query(join(' ; ',@commands));
# A $' has been removed here to improve speed -- tim.cutts@incyte.com 2 Sep 1999
# did this query succeed?
my ($bytes, $trim);
return unless ($bytes, $trim) = $data=~m!^// (\d+) bytes\n\0*(.+)!sm;
my $gif = substr($trim,0,$bytes);
# now process the boxes
Ace/Sequence.pm view on Meta::CPAN
my $self = shift;
my ($opt,$db) = @_;
my $data = $self->_query("seqfeatures -version 2 $opt",$db);
$data =~ s/\0+\Z//;
return $data; #blasted nulls!
}
# shortcut for running a gif query
sub _query {
my $self = shift;
my $command = shift;
my $db = shift || $self->db;
my $parent = $self->parent;
my $start = $self->start(1);
my $end = $self->end(1);
($start,$end) = ($end,$start) if $start > $end; #flippity floppity
my $coord = "-coords $start $end";
# BAD BAD HACK ALERT - CHECKS THE QUERY THAT IS PASSED DOWN
# ALSO MAKES THINGS INCOMPATIBLE WITH PRIOR 4.9 servers.
# my $opt = $command =~ /seqfeatures/ ? '-nodna' : '';
my $opt = '-noclip';
my $query = "gif seqget $parent $opt $coord ; $command";
warn $query if $self->debug;
return $db->raw_query("gif seqget $parent $opt $coord ; $command");
}
# utility function -- reverse complement
sub _complement {
my $dna = shift;
$$dna =~ tr/GATCgatc/CTAGctag/;
$$dna = scalar reverse $$dna;
}
sub _feature_filter {
To take full advantage of the sequence annotation features in the
Ace::Sequence and Ace::Sequence::Feature classes, you will need
version 4.9r or higher.
If you wish to use AcePerl in a client-server fashion, you must get
sgifaceserver up and running. Some hints on installing the
sgifaceserver application are given later in this README.
Follow these steps to unpack, build and install AcePerl:
1. Unpack the AcePerl distribution with this command:
gunzip -c AcePerl-X.XX.tar.gz | tar xvf -
Replace X.XX with the current version number of AcePerl.
2. cd AcePerl-X.XX
3. perl Makefile.PL
This script will ask you whether you wish to build: (1) the minimal package
At this point, Makefile.PL will create the make files necessary to build
AcePerl. Among other things, the Makefile.PL script will attempt
to guess the type of your machine and its operating system. This information
is needed to select the correct makefile in the ACEDB library
directory, AcePerl-X.XX/ace/.
If AcePerl fails to make correctly later in the process, it may be
because the script guessed wrong. You can override this guess by
setting the machine type using the ACEDB_MACHINE environment
variable. On a C-shell or TC-shell machine, use a command like
this one:
setenv ACEDB_MACHINE ALPHA_4_GCC; perl Makefile.PL
On a Bourne-shell or Korn-shell system, use:
ACEDB_MACHINE=ALPHA_4_GCC; export ACEDB_MACHINE
perl Makefile.PL
You can find a list of machine definitions in
4. make
This will build the ACEDB client library, libaceperl.a, in the ace
subdirectory. It will then link in the Perl client subs.
5. make test (optional)
You may "make test" to test the system. It will attempt to open a
connection to a database at beta.crbm.cnrs-mop.fr:20000100. You may
change these defaults by setting the environment variables ACEDB_HOST
and ACEDB_PORT, or by defining them on the command line, as in:
make test ACEDB_HOST=localhost ACEDB_PORT=200005
However, since some of the tests are dependent on specific values in
the database, this may cause some tests to fail. Do not be alarmed if
a handful of tests fail. Do be alarmed if all of the tests fail.
6. make install
This will install AcePerl into your perl5 library directory.
A. Read the copious documentation
perldoc Ace
B. Review the examples
A few useful examples can be found in the "examples" subdirectory.
Among these is a script called "ace.pl", which implements a text
interface to any local or remote ace database. If you have the Perl
Term::readline module installed, it gives you command-line editing,
completion, and history.
The script "dump_cdna.pl" shows you how to dump out all spliced cDNAs
from wormbase.org. Other dump scripts show similar tricks. You can
use these as templates for doing other biologically interesting
tricks.
There is also family of CGI scripts that run on top of AcePerl to give
a WebAce-like interface to Ace (it is not as feature-full as WebAce,
but it is probably easier to set up and run). This package is now part
README.ACEBROWSER view on Meta::CPAN
If you are only interested in accessing a single database, it is
easiest to modify the default.pm configuration file. To serve
multiple databases, just make a copy of default.pm and edit the copy.
If, for some reason, Acebrowser cannot find its configuration files,
it will generate an internal server error. The location of the
configuration files directory is stored in the module
Ace::Browser::LocalSiteDefs, typically somewhere inside the
"site_perl" subdirectory of the Perl library directory (use "perl -V"
to see where that is). You can find out where Acebrowser expects to
find its configuration files by running the following command:
perl -MAce::Browser::LocalSiteDefs \
-e 'print $Ace::Browser::LocalSiteDefs::SITE_DEFS,"\n"'
To change this value, either reinstall Aceperl or edit
LocalSiteDefs.pm manually.
EDITING THE CONFIGURATION FILE
The settings in the default.pm configuration file distributed with
README.ACEBROWSER view on Meta::CPAN
displays that are appropriate for a class, you can bind them all to
the class in the following fashion:
NewObject => ['newdisplay','newerdisplay','newestdisplay'],
When creating a link for an Acedb object, Acebrowser will choose the
first display in the array. When the object is displayed, all three
of the alternative displays will appear in the type selector.
More information on writing display scripts can be found in the
documentation for Ace::Browser::AceSubs. From the command line, run:
perldoc Ace::Browser::AceSubs
Writing New Searches
--------------------
To create a new search,
1. Write a script following the model of one of the existing scripts.
Ace::Browser::SearchSubs exports subroutines that are useful in
managing the multiple pages of results produced by most search
scripts.
2. Register the new script in the @SEARCHES array. Provide an
explanatory name for the search script, and a pointer to its URL.
More information on writing search scripts can be found in the
documentation for Ace::Browser::SearchSubs. From the command line, run:
perldoc Ace::Browser::SearchSubs
FOR HELP
Please write to the Acedb newsgroup, acedb@sanger.ac.uk for help or to
report possible bugs. If you get really stuck, write to the author,
lstein@cshl.org.
Lincoln D. Stein
acelib/aceclientlib.c view on Meta::CPAN
unsigned char *answer, *loop ;
int aceError, length, i, encore = 0 ;
/* generate question structure */
question.clientId = handle->clientId;
question.magic = handle->magic;
question.reponse.reponse_len = 0;
question.reponse.reponse_val = "";
question.kBytes = chunkSize;
question.aceError = 0;
/* check if request contains a local command */
if (!strncasecmp(request,"encore",6))
{
/* encore request */
question.encore = WANT_ENCORE;
question.question = "";
}
else if (!strncasecmp(request,"noencore",8))
{
/* encore request */
question.encore = DROP_ENCORE;
acelib/arraysub.c view on Meta::CPAN
return 0 ; /* JTM, so while stackNextText makes sense */
while (*s->pos++) ;
if (!s->textOnly)
while ((long)s->pos % STACK_ALIGNMENT)
++s->pos ;
return text ;
}
/*********/
/* Push text in stack s, after breaking it on delimiters */
/* You can later access the tokens with command
while (token = stackNextText(s)) work on your tokens ;
*/
void stackTokeniseTextOn(Stack s, char *text, char *delimiters)
{
char *cp, *cq , *cend, *cd, old, oldend ;
int i, n ;
if(!stackExists(s) || !text || !delimiters)
messcrash("stackTextOn received some null parameter") ;
acelib/call.c view on Meta::CPAN
}
return FALSE ;
}
/***************** routines to run external programs *******************/
/* ALL calls to system() and popen() should be through these routines
** First, this makes it easier for the Macintosh to handle them.
** Second, by using wscripts as an intermediate one can remove system
** dependency in the name, and even output style, of commands.
** Third, if not running in ACEDB it does not look for wscripts...
*/
static char *buildCommand (char *dir, char *script, char *args)
{
static Stack command = 0 ;
/*#ifdef ACEDB*/ /* until we resolve this bit, we have to include wscripts bit even ifndef ACEDB */
char *cp ;
static Stack s = 0 ; /* don't use messprintf() - often used to make args */
s = stackReCreate (s, 32) ;
if (!dir)
{
catText (s, "wscripts/") ;
catText (s, script) ;
if ((cp = filName (stackText (s, 0), 0, "x")))
script = cp ; /* mieg else fall back on direct unix call */
}
/*#endif*/
command = stackReCreate (command, 128) ;
if (dir)
{ catText (command, "cd ") ;
catText (command, dir) ;
catText (command, "; ") ;
}
catText (command, script) ;
if (args)
{ catText (command, " ") ;
catText (command, args) ;
}
return stackText (command, 0) ;
}
int callCdScript (char *dir, char *script, char *args)
{
#if !defined(MACINTOSH)
return system (buildCommand (dir, script, args)) ;
#else
return -1 ;
#endif
}
int callScript (char *script, char *args)
{
return callCdScript (0, script, args) ;
}
FILE* callCdScriptPipe (char *dir, char *script, char *args)
{
char *command = buildCommand (dir, script, args) ;
FILE *pipe ;
int peek ;
#if !(defined(MACINTOSH) || defined(WIN32))
pipe = popen (command, "r" ) ;
#elif defined(WIN32)
pipe = _popen (command, "rt") ;
#else /* defined(MACINTOSH) */
return 0 ;
#endif /* defined(MACINTOSH) */
peek = fgetc (pipe) ; /* first char from popen on DEC
seems often to be -1 == EOF!!!
*/
if (isprint(peek)) ungetc (peek, pipe) ;
#ifdef DEBUG
printf ("First char on callCdScriptPipe is %c (0x%x)\n", peek, peek) ;
acelib/filsubs.c view on Meta::CPAN
/* This function returns the filename part of a given path, */
/* */
/* Given "/some/load/of/directories/filename" returns "filename" */
/* */
/* The function returns NULL for the following errors: */
/* */
/* 1) supplying a NULL ptr as the path */
/* 2) supplying "" as the path */
/* 3) supplying a path that ends in "/" */
/* */
/* NOTE, this function is _NOT_ the same as the UNIX basename command or the */
/* XPG4_UNIX basename() function which do different things. */
/* */
/* The function makes a copy of the supplied path on which to work, this */
/* copy is thrown away each time the function is called. */
/* */
/*****************************************************************************/
UTIL_FUNC_DEF char *filGetFilename(char *path)
{
static char *path_copy = NULL ;
acelib/freesubs.c view on Meta::CPAN
*in = _FREECHAR ;
lao:
if (special[((int) *in) & 0xFF] && *in != '$' && *in != '@' )
switch (*in)
{
#if defined(WIN32)
case '\r':
continue ; /* ignore carriage returns */
#endif
case '\n': /* == '\x0a' */
case ';': /* card break for multiple commands on one line */
goto got_line ;
case (unsigned char) EOF:
case '\0':
freeclose(streamlevel) ;
goto got_line;
case '\t': /* tabs should get rounded to 8 spaces */
if (isecho) /* write it out */
putchar (*in) ;
*in++ = ' ' ;
while ((in - card) % 8)
acelib/freesubs.c view on Meta::CPAN
}
} /* while TRUE loop */
got_line:
stream[streamlevel].line++ ;
*in = 0 ;
if (isecho)
putchar ('\n') ;
pos = card ;
_losewhite ;
if (acceptCommand && _stepover ('@')) /* command file */
{ char *name ;
if ((name = freeword ()) &&
(fil = filopen (name, 0, "r")))
freesetfile (fil, (char*) pos) ;
goto restart ;
}
if (acceptShell && _stepover ('$')) /* shell command */
{
#if !defined(MACINTOSH)
system ((char*)pos) ;
#endif
goto restart ;
}
return (char*) card ;
}
acelib/freesubs.c view on Meta::CPAN
if (_stepover ('"'))
{ for (cw = word ; !_stepover('"') && *pos ; *cw++ = *pos++)
if (_stepover('\\')) /* accept next char unless end of line */
if (!*pos)
break ;
_losewhite ;
*cw = 0 ;
return (char*) word ; /* always return a word, even if empty */
}
/* default: break on space and \t, not on comma */
for (cw = word ; isgraph (*pos) && *pos != '\t' ; *cw++ = *pos++)
if (_stepover('\\')) /* accept next char unless end of line */
if (!*pos)
break ;
_losewhite ;
*cw = 0 ;
return *word ? (char*) word : 0 ;
}
/************************************************/
acelib/freesubs.c view on Meta::CPAN
if (_stepover ('"'))
{ for (cw = word ; !_stepover('"') && *pos ; *cw++ = *pos++)
if (_stepover('\\')) /* accept next char unless end of line */
if (!*pos)
break ;
_losewhite ;
*cw = 0 ;
return (char*) word ; /* always return a word, even if empty */
}
/* default: break on space, \t or end of line, not on comma
also, does not skip over backslashes which are assumed to be
MS DOS/Windows path delimiters */
for (cw = word ; ( *pos == '\\' || isgraph (*pos) ) && *pos != '\t' ; *cw++ = *pos++) ;
_losewhite ;
*cw = 0 ;
return *word ? (char*) word : 0 ;
}
#endif
acelib/rpcace.x view on Meta::CPAN
set by server on first connection,
must be retransmitted by client each time.
magic:
negotiated between the client and the server,
must be retransmitted by client each time.
cardinal:
set by server to: number of objects in the active list.
aceError:
set by server to: 100 Unrecognised command
200 Out of context command
300 Invalid command (bad nb of parms etc)
400 Syntax error in body of command
kBytes:
set by client to: Desired max size of answer,
NOT strict, server is allowed to return more
Server only splits on ace boundaries.
*/
#define HAVE_ENCORE -1
#define WANT_ENCORE -1
#define DROP_ENCORE -2
/* encore == -3 is used in aceclient && aceserver */
acelib/texthelp.c view on Meta::CPAN
freeOut("\n") ;
filDirectoryDestroy (dirList);
return FALSE;
} /* helpPrint */
/************************************************************/
/* counter-part to graphWebBrowser(), which remote-controls
netscape using the -remote command line option. Useful
for textual applications running in an X11 environment,
where x-apps can be called from within the application,
but the Xtoolkit (used to drive netscape via X-atoms)
shouldn't be linked in, because it is a textual app. */
/************************************************************/
UTIL_FUNC_DEF BOOL helpWebBrowser(char *link)
{
/* currently impossible, because it is hard to find out whether
a netscape process is already running.
Stupidly enough 'netscape -remote...' doesn't exit
acelib/wh/call.h view on Meta::CPAN
*-------------------------------------------------------------------
* This file is part of the ACEDB genome database package, written by
* Richard Durbin (MRC LMB, UK) rd@mrc-lmb.cam.ac.uk, and
* Jean Thierry-Mieg (CRBM du CNRS, France) mieg@kaa.cnrs-mop.fr
*
* Description: Header file for message system to allow calls by name
* Exported functions:
* HISTORY:
* Last edited: Oct 19 11:06 1998 (fw)
* * Nov 3 16:15 1994 (mieg): callCdScript, first cd to establish
the pwd of the command, needed for ghostview etc.
* Created: Mon Oct 3 14:57:16 1994 (rd)
*-------------------------------------------------------------------
*/
/* $Id: call.h,v 1.1 2002/11/14 20:00:06 lstein Exp $ */
#ifndef DEF_CALL_H
#define DEF_CALL_H
acelib/wh/call.h view on Meta::CPAN
typedef void (*CallFunc)() ;
void callRegister (char *name, CallFunc func) ;
BOOL call (char *name, ...) ;
BOOL callExists (char *name) ;
int callScript (char *script, char *args) ;
int callCdScript (char *dir, char *script, char *args) ;
FILE* callScriptPipe (char *script, char *args) ;
FILE* callCdScriptPipe (char *dir, char *script, char *args) ;
BOOL externalAsynchroneCommand (char *command, char *parms,
void *look, void(*g)(FILE *f, void *lk)) ;
void externalFileDisplay (char *title, FILE *f, Stack s) ;
void externalPipeDisplay (char *title, FILE *f, Stack s) ;
void acedbMailComments(void) ;
void externalCommand (char* command) ;
#endif
acelib/wh/help.h view on Meta::CPAN
it will try to init to whelp/, but return 0 if it is not
accessible*/
UTIL_FUNC_DCL BOOL helpPrint (char *helpFilename);
/* dump helpfile as text - default for helpOn,
if helpOnRegister wasn't called to change it. */
UTIL_FUNC_DCL BOOL helpWebBrowser(char *link);
/* counter-part to graphWebBrowser(), which remote-controls
netscape using the -remote command line option. Useful
for textual applications running in an X11 environment,
where x-apps can be called from within the applcation,
but the Xtoolkit (used to drive netscape via X-atoms)
shoiuldn't be linked in, because it is a textual app. */
UTIL_FUNC_DCL char *helpSubjectGetFilename (char *subject);
/* Returns the complete file name of the html help
file for a given subject.
Returns ? if subject was ? to signal,
acelib/wh/mystdlib.h view on Meta::CPAN
/* case-insensitive string comparison */
int strcasecmp (const char *a, const char *b) ;
int strncasecmp(const char *s1, const char *s2, mysize_t n);
#endif
#ifndef __malloc_h
void free (void *block) ; /* int on SUN, void on SGI etc */
#endif
/* system functions and sorts - simplest to give full prototypes for all */
int system (const char *command);
#ifndef IBM
void exit (int status);
#endif
char * getenv (const char *name);
#if !defined(NEXT) && !defined(ALPHA)
void qsort (void *base, mysize_t nelem, mysize_t width,
int (*fcmp)(const void *, const void *)) ;
#endif /* !NEXT or !ALPHA */
acelib/wh/mystdlib.h view on Meta::CPAN
FILE * fopen (const char *path, const char *mode);
int fputc (int c, FILE *stream);
int fputs (const char *s, FILE *stream);
int fseek (FILE *stream, long offset, int whence);
int fsetpos (FILE *stream, const fpos_t *pos);
long ftell (FILE *stream);
mysize_t fread (void *ptr, mysize_t size, mysize_t n, FILE *stream);
mysize_t fwrite (const void *ptr, mysize_t size, mysize_t n,
FILE *stream);
void perror (const char *s);
FILE *popen (const char *command, const char *type);
int pclose (FILE *stream);
void rewind (FILE *stream);
void setbuf (FILE *stream, char *buf);
/*int isalpha (int c); - fails for some reason with "parse error before `+'" */
char getopt (int c, char **s1, char *s2);
#endif /* defined SUN */
/************************************************************/
docs/ACEDB.HOWTO view on Meta::CPAN
admin e5cc20aa1a8f3e7e5b29728bbd1355d8
fred 08b622ddf7eb7c8e44cdb3bd6362f966
ricky 64c12094434c3c4a1a24cdd21ad06485
ethel f95557500f46122aacd59ce920aae6e8
2) Try to start the server under your own account, using saceclient.
Assuming that you have installed the acedb databases using your own
user permissions, you can try to run the web server as yourself. Open
up two command windows on your system. In one type this command:
% ~acedb/bin/sgifaceserver ~acedb/elegans 5000
This is telling the server to run on port 5000 and to read data from
the database directory located at ~acedb/elegans. If all is well, you
will see messages like this:
// Database directory: /usr/local/acedb/elegans
// Shared files: /usr/local/acedb
// #### Server started at 2003-05-12_11:54:13
// #### host=brie3.cshl.org listening port=5000
// #### Database dir=/usr/local/acedb/elegans/
// #### Working dir=/usr/local/acedb/elegans/
// #### clientTimeout=600 serverTimeout=600 maxbytes=102400 autoSaveInterval=600
The messages will stop, indicating that the server is waiting for
incoming connections.
In the other window, launch saceclient with this command:
% ~acedb/bin/saceclient localhost -port 5000
It will prompt you for a userid (type "admin") and a password (type
the password). If all goes well, you will get this prompt:
acedb@localhost>
and the server will accept queries. For example, try the command
"Find Model".
3) Try to communicate with the server using aceperl.
When you installed AcePerl, it should have installed a small interface
script named ace.pl. Confirm that it can talk to the server:
% ace.pl -host localhost -port 5000
By default, you will get an "anonymous" read only connection, and you
docs/ACEDB.HOWTO view on Meta::CPAN
5) Try running the server as the "acedb" user.
If you are going to be running the acedb server a lot, it is better to
run it under the "acedb" account than under your personal login. The
reason for this is that bugs in the acedb server code may
inadvertently expose your personal files to snooping or deletion if
the server is running under your personal ID.
To run the server as acedb, you must make its database files writable
by the acedb user. To do this, become the root user, and run the
following commands:
# chown -R acedb ~acedb/elegans/database
# chgrp -R acedb ~acedb/elegans/database
# chmod -R +rw ~acedb/elegans/database
Replace the path ~acedb/elegans with the path to the database that you
want to be accessible. What this is doing is to make the "database"
subdirectory owned by the acedb user and writable by it.
Still running as root, become the acedb user:
docs/ACE_SERVER_TRAPS.HOWTO view on Meta::CPAN
ACEDB=[pathname to database]
DBDIR=[pathname to database]/database/
PATH=$PATH:[pathname to ace software directory]/bin
export ACEDB
export DBDIR
(PATH was already exported)
Testing the Solution
Use the echo command to make sure the environment variables are in
place. We put our "contacts" database under /home/httpd because that
directory is accessible to the web server. This is a requirement of
AceBrowser, which we want to use as the primary interface.
A test of the $ACEDB environment variable looks like this:
echo $ACEDB (return)
It returns this:
/home/httpd/database/contacts/
docs/ACE_SERVER_TRAPS.HOWTO.html view on Meta::CPAN
<p>I altered my .bash_profile with the following lines:</p>
<p>ACEDB=[pathname to database]<br>
DBDIR=[pathname to database]/database/<br>
PATH=$PATH:[pathname to ace software directory]/bin<br>
export ACEDB<br>
export DBDIR<br>
(PATH was already exported)</p>
<p><h5>Testing the Solution</h5></p>
<p>Use the <em>echo</em> command to make sure the environment variables are in place. We put our "contacts" database under /home/httpd because that directory is accessible to the web server. This is a requirement of AceBrowser, which we want to us...
<p>A test of the $ACEDB environment variable looks like this:<br>
<em>echo $ACEDB (return)</em></p>
<p>It returns this:<br>
<em>/home/httpd/database/contacts/</em></p>
<p><h5>Consequences of the Solution</h5></p>
<p>The <strong>NOTES</strong> file distributed with this version of ACEDB advises you to move the <em>acedb</em> and <em>textace</em> scripts to /usr/local/bin, and using them to start the program. With your environment variables in place, you can s...
<p><h4>Permissions</h4></p>
<p>Take your permissions seriously. Richard Durbin's Installation Guide is out of date, but gives good advice in this department.</p>
docs/GFF_Spec.html view on Meta::CPAN
Back to <A HREF="#TOC">Table of Contents</A>
<P>
<HR>
<A NAME="mailing_list"><h2> Mailing list </h2>
<P>
There is a <A HREF="mailto:gff-list@sanger.ac.uk"> mailing list </a>
to which you can send comments, enquiries, complaints etc. about GFF.
If you want to be added to the mailing list, please send
mail to <A HREF="mailto:Majordomo@sanger.ac.uk">Majordomo@sanger.ac.uk</A> with the
following command in the body of your email message:
<P>
<code>
subscribe gff-list
</code>
<P>
<P>
Back to <A HREF="#TOC">Table of Contents</A>
<P>
<HR>
docs/NEW_DB.HOWTO view on Meta::CPAN
The recipe for creating a new database from scratch using the
interactive xace tool is this:
1) create a directory with the database's name
2) within that directory create a directory named "wspec" (where
the schema lives) and another named "database"
3) populate the wspec subdirectory with the schema files,
which you can copy from another database, such as
the C. elegans database
4) run xace, giving it the database's directory as its
command-line argument
5) xace will prompt you to reinitialize the database, say "OK"
6) using the edit menu, select "read .ace" file. Say "yes"
when prompted for write access
7) choose "Open ace file" from the dialog box, and locate
the file you wish to load
8) select "Read all"
9) when done, close the window and select "Save..." from the
main xace window
Read other .ace files in the same way.
examples/README view on Meta::CPAN
ace.pl is a replacement for tace and aceclient. If you have the perl
Readline package installed it offers a host of nice features,
including command-line editing and command completion. The other
scripts in this directory are small examples of using AcePerl.
Lincoln
examples/ace.pl view on Meta::CPAN
#!/usr/bin/perl
# Simple interface to acedb.
# Uses readline for command-line editing if available.
use lib '..','..blib/lib','../blib/arch';
use Ace 1.66;
use Getopt::Long;
use Text::ParseWords;
use strict vars;
use vars qw/@CLASSES @HELP_TOPICS/;
use constant DEBUG => 0;
my ($HOST,$PORT,$PATH,$TCSH,$URL,$AUTOSAVE,$USER,$PASS,@EXEC);
GetOptions('host=s' => \$HOST,
examples/ace.pl view on Meta::CPAN
Options (can be abbreviated):
-host <hostname> Server host (localhost)
-port <port> Server port (200005)
-path <db path> Local database path (no default)
-url <url> Server URL (see below
-login <user> Username
-pass <pass> Password
-tcsh Use T-shell completion mode
-save Save database updates automatically
-exec <command> Run a command and quit
Respects the environment variables \$ACEDB_HOST and \$ACEDB_PORT, if present.
You can edit the command line using the cursor keys and emacs style
key bindings. Use up and down arrows (or ^P, ^N) to access the history.
The tab key completes partial commands. In tcsh mode, the tab key cycles
among the completions, otherwise pressing the tab key a second time lists
all the possibilities.
You may use multiple -exec switches to run a sequence of commands, or
separate multiple commands in a single string by semicolons:
ace.pl -e 'find Author Thierry-Mieg*' -e 'show'
ace.pl -e 'find Author Thierry-Mieg*; show'
Server URLs:
rpcace://hostname:port RPC server
sace://hostname:port Socket server
tace:/path/to/database Local database
/path/to/database Local database
examples/ace.pl view on Meta::CPAN
quit();
sub quit {
undef $DB;
print "\n// A bientot!\n";
exit 0;
}
sub evaluate {
my $query = shift;
my @commands;
if ($query=~/^(quit|exit)/i) {
quit();
exit 0;
}
if ($query =~ /^(p?parse) (?!=)(.*)/i) {
push (@commands,setup_parse($1,$2));
} else {
push (@commands,$query);
}
foreach (@commands) {
print "$_\n" if @commands > 1;
$_ = setup_remote_parse($_) if /^parse (?!=)/ && !$PATH;
$DB->db->query($_) || return undef;
die "Ace Error: \n",$DB->db->error,"\n" if $DB->db->status == STATUS_ERROR;
while ($DB->db->status == STATUS_PENDING) {
my $h = $DB->db->read;
$h=~s/\0+\Z//; # get rid of nulls in data stream!
print $h;
print "\n" unless $h =~ /\n\Z/;
}
die "Ace Error: \n",$DB->db->error,"\n" if $DB->db->status == STATUS_ERROR;
}
}
sub setup_readline {
my $term = new Term::ReadLine 'aceperl';
my (@commands) = qw/quit help classes model find follow grep longgrep list
show is remove query where table-maker biblio dna peptide keyset-read
spush spop swap sand sor sxor sminus parse pparse write edit
eedit shutdown who data_version kill status date time_stamps
count clear save undo wspec/;
eval {
readline::rl_basic_commands(@commands);
readline::rl_set('TcshCompleteMode', 'On') if $TCSH;
$readline::rl_special_prefixes='"';
$readline::rl_completion_function=\&complete;
};
$term;
}
# This is a big function for command completion/guessing.
sub complete {
my($txt,$line,$start) = @_;
return ('"') if $txt eq '"'; # to fix wierdness
# Examine current word in the context of the two previous ones
$line = substr($line,0,$start+length($txt)); # truncate
$line .= '"' if $line=~tr/"/"/ % 2; # correct odd quote parity errors
my(@tokens) = quotewords(' ',0,$line);
push(@tokens,$txt) unless $txt || $line=~/\"$/;
my $old = $txt;
examples/ace.pl view on Meta::CPAN
return grep (/^$txt/i,qw/-h -a -p -j -T -b -c -f/);
}
if ($tokens[$#tokens-1] =~ /^help/i) {
@HELP_TOPICS = get_help_topics() unless @HELP_TOPICS;
return grep(/^$txt/i,'query_syntax',@HELP_TOPICS);
}
debug(join(':',@_));
return grep(/^$txt/i,@readline::rl_basic_commands);
}
# This handles the
sub setup_parse {
my ($command,$file) = @_;
my (@files) = glob($file);
# if we're local, then we just create a series
# of parse commands and let tace take care of reading
# the file
return map {"parse $_"} @files if $PATH;
# if we're talking to a remote server, we create a series of parse
# commands and stop at the first file that we find
my @c;
local(*F);
local($/) = undef; # file slurp
foreach (@files) {
open (F,$_) || die "Couldn't open $_: $!";
print "parse $_\n";
my $result = $DB->raw_query(scalar(<F>),1);
print $result;
return if $result=~/error|sorry/i and $command ne 'pparse';
close F;
}
return ();
}
sub get_help_topics {
return () unless $DB;
my $result = $DB->raw_query('help topics');
return grep(/^About/../^nohelp/,split(' ',$result));
}
util/ace.PLS view on Meta::CPAN
print "Extracting $file (with variable substitutions)\n";
print OUT <<"!GROK!THIS!";
$Config{startperl} -w
!GROK!THIS!
# In the following, perl variables are not expanded during extraction.
print OUT <<'!NO!SUBS!';
# Simple interface to acedb.
# Uses readline for command-line editing if available.
use Ace;
use Getopt::Long;
use Text::ParseWords;
use strict vars;
use vars qw/@CLASSES @HELP_TOPICS/;
use constant DEBUG => 0;
my ($HOST,$PORT,$PATH,$TCSH,$URL,$AUTOSAVE,$USER,$PASS,@EXEC);
GetOptions('host=s' => \$HOST,
'port=i' => \$PORT,
util/ace.PLS view on Meta::CPAN
Options (can be abbreviated):
-host <hostname> Server host (localhost)
-port <port> Server port (200005)
-path <db path> Local database path (no default)
-url <url> Server URL (see below
-login <user> Username
-pass <pass> Password
-tcsh Use T-shell completion mode
-save Save database updates automatically
-exec <command> Run a command and quit
Respects the environment variables \$ACEDB_HOST and \$ACEDB_PORT, if present.
You can edit the command line using the cursor keys and emacs style
key bindings. Use up and down arrows (or ^P, ^N) to access the history.
The tab key completes partial commands. In tcsh mode, the tab key cycles
among the completions, otherwise pressing the tab key a second time lists
all the possibilities.
You may use multiple -exec switches to run a sequence of commands, or
separate multiple commands in a single string by semicolons:
ace.pl -e 'find Author Thierry-Mieg*' -e 'show'
ace.pl -e 'find Author Thierry-Mieg*; show'
Server URLs:
rpcace://hostname:port RPC server
sace://hostname:port Socket server
tace:/path/to/database Local database
/path/to/database Local database
util/ace.PLS view on Meta::CPAN
quit();
sub quit {
undef $DB;
print "\n// A bientot!\n";
exit 0;
}
sub evaluate {
my $query = shift;
my @commands;
if ($query=~/^(quit|exit)/i) {
quit();
exit 0;
}
if ($query =~ /^(p?parse) (?!=)(.*)/i) {
push (@commands,setup_parse($1,$2));
} else {
push (@commands,$query);
}
foreach (@commands) {
print "$_\n" if @commands > 1;
$_ = setup_remote_parse($_) if /^parse (?!=)/ && !$PATH;
$DB->db->query($_) || return undef;
die "Ace Error: \n",$DB->db->error,"\n" if $DB->db->status == STATUS_ERROR;
while ($DB->db->status == STATUS_PENDING) {
my $h = $DB->db->read;
$h=~s/\0+\Z//; # get rid of nulls in data stream!
print $h;
print "\n" unless $h =~ /\n\Z/;
}
die "Ace Error: \n",$DB->db->error,"\n" if $DB->db->status == STATUS_ERROR;
}
}
sub setup_readline {
my $term = new Term::ReadLine 'aceperl';
my (@commands) = qw/quit help classes model find follow grep longgrep list
show is remove query where table-maker biblio dna peptide keyset-read
spush spop swap sand sor sxor sminus parse pparse write edit
eedit shutdown who data_version kill status date time_stamps
count clear save undo wspec/;
eval {
readline::rl_basic_commands(@commands);
readline::rl_set('TcshCompleteMode', 'On') if $TCSH;
$readline::rl_special_prefixes='"';
$readline::rl_completion_function=\&complete;
};
$term;
}
# This is a big function for command completion/guessing.
sub complete {
my($txt,$line,$start) = @_;
return ('"') if $txt eq '"'; # to fix wierdness
# Examine current word in the context of the two previous ones
$line = substr($line,0,$start+length($txt)); # truncate
$line .= '"' if $line=~tr/"/"/ % 2; # correct odd quote parity errors
my(@tokens) = quotewords(' ',0,$line);
push(@tokens,$txt) unless $txt || $line=~/\"$/;
my $old = $txt;
util/ace.PLS view on Meta::CPAN
return grep (/^$txt/i,qw/-h -a -p -j -T -b -c -f/);
}
if ($tokens[$#tokens-1] =~ /^help/i) {
@HELP_TOPICS = get_help_topics() unless @HELP_TOPICS;
return grep(/^$txt/i,'query_syntax',@HELP_TOPICS);
}
debug(join(':',@_));
return grep(/^$txt/i,@readline::rl_basic_commands);
}
# This handles the
sub setup_parse {
my ($command,$file) = @_;
my (@files) = glob($file);
# if we're local, then we just create a series
# of parse commands and let tace take care of reading
# the file
return map {"parse $_"} @files if $PATH;
# if we're talking to a remote server, we create a series of parse
# commands and stop at the first file that we find
my @c;
local(*F);
local($/) = undef; # file slurp
foreach (@files) {
open (F,$_) || die "Couldn't open $_: $!";
print "parse $_\n";
my $result = $DB->raw_query(scalar(<F>),1);
print $result;
return if $result=~/error|sorry/i and $command ne 'pparse';
close F;
}
return ();
}
sub get_help_topics {
return () unless $DB;
my $result = $DB->raw_query('help topics');
return grep(/^About/../^nohelp/,split(' ',$result));
}