| 1 | # | ||||||||||||||||||||||||||||
| 2 | # BioPerl module for Bio::SeqFeature::Amplicon | ||||||||||||||||||||||||||||
| 3 | # | ||||||||||||||||||||||||||||
| 4 | # Please direct questions and support issues to <bioperl-l@bioperl.org> | ||||||||||||||||||||||||||||
| 5 | # | ||||||||||||||||||||||||||||
| 6 | # Copyright Florent Angly | ||||||||||||||||||||||||||||
| 7 | # | ||||||||||||||||||||||||||||
| 8 | # You may distribute this module under the same terms as perl itself | ||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | =head1 NAME | ||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | Bio::SeqFeature::Amplicon - Amplicon feature | ||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | # Amplicon with explicit sequence | ||||||||||||||||||||||||||||
| 18 | use Bio::SeqFeature::Amplicon; | ||||||||||||||||||||||||||||
| 19 | my $amplicon = Bio::SeqFeature::Amplicon->new( | ||||||||||||||||||||||||||||
| 20 | -seq => $seq_object, | ||||||||||||||||||||||||||||
| 21 | -fwd_primer => $primer_object_1, | ||||||||||||||||||||||||||||
| 22 | -rev_primer => $primer_object_2, | ||||||||||||||||||||||||||||
| 23 | ); | ||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | # Amplicon with implicit sequence | ||||||||||||||||||||||||||||
| 26 | use Bio::Seq; | ||||||||||||||||||||||||||||
| 27 | my $template = Bio::Seq->new( -seq => 'AAAAACCCCCGGGGGTTTTT' ); | ||||||||||||||||||||||||||||
| 28 | $amplicon = Bio::SeqFeature::Amplicon->new( | ||||||||||||||||||||||||||||
| 29 | -start => 6, | ||||||||||||||||||||||||||||
| 30 | -end => 15, | ||||||||||||||||||||||||||||
| 31 | ); | ||||||||||||||||||||||||||||
| 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' | ||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | Bio::SeqFeature::Amplicon extends L<Bio::SeqFeature::Subseq> to represent an | ||||||||||||||||||||||||||||
| 41 | amplicon sequence and optional primer sequences. | ||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | =head1 FEEDBACK | ||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | =head2 Mailing Lists | ||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 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. | ||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | bioperl-l@bioperl.org - General discussion | ||||||||||||||||||||||||||||
| 52 | http://bioperl.org/wiki/Mailing_lists - About the mailing lists | ||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | =head2 Support | ||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | Please direct usage questions or support issues to the mailing list: | ||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | I<bioperl-l@bioperl.org> | ||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 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. | ||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | =head2 Reporting Bugs | ||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||
| 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 | ||||||||||||||||||||||||||||
| 69 | the web: | ||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||
| 71 | https://github.com/bioperl/bioperl-live/issues | ||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||
| 73 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | Florent Angly <florent.angly@gmail.com> | ||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||
| 77 | =head1 APPENDIX | ||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||
| 79 | The rest of the documentation details each of the object | ||||||||||||||||||||||||||||
| 80 | methods. Internal methods are usually preceded with a _ | ||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||
| 82 | =cut | ||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||
| 85 | package Bio::SeqFeature::Amplicon; | ||||||||||||||||||||||||||||
| 86 | 4 | $Bio::SeqFeature::Amplicon::VERSION = '1.7.8'; | |||||||||||||||||||||||||||
| 87 | 4 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||
| 89 | 4 | ▶ | use base qw(Bio::SeqFeature::SubSeq); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||
| 91 | =head2 new | ||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||
| 93 | Title : new() | ||||||||||||||||||||||||||||
| 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 | ||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||
| 101 | =cut | ||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||
| 103 | 25 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||
| 104 | 25 | my ($class, @args) = @_; | |||||||||||||||||||||||||||
| 105 | 25 | my $self = $class->SUPER::new(@args); | |||||||||||||||||||||||||||
| 106 | 25 | my ($fwd_primer, $rev_primer) = | |||||||||||||||||||||||||||
| 107 | $self->_rearrange([qw(FWD_PRIMER REV_PRIMER)], @args); | ||||||||||||||||||||||||||||
| 108 | 25 | ▶ | $fwd_primer && $self->fwd_primer($fwd_primer); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 109 | 25 | ▶ | $rev_primer && $self->rev_primer($rev_primer); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 110 | 25 | return $self; | |||||||||||||||||||||||||||
| 111 | } | ||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||
| 114 | 8 | ▶ | sub _primer { | ||||||||||||||||||||||||||
|
Subroutine
_primer: called CC=5 SCAR=17.6
| |||||||||||||||||||||||||||||
| 115 | # Get or set a primer. Type is either 'fwd' or 'rev'. | ||||||||||||||||||||||||||||
| 116 | 8 | my ($self, $type, $primer) = @_; | |||||||||||||||||||||||||||
| 117 | 8 | ▶ | if (defined $primer) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 118 | 3 | ▶ | if ( not(ref $primer) || not $primer->isa('Bio::SeqFeature::Primer') ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
ref $primer and $primer->isa("Bio::SeqFeature::Primer")
MC/DC0%0/2
ref $primer and $primer->isa("Bio::SeqFeature::Primer")
ref $primer
$primer->isa("Bio::SeqFeature::Primer")
Truth table33%1/3
A and B
A= ref $primerB= $primer->isa("Bio::SeqFeature::Primer")
| |||||||||||||||||||||||||||||
| 119 | 0 | $self->throw("Expected a primer object but got a '".ref($primer)."'\n"); | |||||||||||||||||||||||||||
| 120 | } | ||||||||||||||||||||||||||||
| 121 | 3 | ▶ | if ( not defined $self->location ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 122 | 0 | $self->throw("Location of $type primer on amplicon is not known. ". | |||||||||||||||||||||||||||
| 123 | "Use start(), end() or location() to set it."); | ||||||||||||||||||||||||||||
| 124 | } | ||||||||||||||||||||||||||||
| 125 | 3 | $primer->primary_tag($type.'_primer'); | |||||||||||||||||||||||||||
| 126 | 3 | $self->add_SeqFeature($primer); | |||||||||||||||||||||||||||
| 127 | } | ||||||||||||||||||||||||||||
| 128 | 8 | return (grep { $_->primary_tag eq $type.'_primer' } $self->get_SeqFeatures)[0]; | |||||||||||||||||||||||||||
| 129 | } | ||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||
| 132 | =head2 fwd_primer | ||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||
| 134 | Title : fwd_primer | ||||||||||||||||||||||||||||
| 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 | ||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||
| 143 | =cut | ||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||
| 145 | 5 | ▶ | sub fwd_primer { | ||||||||||||||||||||||||||
|
Subroutine
fwd_primer: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 146 | 5 | my ($self, $primer) = @_; | |||||||||||||||||||||||||||
| 147 | 5 | return $self->_primer('fwd', $primer); | |||||||||||||||||||||||||||
| 148 | } | ||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||
| 151 | =head2 rev_primer | ||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||
| 153 | Title : rev_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 | ||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||
| 160 | =cut | ||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||
| 162 | 3 | ▶ | sub rev_primer { | ||||||||||||||||||||||||||
|
Subroutine
rev_primer: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 163 | 3 | my ($self, $primer) = @_; | |||||||||||||||||||||||||||
| 164 | 3 | return $self->_primer('rev', $primer); | |||||||||||||||||||||||||||
| 165 | } | ||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||
| 168 | 4 | 1; | |||||||||||||||||||||||||||