JWS-67 insert Jpred 3.0.1 sources into JABAWS
[jabaws.git] / binaries / src / jpred / lib / Paths.pm
1 package Paths;
2
3 use strict;
4 use warnings;
5 use base qw(Exporter);
6 use Sys::Hostname ();
7
8 =head1 NAME
9
10 Paths - Sets paths for executable programs
11
12 =head1 DESCRIPTION
13
14 This module gathers together all of the little pieces of information that would other wise be floating around in all of the 
15 other modules that run external programs. Namely, the path to the executable and nessecery environment variables. 
16
17 Putting it all here should mean that this is the only file that needs updating when their location changes, or it's redeployed. 
18 Plus some degree of automagic can be used to try and detect changes.
19
20 =cut
21
22 our @EXPORT_OK = qw($ff_bignet $analyze $batchman $sov $pairwise $oc $jnet $fastacmd $hmmbuild $hmmconvert $psiblastbin check_OS);
23
24 my $HOME = $ENV{HOME};
25
26 # main production path
27 #my $SOFTDIR = '/homes/www-jpred/live/jpred/bin';
28 #my $platform_dir = "x86_64";
29 # development path
30 #my $SOFTDIR = '/homes/www-jpred/devel/jpred/bin';
31 #my $platform_dir = "x86_64";
32 # my laptop test path
33 my $SOFTDIR = '/home/asherstnev/Projects/Jpred.project/jpred/branches/portable';
34 my $platform_name = "x86_64";
35
36 our $pairwise    = "$SOFTDIR/$platform_name/pairwise";
37 our $oc          = "$SOFTDIR/$platform_name/oc";
38 our $jnet        = "$SOFTDIR/$platform_name/jnet";
39 our $fastacmd    = "$SOFTDIR/$platform_name/fastacmd";
40 our $hmmbuild    = "$SOFTDIR/$platform_name/hmmbuild";
41 our $hmmconvert  = "$SOFTDIR/$platform_name/hmmconvert";
42 our $psiblastbin = "$SOFTDIR/$platform_name/blastpgp";
43
44 # required for training with SNNS, but unused currently
45 our $ff_bignet = "$HOME/projects/Jnet/bin/snns/ff_bignet";    # CC modified for new path (SNNS app)
46 our $analyze   = "$HOME/projects/Jnet/bin/snns/analyze";      # CC modified for new path (SNNS app)
47 our $batchman  = "$HOME/projects/Jnet/bin/snns/batchman";     # CC modified for new path (SNNS app)
48 our $sov       = "$HOME/projects/Jnet/bin/sov";
49
50 =head1 AUTOMATED CHANGES
51
52 Currently the paths are altered on the basis of per host rules.
53
54 =cut
55
56 sub check_OS {
57   if ("linux" eq $^O or "Linux" eq $^O) {
58     my $status = system "uname -m > .platform";
59     open my $PLH, "<", ".platform" or die "can't check platform information";
60     my $plt = <$PLH>;
61     close $PLH;
62     chop $plt;
63     $platform_name = "i686" if ($plt =~ /i[3-6]86/);
64   } elsif ("MSWin32" eq $^O) {
65     $platform_name = "win";
66   } else {
67     warn "check_OS: unknown platform, I'll try to use x86_64 binaries....";
68   }
69
70   $oc          = "$SOFTDIR/$platform_name/oc";
71   $jnet        = "$SOFTDIR/$platform_name/jnet";
72   $fastacmd    = "$SOFTDIR/$platform_name/fastacmd";
73   $pairwise    = "$SOFTDIR/$platform_name/pairwise";
74   $hmmbuild    = "$SOFTDIR/$platform_name/hmmbuild";
75   $psiblastbin = "$SOFTDIR/$platform_name/blastpgp";
76   $hmmconvert  = "$SOFTDIR/$platform_name/hmmconvert";
77
78   return $platform_name;
79 }
80
81 =head1 AUTOMATED CHANGES
82
83 Currently the paths are altered on the basis of per host rules.
84
85 =cut
86
87 1;