Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > c0b2316b5320756fc35b43f35335d7ce > files > 149

perl-AcePerl-1.920.0-1mdv2010.0.i586.rpm

<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Ace::Object - Manipulate  Ace Data Objects</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:root@localhost" />
</head>

<body style="background-color: white">


<!-- INDEX BEGIN -->
<div name="index">
<p><a name="__index__"></a></p>
<!--

<ul>

	<li><a href="#name">NAME</a></li>
	<li><a href="#synopsis">SYNOPSIS</a></li>
	<li><a href="#description">DESCRIPTION</a></li>
	<li><a href="#acedb__object_methods">ACEDB::OBJECT METHODS</a></li>
	<ul>

		<li><a href="#new___method"><code>new()</code> method</a></li>
		<li><a href="#name___method"><code>name()</code> method</a></li>
		<li><a href="#class___method"><code>class()</code> method</a></li>
		<li><a href="#db___method"><code>db()</code> method</a></li>
		<li><a href="#isclass___method"><code>isClass()</code> method</a></li>
		<li><a href="#istag___method"><code>isTag()</code> method</a></li>
		<li><a href="#tags___method"><code>tags()</code> method</a></li>
		<li><a href="#right___and_down___methods"><code>right()</code> and <code>down()</code> methods</a></li>
		<li><a href="#at___method"><code>at()</code> method</a></li>
		<li><a href="#get___method"><code>get()</code> method</a></li>
		<li><a href="#search___method"><code>search()</code> method</a></li>
		<li><a href="#autogenerated_access_methods">Autogenerated Access Methods</a></li>
		<li><a href="#fetch___method"><code>fetch()</code> method</a></li>
		<li><a href="#follow___method"><code>follow()</code> method</a></li>
		<li><a href="#pick___method"><code>pick()</code> method</a></li>
		<li><a href="#col___method"><code>col()</code> method</a></li>
		<li><a href="#row___method"><code>row()</code> method</a></li>
		<li><a href="#asstring___method"><code>asString()</code> method</a></li>
		<li><a href="#astable___method"><code>asTable()</code> method</a></li>
		<li><a href="#asace___method"><code>asAce()</code> method</a></li>
		<li><a href="#ashtml___method"><code>asHTML()</code> method</a></li>
		<li><a href="#asxml___method"><code>asXML()</code> method</a></li>
		<li><a href="#asgif___method"><code>asGIF()</code> method</a></li>
		<li><a href="#asdna___and_aspeptide___methods"><code>asDNA()</code> and <code>asPeptide()</code> methods</a></li>
		<li><a href="#add_row___method"><code>add_row()</code> method</a></li>
		<li><a href="#add_tree__"><code>add_tree()</code></a></li>
		<li><a href="#delete___method"><code>delete()</code> method</a></li>
		<li><a href="#commit___method"><code>commit()</code> method</a></li>
		<li><a href="#rollback___method"><code>rollback()</code> method</a></li>
		<li><a href="#kill___method"><code>kill()</code> method</a></li>
		<li><a href="#date_style___method"><code>date_style()</code> method</a></li>
		<li><a href="#isroot___method"><code>isRoot()</code> method</a></li>
		<li><a href="#model___method"><code>model()</code> method</a></li>
		<li><a href="#timestamp___method"><code>timestamp()</code> method</a></li>
		<li><a href="#comment___method"><code>comment()</code> method</a></li>
		<li><a href="#error___method"><code>error()</code> method</a></li>
		<li><a href="#factory___method"><code>factory()</code> method</a></li>
		<li><a href="#debug___method"><code>debug()</code> method</a></li>
	</ul>

	<li><a href="#see_also">SEE ALSO</a></li>
	<li><a href="#author">AUTHOR</a></li>
</ul>

-->


</div>
<!-- INDEX END -->

<p>
</p>
<h1><a name="name">NAME</a></h1>
<p>Ace::Object - Manipulate  Ace Data Objects</p>
<p>
</p>
<hr />
<h1><a name="synopsis">SYNOPSIS</a></h1>
<pre>
    # open database connection and get an object
    use Ace;
    $db = Ace-&gt;connect(-host =&gt; 'beta.crbm.cnrs-mop.fr',
                       -port =&gt; 20000100);
    $sequence  = $db-&gt;fetch(Sequence =&gt; 'D12345');
    
    # Inspect the object
    $r    = $sequence-&gt;at('Visible.Overlap_Right');
    @row  = $sequence-&gt;row;
    @col  = $sequence-&gt;col;
    @tags = $sequence-&gt;tags;
    
    # Explore object substructure
    @more_tags = $sequence-&gt;at('Visible')-&gt;tags;
    @col       = $sequence-&gt;at(&quot;Visible.$more_tags[1]&quot;)-&gt;col;</pre>
<pre>
    # Follow a pointer into database
    $r     = $sequence-&gt;at('Visible.Overlap_Right')-&gt;fetch;
    $next  = $r-&gt;at('Visible.Overlap_left')-&gt;fetch;</pre>
<pre>
    # Classy way to do the same thing
    $r     = $sequence-&gt;Overlap_right;
    $next  = $sequence-&gt;Overlap_left;</pre>
<pre>
    # Pretty-print object
    print $sequence-&gt;asString;
    print $sequence-&gt;asTabs;
    print $sequence-&gt;asHTML;</pre>
<pre>
    # Update object
    $sequence-&gt;replace('Visible.Overlap_Right',$r,'M55555');
    $sequence-&gt;add('Visible.Homology','GR91198');
    $sequence-&gt;delete('Source.Clone','MBR122');
    $sequence-&gt;commit();</pre>
<pre>
    # Rollback changes
    $sequence-&gt;rollback()</pre>
<pre>
    # Get errors
    print $sequence-&gt;error;</pre>
