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

Diff of /FigKernelPackages/FIGO.pm

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

revision 1.8, Thu Feb 22 14:28:32 2007 UTC revision 1.9, Mon Feb 26 21:06:58 2007 UTC
# Line 1  Line 1 
1    ########################################################################
2  #  #
3  # Copyright (c) 2003-2006 University of Chicago and Fellowship  # Copyright (c) 2003-2006 University of Chicago and Fellowship
4  # for Interpretations of Genomes. All Rights Reserved.  # for Interpretations of Genomes. All Rights Reserved.
# Line 14  Line 15 
15  # Genomes at veronika@thefig.info or download a copy from  # Genomes at veronika@thefig.info or download a copy from
16  # http://www.theseed.org/LICENSE.TXT.  # http://www.theseed.org/LICENSE.TXT.
17  #  #
18    ########################################################################
19    
20  package FIGO;  =head1 Overview
21    
22    This module is a set of packages encapsulating the SEED's core methods
23    using an "OOP-like" style.
24    
25    There are several modules clearly related to "individual genomes:"
26    FIGO, GenomeO, ContigO, FeatureO (and I<maybe> AnnotationO).
27    
28    There are also modules that deal with complex relationships between
29    pairs or sets of features in one, two, or more genomes,
30    rather than any particular single genome:
31    BBHO, CouplingO, SubsystemO, FunctionalRoleO, FigFamO.
32    
33    Finally, the methods in "Attribute" might in principle attach
34    "atributes" to any type of object.
35    (Likewise, in principle one might like to attach an "annotation"
36    to any type of object
37    
38    Four of the modules dealing with "genomes" have a reasonable clear
39    "implied heirarchy:"
40    
41    =over 4
42    
43        FIGO > GenomeO > ContigO > FeatureO
44    
45    =back
46    
47    However, inheritance is B<NOT> implemented using the C<@ISA> mechanism,
48    because some methods deal with "pairwise" or "setwise" relations between objects
49    or other more complex relationships that do not naturally fit into any heirarchy ---
50    which would get us into the whole quagmire of "multiple inheritance."
51    
52    We have chosen to sidestep the entire issue of inheritance via an I<ad hoc> mechanism:
53    If a "child" object needs access to its "ancestors'" methods,
54    we pass it references to its "ancestors" using subroutine arguments.
55    This is admittedly ugly, clumsy, and potentially error-prone ---
56    but it has the advantage that, unlike multiple inheritance,
57    we understand how to do it...
58    
59    MODULE DEPENDENCIES: FIG, FIG_Config, FigFams, SFXlate, SproutFIG, Tracer,
60        gjoparseblast, Data::Dumper.
61    
62    =cut
63    
64    ########################################################################
65    package FIGO;
66    ########################################################################
67  use strict;  use strict;
68  use FIG;  use FIG;
69  use FIG_Config;  use FIG_Config;
# Line 27  Line 74 
74  use FigFams;  use FigFams;
75  use gjoparseblast;  use gjoparseblast;
76    
77  =head1 FIGO Methods  =head1 FIGO
78    
79    The effective "base class" containing a few "top-level" methods.
80    
81    =cut
82    
83    
84  =head3 new  =head3 new
85    
# Line 80  Line 132 
132  C<< my @tax_ids = $figo->genomes( @constraints ); >>  C<< my @tax_ids = $figo->genomes( @constraints ); >>
133    
134  =item @constraints  =item @constraints
135    
136  One or more element of: complete, prokaryotic, eukaryotic, bacterial, archaeal, nmpdr.  One or more element of: complete, prokaryotic, eukaryotic, bacterial, archaeal, nmpdr.
137    
138  =item RETURNS: List of Tax-IDs.  =item RETURNS: List of Tax-IDs.
139    
140  =item EXAMPLE: L<Display all complete, prokaryotic genomes>  =item EXAMPLE:
141    
142        L<Display all complete, prokaryotic genomes>
143    
144  =back  =back
145    
# Line 141  Line 196 
196  =over4  =over4
197    
198  =item RETURNS:  =item RETURNS:
199    
200  List of all subsystems.  List of all subsystems.
201    
202  =item EXAMPLE: L<Accessing Subsystem data>  =item EXAMPLE:
203    
204        L<Accessing Subsystem data>
205    
206  =back  =back
207    
# Line 188  Line 246 
246    
247  =over4  =over4
248    
249  =item USAGE:  C<< foreach $fam ($figO->all_figfams) { #...Do something } >>  =item USAGE:
250    
251        C<< foreach $fam ($figO->all_figfams) { #...Do something } >>
252    
253    =item RETURNS:
254    
255        List of FIGfam Objects
256    
257  =item RETURNS: List of FIGfam Objects  =item EXAMPLE:
258    
259  =item EXAMPLE: L<Accessing FIGfams>      L<Accessing FIGfams>
260    
261  =back  =back
262    
# Line 211  Line 275 
275    
276  =over4  =over4
277    
278  =item USAGE:   C<< my ($fam, $sims) = $figO->family_containing($seq); >>  =item USAGE:
279    
280        C<< my ($fam, $sims) = $figO->family_containing($seq); >>
281    
282    =item $seq:
283    
284  =item $seq:    A protein translation string.      A protein translation string.
285    
286  =item RETURNS:  =item RETURNS:
287    
288        $fam:  A FIGfam Object.        $fam:  A FIGfam Object.
289    
290        $sims: A set of similarity objects.        $sims: A set of similarity objects.
291    
292  =item EXAMPLE: L<Placing a sequence into a FIGfam>  =item EXAMPLE: L<Placing a sequence into a FIGfam>
# Line 258  Line 328 
328  =over4  =over4
329    
330  =item USAGE:  =item USAGE:
331    
332  C<< my $org = GenomeO->new($figo, $tax_id); >>  C<< my $org = GenomeO->new($figo, $tax_id); >>
333    
334  =item RETURNS: A new GenomeO object.  =item RETURNS:
335    
336        A new GenomeO object.
337    
338  =back  =back
339    
# Line 281  Line 354 
354    
355  =over4  =over4
356    
357  =item USAGE:   C<< my $tax_id = $org->id(); >>  =item USAGE:
358    
359        C<< my $tax_id = $org->id(); >>
360    
361    =item RETURNS:
362    
363  =item RETURNS: Taxonomy-ID of GenomeO object.      Taxonomy-ID of GenomeO object.
364    
365  =back  =back
366    
# Line 301  Line 378 
378    
379  =over4  =over4
380    
381  =item USAGE:   C<< $gs = $genome->genus_species(); >>  =item USAGE:
382    
383        C<< $gs = $genome->genus_species(); >>
384    
385  =item RETURNS: Genus-species-strain string  =item RETURNS:
386    
387        Genus-species-strain string
388    
389  =back  =back
390    
# Line 321  Line 402 
402    
403  =over4  =over4
404    
405  =item RETURNS: List of C<contig> objects contained in a C<GenomeO> object.  =item RETURNS:
406    
407        List of C<contig> objects contained in a C<GenomeO> object.
408    
409    =item EXAMPLE:
410    
411  =item EXAMPLE: L<Show how to access contigs and extract sequence>      L<Show how to access contigs and extract sequence>
412    
413  =back  =back
414    
# Line 359  Line 444 
444    
445  =over4  =over4
446    
447  =item USAGE:   C<< $genome->display(); >>  =item USAGE:
448    
449        C<< $genome->display(); >>
450    
451  =item RETURNS: Null  =item RETURNS:
452    
453        (Void)
454    
455  =back  =back
456    
# Line 393  Line 482 
482  =over4  =over4
483    
484  =item USAGE:  =item USAGE:
485    
486  C<< $contig = ContigO->new( $figO, $genomeId, $contigId); >>  C<< $contig = ContigO->new( $figO, $genomeId, $contigId); >>
487    
488  =item $figO: A FIGO object.  =item $figO:
489    
490        Parent FIGO object.
491    
492  =item $genomeId: Taxon-ID for the genome the contig is from.  =item $genomeId:
493    
494  =item $contigId: Identifier for the contig      Taxon-ID for the genome the contig is from.
495    
496  =item RETURNS: A "ContigO" object.  =item $contigId:
497    
498        Identifier for the contig
499    
500    =item RETURNS:
501    
502        A "ContigO" object.
503    
504  =back  =back
505    
# Line 423  Line 521 
521    
522  =over4  =over4
523    
524  =item RETURNS: Sequence ID string of "ContigO" object  =item RETURNS:
525    
526        Sequence ID string of "ContigO" object
527    
528  =back  =back
529    
# Line 441  Line 541 
541  =over4  =over4
542    
543  =item USAGE:  =item USAGE:
544    
545      C<< my $tax_id = $contig->genome(); >>      C<< my $tax_id = $contig->genome(); >>
546    
547  =item RETURNS: GenomeO object containing the contig object.  =item RETURNS:
548    
549        Tax-ID of the GenomeO object containing the contig object.
550    
551  =back  =back
552    
# Line 462  Line 565 
565  =over4  =over4
566    
567  =item USAGE:  =item USAGE:
568    
569      C<< my $len = $contig->contig_length(); >>      C<< my $len = $contig->contig_length(); >>
570    
571  =item RETURNS: Length of contig's DNA sequence.  =item RETURNS:
572    
573        Length of contig's DNA sequence.
574    
575  =back  =back
576    
# Line 484  Line 590 
590  =over4  =over4
591    
592  =item USAGE:  =item USAGE:
593    
594      C<< my $seq = $contig->dna_seq(beg, $end); >>      C<< my $seq = $contig->dna_seq(beg, $end); >>
595    
596  =item $beg: Begining point of DNA subsequence  =item $beg:
597    
598        Begining point of DNA subsequence
599    
600  =item $end: End point of DNA subsequence  =item $end:
601    
602  =item RETURNS: string of DNA sequence from $beg to $end      End point of DNA subsequence
603    
604    =item RETURNS:
605    
606        string of DNA sequence running from $beg to $end
607  (NOTE: if $beg > $end, returns reverse complement of DNA subsequence.)  (NOTE: if $beg > $end, returns reverse complement of DNA subsequence.)
608    
609  =back  =back
# Line 527  Line 639 
639    
640  =over4  =over4
641    
642  =item RETURNS: Nil  =item RETURNS:
643    
644        (Void)
645    
646  =back  =back
647    
# Line 548  Line 662 
662    
663  =head1 FeatureO  =head1 FeatureO
664    
665  =cut  Methods for working with features on "ContigO" objects.
   
666    
667    =cut
668    
669  =head1 new  =head3 new
670    
671  Constructor of "FeatureO" objects  Constructor of "FeatureO" objects
672    
# Line 791  Line 905 
905    
906  =head3 run  =head3 run
907    
908  =cut  =sub
909    
910  sub run {  cut run {
911      my($cmd) = @_;      my($cmd) = @_;
912      (system($cmd) == 0) || Confess("FAILED: $cmd");      (system($cmd) == 0) || Confess("FAILED: $cmd");
913  }  }
# Line 1234  Line 1348 
1348      my $figO = $self->{_figO};      my $figO = $self->{_figO};
1349      my $subO = $self->{_subO};      my $subO = $self->{_subO};
1350      if (! $subO) { $subO = $self->{_subO} = new Subsystem($self->{_id},$figO->{_fig}); }      if (! $subO) { $subO = $self->{_subO} = new Subsystem($self->{_id},$figO->{_fig}); }
     if (! defined($subO)) { return undef }  
1351    
1352      return map { &GenomeO::new('GenomeO',$figO,$_) } $subO->get_genomes;      return map { &GenomeO::new('GenomeO',$figO,$_) } $subO->get_genomes;
1353  }  }
1354    
1355    
1356    
1357  =head3 roles  =head3 roles
1358    
1359  =cut  =cut
# Line 1249  Line 1364 
1364      my $figO = $self->{_figO};      my $figO = $self->{_figO};
1365      my $subO = $self->{_subO};      my $subO = $self->{_subO};
1366      if (! $subO) { $subO = $self->{_subO} = new Subsystem($self->{_id},$figO->{_fig}); }      if (! $subO) { $subO = $self->{_subO} = new Subsystem($self->{_id},$figO->{_fig}); }
1367      if (! defined($subO)) { return undef }  
1368      return map { &FunctionalRoleO::new('FunctionalRoleO',$figO,$_) }  $subO->get_roles($self->id);      return map { &FunctionalRoleO::new('FunctionalRoleO',$figO,$_) }  $subO->get_roles($self->id);
1369  }  }
1370    
1371    
1372    
1373  =head3 curator  =head3 curator
1374    
1375  =cut  =cut
# Line 1263  Line 1380 
1380      my $figO = $self->{_figO};      my $figO = $self->{_figO};
1381      my $subO = $self->{_subO};      my $subO = $self->{_subO};
1382      if (! $subO) { $subO = $self->{_subO} = new Subsystem($self->{_id},$figO->{_fig}); }      if (! $subO) { $subO = $self->{_subO} = new Subsystem($self->{_id},$figO->{_fig}); }
1383      return defined($subO) ? $subO->get_curator : undef;  
1384        return $subO->get_curator;
1385  }  }
1386    
1387    
# Line 1279  Line 1397 
1397      my $figO = $self->{_figO};      my $figO = $self->{_figO};
1398      my $subO = $self->{_subO};      my $subO = $self->{_subO};
1399      if (! $subO) { $subO = $self->{_subO} = new Subsystem($self->{_id},$figO->{_fig}); }      if (! $subO) { $subO = $self->{_subO} = new Subsystem($self->{_id},$figO->{_fig}); }
     if (! defined($subO)) { return undef }  
