2 # BioPerl module for Bio::SeqFeature::Amplicon
4 # Please direct questions and support issues to <bioperl-l@bioperl.org>
6 # Copyright Florent Angly
8 # You may distribute this module under the same terms as perl itself
13 Bio::SeqFeature::Amplicon - Amplicon feature
17 # Amplicon with explicit sequence
18 use Bio::SeqFeature::Amplicon;
19 my $amplicon = Bio::SeqFeature::Amplicon->new(
21 -fwd_primer => $primer_object_1,
22 -rev_primer => $primer_object_2,
25 # Amplicon with implicit sequence
27 my $template = Bio::Seq->new( -seq => 'AAAAACCCCCGGGGGTTTTT' );
28 $amplicon = Bio::SeqFeature::Amplicon->new(
32 $template->add_SeqFeature($amplicon);
33 print "Amplicon start : ".$amplicon->start."\n";
34 print "Amplicon end : ".$amplicon->end."\n";
35 print "Amplicon sequence: ".$amplicon->seq->seq."\n";
36 # Amplicon sequence should be 'CCCCCGGGGG'
40 Bio::SeqFeature::Amplicon extends L<Bio::SeqFeature::Subseq> to represent an
41 amplicon sequence and optional primer sequences.
47 User feedback is an integral part of the evolution of this and other
48 Bioperl modules. Send your comments and suggestions preferably to one
49 of the Bioperl mailing lists. Your participation is much appreciated.
51 bioperl-l@bioperl.org - General discussion
52 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
56 Please direct usage questions or support issues to the mailing list:
58 I<bioperl-l@bioperl.org>
60 rather than to the module maintainer directly. Many experienced and
61 reponsive experts will be able look at the problem and quickly
62 address it. Please include a thorough description of the problem
63 with code and data examples if at all possible.
67 Report bugs to the Bioperl bug tracking system to help us keep track
68 the bugs and their resolution. Bug reports can be submitted via
71 https://github.com/bioperl/bioperl-live/issues
75 Florent Angly <florent.angly@gmail.com>
79 The rest of the documentation details each of the object
80 methods. Internal methods are usually preceded with a _
85 package Bio
::SeqFeature
::Amplicon
;
89 use base
qw(Bio::SeqFeature::SubSeq);
94 Usage : my $amplicon = Bio::SeqFeature::Amplicon( -seq => $seq_object );
95 Function: Instantiate a new Bio::SeqFeature::Amplicon object
96 Args : -seq , the sequence object or sequence string of the amplicon (optional)
97 -fwd_primer , a Bio::SeqFeature primer object with specified location on amplicon (optional)
98 -rev_primer , a Bio::SeqFeature primer object with specified location on amplicon (optional)
99 Returns : A Bio::SeqFeature::Amplicon object
104 my ($class, @args) = @_;
105 my $self = $class->SUPER::new
(@args);
106 my ($fwd_primer, $rev_primer) =
107 $self->_rearrange([qw(FWD_PRIMER REV_PRIMER)], @args);
108 $fwd_primer && $self->fwd_primer($fwd_primer);
109 $rev_primer && $self->rev_primer($rev_primer);
115 # Get or set a primer. Type is either 'fwd' or 'rev'.
116 my ($self, $type, $primer) = @_;
117 if (defined $primer) {
118 if ( not(ref $primer) || not $primer->isa('Bio::SeqFeature::Primer') ) {
119 $self->throw("Expected a primer object but got a '".ref($primer)."'\n");
121 if ( not defined $self->location ) {
122 $self->throw("Location of $type primer on amplicon is not known. ".
123 "Use start(), end() or location() to set it.");
125 $primer->primary_tag($type.'_primer');
126 $self->add_SeqFeature($primer);
128 return (grep { $_->primary_tag eq $type.'_primer' } $self->get_SeqFeatures)[0];
135 Usage : my $primer = $feat->fwd_primer();
136 Function: Get or set the forward primer. When setting it, the primary tag
137 'fwd_primer' is added to the primer and its start, stop and strand
138 attributes are set if needed, assuming that the forward primer is
139 at the beginning of the amplicon and the reverse primer at the end.
140 Args : A Bio::SeqFeature::Primer object (optional)
141 Returns : A Bio::SeqFeature::Primer object
146 my ($self, $primer) = @_;
147 return $self->_primer('fwd', $primer);
154 Usage : my $primer = $feat->rev_primer();
155 Function: Get or set the reverse primer. When setting it, the primary tag
156 'rev_primer' is added to the primer.
157 Args : A Bio::SeqFeature::Primer object (optional)
158 Returns : A Bio::SeqFeature::Primer object
163 my ($self, $primer) = @_;
164 return $self->_primer('rev', $primer);