<p>
</p>
<hr />
<h1><a name="description">DESCRIPTION</a></h1>
<p><em>Ace::Object</em> is the base class for objects returned from ACEDB
databases. Currently there is only one type of <em>Ace::Object</em>, but
this may change in the future to support more interesting
object-specific behaviors.</p>
<p>Using the <em>Ace::Object</em> interface, you can explore the internal
structure of an <em>Ace::Object</em>, retrieve its content, and convert it
into various types of text representation.  You can also fetch a
representation of any object as a GIF image.</p>
<p>If you have write access to the databases, add new data to an object,
replace existing data, or kill it entirely.  You can also create a new
object de novo and write it into the database.</p>
<p>For information on connecting to ACEDB databases and querying them,
see <a href="/AcePerl/docs/./Ace.html">the Ace manpage</a>.</p>
<p>
</p>
<hr />
<h1><a name="acedb__object_methods">ACEDB::OBJECT METHODS</a></h1>
<p>The structure of an Ace::Object is very similar to that of an Acedb
object.  It is a tree structure like this one (an Author object):</p>
<pre>
 Thierry-Mieg J-&gt;Full_name -&gt;Jean Thierry-Mieg
                  |
                 Laboratory-&gt;FF
                  |
                 Address-&gt;Mail-&gt;CRBM duCNRS
                  |        |     |
                  |        |    BP 5051
                  |        |     |
                  |        |    34033 Montpellier
                  |        |     |
                  |        |    FRANCE
                  |        |
                  |       E_mail-&gt;mieg@kaa.cnrs-mop.fr
                  |        |
                  |       Phone -&gt;33-67-613324
                  |        |
                  |       Fax   -&gt;33-67-521559
                  |
                 Paper-&gt;The C. elegans sequencing project
                         |
                        Genome Project Database
                         |
                        Genome Sequencing
                         |
                         How to get ACEDB for your Sun
                         |
                        ACEDB is Hungry</pre>
<p>Each object in the tree has two pointers, a &quot;right&quot; pointer to the
node on its right, and a &quot;down&quot; pointer to the node beneath it.  Right
pointers are used to store hierarchical relationships, such as
Address-&gt;Mail-&gt;E_mail, while down pointers are used to store lists,
such as the multiple papers written by the Author.</p>
<p>Each node in the tree has a type and a name.  Types include integers,
strings, text, floating point numbers, as well as specialized
biological types, such as &quot;dna&quot; and &quot;peptide.&quot;  Another fundamental
type is &quot;tag,&quot; which is a text identifier used to label portions of
the tree.  Examples of tags include &quot;Paper&quot; and &quot;Laboratory&quot; in the
example above.</p>
<p>In addition to these built-in types, there are constructed types known
as classes.  These types are specified by the data model.  In the
above example, &quot;Thierry-Mieg J&quot; is an object of the &quot;Author&quot; class,
and &quot;Genome Project Database&quot; is an object of the &quot;Paper&quot; class.  An
interesting feature of objects is that you can follow them into the
database, retrieving further information.  For example, after
retrieving the &quot;Genome Project Database&quot; Paper from the Author object,
you could fetch more information about it, either by following <strong>its</strong>
right pointer, or by using one of the specialized navigation routines
described below.</p>
<p>
</p>
<h2><a name="new___method"><code>new()</code> method</a></h2>
<pre>
    $object = new Ace::Object($class,$name,$database);
    $object = new Ace::Object(-class=&gt;$class,
                              -name=&gt;$name,
                              -db=&gt;database);</pre>
<p>You can create a new Ace::Object from scratch by calling the <code>new()</code>
routine with the object's class, its identifier and a handle to the
database to create it in.  The object won't actually be created in the
database until you <code>add()</code> one or more tags to it and <code>commit()</code> it (see
below).  If you do not provide a database handle, the object will be
created in memory only.</p>
<p>Arguments can be passed positionally, or as named parameters, as shown
above.</p>
<p>This routine is usually used internally.  See also <code>add_row()</code>,
<code>add_tree()</code>, <code>delete()</code> and <code>replace()</code> for ways to manipulate this object.</p>
<p>
</p>
<h2><a name="name___method"><code>name()</code> method</a></h2>
<pre>
    $name = $object-&gt;name();</pre>
<p>Return the name of the Ace::Object.  This happens automatically
whenever you use the object in a context that requires a string or a
number.  For example:</p>
<pre>
    $object = $db-&gt;fetch(Author,&quot;Thierry-Mieg J&quot;);
    print &quot;$object did not write 'Pride and Prejudice.'\n&quot;;</pre>
<p>
</p>
<h2><a name="class___method"><code>class()</code> method</a></h2>
<pre>
    $class = $object-&gt;class();</pre>
<p>Return the class of the object.  The return value may be one of
&quot;float,&quot; &quot;int,&quot; &quot;date,&quot; &quot;tag,&quot; &quot;txt,&quot; &quot;dna,&quot; &quot;peptide,&quot; and &quot;scalar.&quot;
(The last is used internally by Perl to represent objects created
programatically prior to committing them to the database.)  The class
may also be a user-constructed type such as Sequence, Clone or
Author.  These user-constructed types usually have an initial capital
letter.</p>
<p>
</p>
<h2><a name="db___method"><code>db()</code> method</a></h2>
<pre>
     $db = $object-&gt;db();</pre>
<p>Return the database that the object is associated with.</p>
<p>
</p>
<h2><a name="isclass___method"><code>isClass()</code> method</a></h2>
<pre>
     $bool = $object-&gt;isClass();</pre>
<p>Returns true if the object is a class (can be fetched from the
database).</p>
<p>
</p>
<h2><a name="istag___method"><code>isTag()</code> method</a></h2>
<pre>
     $bool = $object-&gt;isTag();</pre>
<p>Returns true if the object is a tag.</p>
<p>
</p>
<h2><a name="tags___method"><code>tags()</code> method</a></h2>
<pre>
     @tags = $object-&gt;tags();</pre>
<p>Return all the top-level tags in the object as a list.  In the Author
example above, the returned list would be
('Full_name','Laboratory','Address','Paper').</p>
<p>You can fetch tags more deeply nested in the structure by navigating
inwards using the methods listed below.</p>
<p>
</p>
<h2><a name="right___and_down___methods"><code>right()</code> and <code>down()</code> methods</a></h2>
<pre>
     $subtree = $object-&gt;right;
     $subtree = $object-&gt;right($position);      
     $subtree = $object-&gt;down;
     $subtree = $object-&gt;down($position);</pre>
<p><strong>right()</strong> and <strong>down()</strong> provide a low-level way of traversing the
tree structure by following the tree's right and down pointers.
Called without any arguments, these two methods will move one step.
Called with a numeric argument &gt;= 0 they will move the indicated
number of steps (zero indicates no movement).</p>
<pre>
     $full_name = $object-&gt;right-&gt;right;
     $full_name = $object-&gt;right(2);</pre>
