2 # bioperl module for Bio::LiveSeq::Range
4 # Please direct questions and support issues to <bioperl-l@bioperl.org>
6 # Cared for by Joseph Insana <insana@ebi.ac.uk> <jinsana@gmx.net>
8 # Copyright Joseph Insana
10 # You may distribute this module under the same terms as perl itself
12 # POD documentation - main docs before the code
16 Bio::LiveSeq::Range - Range abstract class for LiveSeq
20 # documentation needed
24 This is used as parent for exon and intron classes.
26 =head1 AUTHOR - Joseph A.L. Insana
28 Email: Insana@ebi.ac.uk, jinsana@gmx.net
32 The rest of the documentation details each of the object
33 methods. Internal methods are usually preceded with a _
37 # Let the code begin...
39 package Bio
::LiveSeq
::Range
;
41 use base
qw(Bio::LiveSeq::SeqI);
46 Usage : $range1 = Bio::LiveSeq::Range->new(-seq => $obj_ref,
47 -start => $beginlabel,
48 -end => $endlabel, -strand => 1);
50 Function: generates a new Bio::LiveSeq::Range
51 Returns : reference to a new object of class Range
53 Args : two labels, an obj_ref and an integer
54 strand 1=forward strand, strand -1=reverse strand
55 if strand not specified, it defaults to 1
56 the -seq argument must point to the underlying DNA LiveSeq object
61 my ($thing, %args) = @_;
62 my $class = ref($thing) || $thing;
65 my ($seq,$start,$end,$strand)=($args{-seq
},$args{-start
},$args{-end
},$args{-strand
});
68 $obj = bless $obj, $class;
70 unless ($seq->valid($start)) {
71 $obj->warn("$class not initialised because start label not valid");
74 unless ($seq->valid($end)) {
75 $obj->warn("$class not initialised because end label not valid");
78 unless (defined $strand) {
81 if (($strand != 1)&&($strand != -1)) {
82 $obj->warn("$class not initialised because strand identifier not valid. Use 1 (forward strand) or -1 (reverse strand).");
86 $obj->warn("$class reports: start and end label are the same....");
88 unless ($seq->follows($start,$end,$strand)==1) {
89 $obj->warn("Fatal: end label $end doesn't follow start label $start for strand $strand!");
94 # unless ($seq->is_downstream($start,$end)==1) {
95 # croak "Fatal: end label not downstream of start label for forward strand!";
98 # unless ($seq->is_upstream($start,$end)==1) {
99 # croak "Fatal: end label not upstream of start label for reverse strand!";
103 $obj->{'start'}=$start;
105 $obj->{'strand'}=$strand;
112 Usage : $boolean = $obj->valid($label)
113 Function: tests if a label exists AND is part of the object