PageRenderTime 50ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/Bio/Pipeline/Runnable/Tmhmm.pm

https://github.com/bioperl/bioperl-pipeline
Perl | 199 lines | 125 code | 61 blank | 13 comment | 9 complexity | 272f437c5a4733494824c3849905309b MD5 | raw file
Possible License(s): LGPL-2.0
  1. # Pipeline module for Tmhmm Bio::Pipeline::Runnable::Tmhmm
  2. #
  3. # Based on the EnsEMBL module Bio::EnsEMBL::Pipeline::Runnable::Protein::Tmhmm
  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::Tmhmm
  14. =head1 SYNOPSIS
  15. my $runnable = Bio::Pipeline::Runnable::Tmhmm->new();
  16. $runnable->analysis($analysis);
  17. $runnable->run;
  18. my $output = $runnable->output;
  19. =head1 DESCRIPTION
  20. Runnable for Tmhmm
  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::Tmhmm
  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::Tmhmm;
  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::Tmhmm;
  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 Tmhmm
  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. $factory = Bio::Tools::Run::Tmhmm->new();
  114. my $program_file = $self->analysis->program_file;
  115. $factory->executable($program_file) if $program_file;
  116. my @genes;
  117. eval {
  118. @genes = $factory->predict_protein_features($seq);
  119. };
  120. $self->throw("Problems running predict_protein_featuers due to $@") if $@;
  121. $self->output(\@genes);
  122. return \@genes;
  123. }
  124. =head2 output
  125. Title : output
  126. Usage : $self->output($seq)
  127. Function: Get/set method for output
  128. Returns :
  129. Args :
  130. =cut
  131. sub output{
  132. my ($self,$gene) = @_;
  133. if(defined $gene){
  134. (ref($gene) eq "ARRAY") || $self->throw("Output must be an array reference.");
  135. $self->{'_gene'} = $gene;
  136. }
  137. return @{$self->{'_gene'}};
  138. }