Commit f7720c28 authored by Marco Antoniotti's avatar Marco Antoniotti

*** empty log message ***

parents
# CVS default ignores begin
tags
TAGS
.make.state
.nse_depinfo
*~
#*
.#*
,*
_$*
*$
*.old
*.bak
*.BAK
*.orig
*.rej
.del-*
*.a
*.olb
*.o
*.obj
*.so
*.exe
*.Z
*.elc
*.ln
core
# CVS default ignores end
Copyright (c) 2004-2005 Marco Antoniotti, Samantha Kleinberg
All rights reserved.
Permission is hereby granted, without written agreement and without
license or royalty fees, to use, copy, modify, and distribute this
software and its documentation for any purpose, provided that the
above copyright notice and the following two paragraphs appear in all
copies of this software.
IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE TO ANY PARTY FOR DIRECT,
INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF
THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE AUTHOR(S),
HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
THE AUTHOR(S) UNIVERSITY, COMPANY AND/OR AFFILIATION SPECIFICALLY
DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND
THE AUTHOR(S) HAVE NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT,
UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
CL-GODB
The Gene Ontology (GO), is a controlled vocabulary used to aid the
description of gene and gene product attributes in a variety of
organisms. There are three different ontologies that describe
molecular functions, biological processes, and cellular components.
CL-GODB provides a new way to access and interact with the GO
Database. As queries are made, the results are indexed locally.
This indexing makes successive queries faster, requiring fewer
database accesses. In addition to the library of functions, there
is a graphical interface that allows the user to browse the database
in tree form.
Requirements:
GO Database -- which requires MySQL.
Lispworks Enterprise Edition 4.2 or higher -- this restriction will
be removed soon by making sure that the MySQL connection works
on the freely available CL-SQL.
Last Update: 2005-08-01
Contact: marcoxa at cs.nyu.edu, sjk267 at nyu.edu
Copyright 2005 Marco Antoniotti, Samantha Kleinberg
;;; -*- Mode: Lisp -*-
(in-package "GODB")
(eval-when (:compile-toplevel :load-toplevel :execute)
(require "sql")
(require "odbc"))
#.(sql:enable-sql-reader-syntax)
(defclass association ()
((id :accessor assoc-id :initarg :assoc-id)
(term-id :accessor assoc-term-id :initarg :assoc-term-id)
(gene-product-id :accessor gene-product-id :initarg :gene-product-id)
(is-not :accessor assoc-is-not :initarg :is-not)
(role-group :accessor assoc-role-group :initarg :assoc-role-group)
(acc :accessor assoc-acc :initarg :assoc-acc)
)
(:documentation "The Association Class.
This class is a representation of the association table in the go database, with the addition
of a slot for the accession."))
)
(defgeneric association-list (gh go-acc)
(:documentation "Gets associations for a given accession number.
arguments: go handle, accession
usage: (godb:association-list mygohandle ""GO:0000124"")
returns: list of objects of type association that match the term id for the
supplied accession number
notes: Creates objects of type 'association' and then indexes them in the hash
on both accession and gene-product-id"))
(defgeneric associations-by-gene-prod (gh gene-prod-id)
(:documentation "Gets associations for a given gene product id.
arguments: go handle, gene product id
usage: (godb:get-association-list mygohandle 16720)
returns: list of objects of type association that match the supplied gene product id
notes: Creates objects of type 'association' and then indexes them in the hash
on both accession and gene-product-id"))
(defgeneric is-association-accession-indexed-p (gh accession)
(:documentation "Checks whether a given accession number is presently indexed.
arguments: go handle, accession number
usage: (godb:is-association-accession-indexed mygohandle ""GO:0000124"")
returns: Value stored in hash if it's indexed, or nothing if it's not
notes: This is a function mostly for use by other functions. It checks
whether or not a given accession number has been stored in the
association-accession index"))
(defgeneric is-association-gene-prod-indexed-p (gh gene-prod-id)
(:documentation "Checks whether a given gene product id is presently indexed.
arguments: go handle, gene product id
usage: (godb:is-association-gene-prod-indexed mygohandle 124)
returns: Value stored in hash if it's indexed, or nothing if it's not
notes: This is a function mostly for use by other functions. It checks
whether or not a given gene-product-id has been stored in the
association-gene-product index"))
(defgeneric index-association-by-accession (gh new-association accession)
(:documentation "Adds the given association to the hash table, indexed by its accession number.
arguments: go handle, association (i.e. of type association), accession number
usage: (godb:index-association-by-accession mygohandle myassociation ""GO:0000124"")
returns: -"))
(defgeneric index-association-by-gene-prod (gh new-association gene-prod-id)
(:documentation "Adds the given association to the hash table, indexed by its gene product
arguments: go handle, association (i.e. of type association), gene product id
usage: (godb:index-association-by-gene-prod mygohandle myassociation 124)
returns: -"))
(defun create-association (id term-id gene-product-id is-not role-group acc)
"Makes a new object of type association, given the inputs for the slots"
(make-instance 'association
:assoc-id id
:assoc-term-id term-id
:gene-product-id gene-product-id
:is-not is-not
:assoc-role-group role-group
:assoc-acc acc
))
(defmethod association-list ((gh go-handle) go-acc)
(let ((index (is-association-accession-indexed-p gh go-acc)))
(if index
index
(let ((associations (sql:select [association.id] [association.term_id] [association.gene_product_id]
[association.is_not] [association.role_group] [term.acc]
:from '([term] [association])
:where [and [= go-acc [term.acc]]
[= [term.id] [association.term_id]]]
:database (connection gh))))
(when associations
(let* ((assoc-list nil) (go-acc (intern go-acc "GODB")))
(dolist (x associations)
(let ((new-assoc (make-instance 'association
:assoc-id (first x)
:assoc-term-id (nth 1 x)
:gene-product-id (nth 2 x)
:is-not (nth 3 x)
:assoc-role-group (nth 4 x)
:assoc-acc (nth 5 x))))
(index-association-by-gene-prod gh new-assoc (gene-product-id new-assoc))
(push new-assoc assoc-list)))
(index-association-by-accession gh assoc-list go-acc)
assoc-list))))))
(defmethod associations-by-gene-prod ((gh go-handle) (gene-prod-id integer))
(let ((index (is-association-gene-prod-indexed-p gh gene-prod-id)))
(if index
index
(let ((associations (sql:select [association.id] [association.term_id] [association.gene_product_id]
[association.is_not] [association.role_group] [term.acc]
:from '([term] [association])
:where [and [= gene-prod-id [association.gene_product_id]]
[= [term.id] [association.term_id]]]
:database (connection gh)
:distinct t)))
(when associations
(let* ((assoc-list nil))
(dolist (x associations)
(let ((new-assoc (make-instance 'association
:assoc-id (first x)
:assoc-term-id (second x)
:gene-product-id (third x)
:is-not (fourth x)
:assoc-role-group (fifth x)
:assoc-acc (intern (sixth x) "GODB"))))
(index-association-by-accession gh new-assoc (assoc-acc new-assoc))
(push new-assoc assoc-list)))
(index-association-by-gene-prod gh assoc-list gene-prod-id)
assoc-list))))))
(defmethod is-association-accession-indexed-p ((gh go-handle) (accession symbol))
(multiple-value-bind (value found)
(gethash accession (association-accession-index gh))
(when found value))
)
(defmethod is-association-accession-indexed-p ((gh go-handle) (accession string))
(multiple-value-bind (value found)
(gethash (intern accession "GODB") (association-accession-index gh))
(when found value))
)
(defmethod is-association-gene-prod-indexed-p ((gh go-handle) gene-prod-id)
(multiple-value-bind (value found)
(gethash gene-prod-id (association-gene-prod-index gh))
(when found value))
)
(defmethod index-association-by-accession ((gh go-handle) new-association accession)
(setf (gethash accession (association-accession-index gh)) new-association)
)
(defmethod index-association-by-gene-prod ((gh go-handle) new-association gene-prod-id)
(setf (gethash gene-prod-id (association-gene-prod-index gh)) new-association)
)
#.(sql:disable-sql-reader-syntax)
;;; end of file -- association.lisp --
;;; -*- Mode: Lisp -*-
(mk:defsystem "CL-GODB"
:components ("godb-package"
(:file "godb" :depends-on ("godb-package"))
"graph"
"relationship"
"geneproduct"
"association"
))
;;; end of file -- cl-godb.system --
<html>
<head>
<title>CL-GODB Dictionary</title>
<link rel="stylesheet" href="style.css">
<!--[if IE]>
<style>
.header {
border: 0px;
width: 100%;
}
#main #menu {
margin:10px 0px 0px 0px;
}
.content
{
background: #ffffff;
margin-top: 0px;
padding: 0px 0px 10px 155px;
}
.navigation
{
width: 90%;
top: -1px;
word-spacing: 5px;
position: relative;
text-align: right;
}
</style>
<![endif]-->
</head>
<body>
<div id="main">
<div class="header"
style="font-family:=Verdana,Arial,Helvetica; font-size: 18px; color: #993333;">
<strong><i>CL-GODB Dictionary</i></strong>
<div class="navigation">
<a href="index.html" class="navigation-link-selected">Home</a>
| <a href="dictionary.html" class="navigation-link">Dictionary</a>
| <a href="downloads.html" class="navigation-link">Downloads</a>
| <a href="installation.html" class="navigation-link">Installation</a>
| <a href="links.html" class="navigation-link">Links</a>
</div>
<div class="black-line"><img src="images/shim.gif" height="1" width="1"></div>
<div class="middle-bar"><img src="images/shim.gif" height="5" width="1"></div>
<div class="black-line"><img src="images/shim.gif" height="1" width="1"></div>
</div>
<div class="content">
<div class="text">
<h1>CL-GODB Dictionary</h1>
<p>The following entries are part of the <strong>CL-GODB</strong>
dictionary.</p>
<ul>
<li><a href="dictionary/CL-GODB-package.html"><i>Package</i> <b>CL-GODB</b></a>
<li><a href="dictionary/term.html"><i>Standard Class</i> <b>term</b></a>
<li><a href="dictionary/go-handle.html"><i>Standard Class</i> <b>go-handle</b></a>
<li><a href="dictionary/sqlcon.html"><i>Function</i> <b>sqlcon</b></a>
<li><a href="dictionary/connect.html"><i>Function</i> <b>connect</b></a>
<li><a href="dictionary/get-root-terms.html"><i>Function</i> <b>get-root-terms</b></a>
<li><a href="dictionary/get-term.html"><i>Generic function</i> <b>get-term</b></a>
<li><a href="dictionary/get-term-by-acc.html"><i>Generic function</i> <b>get-term-by-acc</b></a>
<li><a href="dictionary/get-term-by-name.html"><i>Generic function</i> <b>get-term-by-name</b></a>
<li><a href="dictionary/get-name.html"><i>Generic function</i> <b>get-name</b></a>
<li><a href="dictionary/has-synonym-p.html"><i>Generic function</i> <b>has-synonym-p</b></a>
<li><a href="dictionary/index-term-by-id.html"><i>Generic function</i> <b>index-term-by-id</b></a>
<li><a href="dictionary/index-term-by-accession.html"><i>Generic function</i> <b>index-term-by-accession</b></a>
<li><a href="dictionary/index-term-by-name.html"><i>Generic function</i> <b>index-term-by-name</b></a>
<li><a href="dictionary/is-term-id-indexed-p.html"><i>Generic function</i> <b>is-term-id-indexed-p</b></a>
<li><a href="dictionary/is-term-accession-indexed-p.html"><i>Generic function</i> <b>is-term-accession-indexed-p</b></a>
<li><a href="dictionary/is-term-name-indexed-p.html"><i>Generic function</i> <b>is-term-name-indexed-p</b></a>
</ul>
<ul>
<li><a href="dictionary/relationship.html"><i>Standard Class</i> <b>relationship</b></a>
<li><a href="dictionary/count-all-nodes.html"><i>Function</i> <b>count-all-nodes</b></a>
<li><a href="dictionary/n-children.html"><i>Generic Function</i> <b>n-children</b></a>
<li><a href="dictionary/n-parents.html"><i>Generic Function</i> <b>n-parents</b></a>
<li><a href="dictionary/get-child-relationships.html"><i>Generic Function</i> <b>get-child-relationships</b></a>
<li><a href="dictionary/get-parent-relationships.html"><i>Generic Function</i> <b>get-parent-relationships</b></a>
<li><a href="dictionary/get-relationships.html"><i>Generic Function</i> <b>get-relationships</b></a>
<li><a href="dictionary/get-child-terms.html"><i>Generic Function</i> <b>get-child-terms</b></a>
<li><a href="dictionary/get-parent-terms.html"><i>Generic Function</i> <b>get-parent-terms</b></a>
<li><a href="dictionary/get-container-terms.html"><i>Generic Function</i> <b>get-container-terms</b></a>
<li><a href="dictionary/get-component-terms.html"><i>Generic Function</i> <b>get-component-terms</b></a>
<li><a href="dictionary/get-all-ancestors"><i>Generic Function</i> <b>get-all-ancestors</b></a>
<li><a href="dictionary/get-all-descendants"><i>Generic Function</i> <b>get-all-descendants</b></a>
<li><a href="dictionary/is-leaf-node.html"><i>Generic Function</i> <b>is-leaf-node</b></a>
</ul>
<ul>
<li><a href="dictionary/association.html"><i>Standard Class</i> <b>association</b></a>
<li><a href="dictionary/association-list.html"><i>Generic Function</i> <b>association-list</b></a>
<li><a href="dictionary/associations-by-gene-prod.html"><i>Generic Function</i> <b>associations-by-gene-prod</b></a>
<li><a href="dictionary/is-association-accession-indexed-p.html"><i>Generic Function</i> <b>is-association-accession-indexed-p</b></a>
<li><a href="dictionary/is-association-gene-prod-indexed-p.html"><i>Generic Function</i> <b>is-association-gene-prod-indexed-p</b></a>
<li><a href="dictionary/index-association-by-accession.html"><i>Generic Function</i> <b>index-association-by-accession</b></a>
<li><a href="dictionary/index-association-by-gene-prod.html"><i>Generic Function</i> <b>index-association-by-gene-prod</b></a>
</ul>
<ul>
<li><a href="dictionary/gene-product.html"><i>Standard Class</i> <b>gene-product</b></a>
<li><a href="dictionary/gene-prod-go-accessions.html"><i>Generic Function</i> <b>gene-prod-go-accessions</b></a>
<li><a href="dictionary/go-accession-gene-products.html"><i>Generic Function</i> <b>go-accession-gene-products</b></a>
<li><a href="dictionary/term-gene-products.html"><i>Generic Function</i> <b>term-gene-products</b></a>
<li><a href="dictionary/synonym-list.html"><i>Generic Function</i> <b>synonym-list</b></a>
<li><a href="dictionary/species-db.html"><i>Generic Function</i> <b>species-db</b></a>
<li><a href="dictionary/term-type.html"><i>Generic Function</i> <b>term-type</b></a>
<li><a href="dictionary/is-gene-product-symbol-indexed-p.html"><i>Generic Function</i> <b>is-gene-product-symbol-indexed-p</b></a>
<li><a href="dictionary/index-gene-product-by-symbol.html"><i>Generic Function</i> <b>index-gene-product-by-symbol</b></a>
</ul>
<ul>
<li><a href="dictionary/view-cl-godb.html"><i>Generic Function</i> <b>view-cl-godb</b>/a></li>
</ul>
<!--
;;; Copyright (c) 2005 Samantha Kleinberg, All rights reserved.
;;;
;;; Permission to use, modify, and redistribute this code is hereby
;;; granted.
;;; The code is provided AS IS with NO warranty whatsoever. The author
;;; will not be held liable etc etc etc etc etc.
-->
<hr>
<p>Questions? Queries? Suggestions? Comments? Please direct them
at <a href="mailto:marcoxa_PROVA_A_SPAMMARME@cs.nyu.edu">me</a>.
</p>
</div>
</div>
<!-- -->
<div class="content">
<div class="text">
<h1>News</h1>
<p>News in chronological order, most recent on top.
</p>
<ul>
<li><strong>2005-07-11</strong><br>
Page updated.
</li>
<li><strong>2005-06-13</strong><br>
Page created.
</li>
</ul>
</div>
</div>
<div class="copyright">
&copy; 2005, Samantha Kleinberg, all rights reserved.
</div>
</div></body>
</html>
<html>
<head>
<title>CL-GODB: Standard Generic Function ASSOCIATION-LIST</title>
<link rel="stylesheet" href="../style.css">
<!--[if IE]>
<style>
.header {
border: 0px;
width: 100%;
}
#main #menu {
margin:10px 0px 0px 0px;
}
.content
{
background: #ffffff;
margin-top: 0px;
padding: 0px 0px 10px 155px;
}
.navigation
{
width: 90%;
top: -1px;
word-spacing: 5px;
position: relative;
text-align: right;
}
</style>
<![endif]-->
</head>
<body><div id="main">
<div class="header"
style="font-family:=Verdana,Arial,Helvetica; font-size: 18px; color: #993333;">
<strong><i>CL-GODB: Standard Generic Function ASSOCIATION-LIST</title></i></strong>
<div class="navigation">
<a href="../index.html" class="navigation-link">Home</a>
| <a href="association.html" class="navigation-link">Previous</a>
| <a href="associations-by-gene-prod.html" class="navigation-link">Next</a>
| <a href="../downloads.html" class="navigation-link">Downloads</a>
| <a href="../links.html" class="navigation-link">Links</a>
</div>
<div class="black-line"><img src="../images/shim.gif" height="1" width="1"></div>
<div class="middle-bar"><img src="../images/shim.gif" height="5" width="1"></div>
<div class="black-line"><img src="../images/shim.gif" height="1" width="1"></div>
</div>
<div class="content">
<div class="text">
<h1><i>Generic function</i> <strong>ASSOCIATION-LIST</strong></h1>
<h2>Package:</h2>
<p><code>GODB</code></p>
<h2>Syntax:</h2>
<p>
<pre>
<b>association-list</b> <i>go-handle accession</i>
=> <i>list-of-association-objects</i>
</pre>
</p>
<h3>Arguments and Values:</h3>
<p><i><code>go-handle</code></i>---an <i>object</i> of type go-handle
<p><i><code>accession</code></i>---a <i>string</i>
<h2>Description:</h2>
<p>The generic function association-list is used to find a term's associations. It takes two parameters, go-handle,
to preserve the session, and accession, to identify the term whose associations are to be found.
It returns a list of objects of type <b>ASSOCIATION</b>.</p>
<h3><a name="known_methods">Known Methods</a>:</h3>
<p>
<ul>
<li>
<p>
<pre>
<b>association-list</b> (<i>go-handle-object</i> go-handle) (<i>accession</i> string)
=> <i>list-of-association-objects</i>
</pre>
</p>
<p></p>
</li>
</ul>
</p>
<h2>Affected By:</h2>
<p>None.</p>
<h2>Examples:</h2>
<p><pre>cl-prompt: (godb:<b>association-list</b> mygohandle "GO:0000140")
(#&lt;GODB:ASSOCIATION 206106DC&gt; #&lt;GODB:ASSOCIATION 206106AC&gt;)</pre></p>
<h2>Exceptional Situations:</h2>
<p>None.</p>
<h2>See Also:</h2>
<p>None.</p>
<h2>Notes:</h2>
<p>The function first checks if the associations are already in the hash table. If they are not,
they are then added. Otherwise, it creates objects of type 'association' and then indexes them in the hashes
on both accession and gene-product-id.</p>
<hr>
<h1>News</h1>
<p>News in chronological order, most recent on top.
</p>
<ul>
<li><strong>2005-06-14</strong><br>
Completed description.
</li>
</ul>
<div class="copyright">
&copy; 2005, Samantha Kleinberg, all rights reserved.
</div>
</div></body>
</html>
<html>
<head>
<title>CL-GODB: Standard Class ASSOCIATION</title>
<link rel="stylesheet" href="../style.css">
<!--[if IE]>
<style>
.header {
border: 0px;
width: 100%;
}
#main #menu {
margin:10px 0px 0px 0px;
}
.content
{
background: #ffffff;
margin-top: 0px;
padding: 0px 0px 10px 155px;
}
.navigation
{
width: 90%;
top: -1px;
word-spacing: 5px;
position: relative;
text-align: right;
}
</style>
<![endif]-->
</head>
<body><div id="main">
<div class="header"
style="font-family:=Verdana,Arial,Helvetica; font-size: 18px; color: #993333;">
<strong><i>CL-GODB: Standard Class ASSOCIATION</title></i></strong>
<div class="navigation">
<a href="../index.html" class="navigation-link">Home</a>
| <a href="is-leaf-node.html" class="navigation-link">Previous</a>
| <a href="association-list.html" class="navigation-link">Next</a>
| <a href="../downloads.html" class="navigation-link">Downloads</a>
| <a href="../links.html" class="navigation-link">Links</a>
</div>
<div class="black-line"><img src="../images/shim.gif" height="1" width="1"></div>
<div class="middle-bar"><img src="../images/shim.gif" height="5" width="1"></div>
<div class="black-line"><img src="../images/shim.gif" height="1" width="1"></div>
</div>
<div class="content">
<div class="text">
<h1><i>Standard Class</i> <strong>ASSOCIATION</strong></h1>
<h2>Package:</h2>
<p><code>GODB</code></p>
<h2>Class Precedence List:</h2>
<p>ASSOCIATION, STANDARD-OBJECT, T</p>
<h2>Slots:</h2>
<ul>
<li>ID accessor assoc-id ,initarg :assoc-id</li>
<li>TERM-ID accessor assoc-term-id, initarg :assoc-term-id</li>
<li>GENE-PRODUCT-ID accessor gene-product-id, initarg :gene-product-id</li>
<li>IS-NOT accessor assoc-is-not, initarg :is-not</li>
<li>ROLE-GROUP accessor assoc-role-group, initarg :assoc-role-group</li>
<li>ACC accessor assoc-acc, initarg :assoc-acc</li>
</ul>
<h2>Description:</h2>
<p>The Association