2 # BioPerl module for Bio::Tools::Genomewise
4 # Copyright Jason Stajich <jason-at-bioperl.org>
6 # You may distribute this module under the same terms as perl itself
8 # POD documentation - main docs before the code
12 Bio::Tools::Genomewise - Results of one Genomewise run
16 use Bio::Tools::Genomewise;
17 my $gw = Bio::Tools::Genomewise(-file=>"genomewise.out");
19 while (my $gene = $gw->next_prediction){
20 my @transcripts = $gene->transcripts;
21 foreach my $t(@transcripts){
22 my @exons = $t->exons;
23 foreach my $e(@exons){
24 print $e->start." ".$e->end."\n";
31 This is the parser for the output of Genewise. It takes either a file
32 handle or a file name and returns a
33 Bio::SeqFeature::Gene::GeneStructure object. You will need to specify
34 the proper target sequence id on the object with the
35 $feature-E<gt>seq_id($seqid).
41 User feedback is an integral part of the evolution of this and other
42 Bioperl modules. Send your comments and suggestions preferably to one
43 of the Bioperl mailing lists. Your participation is much appreciated.
45 bioperl-l@bioperl.org - General discussion
46 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
50 Please direct usage questions or support issues to the mailing list:
52 I<bioperl-l@bioperl.org>
54 rather than to the module maintainer directly. Many experienced and
55 reponsive experts will be able look at the problem and quickly
56 address it. Please include a thorough description of the problem
57 with code and data examples if at all possible.
61 Report bugs to the Bioperl bug tracking system to help us keep track
62 the bugs and their resolution. Bug reports can be submitted via the
65 https://github.com/bioperl/bioperl-live/issues
67 =head1 AUTHOR - Fugu Team, Jason Stajich
69 Email: fugui-at-worf.fugu-sg.org
70 jason-at-bioperl-dot-org
74 The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _
79 # Let the code begin...
82 package Bio
::Tools
::Genomewise
;
86 use Bio::Tools::AnalysisResult;
87 use Bio::SeqFeature::Generic;
88 use Bio::SeqFeature::Gene::Exon;
89 use Bio::SeqFeature::FeaturePair;
90 use Bio::SeqFeature::Gene::Transcript;
91 use Bio::SeqFeature::Gene::GeneStructure;
93 use base qw(Bio::Tools::Genewise);
95 $Srctag = 'genomewise';
100 Usage : $obj->new(-file=>"genewise.out");
101 $obj->new(-fh=>\*GW);
102 Function: Constructor for genomewise wrapper. Takes either a file or filehandle
104 Returns : L<Bio::Tools::Genomewise>
109 my($class,@args) = @_;
110 my $self = $class->SUPER::new
(@args);
117 Usage : $obj->_get_strand
118 Function: takes start and end values, swap them if start>end and returns end
120 Returns :$start,$end,$strand
128 Function: get/set for score info
130 Returns : a score value
137 Usage : $obj->_prot_id
138 Function: get/set for protein id
140 Returns :a protein id
147 Usage : $obj->_target_id
148 Function: get/set for genomic sequence id
155 =head2 next_prediction
157 Title : next_prediction
158 Usage : while($gene = $genewise->next_prediction()) {
161 Function: Returns the gene structure prediction of the Genomewise result
162 file. Call this method repeatedly until FALSE is returned.
165 Returns : a Bio::SeqFeature::Gene::GeneStructure object
171 sub next_prediction
{
175 while ($_ = $self->_readline) {
179 if( /^Gene\s+\d+\s*$/ ) {
180 $genes = Bio
::SeqFeature
::Gene
::GeneStructure
->new
182 -seq_id
=> $self->_target_id, # if this had been specified
184 $_ = $self->_readline;
187 unless ( /^Gene\s+(\d+)\s+(\d+)\s*$/ ) {
188 $self->warn("Unparseable genomewise output");
191 my $transcript = Bio
::SeqFeature
::Gene
::Transcript
->new
193 -seq_id
=> $self->_target_id, # if this had been specified
198 while( $_ = $self->_readline ) {
201 unless( m/^\s+Exon\s+(\d+)\s+(\d+)\s+phase\s+(\d+)/ ){
202 $self->_pushback($_);
205 my ($e_start,$e_end,$phase,$e_strand) = ($1,$2,$3);
207 ($e_start,$e_end,$e_strand) = $self->_get_strand($e_start,
209 $transcript->strand($e_strand) unless $transcript->strand != 0;
211 my $exon = Bio
::SeqFeature
::Gene
::Exon
->new
212 (-seq_id
=>$self->_target_id,
218 $exon->add_tag_value("Exon",$nbr++);
219 $exon->add_tag_value('phase',$phase);
220 $transcript->add_exon($exon);
222 $genes->add_transcript($transcript);
223 last; # only process a single gene at a time