| 1 | |||
| 2 | # BioPerl module for Bio::Installer::Hyphy | ||
| 3 | # | ||
| 4 | # Please direct questions and support issues to <bioperl-l@bioperl.org> | ||
| 5 | # | ||
| 6 | # Cared for by Albert Vilella | ||
| 7 | # | ||
| 8 | # Copyright Albert Vilella | ||
| 9 | # | ||
| 10 | # You may distribute this module under the same terms as perl itself | ||
| 11 | |||
| 12 | # POD documentation - main docs before the code | ||
| 13 | |||
| 14 | =head1 NAME | ||
| 15 | |||
| 16 | Bio::Installer::Hyphy - DESCRIPTION of Object | ||
| 17 | |||
| 18 | =head1 SYNOPSIS | ||
| 19 | |||
| 20 | Give standard usage here | ||
| 21 | |||
| 22 | =head1 DESCRIPTION | ||
| 23 | |||
| 24 | Describe the object here | ||
| 25 | |||
| 26 | =head1 FEEDBACK | ||
| 27 | |||
| 28 | =head2 Mailing Lists | ||
| 29 | |||
| 30 | User feedback is an integral part of the evolution of this and other | ||
| 31 | Bioperl modules. Send your comments and suggestions preferably to | ||
| 32 | the Bioperl mailing list. Your participation is much appreciated. | ||
| 33 | |||
| 34 | bioperl-l@bioperl.org - General discussion | ||
| 35 | http://bioperl.org/MailList.shtml - About the mailing lists | ||
| 36 | |||
| 37 | =head2 Support | ||
| 38 | |||
| 39 | Please direct usage questions or support issues to the mailing list: | ||
| 40 | |||
| 41 | I<bioperl-l@bioperl.org> | ||
| 42 | |||
| 43 | rather than to the module maintainer directly. Many experienced and | ||
| 44 | reponsive experts will be able look at the problem and quickly | ||
| 45 | address it. Please include a thorough description of the problem | ||
| 46 | with code and data examples if at all possible. | ||
| 47 | |||
| 48 | =head2 Reporting Bugs | ||
| 49 | |||
| 50 | Report bugs to the Bioperl bug tracking system to help us keep track | ||
| 51 | of the bugs and their resolution. Bug reports can be submitted via | ||
| 52 | the web: | ||
| 53 | |||
| 54 | http://redmine.open-bio.org/projects/bioperl/ | ||
| 55 | |||
| 56 | =head1 AUTHOR - Albert Vilella | ||
| 57 | |||
| 58 | Email avilella-AT-gmail-DOT-com | ||
| 59 | |||
| 60 | Describe contact details here | ||
| 61 | |||
| 62 | =head1 CONTRIBUTORS | ||
| 63 | |||
| 64 | Additional contributors names and emails here | ||
| 65 | |||
| 66 | =head1 APPENDIX | ||
| 67 | |||
| 68 | The rest of the documentation details each of the object methods. | ||
| 69 | Internal methods are usually preceded with a _ | ||
| 70 | |||
| 71 | =cut | ||
| 72 | |||
| 73 | |||
| 74 | # Let the code begin... | ||
| 75 | |||
| 76 | |||
| 77 | package Bio::Installer::Hyphy; | ||
| 78 | use vars qw(@ISA %DEFAULTS); | ||
| 79 | use strict; | ||
| 80 | |||
| 81 | # Object preamble - inherits from Bio::Root::Root | ||
| 82 | |||
| 83 | use Bio::Root::Root; | ||
| 84 | use Bio::Installer::Generic; | ||
| 85 | |||
| 86 | @ISA = qw(Bio::Installer::Generic ); | ||
| 87 | |||
| 88 | BEGIN { | ||
| 89 | %DEFAULTS = ( 'ORIGIN_DOWNLOAD_DIR' => 'http://www.hyphy.org/current', | ||
| 90 | 'BIN_FOLDER' => '', | ||
| 91 | 'DESTINATION_DOWNLOAD_DIR' => '/tmp', | ||
| 92 | 'DESTINATION_INSTALL_DIR' => "$ENV{'HOME'}", | ||
| 93 | 'PACKAGE_NAME' => 'HYPHY_Source.tgz', | ||
| 94 | 'DIRECTORY_NAME' => 'HYPHY_Source', | ||
| 95 | 'ENV_NAME' => 'HYPHYDIR', | ||
| 96 | ); | ||
| 97 | } | ||
| 98 | |||
| 99 | |||
| 100 | =head2 get_default | ||
| 101 | |||
| 102 | Title : get_default | ||
| 103 | Usage : | ||
| 104 | Function: | ||
| 105 | Example : | ||
| 106 | Returns : | ||
| 107 | Args : | ||
| 108 | |||
| 109 | |||
| 110 | =cut | ||
| 111 | |||
| 112 | sub get_default { | ||
| 113 | my $self = shift; | ||
| 114 | my $param = shift; | ||
| 115 | return $DEFAULTS{$param}; | ||
| 116 | } | ||
| 117 | |||
| 118 | |||
| 119 | =head2 install | ||
| 120 | |||
| 121 | Title : install | ||
| 122 | Usage : $installer->install(); | ||
| 123 | Function: | ||
| 124 | Example : | ||
| 125 | Returns : | ||
| 126 | Args : | ||
| 127 | |||
| 128 | |||
| 129 | =cut | ||
| 130 | |||
| 131 | sub install{ | ||
| 132 | my ($self,@args) = @_; | ||
| 133 | my $dir; | ||
| 134 | $self->_decompress; | ||
| 135 | $self->_execute_Hyphy_install_script; | ||
| 136 | $dir = $self->destination_install_dir; | ||
| 137 | $self->_remember_env; | ||
| 138 | } | ||
| 139 | |||
| 140 | |||
| 141 | =head2 _execute_Hyphy_install_script | ||
| 142 | |||
| 143 | Title : _execute_Hyphy_install_script | ||
| 144 | Usage : | ||
| 145 | Function: | ||
| 146 | Example : | ||
| 147 | Returns : | ||
| 148 | Args : | ||
| 149 | |||
| 150 | |||
| 151 | =cut | ||
| 152 | |||
| 153 | sub _execute_Hyphy_install_script{ | ||
| 154 | my ($self,@args) = @_; | ||
| 155 | my $call; | ||
| 156 | |||
| 157 | my $destination = $self->destination_install_dir; | ||
| 158 | $destination =~ s|/$||; | ||
| 159 | $destination .= "/" . $self->directory_name; | ||
| 160 | |||
| 161 | chdir $destination or die "Cant cd to $destination $!\n"; | ||
| 162 | print "\n\nCompiling now... (this might take a while)\n\n"; | ||
| 163 | $call = "sh build.sh MP"; | ||
| 164 | system("$call") == 0 or die "Error when trying to run install script $?\n"; | ||
| 165 | |||
| 166 | |||
| 167 | } | ||
| 168 | |||
| 169 | |||
| 170 | 1; |