<pre>
     $city = $object-&gt;right-&gt;down-&gt;down-&gt;right-&gt;right-&gt;down-&gt;down;
     $city = $object-&gt;right-&gt;down(2)-&gt;right(2)-&gt;down(2);</pre>
<p>If $object contains the &quot;Thierry-Mieg J&quot; Author object, then the first
series of accesses shown above retrieves the string &quot;Jean
Thierry-Mieg&quot; and the second retrieves &quot;34033 Montpellier.&quot;  If the
right or bottom pointers are NULL, these methods will return undef.</p>
<p>In addition to being somewhat awkard, you will probably never need to
use these methods.  A simpler way to retrieve the same information
would be to use the <code>at()</code> method described in the next section.</p>
<p>The <code>right()</code> and <code>down()</code> methods always walk through the tree of the
current object.  They do not follow object pointers into the database.
Use <strong>fetch()</strong> (or the deprecated <strong>pick()</strong> or <strong>follow()</strong> methods)
instead.</p>
<p>
</p>
<h2><a name="at___method"><code>at()</code> method</a></h2>
<pre>
    $subtree    = $object-&gt;at($tag_path);
    @values     = $object-&gt;at($tag_path);</pre>
<p><code>at()</code> is a simple way to fetch the portion of the tree that you are
interested in.  It takes a single argument, a simple tag or a path.  A
simple tag, such as &quot;Full_name&quot;, must correspond to a tag in the
column immediately to the right of the root of the tree.  A path such
as &quot;Address.Mail&quot; is a dot-delimited path to the subtree.  Some
examples are given below.</p>
<pre>
    ($full_name)   = $object-&gt;at('Full_name');
    @address_lines = $object-&gt;at('Address.Mail');</pre>
<p>The second line above is equivalent to:</p>
<pre>
    @address = $object-&gt;at('Address')-&gt;at('Mail');</pre>
