[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.12, Tue Feb 27 08:31:50 2007 UTC revision 1.13, Wed Feb 28 21:55:44 2007 UTC
# Line 49  Line 49 
49  or other more complex relationships that do not naturally fit into any heirarchy ---  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."  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:  We have chosen to in many cases sidestep the entire issue of inheritance
53    via an I<ad hoc> mechanism:
54  If a "child" object needs access to its "ancestors'" methods,  If a "child" object needs access to its "ancestors'" methods,
55  we pass it references to its "ancestors" using subroutine arguments.  we pass it references to its "ancestors" using subroutine arguments.
56  This is admittedly ugly, clumsy, and potentially error-prone ---  This is admittedly ugly, clumsy, and potentially error-prone ---
# Line 321  Line 322 
322    
323  =cut  =cut
324    
325    
326  =head3 new  =head3 new
327    
328  Constructor of GenomeO objects.  Constructor of GenomeO objects.
# Line 663  Line 665 
665      return map { new FeatureO($figO,$_) } @$features;      return map { new FeatureO($figO,$_) } @$features;
666  }  }
667    
668    
669    
670  ########################################################################  ########################################################################
671  package FeatureO;  package FeatureO;
672  ########################################################################  ########################################################################
# Line 674  Line 678 
678    
679  =cut  =cut
680    
681    
682  =head3 new  =head3 new
683    
684  Constructor of "FeatureO" objects  Constructor of "FeatureO" objects
685    
686    =over 4
687    
688    =item USAGE:
689    
690    C<< my $feature = FeatureO->new( $figO, $fid ); >>
691    
692    =item C<$figO>:
693    
694    "Base" FIGO object.
695    
696    =item C<$fid>:
697    
698    Feature-ID for new feature
699    
700    =item RETURNS:
701    
702    A newly created "FeatureO" object.
703    
704    =back
705    
706  =cut  =cut
707    
708  sub new {  sub new {
# Line 691  Line 716 
716  }  }
717    
718    
719    
720  =head3 id  =head3 id
721    
722    =over 4
723    
724    =item USAGE:
725    
726    C<< my $fid = $feature->id(); >>
727    
728    =item RETURNS:
729    
730    The FID (Feature ID) of a "FeatureO" object.
731    
732    =back
733    
734  =cut  =cut
735    
736  sub id {  sub id {
# Line 705  Line 743 
743    
744  =head3 genome  =head3 genome
745    
746    =over 4
747    
748    =item USAGE:
749    
750    C<< my $taxid = $feature->genome(); >>
751    
752    =item RETURNS:
753    
754    The TAxon-ID for the "GenomeO" object containg the feature.
755    
756    =back
757    
758  =cut  =cut
759    
760  sub genome {  sub genome {
# Line 718  Line 768 
768    
769  =head3 type  =head3 type
770    
771    =over 4
772    
773    =item USAGE:
774    
775    C<< my $feature_type = $feature->type(); >>
776    
777    =item RETURNS:
778    
779    The feature object's "type" (e.g., "peg," "rna," etc.)
780    
781    =back
782    
783  =cut  =cut
784    
785  sub type {  sub type {
# Line 729  Line 791 
791    
792    
793    
   
794  =head3 location  =head3 location
795    
796    =over 4
797    
798    =item USAGE:
799    
800    C<< my $loc = $feature->location(); >>
801    
802    =item RETURNS:
803    
804    A string representing the feature object's location on the genome's DNA,
805    in SEED "tbl format" (i.e., "contig_beging_end").
806    
807    =back
808    
809  =cut  =cut
810    
811  sub location {  sub location {
# Line 741  Line 815 
815      return scalar $fig->feature_location($self->id);      return scalar $fig->feature_location($self->id);
816  }  }
817    
818    
819    =head3 contig
820    
821    =over 4
822    
823    =item USAGE:
824    
825    C<< my $contig = $feature->contig(); >>
826    
827    =item RETURNS:
828    
829    A "ContigO" object to access the contig data
830    for the contig the feature is on.
831    
832    =back
833    
834    =cut
835    
836  sub contig {  sub contig {
837      my($self) = @_;      my($self) = @_;
838    
# Line 750  Line 842 
842      return ($loc =~ /^(\S+)_\d+_\d+$/) ? new ContigO($figO,$genomeID,$1) : undef;      return ($loc =~ /^(\S+)_\d+_\d+$/) ? new ContigO($figO,$genomeID,$1) : undef;
843  }  }
844    
845    
846    
847    =head3 begin
848    
849    =over 4
850    
851    =item USAGE:
852    
853    C<< my $beg = $feature->begin(); >>
854    
855    =item RETURNS:
856    
857    The numerical coordinate of the first base of the feature.
858    
859    =back
860    
861    =cut
862    
863  sub begin {  sub begin {
864      my($self) = @_;      my($self) = @_;
865    
# Line 757  Line 867 
867      return ($loc =~ /^\S+_(\d+)_\d+$/) ? $1 : undef;      return ($loc =~ /^\S+_(\d+)_\d+$/) ? $1 : undef;
868  }  }
869    
870    
871    
872    =head3 end
873    
874    =over 4
875    
876    =item USAGE:
877    
878    C<< my $end = $feature->end(); >>
879    
880    =item RETURNS:
881    
882    The numerical coordinate of the last base of the feature.
883    
884    =back
885    
886    =cut
887    
888  sub end {  sub end {
889      my($self) = @_;      my($self) = @_;
890    
# Line 764  Line 892 
892      return ($loc =~ /^\S+_\d+_(\d+)$/) ? $1 : undef;      return ($loc =~ /^\S+_\d+_(\d+)$/) ? $1 : undef;
893  }  }
894    
895    
896    
897  =head3 dna_seq  =head3 dna_seq
898    
899    =over 4
900    
901    =item USAGE:
902    
903    C<< my $dna_seq = $feature->dna_seq(); >>
904    
905    =item RETURNS:
906    
907    A string contining the DNA subsequence of the contig
908    running from the first to the last base of the feature.
909    
910    If ($beg > $end), the reverse complement subsequence is returned.
911    
912    =back
913    
914  =cut  =cut
915    
916  sub dna_seq {  sub dna_seq {
# Line 781  Line 926 
926    
927  =head3 prot_seq  =head3 prot_seq
928    
929    =over 4
930    
931    =item USAGE:
932    
933    C<< my $dna_seq = $feature->prot_seq(); >>
934    
935    =item RETURNS:
936    
937    A string contining the protein translation of the feature (if it exists),
938    or the "undef" value if the feature does not exist or is not a PEG.
939    
940    =back
941    
942  =cut  =cut
943    
944  sub prot_seq {  sub prot_seq {
# Line 796  Line 954 
954    
955  =head3 function_of  =head3 function_of
956    
957    =over 4
958    
959    =item USAGE:
960    
961    C<< my $func = $feature->function_of(); >>
962    
963    =item RETURNS:
964    
965    A string containing the function assigned to the feature,
966    or the "undef" value if no function has been assigned.
967    
968    =back
969    
970  =cut  =cut
971    
972  sub function_of {  sub function_of {
# Line 810  Line 981 
981    
982  =head3 coupled_to  =head3 coupled_to
983    
984    =over 4
985    
986    =item USAGE:
987    
988    C<< my @coupled_features = $feature->coupled_to(); >>
989    
990    =item RETURNS:
991    
992    A list of L<CouplingO> objects describing the evidence for functional coupling
993    between this feature and other nearby features.
994    
995    =back
996    
997  =cut  =cut
998    
999  sub coupled_to {  sub coupled_to {
1000      my($self) = @_;      my($self) = @_;
1001    
1002      ($self->type eq "peg") || return undef;      ($self->type eq "peg") || return ();
1003      my $figO = $self->{_figO};      my $figO = $self->{_figO};
1004      my $fig  = $figO->{_fig};      my $fig  = $figO->{_fig};
1005      my $peg1 = $self->id;      my $peg1 = $self->id;
# Line 832  Line 1016 
1016    
1017  =head3 annotations  =head3 annotations
1018    
1019    =over 4
1020    
1021    =item USAGE:
1022    
1023    C<< my @annot_list = $feature->annotations(); >>
1024    
1025    =item RETURNS:
1026    
1027    A list of L<AnnotationO> objects allowing access to the annotations for this feature.
1028    
1029    =back
1030    
1031  =cut  =cut
1032    
1033  sub annotations {  sub annotations {
# Line 843  Line 1039 
1039      return map { &AnnotationO::new('AnnotationO',@$_) } $fig->feature_annotations($self->id,1);      return map { &AnnotationO::new('AnnotationO',@$_) } $fig->feature_annotations($self->id,1);
1040  }  }
1041    
1042    
1043    =head3 in_subsystems
1044    
1045    =over 4
1046    
1047    =item USAGE:
1048    
1049    C<< my @subsys_list = $feature->in_subsystems(); >>
1050    
1051    =item RETURNS:
1052    
1053    A list of L<SubsystemO> objects allowing access to the subsystems
1054    that this feature particupates in.
1055    
1056    =back
1057    
1058    =cut
1059    
1060  sub in_subsystems {  sub in_subsystems {
1061      my($self) = @_;      my($self) = @_;
1062      my $figO = $self->{_figO};      my $figO = $self->{_figO};
# Line 854  Line 1068 
1068    
1069  =head3 possibly_truncated  =head3 possibly_truncated
1070    
1071    =over 4
1072    
1073    =item USAGE:
1074    
1075    C<< my $trunc = $feature->possibly_truncated(); >>
1076    
1077    =item RETURNS:
1078    
1079    Boolean C<TRUE> if the feature may be truncated;
1080    boolean C<FALSE> otherwise.
1081    
1082    =back
1083    
1084  =cut  =cut
1085    
1086  sub possibly_truncated {  sub possibly_truncated {
# Line 868  Line 1095 
1095    
1096  =head3 possible_frameshift  =head3 possible_frameshift
1097    
1098    =over 4
1099    
1100    =item USAGE:
1101    
1102    C<< my $fs = $feature->possible_frameshift(); >>
1103    
1104    =item RETURNS:
1105    
1106    Boolean C<TRUE> if the feature may be a frameshifted fragment;
1107    boolean C<FALSE> otherwise.
1108    
1109    (NOTE: This is a crude prototype implementation,
1110    and is mostly as an example of how to code using FIGO.)
1111    
1112    =back
1113    
1114  =cut  =cut
1115    
1116  sub possible_frameshift {  sub possible_frameshift {
# Line 934  Line 1177 
1177    
1178  =head3 run  =head3 run
1179    
1180  =sub  (Note: This function should be considered "PRIVATE")
1181    
1182    =over 4
1183    
1184    =item FUNCTION:
1185    
1186    Passes a string containing a command to be execture by the "system" shell command.
1187    
1188    =item USAGE:
1189    
1190    C<< $feature->run($cmd); >>
1191    
1192    =item RETURNS:
1193    
1194    Nil if the execution of C<$cmd> was successful;
1195    aborts with traceback if C<$cmd> fails.
1196    
1197  cut run {  =back
1198    
1199    =cut
1200    
1201    sub run {
1202      my($cmd) = @_;      my($cmd) = @_;
1203      (system($cmd) == 0) || Confess("FAILED: $cmd");      (system($cmd) == 0) || Confess("FAILED: $cmd");
1204  }  }
# Line 945  Line 1207 
1207    
1208  =head3 max  =head3 max
1209    
1210    (Note: This function should be considered "PRIVATE")
1211    
1212    =over 4
1213    
1214    =item USAGE:
1215    
1216    C<< my $max = $feature->max($x, $y); >>
1217    
1218    =item C<$x>
1219    
1220    Numerical value.
1221    
1222    =item C<$y>
1223    
1224    Numerical value.
1225    
1226    =items RETURNS:
1227    
1228    The larger of the two numerical values C<$x> and C<$y>.
1229    
1230    =back
1231    
1232  =cut  =cut
1233    
1234  sub max {  sub max {
# Line 956  Line 1240 
1240    
1241  =head3 min  =head3 min
1242    
1243    (Note: This function should be considered "PRIVATE")
1244    
1245    =over 4
1246    
1247    =item USAGE:
1248    
1249    C<< my $min = $feature->min($x, $y); >>
1250    
1251    =item C<$x>
1252    
1253    Numerical value.
1254    
1255    =item C<$y>
1256    
1257    Numerical value.
1258    
1259    =items RETURNS:
1260    
1261    The smaller of the two numerical values C<$x> and C<$y>.
1262    
1263    =back
1264    
1265  =cut  =cut
1266    
1267  sub min {  sub min {
# Line 1222  Line 1528 
1528  ########################################################################  ########################################################################
1529  use Data::Dumper;  use Data::Dumper;
1530    
1531    =head1 CouplingO
1532    
1533    =cut
1534    
1535    
1536    
1537  =head3 new  =head3 new
1538    
1539  =cut  =cut

Legend:
Removed from v.1.12  
changed lines
  Added in v.1.13

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3