PageRenderTime 45ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/Bio/Pipeline/Runnable/Coil.pm

https://github.com/bioperl/bioperl-pipeline
Perl | 204 lines | 128 code | 63 blank | 13 comment | 9 complexity | bb88418813caf83ba7af79ab9b37bbf6 MD5 | raw file
Possible License(s): LGPL-2.0
  1. # Pipeline module for Coil Bio::Pipeline::Runnable::Coil
  2. #
  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>
  7. #
  8. # Cared for by the Fugu Informatics team (fuguteam@fugu-sg.org)
  9. # You may distribute this module under the same terms as perl itself
  10. #
  11. # POD documentation - main docs before the code
  12. =head1 NAME
  13. Bio::Pipeline::Runnable::Coil
  14. =head1 SYNOPSIS
  15. my $runnable = Bio::Pipeline::Runnable::Coil->new(@params);
  16. $runnable->analysis($analysis);
  17. $runnable->run;
  18. my $output = $runnable->output;
  19. =head1 DESCRIPTION
  20. Runnable for Coil
  21. =head1 FEEDBACK
  22. =head2 Mailing Lists
  23. User feedback is an integral part of the evolution of this and other
  24. Bioperl modules. Send your comments and suggestions preferably to the
  25. Bioperl mailing lists Your participation is much appreciated.
  26. bioperl-l@bioperl.org - General discussion
  27. http://bioperl.org/wiki/Mailing_lists - About the mailing lists
  28. =head2 Support
  29. Please direct usage questions or support issues to the mailing list:
  30. L<bioperl-l@bioperl.org>
  31. rather than to the module maintainer directly. Many experienced and
  32. reponsive experts will be able look at the problem and quickly
  33. address it. Please include a thorough description of the problem
  34. with code and data examples if at all possible.
  35. =head2 Reporting Bugs
  36. report bugs to the Bioperl bug tracking system to help us keep track
  37. the bugs and their resolution. Bug reports can be submitted via
  38. email or the web:
  39. bioperl-bugs@bio.perl.org
  40. http://bugzilla.open-bio.org/
  41. =head1 AUTHOR
  42. Based on the EnsEMBL module Bio::EnsEMBL::Pipeline::Runnable::Protein::Coil
  43. originally written by Marc Sohrmann (ms2@sanger.ac.uk)
  44. Written in BioPipe by Balamurugan Kumarasamy <savikalpa@fugu-sg.org>
  45. # Please direct questions and support issues to <bioperl-l@bioperl.org>
  46. #
  47. Cared for by the Fugu Informatics team (fuguteam@fugu-sg.org)
  48. =head1 APPENDIX
  49. The rest of the documentation details each of the object methods.
  50. Internal methods are usually preceded with a _.
  51. =cut
  52. package Bio::Pipeline::Runnable::Coil;
  53. use vars qw(@ISA);
  54. use strict;
  55. use FileHandle;
  56. use Bio::PrimarySeq;
  57. use Bio::SeqFeature::FeaturePair;
  58. use Bio::SeqFeature::Generic;
  59. use Bio::SeqI;
  60. use Bio::SeqIO;
  61. use Bio::Root::Root;
  62. use Bio::Pipeline::DataType;
  63. use Bio::Pipeline::RunnableI;
  64. use Bio::Tools::Run::Coil;
  65. @ISA = qw(Bio::Pipeline::RunnableI);
  66. sub new {
  67. my ($class, @args) = @_;
  68. my $self = $class->SUPER::new(@args);
  69. return $self;
  70. }
  71. =head2 datatypes
  72. Title : datatypes
  73. Usage : $self->datatypes
  74. Function: Returns the datatypes that the runnable requires.
  75. Returns : It returns a hash of the different data types.
  76. Args :
  77. =cut
  78. sub datatypes {
  79. my ($self) = @_;
  80. my $dt1 = Bio::Pipeline::DataType->new('-object_type'=>'Bio::PrimarySeqI',
  81. '-name'=>'sequence',
  82. '-reftype'=>'SCALAR');
  83. my %dts;
  84. $dts{feat1} = $dt1;
  85. return %dts;
  86. }
  87. =head2 feat1
  88. Title : feat1
  89. Usage : $self->feat1($seq)
  90. Function:
  91. Returns :
  92. Args :
  93. =cut
  94. sub feat1{
  95. my ($self,$feat) = @_;
  96. if (defined($feat)){
  97. $self->{'_feat1'} = $feat;
  98. }
  99. return $self->{'_feat1'};
  100. }
  101. =head2 run
  102. Title : run
  103. Usage : $self->run($seq)
  104. Function: Runs Coil
  105. Returns :
  106. Args :
  107. =cut
  108. sub run {
  109. my ($self) = @_;
  110. my $seq = ($self->feat1);
  111. $self->throw("Analysis not set") unless $self->analysis->isa("Bio::Pipeline::Analysis");
  112. my $factory;
  113. my $db_file = $self->analysis->db_file;
  114. my @params = $self->parse_params($self->analysis->parameters);
  115. push @params, ("DB"=> $db_file);
  116. $factory = Bio::Tools::Run::Coil->new(@params);
  117. my $program_file = $self->analysis->program_file;
  118. $factory->executable($program_file) if $program_file;
  119. my @genes;
  120. eval {
  121. @genes = $factory->predict_protein_features($seq);
  122. };
  123. $self->throw("Problems running predict_protein_featuers due to $@") if $@;
  124. $self->output(\@genes);
  125. return \@genes;
  126. }
  127. =head2 output
  128. Title : output
  129. Usage : $self->output($seq)
  130. Function: Get/set method for output
  131. Returns :
  132. Args :
  133. =cut
  134. sub output{
  135. my ($self,$gene) = @_;
  136. if(defined $gene){
  137. (ref($gene) eq "ARRAY") || $self->throw("Output must be an array reference.");
  138. $self->{'_gene'} = $gene;
  139. }
  140. return @{$self->{'_gene'}};
  141. }