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

Annotation of /FigKernelPackages/FF.pm

Parent Directory Parent Directory | Revision Log Revision Log


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

1 : overbeek 1.1 # -*- perl -*-
2 :     ########################################################################
3 :     # Copyright (c) 2003-2006 University of Chicago and Fellowship
4 :     # for Interpretations of Genomes. All Rights Reserved.
5 :     #
6 :     # This file is part of the SEED Toolkit.
7 : parrello 1.9 #
8 : overbeek 1.1 # The SEED Toolkit is free software. You can redistribute
9 :     # it and/or modify it under the terms of the SEED Toolkit
10 : parrello 1.9 # Public License.
11 : overbeek 1.1 #
12 :     # You should have received a copy of the SEED Toolkit Public License
13 :     # along with this program; if not write to the University of Chicago
14 :     # at info@ci.uchicago.edu or the Fellowship for Interpretation of
15 :     # Genomes at veronika@thefig.info or download a copy from
16 :     # http://www.theseed.org/LICENSE.TXT.
17 :     ########################################################################
18 :    
19 :     package FF;
20 :    
21 :     use strict;
22 :     use Carp;
23 :     use Data::Dumper;
24 : parrello 1.30 no warnings 'redefine';
25 : overbeek 1.1
26 :     =head1 Module to access FIGfams
27 :    
28 :     =head3 new
29 :    
30 :     usage:
31 : disz 1.33 my $figfam_obj = FFserver->new();
32 : overbeek 1.1
33 : disz 1.33 =cut
34 : overbeek 1.1
35 : disz 1.33 #
36 :     # Actually, if you are using FF.pm, you should do FF->new(), not FFserver->new()
37 :     # That comment above is for the benefit of the pod doc stuff on how to use FFserver
38 :     # that is generated from this file.
39 :    
40 :     # Here's how you use this module
41 :     # my $figfam_obj = FF->new($fam_id, $fam_dir);
42 :     #C<$fam_id> is the ID of the family, of the form C<FIGnnnnnn> where C<n> is a digit;
43 :     #it is required.
44 :     #
45 :     #C<$fam_data> is required
46 :     #as the directory that contains (or will contain) FigFam data.
47 :     #
48 :     #
49 : overbeek 1.1
50 :     sub new {
51 : olson 1.34 my($class,$fam_id,$ffs) = @_;
52 : overbeek 1.1
53 : disz 1.35 ($fam_id =~ /^FIG\d+$/) || confess "invalid family id: $fam_id";
54 : overbeek 1.1 my $fam = {};
55 :     $fam->{id} = $fam_id;
56 : olson 1.34 $fam->{ffs} = $ffs;
57 : overbeek 1.1
58 : olson 1.34 return bless $fam, $class;
59 : overbeek 1.1 }
60 :    
61 :     =head3 pegs_of
62 :    
63 :     usage:
64 : parrello 1.9 print $figfam_obj->pegs_of();
65 : overbeek 1.1
66 :     Returns a list of just pegs.
67 :    
68 :     =cut
69 :    
70 :     sub pegs_of {
71 :     my($self) = @_;
72 :     return [$self->list_members];
73 :     }
74 :    
75 :     =head3 list_members
76 :    
77 :     usage:
78 : parrello 1.9 @ids = $figfam_obj->list_members();
79 : overbeek 1.1
80 :     Returns a list of the PEG FIDs in a family.
81 :    
82 :     =cut
83 :    
84 :     sub list_members {
85 :     my ($self) = @_;
86 : parrello 1.9
87 : olson 1.34 return @{$self->{ffs}->family_pegs($self->{id})};
88 : overbeek 1.1 }
89 :    
90 :    
91 :     =head3 family_function
92 :    
93 :     usage:
94 : parrello 1.9 $func = $figfam_obj->family_function();
95 : overbeek 1.1
96 :     Returns the "consensus function" assigned to a FIGfam object.
97 :    
98 :     =cut
99 :    
100 :     sub family_function {
101 : overbeek 1.13 my($self,$full) = @_;
102 : overbeek 1.1
103 : olson 1.34 return $self->{ffs}->family_function($self->{id});
104 : overbeek 1.1 }
105 :    
106 :    
107 :     =head3 family_id
108 :    
109 :     usage:
110 : parrello 1.9 $fam_id = $figfam_obj->family_id();
111 : overbeek 1.1
112 :     Returns the FIGfam ID of a FIGfam object.
113 :    
114 :     =cut
115 :    
116 :     sub family_id {
117 :     my($self) = @_;
118 :    
119 :     return $self->{id};
120 :     }
121 :    
122 :     1;

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3