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

Diff of /FigKernelPackages/SAPtutorial.pm

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

revision 1.2, Tue Aug 4 16:53:41 2009 UTC revision 1.3, Tue Aug 4 21:31:29 2009 UTC
# Line 372  Line 372 
372          }          }
373      }      }
374    
375    The I<ids_in_subsystems> service has several useful options for changing the nature
376    of the output. For example, in the above program each role is represented by a
377    full description (C<roleForm> set to C<full>). If you don't need the roles, you
378    can specify C<none> for the role form. You can also request that the gene IDs
379    be returned in a comma-separated list instead of a list data structure. These
380    two changes can drastically simplify the above program.
381    
382        use strict;
383        use SAPserver;
384    
385        my $sapServer = SAPserver->new();
386        # Loop through the input file. Note that this loop will stop on the first
387        # blank line.
388        while (my $genomeID = <STDIN>) {
389            chomp $genomeID;
390            # Get the subsystems for this genome.
391            my $subHash = $sapServer->genomes_to_subsystems(ids => $genomeID);
392            # The data returned for each genome (and in our case there's only one)
393            # includes the subsystem name and the variant code. The following
394            # statement strips away the variant codes, leaving only the subsystem
395            # names.
396            my $subList = [ map { $_->[0] } @{$subHash->{$genomeID}} ];
397            # Ask for the genes in each subsystem, using NCBI identifiers.
398            my $genesHash = $sapServer->ids_in_subsystems(subsystems => $subList,
399                                                         genome => $genomeID,
400                                                         source => 'NCBI',
401                                                         roleForm => 'none',
402                                                         grouped => 1);
403            # The hash maps each subsystem ID to a comma-delimited list of gene IDs.
404            for my $subsystem (sort keys %$genesHash) {
405                my $genes = $genesHash->{$subsystem};
406                print "$genomeID\t$subsystem\t$genes\n";
407            }
408        }
409    
410  =cut  =cut
411    
412  1;  1;

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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3