1 # Parser module for Coil Bio::Tools::Coil
3 # Based on the EnsEMBL module Bio::EnsEMBL::Pipeline::Runnable::Protein::Coil
4 # originally written by Marc Sohrmann (ms2@sanger.ac.uk)
5 # Written in BioPipe by Balamurugan Kumarasamy <savikalpa@fugu-sg.org>
6 # Please direct questions and support issues to <bioperl-l@bioperl.org>
8 # Cared for by the Fugu Informatics team (fuguteam@fugu-sg.org)
10 # You may distribute this module under the same terms as perl itself
12 # POD documentation - main docs before the code
16 Bio::Tools::Coil - parser for Coil output
21 my $parser = Bio::Tools::Coil->new();
22 while( my $sp_feat = $parser->next_result($file) ) {
25 push @sp_feat, $sp_feat;
30 Parser for Coil output
36 User feedback is an integral part of the evolution of this and other
37 Bioperl modules. Send your comments and suggestions preferably to
38 the Bioperl mailing list. Your participation is much appreciated.
40 bioperl-l@bioperl.org - General discussion
41 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
45 Please direct usage questions or support issues to the mailing list:
47 I<bioperl-l@bioperl.org>
49 rather than to the module maintainer directly. Many experienced and
50 reponsive experts will be able look at the problem and quickly
51 address it. Please include a thorough description of the problem
52 with code and data examples if at all possible.
56 Report bugs to the Bioperl bug tracking system to help us keep track
57 of the bugs and their resolution. Bug reports can be submitted via the
60 https://github.com/bioperl/bioperl-live/issues
64 Based on the EnsEMBL module Bio::EnsEMBL::Pipeline::Runnable::Protein::Coil
65 originally written by Marc Sohrmann (ms2@sanger.ac.uk)
66 Written in BioPipe by Balamurugan Kumarasamy <savikalpa@fugu-sg.org>
67 # Please direct questions and support issues to <bioperl-l@bioperl.org>
69 Cared for by the Fugu Informatics team (fuguteam@fugu-sg.org)
73 The rest of the documentation details each of the object methods.
74 Internal methods are usually preceded with a _
79 package Bio
::Tools
::Coil
;
83 use Bio
::SeqFeature
::FeaturePair
;
84 use Bio
::SeqFeature
::Generic
;
85 use base
qw(Bio::Root::Root Bio::Root::IO);
90 my($class,@args) = @_;
92 my $self = $class->SUPER::new
(@args);
93 $self->_initialize_io(@args);
100 Title : parse_results
101 Usage : obj->parse_results
102 Function: Parses the coil output. Automatically called by
103 next_result() if not yet done.
110 my ($self,$resfile) = @_;
111 my $filehandle = $resfile;
112 my %result_hash =_read_fasta
($filehandle);#bala no file handle
113 my @ids = keys %result_hash;
115 foreach my $id (keys %result_hash){
116 my $pep = reverse ($result_hash{$id});
117 my $count = my $switch = 0;
119 while (my $aa = chop $pep) {
121 if (!$switch && $aa eq "x") {
125 elsif ($switch && $aa ne "x") {
128 $feature{name
} = $id;
129 $feature{start
} = $start;
130 $feature{end
} = $end;
131 $feature{source
} = "Coils";
132 $feature{primary
} = 'ncoils';
133 ($feature{program
}) = 'ncoils';
134 $feature{logic_name
} = 'Coils';
135 my $new_feat = $self->create_feature (\
%feature);
136 $self->_add_prediction($new_feat);
142 $self->_predictions_parsed(1);
150 Usage : while($feat = $coil->next_result($file)) {
153 Function: Returns the next protein feature of the coil output file
161 my ($self,$resfile) = @_;
164 $self->parse_results($resfile) unless $self->_predictions_parsed();
166 $gene = $self->_result();
175 Usage : $feat = $obj->_result()
185 return unless(exists($self->{'_feats'}) && @
{$self->{'_feats'}});
186 return shift(@
{$self->{'_feats'}});
189 =head2 _add_prediction
191 Title : _add_prediction()
192 Usage : $obj->_add_prediction($feat)
199 sub _add_prediction
{
200 my ($self, $gene) = @_;
202 if(! exists($self->{'_feats'})) {
203 $self->{'_feats'} = [];
205 push(@
{$self->{'_feats'}}, $gene);
208 =head2 _predictions_parsed
210 Title : _predictions_parsed
211 Usage : $obj->_predictions_parsed
214 Returns : TRUE or FALSE
218 sub _predictions_parsed
{
219 my ($self, $val) = @_;
221 $self->{'_preds_parsed'} = $val if $val;
222 if(! exists($self->{'_preds_parsed'})) {
223 $self->{'_preds_parsed'} = 0;
225 return $self->{'_preds_parsed'};
229 =head2 create_feature
231 Title : create_feature
232 Usage : obj->create_feature(\%feature)
233 Function: Internal(not to be used directly)
241 my ($self, $feat) = @_;
244 # create feature object
245 my $feature = Bio
::SeqFeature
::Generic
->new
246 (-seq_id
=> $feat->{name
},
247 -start
=> $feat->{start
},
248 -end
=> $feat->{end
},
249 -score
=> $feat->{score
},
250 -source
=> $feat->{source
},
251 -primary
=> $feat->{primary
},
252 -logic_name
=> $feat->{logic_name
},
254 $feature->add_tag_value('evalue',0);
255 $feature->add_tag_value('percent_id','NULL');
256 $feature->add_tag_value("hid",$feat->{primary
});
266 Usage : obj->_read_fasta($file)
267 Function: Internal(not to be used directly)
276 my( $id , $seq , %name2seq);#bala
283 $name2seq{$id} = $seq;
285 $id = $new_id ; $seq = "" ;
288 $seq .= $_ ;#bala line instead of $_
289 $name2seq{$id} = $seq;