[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.19, Mon Mar 19 19:49:25 2007 UTC revision 1.34, Sat Aug 23 16:05:38 2008 UTC
# Line 1  Line 1 
1    # -*- perl -*-
2  ########################################################################  ########################################################################
3  #  #
4  # Copyright (c) 2003-2006 University of Chicago and Fellowship  # Copyright (c) 2003-2006 University of Chicago and Fellowship
# Line 17  Line 18 
18  #  #
19  ########################################################################  ########################################################################
20    
21    =head1 TODO
22    
23    =over 4
24    
25    =item Null arg to ContigO::dna_seq() should return entire contig seq.
26    
27    =item Add method to access "FIG::crude_estimate_of_distance()"
28    
29    =back
30    
31    =cut
32    
33  =head1 Overview  =head1 Overview
34    
35  This module is a set of packages encapsulating the SEED's core methods  This module is a set of packages encapsulating the SEED's core methods
36  using an "OOP-like" style.  using an "OOP-like" style.
37    
38  There are several modules clearly related to "individual genomes:"  There are several modules clearly related to "individual genomes:"
39  FIGO, GenomeO, ContigO, FeatureO (and I<maybe> AnnotationO).  GenomeO, ContigO, FeatureO (and I<maybe> AnnotationO).
40    
41  There are also modules that deal with complex relationships between  There are also modules that deal with complex relationships between
42  pairs or sets of features in one, two, or more genomes,  pairs or sets of features in one, two, or more genomes,
# Line 32  Line 45 
45    
46  Finally, the methods in "Attribute" might in principle attach  Finally, the methods in "Attribute" might in principle attach
47  "atributes" to any type of object.  "atributes" to any type of object.
48  (Likewise, in principle one might like to attach an "annotation"  (Likewise, in principle one might also want to attach an "annotation"
49  to any type of object  to any type of object,
50    although currently we only support annotations of "features.")
51    
52  Four of the modules dealing with "genomes" have a reasonable clear  The three modules that act on "individual genomes" have a reasonable clear
53  "implied heirarchy:"  "implied heirarchy" relative to FIGO:
54    
55  =over 4  =over 4
56    
# Line 52  Line 66 
66  We have chosen to in many cases sidestep the entire issue of inheritance  We have chosen to in many cases sidestep the entire issue of inheritance
67  via an I<ad hoc> mechanism:  via an I<ad hoc> mechanism:
68  If a "child" object needs access to its "ancestors'" methods,  If a "child" object needs access to its "ancestors'" methods,
69  we pass it references to its "ancestors" using subroutine arguments.  we will explicitly pass it references to its "ancestors,"
70    as subroutine arguments.
71  This is admittedly ugly, clumsy, and potentially error-prone ---  This is admittedly ugly, clumsy, and potentially error-prone ---
72  but it has the advantage that, unlike multiple inheritance,  but it has the advantage that, unlike multiple inheritance,
73  we understand how to do it...  we understand how to do it...
# Line 67  Line 82 
82  ########################################################################  ########################################################################
83  use strict;  use strict;
84  use FIG;  use FIG;
85    use FIGV;
86  use FIG_Config;  use FIG_Config;
87  use SFXlate;  use SFXlate;
88  use SproutFIG;  use SproutFIG;
89  use Tracer;  use Tracer;
90  use Data::Dumper;  use Data::Dumper;
91    use Carp;
92  use FigFams;  use FigFams;
93  use gjoparseblast;  use gjoparseblast;
94    
# Line 90  Line 107 
107    
108  =item USAGE:  =item USAGE:
109    
110  C<< my $figo = FIGO->new();           #...Subclass defaults to FIG >>      my $figO = FIGO->new();                    #...Subclass defaults to FIG
111    
112        my $figO = FIGO->new('SPROUT');            #...Subclass is a SPROUT object
113    
114  C<< my $figo = FIGO->new('SPROUT');   #...Subclass is a SPROUT object >>      my $figO = FIGO->new($orgdir);             #...Subclass includes $orgdir as a "Virtual" SEED genome
115    
116        my $figO = FIGO->new($orgdir, 'SPROUT');   #...Subclass includes $orgdir as a "Virtual" SPROUT genome
117    
118  =back  =back
119    
120  =cut  =cut
121    
122  sub new {  sub new {
123      my($class,$low_level) = @_;      my ($class, @argv) = @_;
124    
125      my $fig;      my $fig;
126      if ($low_level && ($low_level =~ /sprout/i))      if (@argv) {
127      {          print STDERR ("New FIGO using FIGV( ",
128          $fig = new SproutFIG($FIG_Config::sproutDB, $FIG_Config::sproutData);                        join(qq(, ), @argv),
129      }                        " )\n",
130      else                        ) if $ENV{FIG_DEBUG};
131      {  
132          $fig = new FIG;          $fig = FIGV->new(@argv);
133        }
134        else {
135            print STDERR "FIGO using FIG with installed SEED orgs\n" if $ENV{FIG_DEBUG};
136            $fig = FIG->new();
137      }      }
138    
139      my $self = {};      my $self = {};
# Line 117  Line 142 
142      return bless $self, $class;      return bless $self, $class;
143  }  }
144    
145    sub function_of {
146        my($self,$id) = @_;
147    
148        my $fig  = $self->{_fig};
149        my $func = $fig->function_of($id);
150    
151        return ($func ? $func : "");
152    }
153    
154  =head3 genomes  =head3 genomes
155    
# Line 128  Line 160 
160    
161  =item USAGE:  =item USAGE:
162    
163  C<< my @tax_ids = $figo->genomes(); >>      my @tax_ids = $figo->genomes();
164    
165  C<< my @tax_ids = $figo->genomes( @constraints ); >>      my @tax_ids = $figo->genomes( @constraints );
166    
167  =item @constraints  =item @constraints
168    
# Line 249  Line 281 
281    
282  =item USAGE:  =item USAGE:
283    
284  C<< foreach $fam ($figO->all_figfams) { #...Do something } >>      foreach $fam ($figO->all_figfams) { #...Do something }
285    
286  =item RETURNS:  =item RETURNS:
287    
# Line 266  Line 298 
298  sub all_figfams {  sub all_figfams {
299      my($self) = @_;      my($self) = @_;
300      my $fig = $self->{_fig};      my $fig = $self->{_fig};
301      my $fams = new FigFams($fig);      my $fams = FigFams->new($fig);
302      return map { &FigFamO::new('FigFamO',$self,$_) } $fams->all_families;      return map { &FigFamO::new('FigFamO',$self,$_) } $fams->all_families;
303  }  }
304    
# Line 278  Line 310 
310    
311  =item USAGE:  =item USAGE:
312    
313  C<< my ($fam, $sims) = $figO->family_containing($seq); >>      my ($fam, $sims) = $figO->family_containing($seq);
314    
315  =item $seq:  =item $seq:
316    
# Line 300  Line 332 
332      my($self,$seq) = @_;      my($self,$seq) = @_;
333    
334      my $fig = $self->{_fig};      my $fig = $self->{_fig};
335      my $fams = new FigFams($fig);      my $fams = FigFams->new($fig);
336      my($fam,$sims) = $fams->place_in_family($seq);      my($fam,$sims) = $fams->place_in_family($seq);
337      if ($fam)      if ($fam)
338      {      {
# Line 318  Line 350 
350    
351  =item USAGE:  =item USAGE:
352    
353  C<< my $fam = $figO->figfam($family_id); >>      my $fam = $figO->figfam($family_id);
354    
355  =item $family_id;  =item $family_id;
356    
# Line 342  Line 374 
374  ########################################################################  ########################################################################
375  package GenomeO;  package GenomeO;
376  ########################################################################  ########################################################################
377    use Carp;
378  use Data::Dumper;  use Data::Dumper;
379    
380  =head1 GenomeO  =head1 GenomeO
# Line 357  Line 390 
390    
391  =item USAGE:  =item USAGE:
392    
393  C<< my $org = GenomeO->new($figo, $tax_id); >>      my $orgO = GenomeO->new($figO, $tax_id);
394    
395  =item RETURNS:  =item RETURNS:
396    
397      A new GenomeO object.  A new "GenomeO" object.
398    
399  =back  =back
400    
# Line 384  Line 417 
417    
418  =item USAGE:  =item USAGE:
419    
420  C<< my $tax_id = $org->id(); >>      my $tax_id = $orgO->id();
421    
422  =item RETURNS:  =item RETURNS:
423    
424      Taxonomy-ID of GenomeO object.  Taxonomy-ID of "GenomeO" object.
425    
426  =back  =back
427    
# Line 408  Line 441 
441    
442  =item USAGE:  =item USAGE:
443    
444  C<< $gs = $genome->genus_species(); >>      $gs = $orgO->genus_species();
445    
446  =item RETURNS:  =item RETURNS:
447    
# Line 422  Line 455 
455      my($self) = @_;      my($self) = @_;
456    
457      my $fig = $self->{_figO}->{_fig};      my $fig = $self->{_figO}->{_fig};
458        if (defined($fig)) {
459      return $fig->genus_species($self->{_id});      return $fig->genus_species($self->{_id});
460  }  }
461        else {
462            confess "Undefined FIG or FIGV\n", Dumper($self);
463        }
464    }
465    
466    
467    
468    =head3 taxonomy_of
469    
470    =over 4
471    
472    =item FUNCTION:
473    
474    Return the TAXONOMY string of a "GenomeO" object.
475    
476    =item USAGE:
477    
478        my $taxonomy = $orgO->taxonomy_of();
479    
480    =item RETURNS:
481    
482    TAXONOMY string.
483    
484    =back
485    
486    =cut
487    
488    sub taxonomy_of {
489        my ($self) = @_;
490    
491        my $figO = $self->{_figO};
492        my $fig  = $figO->{_fig};
493    
494        return $fig->taxonomy_of($self->{_id});
495    }
496    
497    
498  =head3 contigs_of  =head3 contigs_of
# Line 454  Line 523 
523    
524  =head3 features_of  =head3 features_of
525    
526    =over 4
527    
528    =item FUNCTION:
529    
530    Returns a list of "FeatureO" objects contained in a "GenomeO" object.
531    
532    =item USAGE:
533    
534        my @featureOs = $orgO->features_of();        #...Fetch all features
535    
536    or
537    
538        my @featureOs = $orgO->features_of('peg');   #...Fetch only PEGs
539    
540    =item RETURNS:
541    
542    List of "FeatureO" objects.
543    
544    =back
545    
546  =cut  =cut
547    
548  sub features_of {  sub features_of {
# Line 474  Line 563 
563    
564  =item USAGE:  =item USAGE:
565    
566  C<< $genome->display(); >>      $genome->display();
567    
568  =item RETURNS:  =item RETURNS:
569    
# Line 511  Line 600 
600    
601  =item USAGE:  =item USAGE:
602    
603  C<< $contig = ContigO->new( $figO, $genomeId, $contigId); >>      $contig = ContigO->new( $figO, $genomeId, $contigId);
604    
605  =item $figO:  =item $figO:
606    
# Line 570  Line 659 
659    
660  =item USAGE:  =item USAGE:
661    
662  C<< my $tax_id = $contig->genome->id(); >>      my $tax_id = $contig->genome->id();
663    
664  =item RETURNS:  =item RETURNS:
665    
# Line 584  Line 673 
673      my($self) = @_;      my($self) = @_;
674    
675      my $figO = $self->{_figO};      my $figO = $self->{_figO};
676      return new GenomeO($figO,$self->{_genome});      return GenomeO->new($figO,$self->{_genome});
677  }  }
678    
679    
# Line 595  Line 684 
684    
685  =item USAGE:  =item USAGE:
686    
687  C<< my $len = $contig->contig_length(); >>      my $len = $contig->contig_length();
688    
689  =item RETURNS:  =item RETURNS:
690    
# Line 620  Line 709 
709    
710  =item USAGE:  =item USAGE:
711    
712  C<< my $seq = $contig->dna_seq(beg, $end); >>      my $seq = $contig->dna_seq(beg, $end);
713    
714  =item $beg:  =item $beg:
715    
# Line 632  Line 721 
721    
722  =item RETURNS:  =item RETURNS:
723    
724      string of DNA sequence running from $beg to $end  String containing DNA subsequence running from $beg to $end
725      (NOTE: if $beg > $end, returns reverse complement of DNA subsequence.)      (NOTE: if $beg > $end, returns reverse complement of DNA subsequence.)
726    
727  =back  =back
# Line 688  Line 777 
777      my $fig = $figO->{_fig};      my $fig = $figO->{_fig};
778    
779      my($features) = $fig->genes_in_region($self->genome->id,$self->id,$beg,$end);      my($features) = $fig->genes_in_region($self->genome->id,$self->id,$beg,$end);
780      return map { new FeatureO($figO,$_) } @$features;      return map { FeatureO->new($figO,$_) } @$features;
781  }  }
782    
783    
# Line 697  Line 786 
786  package FeatureO;  package FeatureO;
787  ########################################################################  ########################################################################
788  use Data::Dumper;  use Data::Dumper;
789    use Carp;
790    
791  =head1 FeatureO  =head1 FeatureO
792    
# Line 707  Line 797 
797    
798  =head3 new  =head3 new
799    
800  Constructor of "FeatureO" objects  Constructor of new "FeatureO" objects
801    
802  =over 4  =over 4
803    
804  =item USAGE:  =item USAGE:
805    
806  C<< my $feature = FeatureO->new( $figO, $fid ); >>      my $feature = FeatureO->new( $figO, $fid );
807    
808  =item C<$figO>:  =item C<$figO>:
809    
# Line 749  Line 839 
839    
840  =item USAGE:  =item USAGE:
841    
842  C<< my $fid = $feature->id(); >>      my $fid = $feature->id();
843    
844  =item RETURNS:  =item RETURNS:
845    
# Line 773  Line 863 
863    
864  =item USAGE:  =item USAGE:
865    
866  C<< my $taxid = $feature->genome(); >>      my $taxid = $feature->genome();
867    
868  =item RETURNS:  =item RETURNS:
869    
870  The TAxon-ID for the "GenomeO" object containg the feature.  The Taxon-ID for the "GenomeO" object containing the feature.
871    
872  =back  =back
873    
# Line 787  Line 877 
877      my($self) = @_;      my($self) = @_;
878      my $figO = $self->{_figO};      my $figO = $self->{_figO};
879      $self->id =~ /^fig\|(\d+\.\d+)/;      $self->id =~ /^fig\|(\d+\.\d+)/;
880      return new GenomeO($figO,$1);      return GenomeO->new($figO,$1);
881  }  }
882    
883    
# Line 798  Line 888 
888    
889  =item USAGE:  =item USAGE:
890    
891  C<< my $feature_type = $feature->type(); >>      my $feature_type = $feature->type();
892    
893  =item RETURNS:  =item RETURNS:
894    
# Line 823  Line 913 
913    
914  =item USAGE:  =item USAGE:
915    
916  C<< my $loc = $feature->location(); >>      my $loc = $feature->location();
917    
918  =item RETURNS:  =item RETURNS:
919    
# Line 848  Line 938 
938    
939  =item USAGE:  =item USAGE:
940    
941  C<< my $contig = $feature->contig(); >>      my $contig = $feature->contig();
942    
943  =item RETURNS:  =item RETURNS:
944    
# Line 865  Line 955 
955      my $figO = $self->{_figO};      my $figO = $self->{_figO};
956      my $loc      = $self->location;      my $loc      = $self->location;
957      my $genomeID = $self->genome->id;      my $genomeID = $self->genome->id;
958      return ($loc =~ /^(\S+)_\d+_\d+$/) ? new ContigO($figO,$genomeID,$1) : undef;      return (($loc =~ /^(\S+)_\d+_\d+$/) ? ContigO->new($figO,$genomeID,$1) : undef);
959  }  }
960    
961    
# Line 876  Line 966 
966    
967  =item USAGE:  =item USAGE:
968    
969  C<< my $beg = $feature->begin(); >>      my $beg = $feature->begin();
970    
971  =item RETURNS:  =item RETURNS:
972    
# Line 901  Line 991 
991    
992  =item USAGE:  =item USAGE:
993    
994  C<< my $end = $feature->end(); >>      my $end = $feature->end();
995    
996  =item RETURNS:  =item RETURNS:
997    
# Line 926  Line 1016 
1016    
1017  =item USAGE:  =item USAGE:
1018    
1019  C<< my $dna_seq = $feature->dna_seq(); >>      my $dna_seq = $feature->dna_seq();
1020    
1021  =item RETURNS:  =item RETURNS:
1022    
# Line 956  Line 1046 
1046    
1047  =item USAGE:  =item USAGE:
1048    
1049  C<< my $dna_seq = $feature->prot_seq(); >>      my $dna_seq = $feature->prot_seq();
1050    
1051  =item RETURNS:  =item RETURNS:
1052    
# Line 984  Line 1074 
1074    
1075  =item USAGE:  =item USAGE:
1076    
1077  C<< my $func = $feature->function_of(); >>      my $func = $feature->function_of();
1078    
1079  =item RETURNS:  =item RETURNS:
1080    
# Line 1011  Line 1101 
1101    
1102  =item USAGE:  =item USAGE:
1103    
1104  C<< my @coupled_features = $feature->coupled_to(); >>      my @coupled_features = $feature->coupled_to();
1105    
1106  =item RETURNS:  =item RETURNS:
1107    
1108  A list of L<CouplingO> objects describing the evidence for functional coupling  A list of "CouplingO" objects describing the evidence for functional coupling
1109  between this feature and other nearby features.  between this feature and other nearby features.
1110    
1111  =back  =back
# Line 1046  Line 1136 
1136    
1137  =item USAGE:  =item USAGE:
1138    
1139  C<< my @annot_list = $feature->annotations(); >>      my @annot_list = $feature->annotations();
1140    
1141  =item RETURNS:  =item RETURNS:
1142    
1143  A list of L<AnnotationO> objects allowing access to the annotations for this feature.  A list of "AnnotationO" objects allowing access to the annotations for this feature.
1144    
1145  =back  =back
1146    
# Line 1072  Line 1162 
1162    
1163  =item USAGE:  =item USAGE:
1164    
1165  C<< my @subsys_list = $feature->in_subsystems(); >>      my @subsys_list = $feature->in_subsystems();
1166    
1167  =item RETURNS:  =item RETURNS:
1168    
1169  A list of L<SubsystemO> objects allowing access to the subsystems  A list of "SubsystemO" objects allowing access to the subsystems
1170  that this feature particupates in.  that this feature particupates in.
1171    
1172  =back  =back
# Line 1088  Line 1178 
1178      my $figO = $self->{_figO};      my $figO = $self->{_figO};
1179      my $fig  = $figO->{_fig};      my $fig  = $figO->{_fig};
1180    
1181      return map { new SubsystemO($figO,$_) } $fig->peg_to_subsystems($self->id);      return map { SubsystemO->new($figO,$_) } $fig->peg_to_subsystems($self->id);
1182  }  }
1183    
1184    
# Line 1098  Line 1188 
1188    
1189  =item USAGE:  =item USAGE:
1190    
1191  C<< my $trunc = $feature->possibly_truncated(); >>      my $trunc = $feature->possibly_truncated();
1192    
1193  =item RETURNS:  =item RETURNS:
1194    
# Line 1125  Line 1215 
1215    
1216  =item USAGE:  =item USAGE:
1217    
1218  C<< my $fs = $feature->possible_frameshift(); >>      my $fs = $feature->possible_frameshift();
1219    
1220  =item RETURNS:  =item RETURNS:
1221    
# Line 1142  Line 1232 
1232  sub possible_frameshift {  sub possible_frameshift {
1233      my($self) = @_;      my($self) = @_;
1234      my $figO = $self->{_figO};      my $figO = $self->{_figO};
1235      my($tmp_dir) = $figO->{_tmp_dir};      my $fig = $figO->{_fig};
1236    
1237      if (! $self->possibly_truncated)      return $fig->possible_frameshift($self->id);
     {  
         my @sims = $self->sims( -max => 1, -cutoff => 1.0e-50);  
         if (my $sim = shift @sims)  
         {  
             my $peg2 = $sim->id2;  
             my $ln1  = $sim->ln1;  
             my $ln2  = $sim->ln2;  
             my $b2   = $sim->b2;  
             my $e2   = $sim->e2;  
             my $adjL = 100 + (($b2-1) * 3);  
             my $adjR = 100 + (($ln2 - $e2) * 3);  
             if ($ln2 > (1.2 * $ln1))  
             {  
                 my $loc = $self->location;  
                 if ($loc =~ /^(\S+)_(\d+)_(\d+)/)  
                 {  
                     my $contig = $1;  
                     my $beg    = $2;  
                     my $end = $3;  
                     my $contigO = new ContigO($figO,$self->genome->id,$contig);  
                     my $begA = &max(1,$beg - $adjL);  
                     my $endA = &min($end+$adjR,$contigO->contig_length);  
                     my $dna  = $contigO->dna_seq($begA,$endA);  
                     open(TMP,">$tmp_dir/tmp_dna") || die "couild not open tmp_dna";  
                     print TMP ">dna\n$dna\n";  
                     close(TMP);  
   
                     my $peg2O = new FeatureO($figO,$peg2);  
                     my $prot  = $peg2O->prot_seq;  
                     open(TMP,">$tmp_dir/tmp_prot") || die "could not open tmp_prot";  
                     print TMP ">tmp_prot\n$prot\n";  
                     close(TMP);  
                     &run("formatdb -i $tmp_dir/tmp_dna -pF");  
                     open(BLAST,"blastall -i $tmp_dir/tmp_prot -d $tmp_dir/tmp_dna -p tblastn -FF -e 1.0e-50 |")  
                         || die "could not blast";  
   
                     my $db_seq_out = &gjoparseblast::next_blast_subject(\*BLAST,1);  
                     my @hsps       = sort { $a->[0] <=> $b->[0] }  
                                      map { [$_->[9],$_->[10],$_->[12],$_->[13]] }  
                                      grep { $_->[1] < 1.0e-50 }  
                                      @{$db_seq_out->[6]};  
                     my @prot = map { [$_->[0],$_->[1]] } @hsps;  
                     my @dna  = map { [$_->[2],$_->[3]] } @hsps;  
                     if (&covers(\@prot,length($prot),3,0) && &covers(\@dna,3*length($prot),9,1))  
                     {  
                         return 1;  
                     }  
                 }  
             }  
         }  
     }  
     return 0;  
1238  }  }
1239    
1240    
# Line 1213  Line 1251 
1251    
1252  =item USAGE:  =item USAGE:
1253    
1254  C<< $feature->run($cmd); >>      $feature->run($cmd);
1255    
1256  =item RETURNS:  =item RETURNS:
1257    
# Line 1226  Line 1264 
1264    
1265  sub run {  sub run {
1266      my($cmd) = @_;      my($cmd) = @_;
1267      (system($cmd) == 0) || Confess("FAILED: $cmd");      (system($cmd) == 0) || confess("FAILED: $cmd");
1268  }  }
1269    
1270    
# Line 1239  Line 1277 
1277    
1278  =item USAGE:  =item USAGE:
1279    
1280  C<< my $max = $feature->max($x, $y); >>      my $max = $feature->max($x, $y);
1281    
1282  =item C<$x>  =item C<$x> and  C<$y>
1283    
1284  Numerical value.  Numerical values.
1285    
1286  =item C<$y>  =item RETURNS:
   
 Numerical value.  
   
 =items RETURNS:  
