1 # $Id: PositionWithSequence.pm,v 1.19 2006/09/20 10:20:01 sendu Exp $
3 # BioPerl module for Bio::Map::PositionWithSequence
5 # Cared for by Sendu Bala <bix@sendu.me.uk>
9 # You may distribute this module under the same terms as perl itself
11 # POD documentation - main docs before the code
15 Bio::Map::PositionWithSequence - A position with a sequence.
19 use Bio::Map::PositionWithSequence;
21 my $pos = Bio::Map::PositionWithSequence->new(-map => $map,
29 Have a position with a sequence, eg. define what the binding site sequence of
30 a certain transcription factor binding site is by modelling it as one of these
31 objects with the -element assigned to a Bio::Map::TranscriptionFactor instance.
37 User feedback is an integral part of the evolution of this and other
38 Bioperl modules. Send your comments and suggestions preferably to
39 the Bioperl mailing list. Your participation is much appreciated.
41 bioperl-l@bioperl.org - General discussion
42 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
46 Report bugs to the Bioperl bug tracking system to help us keep track
47 of the bugs and their resolution. Bug reports can be submitted via the
50 http://bugzilla.open-bio.org/
52 =head1 AUTHOR - Sendu Bala
58 The rest of the documentation details each of the object methods.
59 Internal methods are usually preceded with a _
63 # Let the code begin...
65 package Bio
::Map
::PositionWithSequence
;
68 use base
qw(Bio::Map::Position Bio::LocatableSeq);
73 Usage : my $obj = Bio::Map::PositionWithSequence->new();
74 Function: Builds a new Bio::Map::PositionWithSequence object
75 Returns : Bio::Map::PositionWithSequence
76 Args : -map => Bio::Map::GeneMap object
77 -element => Bio::Map::Gene object
78 -relative => Bio::Map::GeneRelative object
79 -seq => string, length of this string will set the length
80 of this position's range
82 * If this position has no range, or if a single value can describe
84 -value => scalar : something that describes the single
85 point position or range of this
86 Position, most likely an int
88 * Or if this position has a range, at least two of *
89 -start => int : value of the start co-ordinate
90 -end => int : value of the end co-ordinate
91 -length => int : length of the range
96 my ($class, @args) = @_;
97 my $self = $class->SUPER::new
(@args);
99 my ($seq) = $self->_rearrange([qw( SEQ )], @args);
101 $self->seq($seq) if $seq;
109 Usage : my $string = $obj->seq();
110 Function: Get/set the sequence as a string of letters.
112 Args : Optionally on set the new value (a string). An optional second
113 argument presets the alphabet (otherwise it will be guessed).
118 my ($self, $str, $alpha) = @_;
120 # done like this because SUPER will set seq to undef if undef supplied,
121 # but GeneMap wants to send undef, undef, 1 to decendants of this method
125 $alpha ?
($seq = $self->SUPER::seq
($str, $alpha)) : ($seq = $self->SUPER::seq
($str));
128 $seq = $self->SUPER::seq
;
132 $self->length(length($seq));