<p>Called without a tag name, <code>at()</code> just dereferences the object,
returning whatever is to the right of it, the same as
$object-&gt;right</p>
<p>If a path component already has a dot in it, you may escape the dot
with a backslash, as in:</p>
<pre>
    $s=$db-&gt;fetch('Sequence','M4');
    @homologies = $s-&gt;at('Homol.DNA_homol.yk192f7\.3';</pre>
<p>This also demonstrates that path components don't necessarily have to
be tags, although in practice they usually are.</p>
<p><code>at()</code> returns slightly different results depending on the context in
which it is called.  In a list context, it returns the column of
values to the <strong>right</strong> of the tag.  However, in a scalar context, it
returns the subtree rooted at the tag.  To appreciate the difference,
consider these two cases:</p>
<pre>
    $name1   = $object-&gt;at('Full_name');
    ($name2) = $object-&gt;at('Full_name');</pre>
<p>After these two statements run, $name1 will be the tag object named
&quot;Full_name&quot;, and $name2 will be the text object &quot;Jean Thierry-Mieg&quot;,
The relationship between the two is that $name1-&gt;right leads to
$name2.  This is a powerful and useful construct, but it can be a trap
for the unwary.  If this behavior drives you crazy, use this
construct:</p>
<pre>

    $name1   = $object-&gt;at('Full_name')-&gt;at();</pre>
<p>For finer control over navigation, path components can include
optional indexes to indicate navigation to the right of the current
path component.  Here is the syntax:</p>
<pre>
    $object-&gt;at('tag1[index1].tag2[index2].tag3[index3]...');</pre>
<p>Indexes are zero-based.  An index of [0] indicates no movement
relative to the current component, and is the same as not using an
index at all.  An index of [1] navigates one step to the right, [2]
moves two steps to the right, and so on.  Using the Thierry-Mieg
object as an example again, here are the results of various indexes:</p>
<pre>
    $object = $db-&gt;fetch(Author,&quot;Thierry-Mieg J&quot;);
    $a = $object-&gt;at('Address[0]')   --&gt; &quot;Address&quot;
    $a = $object-&gt;at('Address[1]')   --&gt; &quot;Mail&quot;
    $a = $object-&gt;at('Address[2]')   --&gt; &quot;CRBM duCNRS&quot;</pre>
<p>In an array context, the last index in the path does something very
interesting.  It returns the entire column of data K steps to the
right of the path, where K is the index.  This is used to implement
so-called &quot;tag[2]&quot; syntax, and is very useful in some circumstances.
For example, here is a fragment of code to return the Thierry-Mieg
object's full address without having to refer to each of the
intervening &quot;Mail&quot;, &quot;E_Mail&quot; and &quot;Phone&quot; tags explicitly.</p>
<pre>
   @address = $object-&gt;at('Address[2]');
   --&gt; ('CRBM duCNRS','BP 5051','34033 Montpellier','FRANCE',
        'mieg@kaa.cnrs-mop.fr,'33-67-613324','33-67-521559')</pre>
<p>Similarly, &quot;tag[3]&quot; will return the column of data three hops to the
right of the tag.  &quot;tag[1]&quot; is identical to &quot;tag&quot; (with no index), and
will return the column of data to the immediate right.  There is no
special behavior associated with using &quot;tag[0]&quot; in an array context;
it will always return the subtree rooted at the indicated tag.</p>
<p>Internal indices such as &quot;Homol[2].BLASTN&quot;, do not have special
behavior in an array context.  They are always treated as if they were
called in a scalar context.</p>
<p>Also see <strong>col()</strong> and <strong>get()</strong>.</p>
<p>
</p>
<h2><a name="get___method"><code>get()</code> method</a></h2>
<pre>
    $subtree    = $object-&gt;get($tag);
    @values     = $object-&gt;get($tag);
    @values     = $object-&gt;get($tag, $position);
    @values     = $object-&gt;get($tag =&gt; $subtag, $position);</pre>
<p>The <code>get()</code> method will perform a breadth-first search through the
object (columns first, followed by rows) for the tag indicated by the
argument, returning the column of the portion of the subtree it points
to.  For example, this code fragment will return the value of the
&quot;Fax&quot; tag.</p>
<pre>
    ($fax_no) = $object-&gt;get('Fax');
         --&gt; &quot;33-67-521559&quot;</pre>
<p>The list versus scalar context semantics are the same as in <code>at()</code>, so
if you want to retrieve the scalar value pointed to by the indicated
tag, either use a list context as shown in the example, above, or a
dereference, as in:</p>
<pre>
     $fax_no = $object-&gt;get('Fax');
         --&gt; &quot;Fax&quot;
     $fax_no = $object-&gt;get('Fax')-&gt;at;
         --&gt; &quot;33-67-521559&quot;</pre>
<p>An optional second argument to <strong>get()</strong>, $position, allows you to
navigate the tree relative to the retrieved subtree.  Like the <strong>at()</strong>
navigational indexes, $position must be a number greater than or equal
to zero.  In a scalar context, $position moves rightward through the
tree.  In an array context, $position implements &quot;tag[2]&quot; semantics.</p>
<p>For example:</p>
<pre>
     $fax_no = $object-&gt;get('Fax',0);
          --&gt; &quot;Fax&quot;</pre>
<pre>
     $fax_no = $object-&gt;get('Fax',1);
          --&gt; &quot;33-67-521559&quot;</pre>
<pre>
     $fax_no = $object-&gt;get('Fax',2);
          --&gt; undef  # nothing beyond the fax number</pre>
<pre>
     @address = $object-&gt;get('Address',2);
          --&gt; ('CRBM duCNRS','BP 5051','34033 Montpellier','FRANCE',
               'mieg@kaa.cnrs-mop.fr,'33-67-613324','33-67-521559')</pre>
<p>It is important to note that <strong>get()</strong> 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 &quot;show&quot; command.</p>
<p>This restriction can lead to confusing results.  For example, consider
the following object:</p>
<pre>
 Clone: B0280  Position    Map            Sequence-III  Ends   Left   3569
                                                               Right  3585
                           Pmap           ctg377        -1040  -1024
               Positive    Positive_locus nhr-10
               Sequence    B0280
               Location    RW
               FingerPrint Gel_Number     0
                           Canonical_for  T20H1
                                          K10E5
                           Bands          1354          18</pre>
<p>The following attempt to fetch the left and right positions of the
clone will fail, because the search for the &quot;Left&quot; and &quot;Right&quot; tags
cannot traverse &quot;Sequence-III&quot;, which is an object, not a tag:</p>
<pre>
  my $left = $clone-&gt;get('Left');    # will NOT work
  my $right = $clone-&gt;get('Right');  # neither will this one</pre>
<p>You must explicitly step over the non-tag node in order to make this
query work.  This syntax will work:</p>
<pre>
  my $left = $clone-&gt;get('Map',1)-&gt;get('Left');   # works
  my $left = $clone-&gt;get('Map',1)-&gt;get('Right');  # works</pre>
<p>Or you might prefer to use the tag[2] syntax here:</p>
<pre>
  my($left,$right) = $clone-&gt;get('Map',1)-&gt;at('Ends[2]');</pre>
<p>Although not frequently used, there is a form of <code>get()</code> which allows
you to stack subtags:</p>
<pre>
    $locus = $object-&gt;get('Positive'=&gt;'Positive_locus');</pre>
<p>Only on subtag is allowed.  You can follow this by a position if wish
to offset from the subtag.</p>
<pre>
    $locus = $object-&gt;get('Positive'=&gt;'Positive_locus',1);</pre>
<p>
</p>
<h2><a name="search___method"><code>search()</code> method</a></h2>
<p>This is a deprecated synonym for <code>get()</code>.</p>
<p>
</p>
<h2><a name="autogenerated_access_methods">Autogenerated Access Methods</a></h2>
<pre>
     $scalar = $object-&gt;Name_of_tag;
     $scalar = $object-&gt;Name_of_tag($position);
     @array  = $object-&gt;Name_of_tag;
     @array  = $object-&gt;Name_of_tag($position);
     @array  = $object-&gt;Name_of_tag($subtag=&gt;$position);
     @array  = $object-&gt;Name_of_tag(-fill=&gt;$tag);</pre>
<p>The module attempts to autogenerate data access methods as needed.
For example, if you refer to a method named &quot;Fax&quot; (which doesn't
correspond to any of the built-in methods), then the code will call
the <strong>get()</strong> method to find a tag named &quot;Fax&quot; and return its
contents.</p>
<p>Unlike <code>get()</code>, this method will <strong>always step into objects</strong>.  This
means that:</p>
<pre>
   $map = $clone-&gt;Map;</pre>
<p>will return the Sequence_Map object pointed to by the Clone's Map tag
and not simply a pointer to a portion of the Clone tree.  Therefore
autogenerated methods are functionally equivalent to the following:</p>
<pre>
   $map = $clone-&gt;get('Map')-&gt;fetch;</pre>
<p>The scalar context semantics are also slightly different.  In a scalar
context, the autogenerated function will *always* move one step to the
right.</p>
<p>The list context semantics are identical to <code>get()</code>.  If you want to
dereference all members of a multivalued tag, you have to do so manually:</p>
<pre>
  @papers = $author-&gt;Paper;
  foreach (@papers) { 
    my $paper = $_-&gt;fetch;
    print  $paper-&gt;asString;
  }</pre>
<p>You can provide an optional positional index to rapidly navigate
through the tree or to obtain tag[2] behavior.  In the following
examples, the first two return the object's Fax number, and the third
returns all data two hops to the right of Address.</p>
<pre>
     $object   = $db-&gt;fetch(Author =&gt; 'Thierry-Mieg J');
     ($fax_no) = $object-&gt;Fax;
     $fax_no   = $object-&gt;Fax(1);
     @address  = $object-&gt;Address(2);</pre>
<p>You may also position at a subtag, using this syntax:</p>
<pre>
     $representative = $object-&gt;Laboratory('Representative');</pre>
<p>Both named tags and positions can be combined as follows:</p>
<pre>
     $lab_address = $object-&gt;Laboratory(Address=&gt;2);</pre>
<p>If you provide a -fill=&gt;$tag argument, then the object fetch will
automatically fill the specified subtree, greatly improving
performance.  For example:</p>
<pre>
      $lab_address = $object-&gt;Laboratory(-filled=&gt;'Address');</pre>
<p>** NOTE: In a scalar context, if the node to the right of the tag is
** an object, the method will perform an implicit dereference of the
** object.  For example, in the case of:</p>
<pre>
    $lab = $author-&gt;Laboratory;</pre>
<p>**NOTE: The object returned is the dereferenced Laboratory object, not
a node in the Author object.  You can control this by giving the
autogenerated method a numeric offset, such as <code>Laboratory(0)</code> or
<code>Laboratory(1)</code>.  For backwards compatibility, <code>Laboratory('@')</code> is
equivalent to <code>Laboratory(1)</code>.</p>
<p>The semantics of the autogenerated methods have changed subtly between
version 1.57 (the last stable release) and version 1.62.  In earlier
versions, calling an autogenerated method in a scalar context returned
the subtree rooted at the tag.  In the current version, an implicit
<code>right()</code> and dereference is performed.</p>
<p>
</p>
<h2><a name="fetch___method"><code>fetch()</code> method</a></h2>
<pre>
    $new_object = $object-&gt;fetch;
    $new_object = $object-&gt;fetch($tag);</pre>
<p>Follow object into the database, returning a new object.  This is
the best way to follow object references.  For example:</p>
<pre>
    $laboratory = $object-&gt;at('Laboratory')-&gt;fetch;
    print $laboratory-&gt;asString;</pre>
<p>Because the previous example is a frequent idiom, the optional $tag
argument allows you to combine the two operations into a single one:</p>
<pre>
    $laboratory = $object-&gt;fetch('Laboratory');</pre>
<p>
</p>
<h2><a name="follow___method"><code>follow()</code> method</a></h2>
<pre>
    @papers        = $object-&gt;follow('Paper');
    @filled_papers = $object-&gt;follow(-tag=&gt;'Paper',-filled=&gt;1);
    @filled_papers = $object-&gt;follow(-tag=&gt;'Paper',-filled=&gt;'Author');</pre>
<p>The <code>follow()</code> method will follow a tag into the database, dereferencing
the column to its right and returning the objects resulting from this
operation.  Beware!  If you follow a tag that points to an object,
such as the Author &quot;Paper&quot; tag, you will get a list of all the Paper
objects.  If you follow a tag that points to a scalar, such as
&quot;Full_name&quot;, you will get an empty string.  In a scalar context, this
method will return the number of objects that would have been
followed.</p>
<p>The full named-argument form of this call accepts the arguments
<strong>-tag</strong> (mandatory) and <strong>-filled</strong> (optional).  The former points to
the tag to follow.  The latter accepts a boolean argument or the name
of a subtag.  A numeric true argument will return completely &quot;filled&quot;
objects, increasing network and memory usage, but possibly boosting
performance if you have a high database access latency.
Alternatively, you may provide the name of a tag to follow, in which
case just the named portion of the subtree in the followed objects
will be filled (v.g.)</p>
<p>For backward compatability, if <code>follow()</code> is called without any
arguments, it will act like <code>fetch()</code>.</p>
<p>
</p>
<h2><a name="pick___method"><code>pick()</code> method</a></h2>
<p>Deprecated method.  This has the same semantics as <code>fetch()</code>, which
should be used instead.</p>
<p>
</p>
<h2><a name="col___method"><code>col()</code> method</a></h2>
<pre>
     @column = $object-&gt;col;
     @column = $object-&gt;col($position);</pre>
<p><strong>col()</strong> flattens a portion of the tree by returning the column one
hop to the right of the current subtree. You can provide an additional
positional index to navigate through the tree using &quot;tag[2]&quot; behavior.
This example returns the author's mailing address:</p>
<pre>
  @mailing_address = $object-&gt;at('Address.Mail')-&gt;col();</pre>
<p>This example returns the author's entire address including mail,
e-mail and phone:</p>
<pre>
  @address = $object-&gt;at('Address')-&gt;col(2);</pre>
<p>It is equivalent to any of these calls:</p>
<pre>
  $object-&gt;at('Address[2]');
  $object-&gt;get('Address',2);
  $object-&gt;Address(2);</pre>
<p>Use whatever syntax is most comfortable for you.</p>
<p>In a scalar context, <strong>col()</strong> returns the number of items in the
column.</p>
<p>
</p>
<h2><a name="row___method"><code>row()</code> method</a></h2>
<pre>
     @row=$object-&gt;row();
     @row=$object-&gt;row($position);</pre>
<p><strong>row()</strong> will return the row of data to the right of the object.  The
first member of the list will be the object itself.  In the case of
the &quot;Thierry-Mieg J&quot; object, the example below will return the list
('Address','Mail','CRBM duCNRS').</p>
<pre>
     @row = $object-&gt;Address-&gt;row();</pre>
<p>You can provide an optional position to move rightward one or more
places before retrieving the row.  This code fragment will return
('Mail','CRBM duCNRS'):</p>
<pre>
     @row = $object-&gt;Address-&gt;row(1);</pre>
<p>In a scalar context, <strong>row()</strong> returns the number of items in the row.</p>
<p>
</p>
<h2><a name="asstring___method"><code>asString()</code> method</a></h2>
<pre>
    $object-&gt;asString;</pre>
<p><code>asString()</code> returns a pretty-printed ASCII representation of the object
tree.</p>
<p>
</p>
<h2><a name="astable___method"><code>asTable()</code> method</a></h2>
<pre>
    $object-&gt;asTable;</pre>
<p><code>asTable()</code> returns the object as a tab-delimited text table.</p>
<p>
</p>
<h2><a name="asace___method"><code>asAce()</code> method</a></h2>
<pre>
    $object-&gt;asAce;</pre>
<p><code>asAce()</code> returns the object as a tab-delimited text table in &quot;.ace&quot;
format.</p>
<p>
</p>
<h2><a name="ashtml___method"><code>asHTML()</code> method</a></h2>
<pre>
   $object-&gt;asHTML;
   $object-&gt;asHTML(\&amp;tree_traversal_code);</pre>
<p><code>asHTML()</code> returns an HTML 3 table representing the object, suitable for
incorporation into a Web browser page.  The callback routine, if
provided, will have a chance to modify the object representation
before it is incorporated into the table, for example by turning it
into an HREF link.  The callback takes a single argument containing
the object, and must return a string-valued result.  It may also
return a list as its result, in which case the first member of the
list is the string representation of the object, and the second
member is a boolean indicating whether to prune the table at this
level.  For example, you can prune large repetitive lists.</p>
<p>Here's a complete example:</p>
<pre>
   sub process_cell {
     my $obj = shift;
     return &quot;$obj&quot; unless $obj-&gt;isObject || $obj-&gt;isTag;</pre>
<pre>
     my @col = $obj-&gt;col;
     my $cnt = scalar(@col);
     return (&quot;$obj -- $cnt members&quot;,1);  # prune
            if $cnt &gt; 10                 # if subtree to big</pre>
<pre>
     # tags are bold
     return &quot;&lt;B&gt;$obj&lt;/B&gt;&quot; if $obj-&gt;isTag;</pre>
<pre>
     # objects are blue
     return qq{&lt;FONT COLOR=&quot;blue&quot;&gt;$obj&lt;/FONT&gt;} if $obj-&gt;isObject; 
   }</pre>
<pre>
   $object-&gt;asHTML(\&amp;process_cell);</pre>
<p>
</p>
<h2><a name="asxml___method"><code>asXML()</code> method</a></h2>
<pre>
   $result = $object-&gt;asXML;</pre>
<p><code>asXML()</code> returns a well-formed XML representation of the object.  The
particular representation is still under discussion, so this feature
is primarily for demonstration.</p>
<p>
</p>
<h2><a name="asgif___method"><code>asGIF()</code> method</a></h2>
<pre>
  ($gif,$boxes) = $object-&gt;asGIF();
  ($gif,$boxes) = $object-&gt;asGIF(-clicks=&gt;[[$x1,$y1],[$x2,$y2]...]
                                 -dimensions=&gt; [$width,$height],
                                 -coords    =&gt; [$top,$bottom],
                                 -display   =&gt; $display_type,
                                 -view      =&gt; $view_type,
                                 -getcoords =&gt; $true_or_false
                                 );</pre>
<p><code>asGIF()</code> returns the object as a GIF image.  The contents of the GIF
will be whatever xace would ordinarily display in graphics mode, and
will vary for different object classes.</p>
<p>You can optionally provide asGIF with a <strong>-clicks</strong> argument to
simulate the action of a user clicking on the image.  The click
coordinates should be formatted as an array reference that contains a
series of two-element subarrays, each corresponding to the X and Y
coordinates of a single mouse click.  There is currently no way to
pass information about middle or right mouse clicks, dragging
operations, or keystrokes.  You may also specify a <strong>-dimensions</strong> to
control the width and height of the returned GIF.  Since there is no
way of obtaining the preferred size of the image in advance, this is
not usually useful.</p>
<p>The optional <strong>-display</strong> argument allows you to specify an alternate
display for the object.  For example, Clones can be displayed either
with the PMAP display or with the TREE display.  If not specified, the
default display is used.</p>
<p>The optional <strong>-view</strong> argument allows you to specify an alternative
view for MAP objects only.  If not specified, you'll get the default
view.</p>
<p>The option <strong>-coords</strong> argument allows you to provide the top and
bottom of the display for MAP objects only.  These coordinates are in
the map's native coordinate system (cM, bp).  By default, AceDB will
show most (but not necessarily all) of the map according to xace's
display rules.  If you call this method with the <strong>-getcoords</strong>
argument and a true value, it will return a two-element array
containing the coordinates of the top and bottom of the map.</p>
<p><code>asGIF()</code> returns a two-element array.  The first element is the GIF
data.  The second element is an array reference that indicates special 
areas of the image called &quot;boxes.&quot;  Boxes are rectangular areas that
surround buttons, and certain displayed objects.  Using the contents
of the boxes array, you can turn the GIF image into a client-side
image map.  Unfortunately, not everything that is clickable is
represented as a box.  You still have to pass clicks on unknown image
areas back to the server for processing.</p>
<p>Each box in the array is a hash reference containing the following
keys:</p>
<pre>
    'coordinates'  =&gt; [$left,$top,$right,$bottom]
    'class'        =&gt; object class or &quot;BUTTON&quot;
    'name'         =&gt; object name, if any
    'comment'      =&gt; a text comment of some sort</pre>
<p><em>coordinates</em> points to an array of points indicating the top-left and 
bottom-right corners of the rectangle.  <em>class</em> indicates the class
of the object this rectangle surrounds.  It may be a database object,
or the special word &quot;BUTTON&quot; for one of the display action buttons.
<em>name</em> indicates the name of the object or the button.  <em>comment</em> is 
some piece of information about the object in question.  You can
display it in the status bar of the browser or in a popup window if
your browser provides that facility.</p>
<p>
</p>
<h2><a name="asdna___and_aspeptide___methods"><code>asDNA()</code> and <code>asPeptide()</code> methods</a></h2>
<pre>
    $dna = $object-&gt;asDNA();
    $peptide = $object-&gt;asPeptide();</pre>
<p>If you are dealing with a sequence object of some sort, these methods
will return strings corresponding to the DNA or peptide sequence in
FASTA format.</p>
<p>
</p>
<h2><a name="add_row___method"><code>add_row()</code> method</a></h2>
<pre>
    $result_code = $object-&gt;add_row($tag=&gt;$value);    
    $result_code = $object-&gt;add_row($tag=&gt;[list,of,values]);    
    $result_code = $object-&gt;add(-path=&gt;$tag,
                                -value=&gt;$value);</pre>
<p><code>add_row()</code> updates the tree by adding data to the indicated tag path.  The
example given below adds the value &quot;555-1212&quot; to a new Address entry
named &quot;Pager&quot;.  You may call <code>add_row()</code> a second time to add a new value
under this tag, creating multi-valued entries.</p>
<pre>
 $object-&gt;add_row('Address.Pager'=&gt;'555-1212');</pre>
<p>You may provide a list of values to add an entire row of data.  For
example:</p>
<pre>
 $sequence-&gt;add_row('Assembly_tags'=&gt;['Finished Left',38949,38952,'AC3']);</pre>
<p>Actually, the array reference is not entirely necessary, and if you
prefer you can use this more concise notation:</p>
<pre>
 $sequence-&gt;add_row('Assembly_tags','Finished Left',38949,38952,'AC3');</pre>
<p>No check is done against the database model for the correct data type
or tag path.  The update isn't actually performed until you call
<code>commit()</code>, at which time a result code indicates whether the database
update was successful.</p>
<p>You may create objects that reference other objects this way:</p>
<pre>
    $lab = new Ace::Object('Laboratory','LM',$db);
    $lab-&gt;add_row('Full_name','The Laboratory of Medicine');
    $lab-&gt;add_row('City','Cincinatti');
    $lab-&gt;add_row('Country','USA');</pre>
<pre>
    $author = new Ace::Object('Author','Smith J',$db);
    $author-&gt;add_row('Full_name','Joseph M. Smith');
    $author-&gt;add_row('Laboratory',$lab);</pre>
<pre>
    $lab-&gt;commit();
    $author-&gt;commit();</pre>
<p>The result code indicates whether the addition was syntactically
correct.  <code>add_row()</code> will fail if you attempt to add a duplicate entry
(that is, one with exactly the same tag and value).  In this case, use
<code>replace()</code> instead.  Currently there is no checking for an attempt to
add multiple values to a single-valued (UNIQUE) tag.  The error will
be detected and reported at <code>commit()</code> time however.</p>
<p>The <code>add()</code> method is an alias for <code>add_row()</code>.</p>
<p>See also the Ace-&gt;<code>new()</code> method.</p>
<p>
</p>
<h2><a name="add_tree__"><code>add_tree()</code></a></h2>
<pre>
  $result_code = $object-&gt;add_tree($tag=&gt;$ace_object);
  $result_code = $object-&gt;add_tree(-tag=&gt;$tag,-tree=&gt;$ace_object);</pre>
<p>The <code>add_tree()</code> method will insert an entire Ace subtree into the object
to the right of the indicated tag.  This can be used to build up
complex Ace objects, or to copy portions of objects from one database
to another.  The first argument is a tag path, and the second is the
tree that you wish to insert.  As with <code>add_row()</code> the database will
only be updated when you call <code>commit()</code>.</p>
<p>When inserting a subtree, you must be careful to remember that
everything to the *right* of the node that you are pointing at will be
inserted; not the node itself.  For example, given this Sequence
object:</p>
<pre>
  Sequence AC3
    DB_info     Database    EMBL
    Assembly_tags   Finished Left   1   4   AC3
                    Clone left end      1   4   AC3
                    Clone right end     5512    5515    K07C5
                                        38949   38952   AC3
                    Finished Right      38949   38952   AC3</pre>
<p>If we use at('Assembly_tags') to fetch the subtree rooted on the
&quot;Assembly_tags&quot; tag, it is the tree to the right of this tag,
beginning with &quot;Finished Left&quot;, that will be inserted.</p>
<p>Here is an example of copying the &quot;Assembly_tags&quot; subtree
from one database object to another:</p>
<pre>
 $remote = Ace-&gt;connect(-port=&gt;200005)  || die &quot;can't connect&quot;;
 $ac3 = $remote-&gt;fetch(Sequence=&gt;'AC3') || die &quot;can't get AC7&quot;;
 my $assembly = $ac3-&gt;at('Assembly_tags');</pre>
<pre>
 $local = Ace-&gt;connect(-path=&gt;'~acedb') || die &quot;can't connect&quot;;
 $AC3copy = Ace::Object-&gt;new(Sequence=&gt;'AC3copy',$local);
 $AC3copy-&gt;add_tree('Assembly_tags'=&gt;$tags);
 $AC3copy-&gt;commit || warn $AC3copy-&gt;error;</pre>
<p>Notice that this syntax will not work the way you think it should:</p>
<pre>
 $AC3copy-&gt;add_tree('Assembly_tags'=&gt;$ac3-&gt;at('Assembly_tags'));</pre>
<p>This is because call <code>at()</code> in an array context returns the column to
the right of the tag, not the tag itself.</p>
<p>Here's an example of building up a complex structure from scratch
using a combination of <code>add()</code> and add_tree():</p>
<pre>
 $newObj = Ace::Object-&gt;new(Sequence=&gt;'A555',$local);
 my $assembly = Ace::Object-&gt;new(tag=&gt;'Assembly_tags');
 $assembly-&gt;add('Finished Left'=&gt;[10,20,'ABC']);
 $assembly-&gt;add('Clone right end'=&gt;[1000,2000,'DEF']);
 $assembly-&gt;add('Clone right end'=&gt;[8000,9876,'FRED']);
 $assembly-&gt;add('Finished Right'=&gt;[1000,3000,'ETHEL']);
 $newObj-&gt;add_tree('Assembly_tags'=&gt;$assembly);
 $newObj-&gt;commit || warn $newObj-&gt;error;</pre>
<p>
</p>
<h2><a name="delete___method"><code>delete()</code> method</a></h2>
<pre>
    $result_code = $object-&gt;delete($tag_path,$value);
    $result_code = $object-&gt;delete(-path=&gt;$tag_path,
                                   -value=&gt;$value);</pre>
<p>Delete the indicated tag and value from the object.  This example
deletes the address line &quot;FRANCE&quot; from the Author's mailing address:</p>
<pre>
    $object-&gt;delete('Address.Mail','FRANCE');</pre>
<p>No actual database deletion occurs until you call <code>commit()</code>.  The
<code>delete()</code> result code indicates whether the deletion was successful.
Currently it is always true, since the database model is not checked.</p>
<pre>

=head2 replace() method</pre>
<pre>
    $result_code = $object-&gt;replace($tag_path,$oldvalue,$newvalue);
    $result_code = $object-&gt;replace(-path=&gt;$tag_path,
                                    -old=&gt;$oldvalue,
                                    -new=&gt;$newvalue);</pre>
<p>Replaces the indicated tag and value with the new value.  This example
changes the address line &quot;FRANCE&quot; to &quot;LANGUEDOC&quot; in the Author's
mailing address:</p>
<pre>
    $object-&gt;delete('Address.Mail','FRANCE','LANGUEDOC');</pre>
<p>No actual database changes occur until you call <code>commit()</code>.  The
<code>delete()</code> result code indicates whether the replace was successful.
Currently is true if the old value was identified.</p>
<p>
</p>
<h2><a name="commit___method"><code>commit()</code> method</a></h2>
<pre>
     $result_code = $object-&gt;commit;</pre>
<p>Commits all <code>add()</code>, <code>replace()</code> and <code>delete()</code> operations to the database.
It can also be used to write a completely new object into the
database.  The result code indicates whether the object was
successfully written.  If an error occurred, further details can be
found in the Ace-&gt;<code>error()</code> error string.</p>
<p>
</p>
<h2><a name="rollback___method"><code>rollback()</code> method</a></h2>
<pre>
    $object-&gt;rollback;</pre>
<p>Discard all adds, deletions and replacements, returning the object to
the state it was in prior to the last <code>commit()</code>.</p>
<p><code>rollback()</code> works by deleting the object from Perl memory and fetching
the object anew from AceDB.  If someone has changed the object in the
database while you were working with it, you will see this version,
ot the one you originally fetched.</p>
<p>If you are creating an entirely new object, you <em>must</em> add at least
one tag in order to enter the object into the database.</p>
<p>
</p>
<h2><a name="kill___method"><code>kill()</code> method</a></h2>
<pre>
    $result_code = $object-&gt;kill;</pre>
<p>This will remove the object from the database immediately and
completely.  It does not wait for a <code>commit()</code>, and does not respond to
a <code>rollback()</code>.  If successful, you will be left with an empty object
that contains just the class and object names.  Use with care!</p>
<p>In the case of failure, which commonly happens when the database is
not open for writing, this method will return undef.  A description of
the problem can be found by calling the <code>error()</code> method.</p>
<p>
</p>
<h2><a name="date_style___method"><code>date_style()</code> method</a></h2>
<pre>
   $object-&gt;date_style('ace');</pre>
<p>This is a convenience method that can be used to set the date format
for all objects returned by the database.  It is exactly equivalent to</p>
<pre>
   $object-&gt;db-&gt;date_style('ace');</pre>
<p>Note that the text representation of the date will change for all
objects returned from this database, not just the current one.</p>
<p>
</p>
<h2><a name="isroot___method"><code>isRoot()</code> method</a></h2>
<pre>
    print &quot;Top level object&quot; if $object-&gt;isRoot;</pre>
<p>This method will return true if the object is a &quot;top level&quot; object,
that is the root of an object tree rather than a subtree.</p>
<p>
</p>
<h2><a name="model___method"><code>model()</code> method</a></h2>
<pre>
    $model = $object-&gt;model;</pre>
<p>This method will return the object's model as an Ace::Model object, or
undef if the object does not have a model. See <a href="/AcePerl/docs/./Ace/Model.html">the Ace::Model manpage</a> for
details.</p>
<p>
</p>
<h2><a name="timestamp___method"><code>timestamp()</code> method</a></h2>
<pre>
   $stamp = $object-&gt;timestamp;</pre>
<p>The <strong>timestamp()</strong> method will retrieve the modification time and date
from the object.  This works both with top level objects and with
subtrees.  Timestamp handling must be turned on in the database, or
<strong>timestamp()</strong> will return undef.</p>
<p>The returned timestamp is actually a UserSession object which can be
printed and explored like any other object.  However, there is
currently no useful information in UserSession other than its name.</p>
<p>
</p>
<h2><a name="comment___method"><code>comment()</code> method</a></h2>
<pre>
   $comment = $object-&gt;comment;</pre>
<p>This returns the comment attached to an object or object subtree, if
any.  Comments are <em>Comment</em> objects and have the interesting
property that a single comment can refer to multiple objects.  If
there is no comment attached to the current subtree, this method will
return undef.</p>
<p>Currently you cannot create a new comment in AcePerl or edit an old
one.</p>
<p>
</p>
<h2><a name="error___method"><code>error()</code> method</a></h2>
<pre>

    $error = $object-&gt;error;</pre>
<p>Returns the error from the previous operation, if any.  As in
Ace::error(), this string will only have meaning if the previous
operation returned a result code indicating an error.</p>
<p>
</p>
<h2><a name="factory___method"><code>factory()</code> method</a></h2>
<p>WARNING - THIS IS DEFUNCT AND NO LONGER WORKS.  USE THE Ace-&gt;<code>class()</code> METHOD INSTEAD</p>
<pre>
    $package = $object-&gt;factory;</pre>
<p>When a root Ace object instantiates its tree of tags and values, it
creates a hierarchical structure of Ace::Object objects.  The
<code>factory()</code> method determines what class to bless these subsidiary
objects into.  By default, they are Ace::Object objects, but you can
override this method in a child class in order to create more
specialized Ace::Object classes.  The method should return a string
corresponding to the package to bless the object into.  It receives
the current Ace::Object as its first argument.</p>
<p>
</p>
<h2><a name="debug___method"><code>debug()</code> method</a></h2>
<pre>
    $object-&gt;debug(1);</pre>
<p>Change the debugging mode.  A zero turns off debugging messages.
Integer values produce debug messages on standard error.  Higher
integers produce progressively more verbose messages.  This actually
is just a front end to Ace-&gt;<code>debug()</code>, so the debugging level is global.</p>
<p>
</p>
<hr />
<h1><a name="see_also">SEE ALSO</a></h1>
<p><a href="/AcePerl/docs/./Ace.html">the Ace manpage</a>, <a href="/AcePerl/docs/./Ace/Model.html">the Ace::Model manpage</a>, <a href="/AcePerl/docs/./Ace/Object.html">the Ace::Object manpage</a>, <a href="/AcePerl/docs/./Ace/Local.html">the Ace::Local manpage</a>,
<a href="/AcePerl/docs/./Ace/Sequence.html">the Ace::Sequence manpage</a>,<a href="/AcePerl/docs/./Ace/Sequence/Multi.html">the Ace::Sequence::Multi manpage</a></p>
<p>
</p>
<hr />
<h1><a name="author">AUTHOR</a></h1>
<p>Lincoln Stein &lt;<a href="mailto:lstein@cshl.org">lstein@cshl.org</a>&gt; with extensive help from Jean
Thierry-Mieg &lt;<a href="mailto:mieg@kaa.crbm.cnrs-mop.fr">mieg@kaa.crbm.cnrs-mop.fr</a>&gt;</p>
<p>Copyright (c) 1997-1998, Lincoln D. Stein</p>
<p>This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.  See DISCLAIMER.txt for
disclaimers of warranty.</p>

</body>

</html>