3 # BioPerl module for Bio::Tools::EPCR
5 # Cared for by Jason Stajich <jason-at-bioperl.org>
7 # Copyright Jason Stajich
9 # You may distribute this module under the same terms as perl itself
11 # POD documentation - main docs before the code
15 Bio::Tools::EPCR - Parse ePCR output and make features
19 # A simple annotation pipeline wrapper for ePCR data
20 # assuming ePCR data is already generated in file seq1.epcr
21 # and sequence data is in fasta format in file called seq1.fa
25 my $parser = Bio::Tools::EPCR->new(-file => 'seq1.epcr');
26 my $seqio = Bio::SeqIO->new(-format => 'fasta', -file => 'seq1.fa');
27 my $seq = $seqio->next_seq || die("cannot get a seq object from SeqIO");
29 while( my $feat = $parser->next_feature ) {
30 # add EPCR annotation to a sequence
31 $seq->add_SeqFeature($feat);
33 my $seqout = Bio::SeqIO->new(-format => 'embl');
34 $seqout->write_seq($seq);
39 This object serves as a parser for ePCR data, creating a
40 Bio::SeqFeatureI for each ePCR hit. These can be processed or added
41 as annotation to an existing Bio::SeqI object for the purposes of
48 User feedback is an integral part of the evolution of this and other
49 Bioperl modules. Send your comments and suggestions preferably to
50 the Bioperl mailing list. Your participation is much appreciated.
52 bioperl-l@bioperl.org - General discussion
53 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
57 Report bugs to the Bioperl bug tracking system to help us keep track
58 of the bugs and their resolution. Bug reports can be submitted via the
61 http://bugzilla.open-bio.org/
63 =head1 AUTHOR - Jason Stajich
65 Email jason-at-bioperl.org
69 The rest of the documentation details each of the object methods.
70 Internal methods are usually preceded with a _
75 # Let the code begin...
78 package Bio
::Tools
::EPCR
;
81 use Bio
::SeqFeature
::FeaturePair
;
82 use Bio
::SeqFeature
::Generic
;
84 use base
qw(Bio::Root::Root Bio::SeqAnalysisParserI Bio::Root::IO);
89 Usage : my $epcr = Bio::Tools::EPCR->new(-file => $file,
90 -primary => $fprimary,
92 -groupclass => $fgroupclass);
93 Function: Initializes a new EPCR parser
94 Returns : Bio::Tools::EPCR
95 Args : -fh => filehandle
99 -primary => a string to be used as the common value for
100 each features '-primary' tag. Defaults to
101 'sts'. (This in turn maps to the GFF 'type'
104 -source => a string to be used as the common value for
105 each features '-source' tag. Defaults to
106 'e-PCR'. (This in turn maps to the GFF 'source'
109 -groupclass => a string to be used as the name of the tag
110 which will hold the sts marker namefirst
111 attribute. Defaults to 'name'.
116 my($class,@args) = @_;
118 my $self = $class->SUPER::new
(@args);
119 my ($primary, $source,
120 $groupclass) = $self->_rearrange([qw(PRIMARY
123 $self->primary(defined $primary ?
$primary : 'sts');
124 $self->source(defined $source ?
$source : 'e-PCR');
125 $self->groupclass(defined $groupclass ?
$groupclass : 'name');
127 $self->_initialize_io(@args);
134 Usage : $seqfeature = $obj->next_feature();
135 Function: Returns the next feature available in the analysis result, or
136 undef if there are no more features.
138 Returns : A Bio::SeqFeatureI implementing object, or undef if there are no
146 my $line = $self->_readline;
147 return unless defined($line);
149 my($seqname,$location,$mkrname, $rest) = split(/\s+/,$line,4);
151 my ($start,$end) = ($location =~ /(\S+)\.\.(\S+)/);
153 # `e-PCR -direct` results code match strand in $rest as (+) and (-). Decode it if present.
155 if ($rest =~ m/^\(([+-])\)(.*)$/) {
156 ($strandsign,$rest) = ($1, $2);
160 my $strand = $strandsign eq "+" ?
1 : $strandsign eq "-" ?
-1 : 0;
162 my $markerfeature = Bio
::SeqFeature
::Generic
->new
163 ( '-start' => $start,
165 '-strand' => $strand,
166 '-source' => $self->source,
167 '-primary' => $self->primary,
168 '-seq_id' => $seqname,
170 $self->groupclass => $mkrname,
171 ($rest ?
('Note' => $rest ) : ()),
173 #$markerfeature->add_tag_value('Note', $rest) if defined $rest;
174 return $markerfeature;
180 Usage : $obj->source($newval)
183 Returns : value of source (a scalar)
184 Args : on set, new value (a scalar or undef, optional)
191 return $self->{'_source'} = shift if @_;
192 return $self->{'_source'};
198 Usage : $obj->primary($newval)
201 Returns : value of primary (a scalar)
202 Args : on set, new value (a scalar or undef, optional)
209 return $self->{'_primary'} = shift if @_;
210 return $self->{'_primary'};
216 Usage : $obj->groupclass($newval)
219 Returns : value of groupclass (a scalar)
220 Args : on set, new value (a scalar or undef, optional)
228 return $self->{'_groupclass'} = shift if @_;
229 return $self->{'_groupclass'};