File Coverage

Bio/Map/Prediction.pm
Criterion Covered Total %
statement 15 15 100.0
branch 2 4 50.0
condition 1 2 50.0
subroutine 4 4 100.0
pod 2 2 100.0
total 24 27 88.8


line stmt bran cond sub pod time code
1             # $Id: Prediction.pm,v 1.10 2006/09/28 14:09:40 sendu Exp $
2             #
3             # BioPerl module for Bio::Map::Prediction
4             #
5             # Please direct questions and support issues to
6             #
7             # Cared for by Sendu Bala
8             #
9             # Copyright Sendu Bala
10             #
11             # You may distribute this module under the same terms as perl itself
12              
13             # POD documentation - main docs before the code
14              
15             =head1 NAME
16              
17             Bio::Map::Prediction - An object representing the predictions of something
18             that can have multiple locations in several maps.
19              
20             =head1 SYNOPSIS
21              
22             use Bio::Map::Prediction;
23             use Bio::Map::Position;
24              
25             # normally you would get predictions from a run wrapper like
26             # Bio::Tools::Run::Meme, but here we create some manually:
27             my $pred1 = Bio::Map::Prediction->new(-source => 'meme');
28             Bio::Map::Position->new(-element => $prediction1,
29             -map => Bio::Map::GeneMap->get(-gene => 'gene1',
30             -species => 'species1'),
31             -start => 950,
32             -end => 960);
33             Bio::Map::Position->new(-element => $prediction1,
34             -map => Bio::Map::GeneMap->get(-gene => 'gene1',
35             -species => 'species2'),
36             -start => 1950,
37             -end => 1960);
38             Bio::Map::Position->new(-element => $prediction1,
39             -map => Bio::Map::GeneMap->get(-gene => 'gene2',
40             -species => 'species1'),
41             -start => 955,
42             -end => 965);
43             Bio::Map::Position->new(-element => $prediction1,
44             -map => Bio::Map::GeneMap->get(-gene => 'gene2',
45             -species => 'species2'),
46             -start => 1955,
47             -end => 1965);
48              
49             my $pred2 = Bio::Map::Prediction->new(-source => 'gerp');
50             Bio::Map::Position->new(-element => $prediction2,
51             -map => Bio::Map::GeneMap->get(-gene => 'gene1',
52             -species => 'species1'),
53             -start => 950,
54             -end => 960);
55             # etc.
56              
57             # find the places where predictions agree
58             use Bio::Map::GeneRelative;
59             my $rel = Bio::Map::GeneRelative->new(-gene => 0);
60             my $di = Bio::Map::Mappable->disconnected_intersections([$pred1, $pred2],
61             -min_mappables_percent => 100,
62             -min_map_percent => 100,
63             -relative => $rel);
64             my @positions = $di->get_positions;
65              
66             =head1 DESCRIPTION
67              
68             For example, used to model transcription factor binding site predictions, which
69             can have multiple locations in several maps.
70              
71             =head1 FEEDBACK
72              
73             =head2 Mailing Lists
74              
75             User feedback is an integral part of the evolution of this and other
76             Bioperl modules. Send your comments and suggestions preferably to the
77             Bioperl mailing list. Your participation is much appreciated.
78              
79             bioperl-l@bioperl.org - General discussion
80             http://bioperl.org/wiki/Mailing_lists - About the mailing lists
81              
82             =head2 Support
83              
84             Please direct usage questions or support issues to the mailing list:
85              
86             I
87              
88             rather than to the module maintainer directly. Many experienced and
89             reponsive experts will be able look at the problem and quickly
90             address it. Please include a thorough description of the problem
91             with code and data examples if at all possible.
92              
93             =head2 Reporting Bugs
94              
95             Report bugs to the Bioperl bug tracking system to help us keep track
96             of the bugs and their resolution. Bug reports can be submitted via the
97             web:
98              
99             https://github.com/bioperl/bioperl-live/issues
100              
101             =head1 AUTHOR - Sendu Bala
102              
103             Email bix@sendu.me.uk
104              
105             =head1 APPENDIX
106              
107             The rest of the documentation details each of the object methods.
108             Internal methods are usually preceded with a _
109              
110             =cut
111              
112             # Let the code begin...
113              
114             package Bio::Map::Prediction;
115 1     1   1708 use strict;
  1         2  
  1         27  
116              
117 1     1   4 use base qw(Bio::Map::Mappable);
  1         1  
  1         146  
118              
119             =head2 new
120              
121             Title : new
122             Usage : my $prediction = Bio::Map::Prediction->new();
123             Function: Builds a new Bio::Map::Prediction object
124             Returns : Bio::Map::Prediction
125             Args : -name => string : name of the mappable element
126             -id => string : id of the mappable element
127             -source => string : name of the prediction program
128              
129             =cut
130              
131             sub new {
132 2     2 1 6 my ($class, @args) = @_;
133 2         9 my $self = $class->SUPER::new(@args);
134            
135 2         10 my ($source) = $self->_rearrange([qw(SOURCE)], @args);
136 2 50       7 $self->source($source) if $source;
137            
138 2         3 return $self;
139             }
140              
141             =head2 source
142              
143             Title : name
144             Usage : $mappable->name($new_name);
145             my $name = $mappable->name();
146             Function: Get/Set the name for this Mappable
147             Returns : A scalar representing the current name of this Mappable
148             Args : none to get
149             string to set
150              
151             =cut
152              
153             sub source {
154 2     2 1 2 my $self = shift;
155 2 50       5 if (@_) { $self->{_source} = shift }
  2         2  
156 2   50     3 return $self->{_source} || '';
157             }
158              
159             1;