3 # bioperl module for Bio::LiveSeq::Range
5 # Cared for by Joseph Insana <insana@ebi.ac.uk> <jinsana@gmx.net>
7 # Copyright Joseph Insana
9 # You may distribute this module under the same terms as perl itself
11 # POD documentation - main docs before the code
15 Bio::LiveSeq::Range - Range abstract class for LiveSeq
19 # documentation needed
23 This is used as parent for exon and intron classes.
25 =head1 AUTHOR - Joseph A.L. Insana
27 Email: Insana@ebi.ac.uk, jinsana@gmx.net
31 The rest of the documentation details each of the object
32 methods. Internal methods are usually preceded with a _
36 # Let the code begin...
38 package Bio
::LiveSeq
::Range
;
40 use base
qw(Bio::LiveSeq::SeqI);
45 Usage : $range1 = Bio::LiveSeq::Range->new(-seq => $obj_ref,
46 -start => $beginlabel,
47 -end => $endlabel, -strand => 1);
49 Function: generates a new Bio::LiveSeq::Range
50 Returns : reference to a new object of class Range
52 Args : two labels, an obj_ref and an integer
53 strand 1=forward strand, strand -1=reverse strand
54 if strand not specified, it defaults to 1
55 the -seq argument must point to the underlying DNA LiveSeq object
60 my ($thing, %args) = @_;
61 my $class = ref($thing) || $thing;
64 my ($seq,$start,$end,$strand)=($args{-seq
},$args{-start
},$args{-end
},$args{-strand
});
67 $obj = bless $obj, $class;
69 unless ($seq->valid($start)) {
70 $obj->warn("$class not initialised because start label not valid");
73 unless ($seq->valid($end)) {
74 $obj->warn("$class not initialised because end label not valid");
77 unless (defined $strand) {
80 if (($strand != 1)&&($strand != -1)) {
81 $obj->warn("$class not initialised because strand identifier not valid. Use 1 (forward strand) or -1 (reverse strand).");
85 $obj->warn("$class reports: start and end label are the same....");
87 unless ($seq->follows($start,$end,$strand)==1) {
88 $obj->warn("Fatal: end label $end doesn't follow start label $start for strand $strand!");
93 # unless ($seq->is_downstream($start,$end)==1) {
94 # croak "Fatal: end label not downstream of start label for forward strand!";
97 # unless ($seq->is_upstream($start,$end)==1) {
98 # croak "Fatal: end label not upstream of start label for reverse strand!";
102 $obj->{'start'}=$start;
104 $obj->{'strand'}=$strand;
111 Usage : $boolean = $obj->valid($label)
112 Function: tests if a label exists AND is part of the object