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
;
82 use Bio
::SeqFeature
::FeaturePair
;
83 use Bio
::SeqFeature
::Generic
;
84 use base
qw(Bio::Root::Root Bio::Root::IO);
89 my($class,@args) = @_;
91 my $self = $class->SUPER::new
(@args);
92 $self->_initialize_io(@args);
100 Usage : obj->parse_results
101 Function: Parses the coil output. Automatically called by
102 next_result() if not yet done.
109 my ($self,$resfile) = @_;
110 my $filehandle = $resfile;
111 my %result_hash =_read_fasta
($filehandle);#bala no file handle
112 my @ids = keys %result_hash;
114 foreach my $id (keys %result_hash){
115 my $pep = reverse ($result_hash{$id});
116 my $count = my $switch = 0;
118 while (my $aa = chop $pep) {
120 if (!$switch && $aa eq "x") {
124 elsif ($switch && $aa ne "x") {
127 $feature{name
} = $id;
128 $feature{start
} = $start;
129 $feature{end
} = $end;
130 $feature{source
} = "Coils";
131 $feature{primary
} = 'ncoils';
132 ($feature{program
}) = 'ncoils';
133 $feature{logic_name
} = 'Coils';
134 my $new_feat = $self->create_feature (\
%feature);
135 $self->_add_prediction($new_feat);
141 $self->_predictions_parsed(1);
149 Usage : while($feat = $coil->next_result($file)) {
152 Function: Returns the next protein feature of the coil output file
160 my ($self,$resfile) = @_;
163 $self->parse_results($resfile) unless $self->_predictions_parsed();
165 $gene = $self->_result();
174 Usage : $feat = $obj->_result()
184 return unless(exists($self->{'_feats'}) && @
{$self->{'_feats'}});
185 return shift(@
{$self->{'_feats'}});
188 =head2 _add_prediction
190 Title : _add_prediction()
191 Usage : $obj->_add_prediction($feat)
198 sub _add_prediction
{
199 my ($self, $gene) = @_;
201 if(! exists($self->{'_feats'})) {
202 $self->{'_feats'} = [];
204 push(@
{$self->{'_feats'}}, $gene);
207 =head2 _predictions_parsed
209 Title : _predictions_parsed
210 Usage : $obj->_predictions_parsed
213 Returns : TRUE or FALSE
217 sub _predictions_parsed
{
218 my ($self, $val) = @_;
220 $self->{'_preds_parsed'} = $val if $val;
221 if(! exists($self->{'_preds_parsed'})) {
222 $self->{'_preds_parsed'} = 0;
224 return $self->{'_preds_parsed'};
228 =head2 create_feature
230 Title : create_feature
231 Usage : obj->create_feature(\%feature)
232 Function: Internal(not to be used directly)
240 my ($self, $feat) = @_;
243 # create feature object
244 my $feature = Bio
::SeqFeature
::Generic
->new
245 (-seq_id
=> $feat->{name
},
246 -start
=> $feat->{start
},
247 -end
=> $feat->{end
},
248 -score
=> $feat->{score
},
249 -source
=> $feat->{source
},
250 -primary
=> $feat->{primary
},
251 -logic_name
=> $feat->{logic_name
},
253 $feature->add_tag_value('evalue',0);
254 $feature->add_tag_value('percent_id','NULL');
255 $feature->add_tag_value("hid",$feat->{primary
});
265 Usage : obj->_read_fasta($file)
266 Function: Internal(not to be used directly)
275 my( $id , $seq , %name2seq);#bala
282 $name2seq{$id} = $seq;
284 $id = $new_id ; $seq = "" ;
287 $seq .= $_ ;#bala line instead of $_
288 $name2seq{$id} = $seq;