perlcyc+javacyc - Bioinformatics Research Group at SRI

Download Report

Transcript perlcyc+javacyc - Bioinformatics Research Group at SRI

The PerlCyc and JavaCyc APIs

1

SRI International Bioinformatics

2

Architecture of the API server

Works on Unix (Solaris or Linux) only

Start up Pathway Tools with the –api arg

Pathway Tools listens on a Unix socket – perl program communicates through this socket

Supports both querying and editing PGDBs

Must run perl or java program on the same machine that runs Pathway Tools

 This is a security measure, as the API server has no built-in security 

Can only handle one connection at a time SRI International Bioinformatics

3

Obtaining PerlCyc and JavaCyc

Download from http://www.sgn.cornell.edu/downloads/ PerlCyc written and maintained by Lukas Mueller at Boyce Thompson Institute for Plant Research.

JavaCyc written by Thomas Yan at Carnegie Institute, maintained by Lukas Mueller.

Easy to extend… SRI International Bioinformatics

Examples of PerlCyc, JavaCyc Functions

GFP functions (require knowledge of Pathway Tools schema):

 get_slot_values  getSlotValues  get_class_all_instances  getClassAllInstances  put_slot_values  putSlotValues 

Pathway Tools functions (described at http://bioinformatics.ai.sri.com/ptools/ptools-fns.html

):

  genes_of_reaction find_indexed_frame   genesOfReaction findIndexedFrame   pathways_of_gene transport_p   pathwaysOfGene transportP 4

SRI International Bioinformatics

5

Writing a PerlCyc or JavaCyc program

 

Create a PerlCyc, JavaCyc object:

perlcyc -> new (“ORGID”) new Javacyc (“ORGID”)

Call PerlCyc, JavaCyc functions on this object:

my $cyc = perlcyc -> new (“ECOLI”); my @pathways = $cyc -> all_pathways ();  Javacyc cyc = new Javacyc(“ECOLI”); ArrayList pathways = cyc.allPathways ();

Functions return object IDs, not objects.

Must connect to server again to retrieve attributes of an object.

foreach my $p (@pathways) { print $cyc -> get_slot_value ($p, “COMMON-NAME”);} for (int i=0; I < pathways.size(); i++) { String pwy = (String) pathways.get(i); System.out.println (cyc.getSlotValue (pwy, “COMMON-NAME”); }

SRI International Bioinformatics

Sample PerlCyc Query

Number of proteins in E. coli use perlcyc; my $cyc = perlcyc -> new (“ECOLI”); my @proteins = $cyc-> get_class_all_instances("|Proteins|"); my $protein_count = scalar(@proteins); print "Protein count: $protein_count.\n";

6

SRI International Bioinformatics

7

Sample PerlCyc Query

Print IDs of all proteins with molecular weight between 10 and 20 kD and pI between 4 and 5.

use perlcyc; my $cyc = perlcyc -> new (“ECOLI”); foreach my $p ($cyc->get_class_all_instances("|Proteins|")) { my $mw = $cyc->get_slot_value($p, "molecular-weight-kd"); my $pI = $cyc->get_slot_value($p, "pi"); if ($mw <= 20 && $mw >= 10 && $pI <= 5 && $pI >= 4) { print "$p\n"; } } SRI International Bioinformatics

8

Sample PerlCyc Query

List all the transcription factors in E. coli, and the list of genes that each regulates: use perlcyc; my $cyc = perlcyc -> new (“ECOLI”); foreach my $p ($cyc->get_class_all_instances("|Proteins|")) { if ($cyc->transcription_factor_p($p)) { my $name = $cyc->get_slot_value($p, "common-name"); my %genes = (); foreach my $tu ($cyc->regulon_of_protein($p)) { foreach my $g ($cyc->transcription_unit_genes($tu)) { $genes{$g} = $cyc->get_slot_value($g, "common-name"); } } print "\n\n$name: "; print join " ", values %genes; } } SRI International Bioinformatics

Sample Editing Using PerlCyc

Add a link from each gene to the corresponding object in MY-DB (assume ID is same in both cases) use perlcyc; my $cyc = perlcyc -> new (“HPY”); my @genes = $cyc->get_class_all_instances (“|Genes|”); foreach my $g (@genes) { $cyc->add_slot_value ($g, “DBLINKS”, “(MY-DB \”$g\”)”); } $cyc->save_kb();

9

SRI International Bioinformatics

10

Sample JavaCyc Query

Find all enzymes for which ATP is a regulator

import java.util.*; public class JavacycSample { public static void main(String[] args) { Javacyc cyc = new Javacyc("ECOLI"); ArrayList regframes = cyc.getClassAllInstances("|Regulation-of-Enzyme-Activity|"); for (int i = 0; i < regframes.size(); i++) { String reg = (String)regframes.get(i); boolean bool = cyc.memberSlotValueP(reg, “Regulator", "ATP"); if (bool) { String enzrxn = cyc.getSlotValue (reg, “Regulated-Entity”); String enzyme = cyc.getSlotValue (enzrxn, “Enzyme”); System.out.println(enz); } } } }

SRI International Bioinformatics