PageRenderTime 48ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/Bio/Pipeline/Method.pm

https://github.com/bioperl/bioperl-pipeline
Perl | 183 lines | 124 code | 52 blank | 7 comment | 6 complexity | 0fab4a8b2fdc0c9f03b73b5a751253e3 MD5 | raw file
Possible License(s): LGPL-2.0
  1. # BioPerl module for Bio::Pipeline::Method
  2. #
  3. # You may distribute this module under the same terms as perl itself
  4. #
  5. # POD documentation - main docs before the code
  6. #
  7. =head1 NAME
  8. Bio::Pipeline::Method
  9. =head1 SYNOPSIS
  10. use Bio::Pipeline::Method;
  11. my $data_handler = Bio::Pipeline::Method->new(-dbid=>1,
  12. -method=>"fetch_by_dbID",
  13. -argument=>\@arguments,
  14. -rank=>1);
  15. =head1 DESCRIPTION
  16. Methods specifiy the adaptor methods and the correspoding arguments
  17. needed by a IO to fetch or store output. The rank represents the
  18. order in which they are called by IOHandler methods fetch_input,
  19. write_output
  20. =head1 FEEDBACK
  21. =head2 Mailing Lists
  22. User feedback is an integral part of the evolution of this and other
  23. Bioperl modules. Send your comments and suggestions preferably to one
  24. of the Bioperl mailing lists. Your participation is much appreciated.
  25. bioperl-pipeline@bioperl.org - General discussion
  26. http://bioperl.org/wiki/Mailing_lists - About the mailing lists
  27. =head2 Support
  28. Please direct usage questions or support issues to the mailing list:
  29. L<bioperl-l@bioperl.org>
  30. rather than to the module maintainer directly. Many experienced and
  31. reponsive experts will be able look at the problem and quickly
  32. address it. Please include a thorough description of the problem
  33. with code and data examples if at all possible.
  34. =head2 Reporting Bugs
  35. Report bugs to the Bioperl bug tracking system to help us keep track
  36. the bugs and their resolution. Bug reports can be submitted via email
  37. or the web:
  38. bioperl-bugs@bio.perl.org
  39. http://bugzilla.open-bio.org/
  40. =head1 AUTHOR - FuguI Team
  41. Email fugui@fugu-sg.org
  42. =head1 APPENDIX
  43. The rest of the documentation details each of the object
  44. methods. Internal metho ds are usually preceded with a _
  45. =cut
  46. # Let the code begin...
  47. package Bio::Pipeline::Method;
  48. use vars qw(@ISA);
  49. use strict;
  50. use Bio::Root::Root;
  51. @ISA = qw(Bio::Root::Root);
  52. =head1 Constructors
  53. =head2 new
  54. Title : new
  55. Usage : my $data_handler = Bio::Pipeline::Method->new(-dbid=>1,
  56. -method=>"fetch_by_dbID",
  57. -argument=>\@arguments,
  58. -rank=>1);
  59. Function: this constructor should only be used in the IO_adaptor or IO objects.
  60. generates a new Bio::Pipeline::Method
  61. Returns : a new Method object
  62. Args :
  63. =cut
  64. sub new {
  65. my($class,@args) = @_;
  66. my $self = $class->SUPER::new(@args);
  67. my ($dbID,$name,$argument,$rank)=$self->_rearrange([qw( DBID
  68. NAME
  69. ARGUMENT
  70. RANK)],@args);
  71. $name || $self->throw("Method needs a method arg.");
  72. $dbID && $self->dbID($dbID);
  73. $self->{'_name'} = $name;
  74. $self->{'_argument'} = $argument;
  75. $self->{'_rank'} = $rank;
  76. return $self;
  77. }
  78. =head2 dbID
  79. Title : dbID
  80. Function : returns dbID
  81. Example : $data_adaptor->dbID();
  82. Returns : dbid of the data adaptor
  83. Args :
  84. =cut
  85. sub dbID {
  86. my ($self, $dbID) = @_;
  87. if(defined $dbID){
  88. $self->{'_dbid'} = $dbID;
  89. }
  90. return $self->{'_dbid'};
  91. }
  92. =head2 method
  93. Title : method
  94. Function : returns method
  95. Example : $Method->method();
  96. Returns : method of the Method
  97. Args :
  98. =cut
  99. sub name{
  100. my ($self, $name) = @_;
  101. if(defined $name){
  102. $self->{'_name'} = $name;
  103. }
  104. return $self->{'_name'};
  105. }
  106. =head2 argument
  107. Title : argument
  108. Function : returns argument
  109. Example : $dh->adpator_arg();
  110. Returns : argument of the Method
  111. Args :
  112. =cut
  113. sub arguments{
  114. my ($self,$val) = @_;
  115. if($val) {
  116. $self->{'_argument'} = $val;
  117. }
  118. return $self->{'_argument'};
  119. }
  120. =head2 rank
  121. Title : rank
  122. Function : returns rank
  123. Example : $dh->rank();
  124. Returns : rank the Method
  125. Args :
  126. =cut
  127. sub rank{
  128. my ($self) = @_;
  129. return $self->{'_rank'};
  130. }
  131. 1;