~ubuntu-branches/ubuntu/saucy/bioperl/saucy-proposed

« back to all changes in this revision

Viewing changes to Bio/Map/Prediction.pm

  • Committer: Bazaar Package Importer
  • Author(s): Charles Plessy
  • Date: 2009-03-10 07:19:11 UTC
  • mfrom: (1.2.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20090310071911-fukqzw54pyb1f0bd
Tags: 1.6.0-2
* Removed patch system (not used):
  - removed instuctions in debian/rules;
  - removed quilt from Build-Depends in debian/control.
* Re-enabled tests:
  - uncommented test command in debian/rules;
  - uncommented previously missing build-dependencies in debian/control.
  - Re-enabled tests and uncommented build-dependencies accordingly.
* Removed libmodule-build-perl and libtest-harness-perl from
  Build-Depends-Indep (provided by perl-modules).
* Better cleaning of empty directories using find -type d -empty -delete
  instead of rmdir in debian/rules (LP: #324001).

Show diffs side-by-side

added added

removed removed

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