xref: /aoo41x/main/xmerge/source/palmtests/bin/spose (revision cdf0e10c)
1*cdf0e10cSrcweir#!/bin/perl
2*cdf0e10cSrcweir#
3*cdf0e10cSrcweir# spose - start pose
4*cdf0e10cSrcweir#
5*cdf0e10cSrcweir
6*cdf0e10cSrcweiruse Getopt::Std;
7*cdf0e10cSrcweir
8*cdf0e10cSrcweir# Location of needed files
9*cdf0e10cSrcweir#
10*cdf0e10cSrcweir$pose2_exe = $ENV{'POSE2_EXE'};
11*cdf0e10cSrcweir$pose3_exe = $ENV{'POSE3_EXE'};
12*cdf0e10cSrcweir$pose_prc = $ENV{'POSE_PRC'};
13*cdf0e10cSrcweir
14*cdf0e10cSrcweir
15*cdf0e10cSrcweirif (getopts('23qmwo:r:d:v') != 1)
16*cdf0e10cSrcweir{
17*cdf0e10cSrcweir   &usage();
18*cdf0e10cSrcweir}
19*cdf0e10cSrcweir
20*cdf0e10cSrcweir$apps_load = "";
21*cdf0e10cSrcweir
22*cdf0e10cSrcweirif ($opt_q)
23*cdf0e10cSrcweir{
24*cdf0e10cSrcweir   &add_app("$pose_prc/Quickword.PRC");
25*cdf0e10cSrcweir}
26*cdf0e10cSrcweirif ($opt_m)
27*cdf0e10cSrcweir{
28*cdf0e10cSrcweir   &add_app("$pose_prc/MiniCalc.prc");
29*cdf0e10cSrcweir}
30*cdf0e10cSrcweirif ($opt_w)
31*cdf0e10cSrcweir{
32*cdf0e10cSrcweir   &add_app("$pose_prc/WordSmith.PRC");
33*cdf0e10cSrcweir}
34*cdf0e10cSrcweirif ($opt_o)
35*cdf0e10cSrcweir{
36*cdf0e10cSrcweir   &add_app("$opt_o");
37*cdf0e10cSrcweir}
38*cdf0e10cSrcweirif ($opt_r)
39*cdf0e10cSrcweir{
40*cdf0e10cSrcweir   $run_prog .= "-run_app $opt_r";
41*cdf0e10cSrcweir}
42*cdf0e10cSrcweirif ($opt_d)
43*cdf0e10cSrcweir{
44*cdf0e10cSrcweir   $directory = $opt_d;
45*cdf0e10cSrcweir   @files = `/bin/ls -1 $directory/*.pdb`;
46*cdf0e10cSrcweir
47*cdf0e10cSrcweir   for ($i=0; $i <= $#files; $i++)
48*cdf0e10cSrcweir   {
49*cdf0e10cSrcweir      $add_file = "$files[$i]";
50*cdf0e10cSrcweir      chomp $add_file;
51*cdf0e10cSrcweir      &add_app("$add_file");
52*cdf0e10cSrcweir   }
53*cdf0e10cSrcweir}
54*cdf0e10cSrcweir
55*cdf0e10cSrcweirif ($opt_3)
56*cdf0e10cSrcweir{
57*cdf0e10cSrcweir   $pose_exe = $pose3_exe;
58*cdf0e10cSrcweir}
59*cdf0e10cSrcweirelse
60*cdf0e10cSrcweir{
61*cdf0e10cSrcweir   $pose_exe = $pose2_exe;
62*cdf0e10cSrcweir}
63*cdf0e10cSrcweirif ($pose_exe eq "")
64*cdf0e10cSrcweir{
65*cdf0e10cSrcweir    print "\nPose not found: Please set \n       POSE2_EXE\n    or POSE3_EXE\n";
66*cdf0e10cSrcweir    exit 0;
67*cdf0e10cSrcweir}
68*cdf0e10cSrcweirif ($opt_v)
69*cdf0e10cSrcweir{
70*cdf0e10cSrcweir   print ("\n$pose_exe $apps_load $run_prog &\n\n");
71*cdf0e10cSrcweir}
72*cdf0e10cSrcweirelse
73*cdf0e10cSrcweir{
74*cdf0e10cSrcweir   system ("$pose_exe $apps_load $run_prog &");
75*cdf0e10cSrcweir}
76*cdf0e10cSrcweir
77*cdf0e10cSrcweirexit 0;
78*cdf0e10cSrcweir
79*cdf0e10cSrcweirsub usage
80*cdf0e10cSrcweir{
81*cdf0e10cSrcweir   print "\nUsage: getopt [ -m ] [ -q ] [ -w ] [ -o <PrcFile> ] [ -r <RunProg> ]\n";
82*cdf0e10cSrcweir   print " -2            Runs pose version 3.2 [ current default ]\n";
83*cdf0e10cSrcweir   print " -3            Runs pose version 3.3\n";
84*cdf0e10cSrcweir   print " -d            Load all PDB files in specified directory\n";
85*cdf0e10cSrcweir   print " -m            Load MiniCalc PRC file\n";
86*cdf0e10cSrcweir   print " -q            Load QuickWord PRC file\n";
87*cdf0e10cSrcweir   print " -w            Load WordSmith PRC file\n";
88*cdf0e10cSrcweir   print " -o <PrcFile>  Other PRC files to load\n";
89*cdf0e10cSrcweir   print " -r <RunProg>  Program to run on startup\n";
90*cdf0e10cSrcweir   print " -v            Display the command instead of running\n\n";
91*cdf0e10cSrcweir   exit(-1);
92*cdf0e10cSrcweir}
93*cdf0e10cSrcweir
94*cdf0e10cSrcweirsub add_app
95*cdf0e10cSrcweir{
96*cdf0e10cSrcweir   my $new_app = $_[0];
97*cdf0e10cSrcweir
98*cdf0e10cSrcweir   if ($apps_load ne "")
99*cdf0e10cSrcweir   {
100*cdf0e10cSrcweir      $apps_load .= ",";
101*cdf0e10cSrcweir   }
102*cdf0e10cSrcweir   else
103*cdf0e10cSrcweir   {
104*cdf0e10cSrcweir      $apps_load = "-load_apps ";
105*cdf0e10cSrcweir   }
106*cdf0e10cSrcweir
107*cdf0e10cSrcweir   $apps_load .= "$new_app";
108*cdf0e10cSrcweir}
109