JavaCyc Java interface for Pathway Tools software.
[javacyc.git] / javacyc_1.0 / README
blobab704995804673c99564da54d611bdc2a82b101e
1 NAME
2 Javacyc.java
4 ABSTRACT
5 A Java interface for Pathway Tools software. Pathway Tools software
6 needs to run a special socket server program for Javacyc to work.
8 SYNOPSIS
9 Javacyc is a Java interface for Pathway Tools software.
10         Javacyc cyc = new Javacyc("ARA");
11         ArrayList pathways = cyc.allPathways();
13 VERSION
14 Version 0.2 August 1, 2004
16 HISTORY
17 Version History:
18         0.1 June 6, 2003 initial version
19         0.2 August 1, 2004 fixed a socket close bug in the C code
21 INSTALLATION
22 The Javacyc class uses native methods in order to access AF_UNIX sockets for
23 interprocess communication.  Javacyc can be installed by using the included
24 makefile.
26 If you choose not to use the makefile, below is an example of how to 
27 compile Javacyc.  The example assumes that the path to the Java directory is
28 /usr/java and that the platform is solaris:
29         javac UnixDomainSocket.java
30         javah UnixDomainSocket
31         gcc -c -fPIC -I/usr/java/include -I/usr/java/include/solaris/ UnixDomainSoceket.c
32         gcc -shared -o libunixdomainsocket.so UnixDomainSocket.o
33         javac Javacyc.java
35 IMPORTANT NOTE:  In order for Javacyc to work, ensure that the environment
36 variable, LD_LIBRARY_PATH, includes the directory where libunixdomainsocket.so
37 is located.
39 DESCRIPTION
40 Javacyc is a Java class for accessing internal Pathway Tools functions.
41 For a description of what the individual functions do, please refer to the
42 Pathway Tools documentation at http://bioinformatics.ai.sri.com/ptools .
44 Note that optional parameters of all functions are not supported in Javacyc.
46 Limitations:
47 Javacyc does not implement GFP objects in Java.  It sends snippets of code to 
48 Pathway Tools through a socket connection.  Only one connection may be opened
49 at any given time.  The returned values are of type boolean, String, ArrayList,
50 and ArrayLists that contain ArrayLists for functions that return multiple
51 lists.  A list of available functions is given below.
53 GFP functions: (More information on these functions can be found at:
54 http://www.ai.sri.com/~gfp/spec/paper/node63.html )
55         get-slot-values
56         get-slot-value
57         get-class-slot-slotvalue
58         get-class-all-instances
59         instance-all-instance-of-p
60         member-slot-value-p
61         current-kb
62         put-slot-values
63         put-slot-value
64         add-slot-value
65         replace-slot-value
66         remove-slot-value
67         coercible-to-frame-p
68         class-all-type-of-p
69         get-instance-direct-types
70         get-instance-all-types
71         get-frame-slots
72         put-instance-types
73         save-kb
74         revert-kb
75         find-indexed-frame
77 Pathway Tools functions: (More information on these functions can be found at
78 http://bioinformatics.ai.sri.com/ptools/ptools-fns.html)
79         select-organism
80         all-pathways
81         all-orgs
82         all-rxns
83         genes-of-reaction
84         substrates-of-reaction
85         products-of-reaction
86         enzymes-of-reaction
87         reaction-reactants-and-products
88         get-predecessors
89         get-successors
90         get-reaction-list
91         genes-of-pathway
92         enzymes-of-pathway
93         compounds-of-pathway
94         substrates-of-pathway
95         all-transcription-factors
96         transcription-factor?
97         all-cofactors
98         all-modulators
99         monomers-of-protein
100         components-of-protein
101         genes-of-protein
102         reactions-of-enzyme
103         enzyme?
104         transporter?
105         containers-of
106         modified-forms
107         modified-containers
108         top-containers
109         reactions-of-protein
110         regulon-of-protein
111         transcription-units-of-protein
112         regulator-proteins-of-transcription-unit
113         enzymes-of-gene
114         all-products-of-gene
115         reactions-of-gene
116         pathways-of-gene
117         chromosome-of-gene
118         transcription-units-of-gene
119         transcription-unit-promoter
120         transcription-unit-genes
121         transcription-unit-binding-sites
122         transcription-unit-transcription-factors
123         transcription-unit-terminators
124         all-transported-chemicals
125         reactions-of-compounds
126         full-enzyme-name
127         enzyme-activity-name
129 EXAMPLE
131    A program to test Javacyc.
134 import java.util.ArrayList;
135 import java.io.*;
137 public class JavacycTest
139     public static void printLists(ArrayList list)
140     {
141         for (int i = 0; i < list.size(); i++)
142         {
143             Object obj = list.get(i);
144             if (obj instanceof String)
145             {
146                 String str = (String)obj;
147                 System.out.println(str);
148             }
149             else if (obj instanceof ArrayList)
150             {
151                 System.out.println("*begin inner list*");
152                 ArrayList aList = (ArrayList)obj;
153                 printLists(aList);
154                 System.out.println("*end inner list*");
155             }
156             else
157             {
158                 System.out.println("WARNING THIS SHOULD NOT HAPPEN!");
159             }
160         }
161     }
163     public static void main(String[] args) throws IOException
164     {
165         Javacyc cyc = new Javacyc("ARA");
166         BufferedReader in = new BufferedReader(
167            new InputStreamReader(System.in));
169         // test a function that returns a boolean
170         System.out.println("Testing a function that returns a boolean: "
171                            + "coercible-to-frame-p");
172         System.out.print("Enter a value for frame: ");
173         String thing = in.readLine();
174         boolean result1 = cyc.coercibleToFrameP(thing);
175         if (result1)
176         {
177             System.out.println("The result: true\n");
178         }
179         else
180         {
181             System.out.println("The result: false\n");
182         }
184         // test a function that returns a string
185         System.out.println("Testing a function that returns a string: "
186                            + "full-enzyme-name");
187         System.out.print("Enter a value for enzyme: ");
188         String enzyme = in.readLine();
189         String result2 = cyc.fullEnzymeName(enzyme);
190         System.out.println("The result: " + result2 +"\n");
192         // test a function that returns an ArrayList
193         System.out.println("Testing a function that returns an ArrayList: "
194                            + "genes-of-pathway 'PWY-581");
195         ArrayList result3 = cyc.genesOfPathway("PWY-581");
196         System.out.println("The returned values: ");
197         for (int i = 0; i < result3.size(); i++)
198         {
199             String rxn = (String)result3.get(i);
200             System.out.println(rxn);
201         }
203         // test a function that returns multiple lists
204         System.out.println("\nTesting a function that returns multiple"
205                            + " lists: reaction-reactants-and-products");
206         System.out.print("Enter a value for reaction: ");
207         String rxn = in.readLine();
208         System.out.print("Enter a value for pathway: ");
209         String pwy = in.readLine();
210         ArrayList result4 = cyc.reactionReactantsAndProducts(rxn, pwy);
211         System.out.println("The returned values: ");
212         printLists(result4);
213     }
216 TROUBLESHOOTING
217 Please send bug reports and comments to curator@arabidopsis.org
219 LICENSE
220 Javacyc, a Java interface for Pathway Tools software
221 Copyright (c) 2003 by Thomas Yan, The Arabidopsis Information Resource (TAIR)
222 and the Carnegie Institution of Washingtion.
224 This library is free software; you can redistribute it and/or
225 modify it under the terms of version 2.1 of the GNU Lesser General 
226 Public License as published by the Free Software Foundation.
228 This library is distributed in the hope that it will be useful,
229 but WITHOUT ANY WARRANTY; without even the implied warranty of
230 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
231 Lesser General Public License for more details:
233 http://www.opensource.org/licenses/lgpl-license.html
234 http://www.gnu.org/copyleft/lesser.html
236 To obtain a written copy of the GNU Lesser General Public License,
237 please write to the Free Software Foundation, Inc., 59 Temple Place, 
238 Suite 330, Boston, MA  02111-1307 USA
241 Javacyc uses native methods to access AF_UNIX sockets provided by J-BUDS, 
242 which was released by Echogent Systems under the GNU Lesser General Public 
243 License.  See the JBUDS_COPYRIGHT for details.
245 AUTHOR
246 Thomas Yan
248 ACKNOWLEDGMENTS
249 Many thanks to Lukas Mueller and Danny Yoo.