[Bio] / FigKernelPackages / ACH.pm Repository:
ViewVC logotype

Diff of /FigKernelPackages/ACH.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2, Wed Oct 7 19:30:07 2009 UTC revision 1.3, Tue Oct 27 03:42:21 2009 UTC
# Line 91  Line 91 
91    
92  =item RETURN  =item RETURN
93    
94  Normally, returns a reference to a list of 4-tuples. Each 4-tuple contains an  Normally, returns a reference to a list of 5-tuples. Each 5-tuple contains an
95  identifier that is sequence-equivalent to at least one of the input identifiers,  identifier that is sequence-equivalent to at least one of the input identifiers,
96  the asserted function of that identifier, the source of the assertion, and a  the asserted function of that identifier, the source of the assertion, a
97  flag that is TRUE if the assertion is by an expert. If the C<-hash> flag  flag that is TRUE if the assertion is by an expert, and the name of the genome
98  is specified in the parameter list, then the return value will be a hash  relevant to the identifier (if any). If the C<-hash> flag is specified in the
99  of lists, keyed by incoming protein identifier, mapping each protein  parameter list, then the return value will be a hash of lists, keyed by incoming
100  identifier to a list of the relevant 4-tuples.  protein identifier, mapping each protein identifier to a list of the relevant
101    5-tuples.
102    
103  =back  =back
104    
# Line 118  Line 119 
119      my $retVal = ($hashFlag ? {} : []);      my $retVal = ($hashFlag ? {} : []);
120      # Get the list of IDs.      # Get the list of IDs.
121      my $ids = ServerThing::GetIdList(-ids => $args);      my $ids = ServerThing::GetIdList(-ids => $args);
     # These object name sequences are the base of every query. The first finds  
     # every identifier associated with a gene that produces the protein sequence.  
     # The second finds every identifier associated with the protein sequence  
     # itself.  
     my @objects = ("ProteinSequence IsProteinFor Feature IsIdentifiedBy Identifier HasAssertionFrom Source",  
                    "ProteinSequence IsNamedBy Identifier HasAssertionFrom Source");  
     # This is the list of fields we want back.  
     my $fields = [qw(Identifier(id) HasAssertionFrom(function) Source(id)  
                   HasAssertionFrom(expert))];  
     # Finally, this is the filter clause.  
     my $filter = "ProteinSequence(id) = ?";  
122      # Loop through the IDs in the list.      # Loop through the IDs in the list.
123      for my $id (@$ids) {      for my $id (@$ids) {
124          # This hash will contain a list of the relevant protein sequence IDs.          # This hash will contain a list of the relevant protein sequence IDs.
         # We apply the above two queries to each protein sequence of interest.  
125          my %prots;          my %prots;
126          # We'll put our assertions found in here.          # We'll put our assertions found in here.
127          my @results;          my @results;
# Line 157  Line 146 
146              }              }
147          }          }
148          # Loop through the protein sequences, finding assertions. For each          # Loop through the protein sequences, finding assertions. For each
149          # protein, we make two queries.          # protein, we make two queries. Note that we expect the number of
150            # protein sequences to be small, despite the large amount of work
151            # performed above.
152          for my $prot (sort keys %prots) {          for my $prot (sort keys %prots) {
153              for my $objects (@objects) {              # Get the assertions on the protein's identifiers.
154                  push @results, $sap->GetAll($objects, $filter, $prot, $fields);              @results = $sap->GetAll("ProteinSequence IsNamedBy Identifier HasAssertionFrom Source",
155              }                                      "ProteinSequence(id) = ?", [$prot],
156                                        [qw(Identifier(id) HasAssertionFrom(function)
157                                            Source(id) HasAssertionFrom(expert))]);
158                # Add the assertions on the identifiers for the protein's features.
159                push @results, $sap->GetAll("ProteinSequence IsProteinFor Feature IsIdentifiedBy Identifier HasAssertionFrom Source AND Feature IsOwnedBy Genome",
160                                            "ProteinSequence(id) = ?", [$prot],
161                                            [qw(Identifier(id) HasAssertionFrom(function)
162                                               Source(id) HasAssertionFrom(expert)
163                                               Genome(scientific-name))]);
164          }          }
165          # If we found results, put them in the return object.          # If we found results, put them in the return object.
166            Trace(scalar(@results) . " results found for $id.") if T(3);
167          if (@results) {          if (@results) {
168              if ($hashFlag) {              if ($hashFlag) {
169                  $retVal->{$id} = \@results;                  $retVal->{$id} = \@results;

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3