1400    
1401      return $subO->get_variant_code_for_genome($genome->id);      return $subO->get_variant_code_for_genome($genome->id);
1402  }  }
# Line 1296  Line 1413 
1413      my $figO = $self->{_figO};      my $figO = $self->{_figO};
1414      my $subO = $self->{_subO};      my $subO = $self->{_subO};
1415      if (! $subO) { $subO = $self->{_subO} = new Subsystem($self->{_id},$figO->{_fig}); }      if (! $subO) { $subO = $self->{_subO} = new Subsystem($self->{_id},$figO->{_fig}); }
     if (! defined($subO)) { return undef }  
1416    
1417      return $subO->get_pegs_from_cell($genome->id,$role->id);      return $subO->get_pegs_from_cell($genome->id,$role->id);
1418  }  }
# Line 1310  Line 1426 
1426    
1427  =head1 FunctionalRoleO  =head1 FunctionalRoleO
1428    
1429    Methods for accessing the functional roles of features.
1430    
1431  =cut  =cut
1432    
1433    
# Line 1462  Line 1580 
1580  ########################################################################  ########################################################################
1581  =head1 Attribute  =head1 Attribute
1582    
1583    (Note yet implemented.)
1584    
1585  =cut  =cut
1586    
1587  1;  1;

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.9

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3