view release on metacpan or search on metacpan
sub class {
my $self = shift;
my $d = $self->{class};
$self->{class} = shift if @_;
$d;
}
sub class_for {
my $self = shift;
my ($class,$id) = @_;
my $selected_class;
if (my $selector = $self->class) {
if (ref $selector eq 'HASH') {
$selected_class = $selector->{$class} || $selector->{'_DEFAULT_'};
}
elsif ($selector->can('class_for')) {
$selected_class = $selector->class_for($class,$id,$self);
}
elsif (!ref $selector) {
$selected_class = $selector;
}
else {
croak "$selector is neither a scalar, nor a HASH, nor an object that supports the class_for() method";
}
}
$selected_class ||= 'Ace::Object';
eval "require $selected_class; 1;" || croak $@
unless $selected_class->can('new');
$selected_class;
}
sub process_url {
my $class = shift;
my $url = shift;
my ($host,$port,$user,$pass,$path,$server_type) = ('','','','','','');
if ($url) { # look for host:port
local $_ = $url;
if (m!^rpcace://([^:]+):(\d+)$!) { # rpcace://localhost:200005
Ace/Browser/AceSubs.pm view on Meta::CPAN
$name = param('name');
$class = param('class');
=item search scripts
These are not called with any CGI parameters on their first
invocation, but can define their own parameter lists by creating
fill-out forms. The AceBrowser system remembers the last search
performed by a search script in a cookie and regenerates the CGI
parameters the next time the user selects that search script.
=back
=head1 SUBROUTINES
The following sections describe the exported subroutines.
=over 4
=cut
Ace/Browser/AceSubs.pm view on Meta::CPAN
=cut
sub Header {
my $config = Configuration();
my $dbname = get_symbolic();
return unless my $searches = $config->Searches;
my $banner = $config->Banner;
# next select the correct search script
my @searches = @{$searches};
my $self = url(-relative=>1);
my $modperl = $ENV{MOD_PERL} && Apache->can('request') && eval {Apache->request->dir_config('AceBrowserConf')};
my @row;
foreach (@searches) {
my ($name,$url,$on,$off,$size) = @{$config->searches($_)}{qw/name url onimage
offimage size/};
my $active = $url =~ /\b$self\b/;
my $image = $active ? $on : $off;
Ace/Browser/AceSubs.pm view on Meta::CPAN
) if $cache_root;
$DB{$name} = Ace->connect(-host=>$host,-port=>$port,-timeout=>50,@auth,@cache);
return $DB{$name};
}
=item PrintTop($object,$class,$title,@html_headers)
The PrintTop() function generates all the boilerplate at the top of a
typical AceBrowser page, including the HTTP header information, the
page title, the navigation bar for searches, the web site banner, the
type selector for choosing alternative displays, and a level-one
header.
Call it with one or more arguments. The arguments are:
$object An AceDB object. The navigation bar and title will be
customized for the object.
$class If no AceDB object is available, then you can pass
a string containing the AceDB class that this page is
designed to display.
Ace/Browser/AceSubs.pm view on Meta::CPAN
sub Style {
my $stylesheet = Configuration()->Stylesheet;
return { -src => $stylesheet };
}
=item $boolean = Toggle($section,[$label,$object_count,$add_plural,$add_count])
=item ($link,$bool) = Toggle($section,$label,$object_count,$add_plural,$add_count)
The Toggle() subroutine makes it easy to create HTML sections that
open and close when the user selects a toggle icon (a yellow
triangle).
Toggle() can be used to manage multiple collapsible HTML sections, but
each section must have a unique name. The required first argument is
the section name. Optional arguments are:
$label The text of the generated link, for example "sequence"
$object_count The number of objects that opening the section will reveal
Ace/Browser/AceSubs.pm view on Meta::CPAN
if (wantarray ){
return ($link,$OPEN{$section})
} else {
print $link,br;
return $OPEN{$section};
}
}
=item $html = TypeSelector($name,$class)
This subroutine generates the HTML for the type selector navigation
bar. The links in the bar are dynamically generated based on the
values of $name and $class. This function is called by PrintTop().
It is not exported by default.
=cut
# Choose a set of displayers based on the type.
sub TypeSelector {
my ($name,$class) = @_;
return unless $class;
Ace/Local.pm view on Meta::CPAN
$self->{'status'} = STATUS_PENDING;
}
sub low_read { # hack to accomodate "uninitialized database" warning from tace
my $self = shift;
my $rdr = $self->{'read'};
return undef unless $self->{'status'} == STATUS_PENDING;
my $rin = '';
my $data = '';
vec($rin,fileno($rdr),1)=1;
unless (select($rin,undef,undef,1)) {
$self->{'status'} = STATUS_WAITING;
return undef;
}
sysread($rdr,$data,READSIZE);
return $data;
}
sub read {
my $self = shift;
return undef unless $self->{'status'} == STATUS_PENDING;
Ace/Object.pm view on Meta::CPAN
#####################################################################
############### mostly private functions from here down #############
#####################################################################
#####################################################################
# simple clone
sub clone {
my $self = shift;
return bless {%$self},ref $self;
}
# selective clone
sub _clone {
my $self = shift;
my $pack = ref($self);
my @public_keys = grep {substr($_,0,1) ne '.'} keys %$self;
my %newobj;
@newobj{@public_keys} = @{$self}{@public_keys};
# Turn into a toplevel object
$newobj{'.root'}++;
return bless \%newobj,$pack;
Ace/Sequence.pm view on Meta::CPAN
=back
If new() is successful, it will create an I<Ace::Sequence> object and
return it. Otherwise it will return undef and return a descriptive
message in Ace->error(). Certain programming errors, such as a
failure to provide required arguments, cause a fatal error.
=head2 Reference Sequences and the Coordinate System
When retrieving information from an I<Ace::Sequence>, the coordinate
system is based on the sequence segment selected at object creation
time. That is, the "+1" strand is the natural direction of the
I<Ace::Sequence> object, and base pair 1 is its first base pair. This
behavior can be overridden by providing a reference sequence to the
new() method, in which case the orientation and position of the
reference sequence establishes the coordinate system for the object.
In addition to the reference sequence, there are two other sequences
used by I<Ace::Sequence> for internal bookeeping. The "source"
sequence corresponds to the smallest ACeDB sequence object that
completely encloses the selected sequence segment. The "parent"
sequence is the smallest ACeDB sequence object that contains the
"source". The parent is used to derive the length and orientation of
source sequences that are not directly associated with DNA objects.
In many cases, the source sequence will be identical to the sequence
initially passed to the new() method. However, there are exceptions
to this rule. One common exception occurs when the offset and/or
length cross the boundaries of the passed-in sequence. In this case,
the ACeDB database is searched for the smallest sequence that contains
both endpoints of the I<Ace::Sequence> object.
Ace/Sequence.pm view on Meta::CPAN
I<Ace::Sequence> objects.
=head2 features()
@features = $seq->features;
@features = $seq->features('exon','intron','Predicted_gene');
@features = $seq->features('exon:GeneFinder','Predicted_gene:hand.*');
features() returns an array of I<Sequence::Feature> objects. If
called without arguments, features() returns all features that cross
the sequence region. You may also provide a filter list to select a
set of features by type and subtype. The format of the filter list
is:
type:subtype
Where I<type> is the class of the feature (the "feature" field of the
GFF format), and I<subtype> is a description of how the feature was
derived (the "source" field of the GFF format). Either of these
fields can be absent, and either can be a regular expression. More
advanced filtering is not supported, but is provided by the Sanger
Ace/Sequence/FeatureList.pm view on Meta::CPAN
@subtypes = $list->types('Predicted_gene');
# Two arguments. Count type & subtype
$genefinder_cnt = $list->types('Predicted_gene','genefinder');
=head1 DESCRIPTION
I<Ace::Sequence::FeatureList> is a small class that provides
statistical information about sequence features. From it you can
obtain summary counts of the features and their types within a
selected region.
=head1 OBJECT CREATION
You will not ordinarily create an I<Ace::Sequence::FeatureList> object
directly. Instead, objects will be created by calling a
I<Ace::Sequence> object's feature_list() method. If you wish to
create an I<Ace::Sequence::FeatureList> object directly, please consult
the source code for the I<new()> method.
=head1 OBJECT METHODS
Ace/SocketServer.pm view on Meta::CPAN
}
$self->{status} = STATUS_PENDING;
$self->{encoring} = 0;
return 1;
}
sub read {
my $self = shift;
return _error("No pending query") unless $self->status == STATUS_PENDING;
$self->_do_encore || return if $self->encore;
# call select() here to time out
if ($self->{timeout}) {
my $rdr = '';
vec($rdr,fileno($self->{socket}),1) = 1;
my $result = select($rdr,undef,undef,$self->{timeout});
return _error("Query timed out") unless $result;
}
my ($msg,$body) = $self->_recv_msg;
return unless defined $msg;
$msg =~ s/\0.+$//; # socketserver bug workaround: get rid of junk in message
if ($msg eq ACESERV_MSGOK or $msg eq ACESERV_MSGFAIL) {
$self->{status} = STATUS_WAITING;
$self->{encoring} = 0;
} elsif ($msg eq ACESERV_MSGENCORE) {
The script will also ask you whether you wish to install support for the
AceBrowser Web server extensions. Only answer yes if you are installing
on a machine that already runs a web server and you wish to have AceBrowser
installed. If you answer in the affirmative, then you will be asked a number
of directory configuration questions. See README.ACEBROWSER for more details
on installation.
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
README.ACEBROWSER view on Meta::CPAN
the data source is to be rendered. All configuration files
are stored in a directory at the location indicated here.
The default is /usr/local/apache/conf/ace/.
b. Acebrowser CGI script directory
The core of Acebrowser is a set of CGI scripts. This is the
directory that will contain them. Choose a directory that will
be recognized by the web server as containing CGI script. If
you are using Apache/mod_perl, select a directory under the
control of Apache::Registry.
The default is /usr/local/apache/cgi-bin/ace/
c. Acebrowser HTML files and images
Acebrowser uses a small number of static HTML files and images.
This is the directory that will contain them. Choose a directory
that is located under the web server's document root.
README.ACEBROWSER view on Meta::CPAN
simple An acedb database running on port 2005 of the
local host
moviedb An example database of movies running on port 200008
of stein.cshl.org
default An oldish snapshot of the C. elegans database running
on port 2005 of stein.cshl.org
To select among the data sources, append the symbolic name to the end
of the URL of the desired CGI script. For example, to do a text
search on the "moviedb" database, fetch this URL:
http://your.site/cgi-bin/ace/searches/text/moviedb
If no symbolic name is specified, the default database is assumed.
http://your.site/cgi-bin/ace/searches/text
is equivalent to
http://your.site/cgi-bin/ace/searches/text/default
As described in EXTENDING ACEBROWSER, another way to select among
databases is to place the CGI script itself in a directory with the
same name as the database. For example, if you have written a
specialized CGI script called screenplay that is designed to work with
the "moviedb" database, you could place it in a subdirectory named
moviedb, and refer to it this way:
http://your.site/cgi-bin/ace/moviedb/screenplay
The symbolic name can actually appear anywhere in the path, so this
would work as well:
http://your.site/cgi-bin/ace/moviedb/custom/screenplay
THE CONFIGURATION FILES
The configuration files are located in the directory selected for
acebrowser configuration. Their names are formed by appending ".pm"
to the symbolic name of the database. For example, the configuration
file "simple.pm" corresponds to the database "simple".
Each of the configuration files is actually an executable Perl script.
As such it can use any Perl constructions you wish, including variable
interpolation. The purpose of the configuration file is to set a
series of configuration variables, which by convention are all
uppercase. For example, here is an excerpt from the default.pm
configuration file:
README.ACEBROWSER view on Meta::CPAN
);
$SEARCH_ICON = "$ICONS/unknown.gif";
The @SEARCHES array sets the searches made available to users. The
first element in each pair is the symbolic name for the search. The
second element is a hash reference containing the keys "name" and
"url". The name is the bit of human readable text printed in the
list of searches located at the top of the AceBrowser page. The url
is the URL of the script that performs the search.
The $SEARCH_ICON variable selects an icon to use for the search
button.
@HOME = (
$DOCROOT => 'Home Page'
);
Select the URL and label for the "home" link appearing on the bottom
of each Acebrowser-generated page. By default, the home will point to
README.ACEBROWSER view on Meta::CPAN
AceBrowser's use of cookies.
@FEEDBACK_RECIPIENTS = (
[ " $ENV{SERVER_ADMIN}", 'general complaints and suggestions', 1 ]
);
This array contains a list of recipient e-mail addresses for the
"feedback" page. Each recipient is an array reference containing
least two elements, the e-mail address and a comment. A third,
optional, element, if true, indicates that this recipient should be
selected by default. The default is the webmaster's e-mail address.
Comment out the entire section of you do not want the feedback link to
appear.
# configuration for the "basic" search script
@BASIC_OBJECTS =
('Any' => '<i>Anything</i>',
'Locus' => 'Confirmed Gene',
'Predicted_gene' => 'Predicted Gene',
'Sequence' => 'Sequence (any)',
'Genome_sequence', => 'Sequence (genomic)',
README.ACEBROWSER view on Meta::CPAN
each object has a class, such as "Sequence". Acebrowser takes
advantage of this object structure by allowing you to assign one or
more displays to a class. Each display is a CGI script that fetches
the desired object from the database, formats it, and displays it as
HTML or an image.
Whenever Acebrowser is called upon to display an object, it consults
the configuration file to determine what displays are registered for
the object, and then presents a row of display names across the top of
the window. In Acebrowser jargon, this line of displays is called the
"type selector." The user can change the display to use by selecting
the corresponding link.
Three generic displays, which will work with all databases, come with
Acebrowser:
tree an HTML representation of the Acedb object which
presents the object in the form of a collapsible outline.
xml an XML representation of the Acedb object
README.ACEBROWSER view on Meta::CPAN
label => 'New Display',
icon => '/ico/layout.gif',
},
The hash key, in this case "newdisplay", is a symbolic name for the
display. It can correspond to the acual name of the CGI script, or
not. The hash value is itself an anonymous hash containing the
required keys "url" and "label", and the optional key "icon". "url"
gives the path to the script that will display, and "label" gives a
human readable label for the link that Acebrowser puts in the type
selector. The "icon" key, if present, will display the indicated icon
in the type selector.
3. Bind this display to the class (or classes) for which this display
is valid, by adding an entry to the %CLASSES array. For example:
NewObject => ['newdisplay'],
This indicates that whenever Acebrowser is called upon to display an
object of type "NewObject", it will display the object using the CGI
script designated by the "newdisplay" display. If you have several
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,
acebrowser/cgi-bin/generic/model view on Meta::CPAN
#!/usr/bin/perl
# -*- Mode: perl -*-
# file: model
# do an internal redirect to show the model for selected object
use strict;
use CGI qw(:standard escape);
use Ace::Browser::AceSubs;
use Ace::Browser::TreeSubs;
# get the requested object
my $object = GetAceObject;
PrintTop(param('name'),param('class'),"Acedb Schema for Class ".param('class'));
acebrowser/cgi-bin/generic/pic view on Meta::CPAN
' ';
print submit('Change');
print end_p;
print end_form;
print end_td(),end_TR(),end_table();
}
sub get_extremes {
my $db = shift;
my $chrom = shift;
my $select = qq(select gm[Position] from g in object("Map","$chrom")->Contains[2], gm in g->Map where gm = "$chrom");
my @positions = $db->aql("select min($select),max($select)");
my ($min,$max) = @{$positions[0]}[0,1];
return ($min,$max);
}
sub center {
my $c = shift;
my ($left,$right) = @{$c}[0,2];
# round to nearest 2 pixels
int( ($left + (($right-$left)/2)) / 2 ) * 2;
}
acebrowser/cgi-bin/misc/feedback view on Meta::CPAN
sub print_instructions {
my @defaults;
for (my $i=0; $i<@FEEDBACK_RECIPIENTS; $i++) {
push @defaults,$i if $FEEDBACK_RECIPIENTS[$i][2];
}
print
p({-class=>'small'},
"Use this form to send new data or corrections to",
"the maintainers of this database. An e-mail message",
"will be sent to the individuals selected from the list",
"below."),
blockquote({-class=>'small'},
checkbox_group(-name => 'recipients',
-Values => [(0..$#FEEDBACK_RECIPIENTS)],
-Labels => { map {
$_=>"$FEEDBACK_RECIPIENTS[$_]->[0] ($FEEDBACK_RECIPIENTS[$_]->[1])"
} (0..$#FEEDBACK_RECIPIENTS) },
-defaults=>\@defaults,
-linebreak=>1));
}
acebrowser/cgi-bin/searches/basic view on Meta::CPAN
use CGI::Carp qw/fatalsToBrowser/;
use Ace::Browser::AceSubs qw(:DEFAULT DoRedirect);
use Ace::Browser::SearchSubs;
my $classlist = Configuration()->Basic_objects;
my @classlist = @{$classlist}[map {2*$_} (0..@$classlist/2-1)]; # keep keys, preserving the order
my $JSCRIPT=<<END;
function focussearch() {
document.SimpleForm.query.focus();
document.SimpleForm.query.select();
return (false);
}
END
# fetch database handle
$DB = OpenDatabase() || AceError("Couldn't open database.");
my $search_class = param('class');
acebrowser/cgi-bin/searches/basic view on Meta::CPAN
param('query' => param('query') . '*') if !$count && param('query') !~ /\*$/; #autoadd
}
DoRedirect(@$objs) if $count==1;
PrintTop(undef,undef,img({-src=>SEARCH_ICON,-align=>CENTER}).'Simple Search');
print p({-class=>'small'},
"Select the type of object you are looking for and optionally",
"type in a name or a wildcard pattern",
"(? for any one character. * for zero or more characters).",
"If no name is entered, the search displays all objects of the selected type.",
i('Anything'),'searches for the entered text across the entire database.');
display_search_form();
display_search($objs,$count,$offset,$search_class) if $search_class;
PrintBottom();
sub display_search_form {
acelib/freesubs.c view on Meta::CPAN
if (i<0)
messcrash("Negative number of options in freekey2text") ;
while (o++, i--)
if (o->key == k)
return (o->text) ;
return title ;
}
/***************************************************/
BOOL freeselect (KEY *kpt, FREEOPT *options) /* like the old freemenu */
{
if (isInteractive)
printf ("%s > ",options[0].text) ;
freecard (0) ; /* just get a card */
if (isInteractive)
while (freestep ('?')) /* write out options list */
{ int i ;
for (i = 1 ; i <= options[0].key ; i++)
printf (" %s\n",options[i].text) ;
printf ("%s > ",options[0].text) ;
freecard (0) ;
}
return freekey (kpt,options) ;
}
/* same but returns TRUE, -1, if stremlevel drops below level */
BOOL freelevelselect (int level, KEY *kpt, FREEOPT *options) /* like the old freemenu */
{
if (isInteractive)
printf ("%s > ",options[0].text) ;
if (!freecard (level)) /* try to get another card */
{ *kpt = (KEY)(-1) ;
return TRUE ;
}
if (isInteractive)
while (freestep ('?')) /* write out options list */
{ int i ;
acelib/timesubs.c view on Meta::CPAN
in case of equality the comparison asks if the lesser detailed date
is completely contained within the other, and the above
comparison evaluates TRUE, because May 2nd 1990 is in the year 1990
1998-07 < 1998-07-09 -> FALSE
because one date gives a specific day in July 1998, but as the
first date misses the day, we can't decide whether it is earlier.
Example: the movie City Hall was released on 1996-02-16.
select m->Title, m->Released from m in class Movie where m->Released < `1996-02
select m->Title, m->Released from m in class Movie where m->Released > `1996-02
will BOTH EXnclude the movie 'City Hall', whereas
select m->Title, m->Released from m in class Movie where m->Released < `1996-02-17
select m->Title, m->Released from m in class Movie where m->Released <= `1996-02
will both INclude 'City Hall'.
*/
/* mhmp 22.10.98
Ici, chaque date, quel que soit son niveau de detail, est consideree
comme un intervalle.
1996-05 = [1996-05-01_00:00:00 , 1996-05-31_23:59:59] = INTER
date == 1996-05 <==> date appartient a INTER
date < 1996-05 <==> date < inf(INTER)
acelib/wh/regular.h view on Meta::CPAN
UTIL_FUNC_DCL char *freewordcut (char *cutset, char *cutter) ;
UTIL_FUNC_DCL void freeback (void) ; /* goes back one word */
UTIL_FUNC_DCL BOOL freeint (int *p) ;
UTIL_FUNC_DCL BOOL freefloat (float *p) ;
UTIL_FUNC_DCL BOOL freedouble (double *p) ;
UTIL_FUNC_DCL BOOL freekey (KEY *kpt, FREEOPT *options) ;
UTIL_FUNC_DCL BOOL freekeymatch (char *text, KEY *kpt, FREEOPT *options) ;
UTIL_FUNC_DCL void freemenu (void (*proc)(KEY), FREEOPT *options) ;
UTIL_FUNC_DCL char *freekey2text (KEY k, FREEOPT *o) ; /* Return text corresponding to key */
UTIL_FUNC_DCL BOOL freeselect (KEY *kpt, FREEOPT *options) ;
UTIL_FUNC_DCL BOOL freelevelselect (int level,
KEY *kpt, FREEOPT *options);
UTIL_FUNC_DCL void freedump (FREEOPT *options) ;
UTIL_FUNC_DCL BOOL freestep (char x) ;
UTIL_FUNC_DCL void freenext (void) ;
UTIL_FUNC_DCL BOOL freeprompt (char *prompt, char *dfault, char *fmt) ;/* gets a card */
UTIL_FUNC_DCL BOOL freecheck (char *fmt) ; /* checks remaining card fits fmt */
UTIL_FUNC_DCL int freefmtlength (char *fmt) ;
UTIL_FUNC_DCL BOOL freequery (char *query) ;
UTIL_FUNC_DCL char *freepos (void) ; /* pointer to present position in card */
UTIL_FUNC_DCL char *freeprotect (char* text) ; /* protect so freeword() reads correctly */
docs/ACEDB.HOWTO view on Meta::CPAN
COMPILING THE SOFTWARE
Unpack the software into its own directory:
1) mkdir acedb
2) gunzip -c acedb-latest.tar.gz | tar xvf -
Compile the software. The makefile requires that an environment
variable named ACEDB_MACHINE be defined. This environment variable is
in turn used to select the makefile to be used to compile. To figure
out what to set this environment variable to, type "make". You will
receive an error message listing the alternatives. Choose one for your
system, and run "make again".
3) cd acedb
4) make (error message listing possibilities)
5) setenv ACEDB_MACHINE LINUX_4 (for example)
6) make
This will create a subdirectory named bin.LINUX_4 (or whatever your
docs/NEW_DB.HOWTO view on Meta::CPAN
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.
Rather than launching xace, you can do it all with tace. Lines
surrounded by <angle brackets> represent user input:
% <tace /usr/local/acedb/my_db>
// Database directory: /usr/local/acedb/my_db
The file /usr/local/acedb/my_db/database/ACEDB.wrm does not exist,