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

Diff of /FigKernelPackages/Phage.pm

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

revision 1.1, Wed Jun 23 16:59:48 2010 UTC revision 1.2, Fri Aug 6 20:21:49 2010 UTC
# Line 10  Line 10 
10    
11  package Phage;  package Phage;
12  use strict;  use strict;
13    use Data::Dumper;
14  use FIG;  use FIG;
15    
16  =head2 Methods  =head2 Methods
# Line 44  Line 45 
45    
46  sub phages {  sub phages {
47          my $self=shift;          my $self=shift;
48          return grep { $self->{'fig'}->is_genome($_) } map {$_->[0]} $self->{'fig'}->get_attributes(undef, 'virus_type', 'Phage');          my %seen;
49            return grep {!$seen{$_}++} grep { $self->{'fig'}->is_genome($_) } map {$_->[0]} $self->{'fig'}->get_attributes(undef, 'virus_type', 'Phage');
50  }  }
51    
52    
# Line 72  Line 74 
74          return 0;          return 0;
75  }  }
76    
77    =head3 prophages_in_genome
78    
79    Get the ids of all the known prophages in the genome
80    
81            my @prophage_ids = $phage->prophages_in_genome($genome);
82    
83    =cut
84    
85    sub prophages_in_genome {
86            my ($self, $genome) = @_;
87            return $self->{'fig'}->all_features($genome, "pp");
88    }
89    
90    
91    =head3 prophage_pegs
92    
93    Get all the pegs in the prophages in a genome
94    
95            my @pegs = $phage->prophage_pegs($genome);
96    
97    =cut
98    
99    sub prophage_pegs {
100            my ($self, $genome) = @_;
101            my @pegs = ();
102            foreach my $pp ($self->prophages_in_genome($genome)) {
103                    my ($contig, $beg, $end)=$self->{'fig'}->boundaries_of($self->{'fig'}->feature_location($pp));
104                    my ($temp, $start, $end) = $self->{'fig'}->genes_in_region($genome, $contig, $beg, $end);
105                    push @pegs, grep {m/\.peg\./} @$temp;
106            }
107            return @pegs;
108    }
109    
110    
111    
112  1;  1;
113    

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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3