[Bio] / FigKernelScripts / server_paper_example1.pl Repository:
ViewVC logotype

Annotation of /FigKernelScripts/server_paper_example1.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.12 - (view) (download) (as text)

1 : parrello 1.1 use strict;
2 : disz 1.10 use SAPserver;
3 :     use Data::Dumper;
4 : parrello 1.1
5 : parrello 1.3 # Example 1: ACH Data for a Protein
6 :     #
7 : parrello 1.5 # This script takes a protein ID on the command line and
8 : parrello 1.12 # finds all identifiers in the Sapling database that correspond
9 :     # to the identified protein (that is, they have the same amino
10 :     # acid sequence). For each identifier found, the following six
11 :     # columns will be output.
12 : parrello 1.3 #
13 :     # 1. The identifier found.
14 :     # 2. The scientific name of the associated genome (if any).
15 : parrello 1.5 # 3. 1 if we believe the identifier corresponds to the
16 :     # exact gene identified by the input identifier, else
17 :     # 0. If the input identifier does not specify a
18 :     # particular gene, this column will always be 0.
19 :     # 4. The functional assignment associated with the protein
20 :     # ID.
21 : parrello 1.3 # 5. The source of the assignment.
22 :     # 6. 1 if the assignment is considered expert, else 0.
23 :     #
24 : parrello 1.5 # The data in columns (1), (4), (5), and (6) are provided
25 : parrello 1.12 # automatically by the Sapling Server method "equiv_sequence".
26 :     # The item in column (3) is extracted via a call to the Sapling
27 :     # Server method "genome_names". The tricky part is the value in
28 :     # column (3). To make this determination, we make an initial call
29 :     # to the "equiv_precise" method to get identifiers for precisely-
30 : parrello 1.5 # equivalent genes and put them into a hash. The value of
31 :     # column (3) is then determined by whether or not an
32 :     # identifier is in the precise-equivalence hash.
33 : parrello 1.1
34 : disz 1.10 my $sapObject = SAPserver->new();
35 : parrello 1.5 my $id = $ARGV[0];
36 :     if (! $id) {
37 :     die "No protein ID specified.";
38 :     } else {
39 : parrello 1.7 my %preciseHash;
40 : parrello 1.11 my $precise_assertions_list = $sapObject->equiv_precise_assertions(-ids => $id);
41 : disz 1.10 $precise_assertions_list = $precise_assertions_list->{$id};
42 :     if (@$precise_assertions_list > 0) {
43 :     my $inputID = $id;
44 :     for my $precise_assertion (@$precise_assertions_list) {
45 : parrello 1.7 my ($newID, $function, $source, $expert) = @$precise_assertion;
46 :     $preciseHash{$newID} = 1;
47 :     }
48 : parrello 1.5 }
49 :    
50 : parrello 1.11 my $assertions = $sapObject->equiv_sequence_assertions(-ids => $id);
51 :     $assertions = $assertions->{$id};
52 : disz 1.10 if (@$assertions < 1) {
53 : parrello 1.5 print STDERR "No results found.\n";
54 : parrello 1.1 } else {
55 : parrello 1.5 for my $assertion (@$assertions) {
56 : parrello 1.8 my ($newID, $function, $source, $expert, $genomeName) = @$assertion;
57 :     $genomeName = '' if ! defined $genomeName;
58 : parrello 1.6 my $column3 = ($preciseHash{$newID} ? 1 : 0);
59 : parrello 1.5 print join("\t", $newID, $genomeName, $column3, $function, $source,
60 :     $expert) . "\n";
61 : parrello 1.1 }
62 :     }
63 : parrello 1.5 }
64 : parrello 1.1

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3