| 1 | |||
| 2 | # BioPerl module for Bio::Installer::Probcons | ||
| 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::Probcons - 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/wiki/Mailing_lists - 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::Probcons; | ||
| 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 = | ||
| 90 | ( 'ORIGIN_DOWNLOAD_DIR' => 'http://probcons.stanford.edu/', | ||
| 91 | 'DESTINATION_DOWNLOAD_DIR' => '/tmp', | ||
| 92 | 'DESTINATION_INSTALL_DIR' => "/usr/local", | ||
| 93 | 'PACKAGE_NAME' => 'probcons_v1_09.tar.gz', | ||
| 94 | 'DIRECTORY_NAME' => 'probcons' | ||
| 95 | ); | ||
| 96 | } | ||
| 97 | |||
| 98 | |||
| 99 | =head2 get_default | ||
| 100 | |||
| 101 | Title : get_default | ||
| 102 | Usage : | ||
| 103 | Function: | ||
| 104 | Example : | ||
| 105 | Returns : | ||
| 106 | Args : | ||
| 107 | |||
| 108 | |||
| 109 | =cut | ||
| 110 | |||
| 111 | sub get_default { | ||
| 112 | my $self = shift; | ||
| 113 | my $param = shift; | ||
| 114 | return $DEFAULTS{$param}; | ||
| 115 | } | ||
| 116 | |||
| 117 | |||
| 118 | =head2 install | ||
| 119 | |||
| 120 | Title : install | ||
| 121 | Usage : $installer->install(); | ||
| 122 | Function: | ||
| 123 | Example : | ||
| 124 | Returns : | ||
| 125 | Args : | ||
| 126 | |||
| 127 | |||
| 128 | =cut | ||
| 129 | |||
| 130 | sub install{ | ||
| 131 | my ($self,@args) = @_; | ||
| 132 | $self->_decompress; | ||
| 133 | $self->_execute_typical_nix_install; | ||
| 134 | $self->_remember_env_is_in_path; | ||
| 135 | } | ||
| 136 | |||
| 137 | |||
| 138 | =head2 _execute_typical_nix_install | ||
| 139 | |||
| 140 | Title : _execute_typical_nix_install | ||
| 141 | Usage : | ||
| 142 | Function: | ||
| 143 | Example : | ||
| 144 | Returns : | ||
| 145 | Args : | ||
| 146 | |||
| 147 | |||
| 148 | =cut | ||
| 149 | |||
| 150 | sub _execute_typical_nix_install{ | ||
| 151 | my ($self,@args) = @_; | ||
| 152 | my $call; | ||
| 153 | |||
| 154 | my $destination = $self->destination_install_dir . "/" . $self->directory_name; | ||
| 155 | |||
| 156 | print "\n\nTypical linux install -- configure -- make -- make install (this might take a while)\n\n";sleep 1; | ||
| 157 | if (($^O =~ /dec_osf|linux|unix|bsd|solaris|darwin/i)) { | ||
| 158 | chdir $destination or die "Cant cd to $destination $!\n"; | ||
| 159 | |||
| 160 | print "\n\nConfigure not needed\n\n";sleep 1; | ||
| 161 | # $call = "./configure --prefix=$destination"; | ||
| 162 | # system("$call") == 0 or $self->throw("Error when trying to run configure"); | ||
| 163 | |||
| 164 | print "\n\nCalling make (this might take a while)\n\n";sleep 1; | ||
| 165 | $call = "make"; | ||
| 166 | system("$call") == 0 or $self->throw("Error when trying to run make"); | ||
| 167 | # print "\n\nCalling make install (this might take a while)\n\n";sleep 1; | ||
| 168 | # if (-w "$destination") { | ||
| 169 | # $call = "make install"; | ||
| 170 | # } else { | ||
| 171 | # print "\n\n You may need administrative password to install\n" | ||
| 172 | # ."this program so that bioperl can see it in the binary PATH\n"; | ||
| 173 | # $call = "su -c \"make install\""; | ||
| 174 | # } | ||
| 175 | # system("$call") == 0 or $self->throw("Error when trying to run make install"); | ||
| 176 | |||
| 177 | } else { | ||
| 178 | $self->throw("_execute_typical_nix not yet implemented in this platform"); | ||
| 179 | } | ||
| 180 | } | ||
| 181 | |||
| 182 | |||
| 183 | =head2 _remember_env_is_in_path | ||
| 184 | |||
| 185 | Title : _remember_env_is_in_path | ||
| 186 | Usage : | ||
| 187 | Function: | ||
| 188 | Example : | ||
| 189 | Returns : | ||
| 190 | Args : | ||
| 191 | |||
| 192 | |||
| 193 | =cut | ||
| 194 | |||
| 195 | sub _remember_env_is_in_path{ | ||
| 196 | my ($self,@args) = @_; | ||
| 197 | my $dir; | ||
| 198 | $dir = $self->destination_install_dir; | ||
| 199 | unless ($dir =~ m|/usr/local|) { | ||
| 200 | print STDERR <<END; | ||
| 201 | |||
| 202 | You may need to make $dir visible for \$PATH to help bioperl find the | ||
| 203 | program. This can be done with a symbolic link (as root): | ||
| 204 | |||
| 205 | ln -s $dir/bin /usr/local/bin | ||
| 206 | END | ||
| 207 | ; | ||
| 208 | } | ||
| 209 | |||
| 210 | } | ||
| 211 | |||
| 212 | |||
| 213 | 1; |