1287    
1288  The larger of the two numerical values C<$x> and C<$y>.  The larger of the two numerical values C<$x> and C<$y>.
1289    
# Line 1272  Line 1306 
1306    
1307  =item USAGE:  =item USAGE:
1308    
1309  C<< my $min = $feature->min($x, $y); >>      my $min = $feature->min($x, $y);
   
 =item C<$x>  
   
 Numerical value.  
1310    
1311  =item C<$y>  =item C<$x> and C<$y>
1312    
1313  Numerical value.  Numerical values.
1314    
1315  =item RETURNS:  =item RETURNS:
1316    
# Line 1295  Line 1325 
1325      return ($x < $y) ? $x : $y;      return ($x < $y) ? $x : $y;
1326  }  }
1327    
   
   
 =head3 covers  
   
 (Question: Should this function be considered "PRIVATE" ???)  
   
 USAGE:  
     C<< if (&covers(\@hits, $len, $diff, $must_shift)) { #...Do stuff } >>  
   
 Returns boolean C<TRUE> if a set of BLAST HSPs "cover" more than 90%  
 of the database sequence(?).  
   
 =cut  
   
 sub covers {  
     my($hsps,$ln,$diff,$must_shift) = @_;  
   
     my $hsp1 = shift @$hsps;  
     my $hsp2;  
     my $merged = 0;  
     while ($hsp1 && ($hsp2 = shift @$hsps) &&  
            ($must_shift ? &diff_frames($hsp1,$hsp2) : 1) &&  
            ($hsp1 = &merge($hsp1,$hsp2,$diff))) { $merged = 1 }  
     return ($merged && $hsp1 && (($hsp1->[1] - $hsp1->[0]) > (0.9 * $ln)));  
 }  
   
 sub diff_frames {  
     my($hsp1,$hsp2) = @_;  
     return (($hsp1->[0] % 3) != ($hsp2->[0] % 3));  
 }  
   
   
   
 =head3 merge  
   
 Merge two HSPs unless their overlap or separation is too large.  
   
 RETURNS: Merged boundaries if merger succeeds, and C<undef> if merger fails.  
   
 =cut  
   
 sub merge {  
     my($hsp1,$hsp2,$diff) = @_;  
   
     my($b1,$e1) = @$hsp1;  
     my($b2,$e2) = @$hsp2;  
     return (($e2 > $e1) && (abs($b2-$e1) <= $diff)) ? [$b1,$e2] : undef;  
 }  
   
   
   
1328  =head3 sims  =head3 sims
1329    
1330  =over 4  =over 4
# Line 1356  Line 1335 
1335    
1336  =item USAGE:  =item USAGE:
1337    
1338  C<< my @sims = $pegO->sims( -all, -cutoff => 1.0e-10); >>      my @sims = $pegO->sims( -all, -cutoff => 1.0e-10);
1339    
1340  C<< my @sims = $pegO->sims( -max => 50, -cutoff => 1.0e-10); >>      my @sims = $pegO->sims( -max => 50, -cutoff => 1.0e-10);
1341    
1342  =item RETURNS: List of sim objects.  =item RETURNS: List of sim objects.
1343    
# Line 1374  Line 1353 
1353      my $fig  = $figO->{_fig};      my $fig  = $figO->{_fig};
1354    
1355      my $cutoff = $args{-cutoff} ? $args{-cutoff} : 1.0e-5;      my $cutoff = $args{-cutoff} ? $args{-cutoff} : 1.0e-5;
1356      my $all    = $args{-all}    ? $args{-all}    : "fig";      my $all    = $args{-all}    ? 'all'          : "fig";
1357      my $max    = $args{-max}    ? $args{-max}    : 10000;      my $max    = $args{-max}    ? $args{-max}    : 10000;
1358    
1359      return $fig->sims($self->id,$max,$cutoff,$all);      my @sims = $fig->sims($self->id,$max,$cutoff,$all);
1360    
1361        if (@sims) {
1362            my $peg1 = FeatureO->new($figO, $sims[0]->[0]);
1363    
1364            foreach my $sim (@sims) {
1365    #           $sim->[0] = $peg1;
1366    #           $sim->[1] = FeatureO->new($figO, $sim->[1]);
1367            }
1368        }
1369    
1370        return @sims;
1371  }  }
1372    
1373    
# Line 1393  Line 1383 
1383    
1384  =item USAGE:  =item USAGE:
1385    
1386  C<< my @bbhs = $pegO->bbhs(); >>      my @bbhs = $pegO->bbhs();
1387    
1388    =item RETURNS:
1389    
1390  =item List of BBHO objects.  List of BBHO objects.
1391    
1392  =back  =back
1393    
# Line 1416  Line 1408 
1408                                                  },'BBHO') } @bbhs;                                                  },'BBHO') } @bbhs;
1409  }  }
1410    
1411    
1412  =head3 display  =head3 display
1413    
1414    =over 4
1415    
1416    =item FUNCTION:
1417    
1418  Prints info about a "FeatureO" object to STDOUT.  Prints info about a "FeatureO" object to STDOUT.
1419    
1420  USAGE:  =item USAGE:
1421    
1422        $pegO->display();
1423    
1424    =item RETURNS;
1425    
1426    (void)
1427    
1428  C<< $pegO->display(); >>  =back
1429    
1430  =cut  =cut
1431    
# Line 1475  Line 1478 
1478    
1479  =item USAGE:  =item USAGE:
1480    
1481  C<< my $peg1 = $bbh->peg1(); >>      my $peg1 = $bbh->peg1();
1482    
1483  =item RETURNS:  =item RETURNS:
1484    
# Line 1490  Line 1493 
1493      my($self) = @_;      my($self) = @_;
1494    
1495      my $figO = $self->{_figO};      my $figO = $self->{_figO};
1496      return new FeatureO($figO,$self->{_peg1});      return FeatureO->new($figO, $self->{_peg1});
1497  }  }
1498    
1499  =head3 peg2  =head3 peg2
# Line 1499  Line 1502 
1502    
1503  =item USAGE:  =item USAGE:
1504    
1505  C<< my $peg2 = $bbh->peg2(); >>      my $peg2 = $bbh->peg2();
1506    
1507  =item RETURNS:  =item RETURNS:
1508    
# Line 1514  Line 1517 
1517      my($self) = @_;      my($self) = @_;
1518    
1519      my $figO = $self->{_figO};      my $figO = $self->{_figO};
1520      return new FeatureO($figO,$self->{_peg2});      return FeatureO->new($figO,$self->{_peg2});
1521  }  }
1522    
1523    
# Line 1525  Line 1528 
1528    
1529  =item USAGE:  =item USAGE:
1530    
1531  C<< my $psc = $bbh->psc(); >>      my $psc = $bbh->psc();
1532    
1533  =item RETURNS:  =item RETURNS:
1534    
# Line 1550  Line 1553 
1553    
1554  =item USAGE:  =item USAGE:
1555    
1556  C<< my $bsc = $bbh->norm_bitscore(); >>      my $bsc = $bbh->norm_bitscore();
1557    
1558  =item RETURNS:  =item RETURNS:
1559    
# Line 1582  Line 1585 
1585    
1586  =head3 new  =head3 new
1587    
1588    =over 4
1589    
1590    =item FUNCTION:
1591    
1592    Cronstruct a new "AnnotationO" object
1593    
1594    =item USAGE:
1595    
1596        my $annotO = AnnotationO->new( $fid, $timestamp, $who, $text);
1597    
1598    =item C<$fid>
1599    
1600    A feature identifier.
1601    
1602    =item C<$timestamp>
1603    
1604    The C<UN*X> timestamp one wishes to associate with the annotation.
1605    
1606    =item C<$who>
1607    
1608    The annotator's user-name.
1609    
1610    =item C<$text>
1611    
1612    The textual content of the annotation.
1613    
1614    =item RETURNS:
1615    
1616    An "AnnotationO" object.
1617    
1618    =back
1619    
1620  =cut  =cut
1621    
1622  sub new {  sub new {
# Line 1599  Line 1634 
1634    
1635  =head3 fid  =head3 fid
1636    
1637    =over 4
1638    
1639    =item FUNCTION:
1640    
1641    Extract the feature-ID that was annotated.
1642    
1643    =item USAGE:
1644    
1645        my $fid = $annotO->fid();
1646    
1647    =item RETURNS;
1648    
1649    The feature-ID as a string.
1650    
1651    =back
1652    
1653  =cut  =cut
1654    
1655  sub fid {  sub fid {
# Line 1611  Line 1662 
1662    
1663  =head3 timestamp  =head3 timestamp
1664    
1665    =over 4
1666    
1667    =item FUNCTION:
1668    
1669    Extract the C<UN*X> timestamp of the annotation.
1670    
1671    =item USAGE:
1672    
1673        my $fid = $annotO->timestamp();
1674    
1675    =item RETURNS;
1676    
1677    The timestamp as a string.
1678    
1679    =back
1680    
1681  =cut  =cut
1682    
1683  sub timestamp {  sub timestamp {
# Line 1630  Line 1697 
1697    
1698  =head3 made_by  =head3 made_by
1699    
1700    =over 4
1701    
1702    =item FUNCTION:
1703    
1704    Extract the annotator's user-name.
1705    
1706    =item USAGE:
1707    
1708        my $fid = $annotO->made_by();
1709    
1710    =item RETURNS;
1711    
1712    The username of the annotator, as a string.
1713    
1714    =back
1715    
1716  =cut  =cut
1717    
1718  sub made_by {  sub made_by {
# Line 1644  Line 1727 
1727    
1728  =head3 text  =head3 text
1729    
1730    =over 4
1731    
1732    =item FUNCTION:
1733    
1734    Extract the text of the annotation.
1735    
1736    =item USGAE:
1737    
1738        my $text = $annotO->text();
1739    
1740    =item RETURNS:
1741    
1742    The text of the annotation, as a string.
1743    
1744    =back
1745    
1746  =cut  =cut
1747    
1748  sub text {  sub text {
# Line 1656  Line 1755 
1755    
1756  =head3 display  =head3 display
1757    
1758    =over 4
1759    
1760    =item FUNCTION:
1761    
1762    Print the contents of an "AnnotationO" object to B<STDOUT>
1763    in human-readable form.
1764    
1765    =item USAGE:
1766    
1767        my $annotO->display();
1768    
1769    =item RETURNS:
1770    
1771    (void)
1772    
1773    =back
1774    
1775  =cut  =cut
1776    
1777  sub display {  sub display {
# Line 1682  Line 1798 
1798    
1799  =head3 new  =head3 new
1800    
1801    =over 4
1802    
1803    =item FUNCTION:
1804    
1805    Construct a new "CouplingO" object
1806    encapsulating the "functional coupling" score
1807    between a pair of features in some genome.
1808    
1809    =item USAGE:
1810    
1811        $couplingO = CouplingO->new($figO, $fid1, $fid2, $sc);
1812    
1813    =item C<$figO>
1814    
1815    Parent "FIGO" object.
1816    
1817    =item C<$fid1> and C<$fid2>
1818    
1819    A pair of feature-IDs.
1820    
1821    =item C<$sc>
1822    
1823    A functional-coupling score
1824    
1825    =item RETURNS:
1826    
1827    A "CouplingO" object.
1828    
1829    =back
1830    
1831  =cut  =cut
1832    
1833  sub new {  sub new {
# Line 1701  Line 1847 
1847    
1848  =head3 peg1  =head3 peg1
1849    
1850    =over 4
1851    
1852    =item FUNCTION:
1853    
1854    Returns a "FeatureO" object corresponding to the first FID in a coupled pair.
1855    
1856    =item USAGE:
1857    
1858        my $peg1 = $couplingO->peg1();
1859    
1860    =item RETURNS:
1861    
1862    A "FeatureO" object.
1863    
1864    =back
1865    
1866  =cut  =cut
1867    
1868  sub peg1 {  sub peg1 {
1869      my($self) = @_;      my($self) = @_;
1870    
1871      my $figO = $self->{_figO};      my $figO = $self->{_figO};
1872      return new FeatureO($figO,$self->{_peg1});      return FeatureO->new($figO,$self->{_peg1});
1873  }  }
1874    
1875    
1876    
1877  =head3 peg1  =head3 peg2
1878    
1879    =over 4
1880    
1881    =item FUNCTION:
1882    
1883    Returns a "FeatureO" object corresponding to the second FID in a coupled pair.
1884    
1885    =item USAGE:
1886    
1887        my $peg2 = $couplingO->peg2();
1888    
1889    =item RETURNS:
1890    
1891    A "FeatureO" object.
1892    
1893    =back
1894    
1895  =cut  =cut
1896    
# Line 1720  Line 1898 
1898      my($self) = @_;      my($self) = @_;
1899    
1900      my $figO = $self->{_figO};      my $figO = $self->{_figO};
1901      return new FeatureO($figO,$self->{_peg2});      return FeatureO->new($figO,$self->{_peg2});
1902  }  }
1903    
1904    
1905    
1906  =head3 sc  =head3 sc
1907    
1908    =over 4
1909    
1910    =item FUNCTION:
1911    
1912    Extracts the "functional coupling" score from a "CouplingO" object.
1913    
1914    =item USAGE:
1915    
1916        my $sc = $couplingO->sc();
1917    
1918    =item RETURNS:
1919    
1920    A scalar score.
1921    
1922    =back
1923    
1924  =cut  =cut
1925    
1926  sub sc {  sub sc {
# Line 1739  Line 1933 
1933    
1934  =head3 evidence  =head3 evidence
1935    
1936    =over 4
1937    
1938    =item FUNCTION:
1939    
1940    Fetch the evidence for a "functional coupling" between two close PEGs,
1941    in the form of a list of objects describing the "Pairs of Close Homologs" (PCHs)
1942    supporting the existence of a functional coupling between the two close PEGs.
1943    
1944    =item USAGE:
1945    
1946        my $evidence = $couplingO->evidence();
1947    
1948    =item RETURNS
1949    
1950    List of pairs of "FeatureO" objects.
1951    
1952    =back
1953    
1954  =cut  =cut
1955    
1956  sub evidence {  sub evidence {
# Line 1761  Line 1973 
1973    
1974  =head3 display  =head3 display
1975    
1976    =over 4
1977    
1978    =item FUNCTION:
1979    
1980    Print the contents of a "CouplingO" object to B<STDOUT> in human-readable form.
1981    
1982    =item USAGE:
1983    
1984        $couplingO->display();
1985    
1986    =item RETURNS:
1987    
1988    (Void)
1989    
1990    =back
1991    
1992  =cut  =cut
1993    
1994  sub display {  sub display {
# Line 1835  Line 2063 
2063    
2064      my $figO = $self->{_figO};      my $figO = $self->{_figO};
2065      my $subO = $self->{_subO};      my $subO = $self->{_subO};
2066      if (! $subO) { $subO = $self->{_subO} = new Subsystem($self->{_id},$figO->{_fig}); }      if (! $subO) {
2067            $subO = $self->{_subO} = Subsystem->new($self->{_id}, $figO->{_fig});
2068        }
2069    
2070      return map { &GenomeO::new('GenomeO',$figO,$_) } $subO->get_genomes;      return map { &GenomeO::new('GenomeO',$figO,$_) } $subO->get_genomes;
2071  }  }
# Line 1851  Line 2081 
2081    
2082      my $figO = $self->{_figO};      my $figO = $self->{_figO};
2083      my $subO = $self->{_subO};      my $subO = $self->{_subO};
2084      if (! $subO) { $subO = $self->{_subO} = new Subsystem($self->{_id},$figO->{_fig}); }      if (! $subO) {
2085            $subO = $self->{_subO} = Subsystem->new($self->{_id}, $figO->{_fig});
2086        }
2087    
2088      return map { &FunctionalRoleO::new('FunctionalRoleO',$figO,$_) }  $subO->get_roles($self->id);      return map { &FunctionalRoleO::new('FunctionalRoleO',$figO,$_) }  $subO->get_roles($self->id);
2089  }  }
# Line 1867  Line 2099 
2099    
2100      my $figO = $self->{_figO};      my $figO = $self->{_figO};
2101      my $subO = $self->{_subO};      my $subO = $self->{_subO};
2102      if (! $subO) { $subO = $self->{_subO} = new Subsystem($self->{_id},$figO->{_fig}); }      if (! $subO) {
2103            $subO = $self->{_subO} = Subsystem->new($self->{_id}, $figO->{_fig});
2104        }
2105    
2106      return $subO->get_curator;      return $subO->get_curator;
2107  }  }
# Line 1884  Line 2118 
2118    
2119      my $figO = $self->{_figO};      my $figO = $self->{_figO};
2120      my $subO = $self->{_subO};      my $subO = $self->{_subO};
2121      if (! $subO) { $subO = $self->{_subO} = new Subsystem($self->{_id},$figO->{_fig}); }      if (! $subO) {
2122            $subO = $self->{_subO} = Subsystem->new($self->{_id},$figO->{_fig});
2123        }
2124    
2125      return $subO->get_variant_code_for_genome($genome->id);      return $subO->get_variant_code_for_genome($genome->id);
2126  }  }
# Line 1900  Line 2136 
2136    
2137      my $figO = $self->{_figO};      my $figO = $self->{_figO};
2138      my $subO = $self->{_subO};      my $subO = $self->{_subO};
2139      if (! $subO) { $subO = $self->{_subO} = new Subsystem($self->{_id},$figO->{_fig}); }      if (! $subO) {
2140            $subO = $self->{_subO} = Subsystem->new($self->{_id},$figO->{_fig});
2141        }
2142    
2143      return $subO->get_pegs_from_cell($genome->id,$role->id);      return $subO->get_pegs_from_cell($genome->id,$role->id);
2144  }  }
# Line 2078  Line 2316 
2316  =head3 Display all complete, prokaryotic genomes  =head3 Display all complete, prokaryotic genomes
2317    
2318  use FIGO;  use FIGO;
2319  my $figO = new FIGO;  my $figO = FIGO->new();
2320    
2321  foreach $genome ($figO->genomes('complete','prokaryotic'))  foreach $genome ($figO->genomes('complete','prokaryotic'))
2322  {  {
# Line 2088  Line 2326 
2326  #---------------------------------------------  #---------------------------------------------
2327    
2328  use FIG;  use FIG;
2329  my $fig = new FIG;  my $fig = FIG->new();
2330    
2331  foreach $genome (grep { $fig->is_prokaryotic($_) } $fig->genomes('complete'))  foreach $genome (grep { $fig->is_prokaryotic($_) } $fig->genomes('complete'))
2332  {  {
# Line 2100  Line 2338 
2338  =head3 Show how to access contigs and extract sequence  =head3 Show how to access contigs and extract sequence
2339    
2340  use FIGO;  use FIGO;
2341  my $figO = new FIGO;  my $figO = FIGO->new();
2342    
2343  $genomeId = '83333.1';  $genomeId = '83333.1';
2344  my $genome = new GenomeO($figO,$genomeId);  my $genome = GenomeO->new($figO, $genomeId);
2345    
2346  foreach $contig ($genome->contigs_of)  foreach $contig ($genome->contigs_of)
2347  {  {
# Line 2115  Line 2353 
2353  #---------------------------------------------  #---------------------------------------------
2354    
2355  use FIG;  use FIG;
2356  my $fig = new FIG;  my $fig = FIG->new();
2357    
2358  $genomeId = '83333.1';  $genomeId = '83333.1';
2359    
# Line 2133  Line 2371 
2371  ### accessing data related to features  ### accessing data related to features
2372    
2373  use FIGO;  use FIGO;
2374  my $figO = new FIGO;  my $figO = FIGO->new();
2375    
2376  my $genome = new GenomeO($figO,"83333.1");  my $genome = GenomeO->new($figO, "83333.1");
2377  my $peg  = "fig|83333.1.peg.4";  my $peg  = "fig|83333.1.peg.4";
2378  my $pegO = new FeatureO($figO,$peg);  my $pegO = FeatureO->new($figO, $peg);
2379    
2380  print join("\t",$pegO->id,$pegO->location,$pegO->function_of),"\n",  print join("\t",$pegO->id,$pegO->location,$pegO->function_of),"\n",
2381        $pegO->dna_seq,"\n",        $pegO->dna_seq,"\n",
# Line 2152  Line 2390 
2390    
2391    
2392  use FIG;  use FIG;
2393  my $fig = new FIG;  my $fig = FIG->new();
2394    
2395  my $genome = "83333.1";  my $genome = "83333.1";
2396  my $peg  = "fig|83333.1.peg.4";  my $peg  = "fig|83333.1.peg.4";
# Line 2171  Line 2409 
2409  ### accessing similarities  ### accessing similarities
2410    
2411  use FIGO;  use FIGO;
2412  my $figO = new FIGO;  my $figO = FIGO->new();
2413    
2414  $peg  = "fig|83333.1.peg.4";  $peg  = "fig|83333.1.peg.4";
2415  $pegO = new FeatureO($figO,$peg);  $pegO = FeatureO->new($figO, $peg);
2416    
2417  @sims = $pegO->sims;  # use sims( -all => 1, -max => 10000, -cutoff => 1.0e-20) to all  @sims = $pegO->sims;  # use sims( -all => 1, -max => 10000, -cutoff => 1.0e-20) to all
2418                        # sims (including non-FIG sequences                        # sims (including non-FIG sequences
2419  foreach $sim (@sims)  foreach $sim (@sims)
2420  {  {
2421      $peg2  = $sim->id2;      $peg2  = $sim->id2;
2422      $pegO2 = new FeatureO($figO,$peg2);      $pegO2 = FeatureO->new($figO, $peg2);
2423      $func  = $pegO2->function_of;      $func  = $pegO2->function_of;
2424      $sc    = $sim->psc;      $sc    = $sim->psc;
2425      print join("\t",($peg2,$sc,$func)),"\n";      print join("\t",($peg2,$sc,$func)),"\n";
# Line 2191  Line 2429 
2429    
2430    
2431  use FIG;  use FIG;
2432  my $fig = new FIG;  my $fig = FIG new;
2433    
2434  $peg  = "fig|83333.1.peg.4";  $peg  = "fig|83333.1.peg.4";
2435    
# Line 2209  Line 2447 
2447  ### accessing BBHs  ### accessing BBHs
2448    
2449  use FIGO;  use FIGO;
2450  my $figO = new FIGO;  my $figO = FIGO new;
2451    
2452  $peg  = "fig|83333.1.peg.4";  $peg  = "fig|83333.1.peg.4";
2453  $pegO = new FeatureO($figO,$peg);  $pegO = FeatureO->new($figO, $peg);
2454    
2455  @bbhs = $pegO->bbhs;  @bbhs = $pegO->bbhs;
2456  foreach $bbh (@bbhs)  foreach $bbh (@bbhs)
2457  {  {
2458      $peg2  = $bbh->peg2;      $peg2  = $bbh->peg2;
2459      $pegO2 = new FeatureO($figO,$peg2);      $pegO2 = FeatureO->new($figO, $peg2);
2460      $func  = $pegO2->function_of;      $func  = $pegO2->function_of;
2461      $sc    = $bbh->psc;      $sc    = $bbh->psc;
2462      print join("\t",($peg2,$sc,$func)),"\n";      print join("\t",($peg2,$sc,$func)),"\n";
# Line 2227  Line 2465 
2465  #---------------------------------------------  #---------------------------------------------
2466    
2467  use FIG;  use FIG;
2468  my $fig = new FIG;  my $fig = FIG->new();
2469    
2470  $peg  = "fig|83333.1.peg.4";  $peg  = "fig|83333.1.peg.4";
2471    
# Line 2244  Line 2482 
2482  ### accessing annotations  ### accessing annotations
2483    
2484  use FIGO;  use FIGO;
2485  my $figO = new FIGO;  my $figO = FIGO->new();
2486    
2487  $peg  = "fig|83333.1.peg.4";  $peg  = "fig|83333.1.peg.4";
2488  $pegO = new FeatureO($figO,$peg);  $pegO = FeatureO->new($figO, $peg);
2489    
2490  @annotations = $pegO->annotations;  @annotations = $pegO->annotations;
2491    
# Line 2259  Line 2497 
2497  #---------------------------------------------  #---------------------------------------------
2498    
2499  use FIG;  use FIG;
2500  my $fig = new FIG;  my $fig = FIG->new();
2501    
2502  $peg = "fig|83333.1.peg.4";  $peg = "fig|83333.1.peg.4";
2503  @annotations = $fig->feature_annotations($peg);  @annotations = $fig->feature_annotations($peg);
# Line 2276  Line 2514 
2514    
2515    
2516  use FIGO;  use FIGO;
2517  my $figO = new FIGO;  my $figO = FIGO->new();
2518    
2519  my $peg  = "fig|83333.1.peg.4";  my $peg  = "fig|83333.1.peg.4";
2520  my $pegO = new FeatureO($figO,$peg);  my $pegO = FeatureO->new($figO, $peg);
2521  foreach $coupled ($pegO->coupled_to)  foreach $coupled ($pegO->coupled_to)
2522  {  {
2523      print join("\t",($coupled->peg1,$coupled->peg2,$coupled->sc)),"\n";      print join("\t",($coupled->peg1,$coupled->peg2,$coupled->sc)),"\n";
# Line 2295  Line 2533 
2533    
2534    
2535  use FIG;  use FIG;
2536  my $fig = new FIG;  my $fig = FIG->new();
2537    
2538  my $peg1  = "fig|83333.1.peg.4";  my $peg1  = "fig|83333.1.peg.4";
2539  foreach $coupled ($fig->coupled_to($peg1))  foreach $coupled ($fig->coupled_to($peg1))
# Line 2315  Line 2553 
2553  =head3 Accessing Subsystem data  =head3 Accessing Subsystem data
2554    
2555  use FIGO;  use FIGO;
2556  my $figO = new FIGO;  my $figO = FIGO->new();
2557    
2558  foreach $sub ($figO->subsystems)  foreach $sub ($figO->subsystems)
2559  {  {
# Line 2349  Line 2587 
2587  #---------------------------------------------  #---------------------------------------------
2588    
2589  use FIG;  use FIG;
2590  my $fig = new FIG;  my $fig = FIG->new();
2591    
2592  foreach $sub (grep { $fig->usable_subsystem($_) } $fig->all_subsystems)  foreach $sub (grep { $fig->usable_subsystem($_) } $fig->all_subsystems)
2593  {  {
2594      $subO = new Subsystem($sub,$fig);      $subO = Subsystem->new($sub, $fig);
2595      $curator = $subO->get_curator;      $curator = $subO->get_curator;
2596      print join("\t",($sub,$curator)),"\n";      print join("\t",($sub,$curator)),"\n";
2597    
# Line 2384  Line 2622 
2622  =head3 Accessing FIGfams  =head3 Accessing FIGfams
2623    
2624  use FIGO;  use FIGO;
2625  my $figO = new FIGO;  my $figO = FIGO->new();
2626    
2627  foreach $fam ($figO->all_figfams)  foreach $fam ($figO->all_figfams)
2628  {  {
# Line 2402  Line 2640 
2640  use FigFam;  use FigFam;
2641  use FigFams;  use FigFams;
2642    
2643  my $fig = new FIG;  my $fig = FIG->new();
2644  my $figfams = new FigFams($fig);  my $figfams = FigFams->new($fig);
2645    
2646  foreach $fam ($figfams->all_families)  foreach $fam ($figfams->all_families)
2647  {  {
2648      my $figfam = new FigFam($fig,$fam);      my $figfam = FigFam->new($fig, $fam);
2649      print join("\t",($fam,$figfam->family_function)),"\n";      print join("\t",($fam,$figfam->family_function)),"\n";
2650      foreach $peg ($figfam->list_members)      foreach $peg ($figfam->list_members)
2651      {      {
# Line 2420  Line 2658 
2658  =head3 Placing a sequence into a FIGfam  =head3 Placing a sequence into a FIGfam
2659    
2660  use FIGO;  use FIGO;
2661  my $figO = new FIGO;  my $figO = FIGO->new();
2662    
2663  $seq = "MKLYNLKDHNEQVSFAQAVTQGLGKNQGLFFPHDLPEFSLTEIDEMLKLDFVTRSAKILS  $seq = "MKLYNLKDHNEQVSFAQAVTQGLGKNQGLFFPHDLPEFSLTEIDEMLKLDFVTRSAKILS
2664  AFIGDEIPQEILEERVRAAFAFPAPVANVESDVGCLELFHGPTLAFKDFGGRFMAQMLTH  AFIGDEIPQEILEERVRAAFAFPAPVANVESDVGCLELFHGPTLAFKDFGGRFMAQMLTH
# Line 2450  Line 2688 
2688  use FigFam;  use FigFam;
2689  use FigFams;  use FigFams;
2690    
2691  my $fig = new FIG;  my $fig = FIG->new();
2692  my $figfams = new FigFams($fig);  my $figfams = FigFams->new($fig);
2693    
2694  $seq = "MKLYNLKDHNEQVSFAQAVTQGLGKNQGLFFPHDLPEFSLTEIDEMLKLDFVTRSAKILS  $seq = "MKLYNLKDHNEQVSFAQAVTQGLGKNQGLFFPHDLPEFSLTEIDEMLKLDFVTRSAKILS
2695  AFIGDEIPQEILEERVRAAFAFPAPVANVESDVGCLELFHGPTLAFKDFGGRFMAQMLTH  AFIGDEIPQEILEERVRAAFAFPAPVANVESDVGCLELFHGPTLAFKDFGGRFMAQMLTH
# Line 2480  Line 2718 
2718  =head3 Getting representative sequences for a FIGfam  =head3 Getting representative sequences for a FIGfam
2719    
2720  use FIGO;  use FIGO;
2721  my $figO = new FIGO;  my $figO = FIGO->new();
2722    
2723  $fam         = "FIG102446";  $fam         = "FIG102446";
2724  my $famO     = &FigFamO::new('FigFamO',$figO,$fam);  my $famO     = &FigFamO::new('FigFamO',$figO,$fam);
# Line 2497  Line 2735 
2735  use FigFam;  use FigFam;
2736  use FigFams;  use FigFams;
2737    
2738  my $fig = new FIG;  my $fig = FIG->new();
2739    
2740  $fam         = "FIG102446";  $fam         = "FIG102446";
2741  my $famO     = new FigFam($fig,$fam);  my $famO     = FigFam->new($fig, $fam);
2742  my @rep_seqs = $famO->representatives;  my @rep_seqs = $famO->representatives;
2743    
2744  foreach $seq (@rep_seqs)  foreach $seq (@rep_seqs)
# Line 2515  Line 2753 
2753  =head3 Testing for membership in FIGfam  =head3 Testing for membership in FIGfam
2754    
2755  use FIGO;  use FIGO;
2756  my $figO = new FIGO;  my $figO = FIGO->new();
2757    
2758  $seq = "MKLYNLKDHNEQVSFAQAVTQGLGKNQGLFFPHDLPEFSLTEIDEMLKLDFVTRSAKILS  $seq = "MKLYNLKDHNEQVSFAQAVTQGLGKNQGLFFPHDLPEFSLTEIDEMLKLDFVTRSAKILS
2759  AFIGDEIPQEILEERVRAAFAFPAPVANVESDVGCLELFHGPTLAFKDFGGRFMAQMLTH  AFIGDEIPQEILEERVRAAFAFPAPVANVESDVGCLELFHGPTLAFKDFGGRFMAQMLTH
# Line 2547  Line 2785 
2785  use FigFam;  use FigFam;
2786  use FigFams;  use FigFams;
2787    
2788  my $fig = new FIG;  my $fig = FIG->new();
2789    
2790  $seq = "MKLYNLKDHNEQVSFAQAVTQGLGKNQGLFFPHDLPEFSLTEIDEMLKLDFVTRSAKILS  $seq = "MKLYNLKDHNEQVSFAQAVTQGLGKNQGLFFPHDLPEFSLTEIDEMLKLDFVTRSAKILS
2791  AFIGDEIPQEILEERVRAAFAFPAPVANVESDVGCLELFHGPTLAFKDFGGRFMAQMLTH  AFIGDEIPQEILEERVRAAFAFPAPVANVESDVGCLELFHGPTLAFKDFGGRFMAQMLTH
# Line 2560  Line 2798 
2798  $seq =~ s/\n//gs;  $seq =~ s/\n//gs;
2799    
2800  $fam                  = "FIG102446";  $fam                  = "FIG102446";
2801  my $famO              = new FigFam($fig,$fam);  my $famO              = FigFam->new($fig, $fam);
2802  my($should_be, $sims) = $famO->should_be_member($seq);  my($should_be, $sims) = $famO->should_be_member($seq);
2803    
2804  if ($should_be)  if ($should_be)

Legend:
Removed from v.1.19  
changed lines
  Added in v.1.34

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3