t/AlignIO/AlignIO.t: fix number of tests in plan (fixup c523e6bed866)
[bioperl-live.git] / Bio / SeqFeature / SiRNA / Oligo.pm
blobb3188723a5cb62dc4d8a58714098daa5963108cb
2 # BioPerl module for Bio::SeqFeature::SiRNA::Pair
4 # Please direct questions and support issues to <bioperl-l@bioperl.org>
6 # Cared for by Donald Jackson, donald.jackson@bms.com
8 # Copyright Donald Jackson
10 # You may distribute this module under the same terms as perl itself
12 # POD documentation - main docs before the code
14 =head1 NAME
16 Bio::SeqFeature::SiRNA::Oligo - Perl object for small inhibitory RNAs.
18 =head1 SYNOPSIS
20 use Bio::SeqFeature::SiRNA::Oligo;
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' }, );
31 # normally two complementary Oligos are combined in an SiRNA::Pair
32 # object
33 $pair->antisense($oligo);
36 =head1 DESCRIPTION
38 Object methods for single SiRNA oligos - inherits
39 L<Bio::SeqFeature::Generic>. Does B<not> include methods for designing
40 SiRNAs - see L<Bio::Tools::SiRNA> for that.
42 =head1 SEE ALSO
44 L<Bio::Tools::SiRNA>, L<Bio::SeqFeature::SiRNA::Pair>.
46 =head1 FEEDBACK
48 =head2 Mailing Lists
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.
54 bioperl-l@bioperl.org - General discussion
55 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
57 =head2 Support
59 Please direct usage questions or support issues to the mailing list:
61 I<bioperl-l@bioperl.org>
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.
68 =head2 Reporting Bugs
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:
74 https://github.com/bioperl/bioperl-live/issues
76 =head1 AUTHOR
78 Donald Jackson (donald.jackson@bms.com)
80 =head1 APPENDIX
82 The rest of the documentation details each of the object methods.
83 Internal methods are usually preceded with a _
85 =cut
87 package Bio::SeqFeature::SiRNA::Oligo;
89 use strict;
90 use warnings;
92 use base qw(Bio::SeqFeature::Generic);
94 our @ARGNAMES = qw(SEQ START END STRAND PRIMARY SOURCE_TAG SCORE TAG
95 SEQ_ID ANNOTATION LOCATION);
97 =head2 new
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
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
120 =cut
122 sub new {
123 my ($proto, @args) = @_;
125 my $pkg = ref($proto) || $proto;
127 my (%args);
129 my $self = $pkg->SUPER::new();
131 @args{@ARGNAMES} = $self->_rearrange(\@ARGNAMES, @args);
132 # default primary tag
133 $args{'PRIMARY'} ||= 'SiRNA::Oligo';
135 $args{'PRIMARY'} && $self->primary_tag($args{'PRIMARY'});
136 $args{'SOURCE_TAG'} && $self->source_tag($args{'SOURCE_TAG'});
137 $args{'SEQNAME'} && $self->seqname($args{'SEQNAME'});
138 $args{'SEQ'} && $self->seq($args{'SEQ'});
139 $args{'ANNOTATION'} && $self->annotation($args{'ANNOTATION'});
140 $args{'LOCATION'} && $self->location($args{'LOCATION'});
141 defined($args{'START'}) && $self->start($args{'START'});
142 defined($args{'END'}) && $self->end($args{'END'});
143 defined($args{'STRAND'}) && $self->strand($args{'STRAND'});
144 defined($args{'SCORE'}) && $self->score($args{'SCORE'});
146 if ($args{'TAG'}) {
147 foreach my $t ( keys %{ $args{'TAG'} } ) {
148 $self->add_tag_value($t, $args{'TAG'}->{$t});
152 return $self;
155 =head2 seq
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.
168 =cut
170 sub seq {
171 my ($self, $seq) = @_;
172 if ($seq) {
173 # check alphabet
174 if ($seq =~ /[^ACGTUacgtu]/ ) {
175 warn "Sequence contains illegal characters";
176 return;
178 else {
179 $self->{'seq'} = $seq;
182 return $self->{'seq'};