0
|
1 #!/usr/bin/perl
|
|
2 use lib "$ENV{'RBT_ROOT'}/lib";
|
|
3 require "run_rbfuncs.pl";
|
|
4
|
|
5 my $rbtroot = $ENV{'RBT_ROOT'};
|
|
6 my $rbthome = $ENV{'RBT_HOME'};
|
|
7 my $recepDir = "$rbtroot/data/receptors";
|
|
8 my $scriptDir = "$rbtroot/data/scripts";
|
|
9 my $libraryDir = "$rbtroot/data/libraries";
|
|
10 my $binDir = "$rbtroot/bin";
|
|
11
|
|
12 #override default directories
|
|
13 #Parse command line arguments
|
|
14 my $nArgs = scalar(@ARGV);
|
|
15
|
|
16 while (scalar(@ARGV)) {
|
|
17 my $arg = shift @ARGV;
|
|
18 if (index($arg,'-r')==0) {
|
|
19 $recepDir = substr($arg,2);
|
|
20 }
|
|
21 elsif (index($arg,'-s')==0) {
|
|
22 $scriptDir = substr($arg,2);
|
|
23 }
|
|
24 elsif (index($arg,'-l')==0) {
|
|
25 $libraryDir = substr($arg,2);
|
|
26 }
|
|
27 }
|
|
28
|
|
29
|
|
30 # Get the receptor, library and script tables
|
|
31 my %receptor_table = get_prm_table($recepDir);
|
|
32 my %script_table = get_prm_table($scriptDir);
|
|
33 my %library_table = get_prm_table($libraryDir);
|
|
34
|
|
35 #GET ALL THE INPUTS
|
|
36 my $defFiles = "*.{sd,sdf,mol,mdl}";
|
|
37 print join("\n",glob $defFiles);
|
|
38 my $libFiles = get_input("\n\nEnter expression for SD files to dock",$defFiles);
|
|
39 my $receptor = get_selection(\%receptor_table,"receptor");
|
|
40 my $script = get_selection(\%script_table,"docking script");
|
|
41 my $flags = get_input("Enter optional rbdock flags","-ap -an");
|
|
42 my $runs = get_input("Enter number of runs/ligand",20);
|
|
43
|
|
44 my $runRoot = get_input("Enter run name","rbdock");
|
|
45 my $queueSys = get_input("Enter queuing system (NQS,CODINE,CONDOR,NONE)","CONDOR");
|
|
46 my $queueName;
|
|
47 $queueName = get_input("Enter NQS queue","QRBD") if ($queueSys eq "NQS");
|
|
48
|
|
49 $pwd = `pwd`;
|
|
50 chomp $pwd;
|
|
51
|
|
52 #WRITE THE NQS SCRIPTS
|
|
53
|
|
54 #GET THE LIST OF SD FILES TO DOCK
|
|
55 my @libList = glob "${libFiles}";
|
|
56
|
|
57 my $subFile = "submit_$runRoot.csh";
|
|
58 open SUBHANDLE,">$subFile";
|
|
59 print SUBHANDLE "#!/bin/csh -ef\n";
|
|
60
|
|
61 my $iFile=0;
|
|
62 foreach $libFile (@libList) {
|
|
63 $iFile++;
|
|
64 #Write the NQS script file
|
|
65 $runName = "${runRoot}_$iFile";
|
|
66 $nqsFile = "run_${runName}.csh";
|
|
67 my $logFile = "${runName}.log";
|
|
68
|
|
69 print "Writing $nqsFile...\n";
|
|
70
|
|
71 open NQSHANDLE,">$nqsFile";
|
|
72 print NQSHANDLE "#!/bin/csh -ef\n";
|
|
73 print NQSHANDLE "setenv RBT_ROOT $rbtroot\n";
|
|
74 print NQSHANDLE "setenv RBT_HOME $rbthome\n";
|
|
75 print NQSHANDLE "source \$RBT_ROOT/bin/setlibrbt.com\n";
|
|
76 print NQSHANDLE "cd $pwd\n";
|
|
77 print NQSHANDLE "if (-e $logFile) rm -f $logFile\n";
|
|
78 print NQSHANDLE "\$RBT_ROOT/bin/rbdock -i$libFile -o${runName} -r$receptor -p$script -n$runs $flags > $logFile\n";
|
|
79 close NQSHANDLE;
|
|
80
|
|
81 chmod 0755,$nqsFile;
|
|
82 print SUBHANDLE "qsub -q $queueName $nqsFile\n" if ($queueSys eq "NQS");
|
|
83 print SUBHANDLE "qsub -e $pwd/$runRoot/tmp/ -o $pwd/$runRoot/tmp/ $nqsFile\n" if ($queueSys eq "CODINE");
|
|
84 if ($queueSys eq "CONDOR") {
|
|
85 my $condorFile = "run_${runName}.cmd";
|
|
86 open CMDHANDLE,">$condorFile";
|
|
87 print CMDHANDLE "#CONDOR FILE WRITTEN BY run_rbscreen.pl\n";
|
|
88 print CMDHANDLE "universe = vanilla\n";
|
|
89 print CMDHANDLE "executable = ${nqsFile}\n";
|
|
90 print CMDHANDLE "Requirements = CATALYST_NODE =!= True\n";
|
|
91 print CMDHANDLE "output = ${nqsFile}.out\n";
|
|
92 print CMDHANDLE "error = ${nqsFile}.err\n";
|
|
93 print CMDHANDLE "log = ${nqsFile}.log\n";
|
|
94 print CMDHANDLE "queue\n";
|
|
95 close NQSHANDLE;
|
|
96 print SUBHANDLE "condor_submit $condorFile\n";
|
|
97 }
|
|
98 }
|
|
99 close SUBHANDLE;
|
|
100 chmod 0755,$subFile;
|
|
101
|
|
102
|
|
103
|
|
104
|
|
105
|
|
106
|
|
107
|
|
108
|
|
109
|
|
110
|
|
111
|
|
112
|
|
113
|
|
114
|
|
115
|
|
116
|