File Coverage

Bio/SeqFeature/SiRNA/Oligo.pm
Criterion Covered Total %
statement 32 37 86.4
branch 13 26 50.0
condition 2 5 40.0
subroutine 5 5 100.0
pod 2 2 100.0
total 54 75 72.0


line stmt bran cond sub pod time code
1             #
2             # BioPerl module for Bio::SeqFeature::SiRNA::Pair
3             #
4             # Please direct questions and support issues to
5             #
6             # Cared for by Donald Jackson, donald.jackson@bms.com
7             #
8             # Copyright Donald Jackson
9             #
10             # You may distribute this module under the same terms as perl itself
11              
12             # POD documentation - main docs before the code
13              
14             =head1 NAME
15              
16             Bio::SeqFeature::SiRNA::Oligo - Perl object for small inhibitory RNAs.
17              
18             =head1 SYNOPSIS
19              
20             use Bio::SeqFeature::SiRNA::Oligo;
21              
22             my $oligo = Bio::SeqFeature::SiRNA::Oligo->
23             new( -seq => 'AUGCCGAUUGCAAGUCAGATT',
24             -start => 10,
25             -end => 31,
26             -strand => -1,
27             -primary => 'SiRNA::Oligo',
28             -source_tag => 'Bio::Tools::SiRNA',
29             -tag => { note => 'A note' }, );
30              
31             # normally two complementary Oligos are combined in an SiRNA::Pair
32             # object
33             $pair->antisense($oligo);
34              
35              
36             =head1 DESCRIPTION
37              
38             Object methods for single SiRNA oligos - inherits
39             L. Does B include methods for designing
40             SiRNAs - see L for that.
41              
42             =head1 SEE ALSO
43              
44             L, L.
45              
46             =head1 FEEDBACK
47              
48             =head2 Mailing Lists
49              
50             User feedback is an integral part of the evolution of this and other
51             Bioperl modules. Send your comments and suggestions preferably to
52             the Bioperl mailing list. Your participation is much appreciated.
53              
54             bioperl-l@bioperl.org - General discussion
55             http://bioperl.org/wiki/Mailing_lists - About the mailing lists
56              
57             =head2 Support
58              
59             Please direct usage questions or support issues to the mailing list:
60              
61             I
62              
63             rather than to the module maintainer directly. Many experienced and
64             reponsive experts will be able look at the problem and quickly
65             address it. Please include a thorough description of the problem
66             with code and data examples if at all possible.
67              
68             =head2 Reporting Bugs
69              
70             Report bugs to the Bioperl bug tracking system to help us keep track
71             of the bugs and their resolution. Bug reports can be submitted via
72             the web:
73              
74             https://github.com/bioperl/bioperl-live/issues
75              
76             =head1 AUTHOR
77              
78             Donald Jackson (donald.jackson@bms.com)
79              
80             =head1 APPENDIX
81              
82             The rest of the documentation details each of the object methods.
83             Internal methods are usually preceded with a _
84              
85             =cut
86              
87             package Bio::SeqFeature::SiRNA::Oligo;
88              
89 1     1   3 use strict;
  1         1  
  1         23  
90 1     1   4 use warnings;
  1         0  
  1         30  
91              
92 1     1   3 use base qw(Bio::SeqFeature::Generic);
  1         1  
  1         336  
93              
94             our @ARGNAMES = qw(SEQ START END STRAND PRIMARY SOURCE_TAG SCORE TAG
95             SEQ_ID ANNOTATION LOCATION);
96              
97             =head2 new
98              
99             Title : new
100             Usage : my $sirna_oligo = Bio::SeqFeature::SiRNA::Oligo->new();
101             Function : Create a new SiRNA::Oligo object
102             Returns : Bio::Tools::SiRNA object
103             Args : -seq sequence of the RNAi oligo. Should be in RNA alphabet
104             except for the final TT overhang.
105             -start start position
106             -end end position
107             -strand strand
108             -primary primary tag - defaults to 'SiRNA::Oligo'
109             -source source tag
110             -score score value
111             -tag a reference to a tag/value hash
112             -seq_id the display name of the sequence
113             -annotation the AnnotationCollectionI object
114             -location the LocationI object
115              
116             Currently passing arguments in gff_string or gff1_string is not
117             supported. SiRNA::Oligo objects are typically created by a design
118             algorithm such as Bio::Tools::SiRNA
119              
120             =cut
121              
122             sub new {
123 624     624 1 1145 my ($proto, @args) = @_;
124              
125 624   33     1590 my $pkg = ref($proto) || $proto;
126              
127 624         441 my (%args);
128              
129 624         1212 my $self = $pkg->SUPER::new();
130              
131 624         1067 @args{@ARGNAMES} = $self->_rearrange(\@ARGNAMES, @args);
132             # default primary tag
133 624   50     2193 $args{'PRIMARY'} ||= 'SiRNA::Oligo';
134              
135 624 50       1510 $args{'PRIMARY'} && $self->primary_tag($args{'PRIMARY'});
136 624 50       1240 $args{'SOURCE_TAG'} && $self->source_tag($args{'SOURCE_TAG'});
137 624 50       831 $args{'SEQNAME'} && $self->seqname($args{'SEQNAME'});
138 624 50       1200 $args{'SEQ'} && $self->seq($args{'SEQ'});
139 624 50       745 $args{'ANNOTATION'} && $self->annotation($args{'ANNOTATION'});
140 624 50       668 $args{'LOCATION'} && $self->location($args{'LOCATION'});
141 624 50       1267 defined($args{'START'}) && $self->start($args{'START'});
142 624 50       1396 defined($args{'END'}) && $self->end($args{'END'});
143 624 50       1521 defined($args{'STRAND'}) && $self->strand($args{'STRAND'});
144 624 50       823 defined($args{'SCORE'}) && $self->score($args{'SCORE'});
145              
146 624 50       859 if ($args{'TAG'}) {
147 0         0 foreach my $t ( keys %{ $args{'TAG'} } ) {
  0         0  
148 0         0 $self->add_tag_value($t, $args{'TAG'}->{$t});
149             }
150             }
151              
152 624         1773 return $self;
153             }
154              
155             =head2 seq
156              
157             Title : Seq
158             Usage : my $oligo_sequence = $sirna_oligo->seq();
159             Purpose : Get/set the sequence of the RNAi oligo
160             Returns : Sequence for the RNAi oligo
161             Args : Sequence of the RNAi oligo (optional)
162             Note : Overloads Bio::SeqFeature::Generic seq method - the oligo and
163             parent sequences are different.
164             Note that all but the last 2 nucleotides are RNA (per Tuschl and colleagues).
165             SiRNA::Pair objects are typically created by a design algorithm such as
166             Bio::Tools::SiRNA.
167              
168             =cut
169              
170             sub seq {
171 624     624 1 507 my ($self, $seq) = @_;
172 624 50       831 if ($seq) {
173             # check alphabet
174 624 50       1254 if ($seq =~ /[^ACGTUacgtu]/ ) {
175 0         0 warn "Sequence contains illegal characters";
176 0         0 return;
177             }
178             else {
179 624         665 $self->{'seq'} = $seq;
180             }
181             }
182 624         607 return $self->{'seq'};
183             }
184              
185             1;