Presentation is loading. Please wait.

Presentation is loading. Please wait.

SRI International Bioinformatics 1 The PerlCyc and JavaCyc APIs.

Similar presentations


Presentation on theme: "SRI International Bioinformatics 1 The PerlCyc and JavaCyc APIs."— Presentation transcript:

1 SRI International Bioinformatics 1 The PerlCyc and JavaCyc APIs

2 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 l This is a security measure, as the API server has no built-in security Can only handle one connection at a time

3 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…

4 SRI International Bioinformatics 4 Examples of PerlCyc, JavaCyc Functions GFP functions (require knowledge of Pathway Tools schema): l get_slot_values l get_class_all_instances l put_slot_values Pathway Tools functions (described at http://bioinformatics.ai.sri.com/ptools/ptools-fns.html): http://bioinformatics.ai.sri.com/ptools/ptools-fns.html l genes_of_reaction l find_indexed_frame l pathways_of_gene l transport_p l getSlotValues l getClassAllInstances l putSlotValues l genesOfReaction l findIndexedFrame l pathwaysOfGene l transportP

5 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. l 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”); }

6 SRI International Bioinformatics 6 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";

7 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 = 10 && $pI = 4) { print "$p\n"; }

8 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; }

9 SRI International Bioinformatics 9 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();

10 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); } } } }


Download ppt "SRI International Bioinformatics 1 The PerlCyc and JavaCyc APIs."

Similar presentations


Ads by Google