1*b1cdbd2cSJim Jagielski#!/bin/perl 2*b1cdbd2cSJim Jagielski# ************************************************************* 3*b1cdbd2cSJim Jagielski# 4*b1cdbd2cSJim Jagielski# Licensed to the Apache Software Foundation (ASF) under one 5*b1cdbd2cSJim Jagielski# or more contributor license agreements. See the NOTICE file 6*b1cdbd2cSJim Jagielski# distributed with this work for additional information 7*b1cdbd2cSJim Jagielski# regarding copyright ownership. The ASF licenses this file 8*b1cdbd2cSJim Jagielski# to you under the Apache License, Version 2.0 (the 9*b1cdbd2cSJim Jagielski# "License"); you may not use this file except in compliance 10*b1cdbd2cSJim Jagielski# with the License. You may obtain a copy of the License at 11*b1cdbd2cSJim Jagielski# 12*b1cdbd2cSJim Jagielski# http://www.apache.org/licenses/LICENSE-2.0 13*b1cdbd2cSJim Jagielski# 14*b1cdbd2cSJim Jagielski# Unless required by applicable law or agreed to in writing, 15*b1cdbd2cSJim Jagielski# software distributed under the License is distributed on an 16*b1cdbd2cSJim Jagielski# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17*b1cdbd2cSJim Jagielski# KIND, either express or implied. See the License for the 18*b1cdbd2cSJim Jagielski# specific language governing permissions and limitations 19*b1cdbd2cSJim Jagielski# under the License. 20*b1cdbd2cSJim Jagielski# 21*b1cdbd2cSJim Jagielski# ************************************************************* 22*b1cdbd2cSJim Jagielski# 23*b1cdbd2cSJim Jagielski# spose - start pose 24*b1cdbd2cSJim Jagielski# 25*b1cdbd2cSJim Jagielski 26*b1cdbd2cSJim Jagielskiuse Getopt::Std; 27*b1cdbd2cSJim Jagielski 28*b1cdbd2cSJim Jagielski# Location of needed files 29*b1cdbd2cSJim Jagielski# 30*b1cdbd2cSJim Jagielski$pose2_exe = $ENV{'POSE2_EXE'}; 31*b1cdbd2cSJim Jagielski$pose3_exe = $ENV{'POSE3_EXE'}; 32*b1cdbd2cSJim Jagielski$pose_prc = $ENV{'POSE_PRC'}; 33*b1cdbd2cSJim Jagielski 34*b1cdbd2cSJim Jagielski 35*b1cdbd2cSJim Jagielskiif (getopts('23qmwo:r:d:v') != 1) 36*b1cdbd2cSJim Jagielski{ 37*b1cdbd2cSJim Jagielski &usage(); 38*b1cdbd2cSJim Jagielski} 39*b1cdbd2cSJim Jagielski 40*b1cdbd2cSJim Jagielski$apps_load = ""; 41*b1cdbd2cSJim Jagielski 42*b1cdbd2cSJim Jagielskiif ($opt_q) 43*b1cdbd2cSJim Jagielski{ 44*b1cdbd2cSJim Jagielski &add_app("$pose_prc/Quickword.PRC"); 45*b1cdbd2cSJim Jagielski} 46*b1cdbd2cSJim Jagielskiif ($opt_m) 47*b1cdbd2cSJim Jagielski{ 48*b1cdbd2cSJim Jagielski &add_app("$pose_prc/MiniCalc.prc"); 49*b1cdbd2cSJim Jagielski} 50*b1cdbd2cSJim Jagielskiif ($opt_w) 51*b1cdbd2cSJim Jagielski{ 52*b1cdbd2cSJim Jagielski &add_app("$pose_prc/WordSmith.PRC"); 53*b1cdbd2cSJim Jagielski} 54*b1cdbd2cSJim Jagielskiif ($opt_o) 55*b1cdbd2cSJim Jagielski{ 56*b1cdbd2cSJim Jagielski &add_app("$opt_o"); 57*b1cdbd2cSJim Jagielski} 58*b1cdbd2cSJim Jagielskiif ($opt_r) 59*b1cdbd2cSJim Jagielski{ 60*b1cdbd2cSJim Jagielski $run_prog .= "-run_app $opt_r"; 61*b1cdbd2cSJim Jagielski} 62*b1cdbd2cSJim Jagielskiif ($opt_d) 63*b1cdbd2cSJim Jagielski{ 64*b1cdbd2cSJim Jagielski $directory = $opt_d; 65*b1cdbd2cSJim Jagielski @files = `/bin/ls -1 $directory/*.pdb`; 66*b1cdbd2cSJim Jagielski 67*b1cdbd2cSJim Jagielski for ($i=0; $i <= $#files; $i++) 68*b1cdbd2cSJim Jagielski { 69*b1cdbd2cSJim Jagielski $add_file = "$files[$i]"; 70*b1cdbd2cSJim Jagielski chomp $add_file; 71*b1cdbd2cSJim Jagielski &add_app("$add_file"); 72*b1cdbd2cSJim Jagielski } 73*b1cdbd2cSJim Jagielski} 74*b1cdbd2cSJim Jagielski 75*b1cdbd2cSJim Jagielskiif ($opt_3) 76*b1cdbd2cSJim Jagielski{ 77*b1cdbd2cSJim Jagielski $pose_exe = $pose3_exe; 78*b1cdbd2cSJim Jagielski} 79*b1cdbd2cSJim Jagielskielse 80*b1cdbd2cSJim Jagielski{ 81*b1cdbd2cSJim Jagielski $pose_exe = $pose2_exe; 82*b1cdbd2cSJim Jagielski} 83*b1cdbd2cSJim Jagielskiif ($pose_exe eq "") 84*b1cdbd2cSJim Jagielski{ 85*b1cdbd2cSJim Jagielski print "\nPose not found: Please set \n POSE2_EXE\n or POSE3_EXE\n"; 86*b1cdbd2cSJim Jagielski exit 0; 87*b1cdbd2cSJim Jagielski} 88*b1cdbd2cSJim Jagielskiif ($opt_v) 89*b1cdbd2cSJim Jagielski{ 90*b1cdbd2cSJim Jagielski print ("\n$pose_exe $apps_load $run_prog &\n\n"); 91*b1cdbd2cSJim Jagielski} 92*b1cdbd2cSJim Jagielskielse 93*b1cdbd2cSJim Jagielski{ 94*b1cdbd2cSJim Jagielski system ("$pose_exe $apps_load $run_prog &"); 95*b1cdbd2cSJim Jagielski} 96*b1cdbd2cSJim Jagielski 97*b1cdbd2cSJim Jagielskiexit 0; 98*b1cdbd2cSJim Jagielski 99*b1cdbd2cSJim Jagielskisub usage 100*b1cdbd2cSJim Jagielski{ 101*b1cdbd2cSJim Jagielski print "\nUsage: getopt [ -m ] [ -q ] [ -w ] [ -o <PrcFile> ] [ -r <RunProg> ]\n"; 102*b1cdbd2cSJim Jagielski print " -2 Runs pose version 3.2 [ current default ]\n"; 103*b1cdbd2cSJim Jagielski print " -3 Runs pose version 3.3\n"; 104*b1cdbd2cSJim Jagielski print " -d Load all PDB files in specified directory\n"; 105*b1cdbd2cSJim Jagielski print " -m Load MiniCalc PRC file\n"; 106*b1cdbd2cSJim Jagielski print " -q Load QuickWord PRC file\n"; 107*b1cdbd2cSJim Jagielski print " -w Load WordSmith PRC file\n"; 108*b1cdbd2cSJim Jagielski print " -o <PrcFile> Other PRC files to load\n"; 109*b1cdbd2cSJim Jagielski print " -r <RunProg> Program to run on startup\n"; 110*b1cdbd2cSJim Jagielski print " -v Display the command instead of running\n\n"; 111*b1cdbd2cSJim Jagielski exit(-1); 112*b1cdbd2cSJim Jagielski} 113*b1cdbd2cSJim Jagielski 114*b1cdbd2cSJim Jagielskisub add_app 115*b1cdbd2cSJim Jagielski{ 116*b1cdbd2cSJim Jagielski my $new_app = $_[0]; 117*b1cdbd2cSJim Jagielski 118*b1cdbd2cSJim Jagielski if ($apps_load ne "") 119*b1cdbd2cSJim Jagielski { 120*b1cdbd2cSJim Jagielski $apps_load .= ","; 121*b1cdbd2cSJim Jagielski } 122*b1cdbd2cSJim Jagielski else 123*b1cdbd2cSJim Jagielski { 124*b1cdbd2cSJim Jagielski $apps_load = "-load_apps "; 125*b1cdbd2cSJim Jagielski } 126*b1cdbd2cSJim Jagielski 127*b1cdbd2cSJim Jagielski $apps_load .= "$new_app"; 128*b1cdbd2cSJim Jagielski} 129